@exodus/assets-feature 5.8.3 → 5.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.10.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@5.9.0...@exodus/assets-feature@5.10.0) (2024-08-07)
7
+
8
+ ### Features
9
+
10
+ - accept and expose `createLogger` dependency ([#8128](https://github.com/ExodusMovement/exodus-hydra/issues/8128)) ([41237a1](https://github.com/ExodusMovement/exodus-hydra/commit/41237a15e6730661df5a8d3ec50169c56eec9602))
11
+
12
+ ## [5.9.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@5.8.3...@exodus/assets-feature@5.9.0) (2024-08-01)
13
+
14
+ ### Features
15
+
16
+ - make assetsModule storage optional ([#8025](https://github.com/ExodusMovement/exodus-hydra/issues/8025)) ([42382f8](https://github.com/ExodusMovement/exodus-hydra/commit/42382f8151d44064dc3bedb7b84c94f5449be770))
17
+
6
18
  ## [5.8.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@5.8.2...@exodus/assets-feature@5.8.3) (2024-07-26)
7
19
 
8
20
  ### Bug Fixes
@@ -10,9 +10,11 @@ class AssetClientInterface {
10
10
  #transactionSigner
11
11
  #publicKeyProvider
12
12
  #config
13
+ #createLogger
13
14
 
14
15
  constructor({
15
16
  blockchainMetadata,
17
+ createLogger,
16
18
  walletAccountsAtom,
17
19
  enabledWalletAccountsAtom,
18
20
  assetsModule,
@@ -33,6 +35,7 @@ class AssetClientInterface {
33
35
  this.#transactionSigner = transactionSigner
34
36
  this.#publicKeyProvider = publicKeyProvider
35
37
  this.#config = config
38
+ this.#createLogger = createLogger
36
39
 
37
40
  // TODO: remove conditional when clients updated
38
41
  if (assetsModule.initialize) {
@@ -40,6 +43,10 @@ class AssetClientInterface {
40
43
  }
41
44
  }
42
45
 
46
+ createLogger(namespace) {
47
+ return this.#createLogger(namespace)
48
+ }
49
+
43
50
  // txHistory interface
44
51
 
45
52
  getTxHistory = async ({ assetName, walletAccount }) => {
package/client/index.js CHANGED
@@ -6,6 +6,7 @@ const assetsClientInterfaceDefinition = {
6
6
  factory: createAssetClientInterface,
7
7
  dependencies: [
8
8
  'blockchainMetadata',
9
+ 'createLogger',
9
10
  'wallet',
10
11
  'walletAccountsAtom',
11
12
  'enabledWalletAccountsAtom',
@@ -90,7 +90,7 @@ export class AssetsModule {
90
90
 
91
91
  constructor({
92
92
  storage,
93
- iconsStorage,
93
+ iconsStorage = { storeIcons: async () => {} },
94
94
  assetPlugins,
95
95
  assetsAtom,
96
96
  combinedAssetsList = [],
@@ -237,6 +237,7 @@ export class AssetsModule {
237
237
  }
238
238
 
239
239
  addToken = async (assetId, baseAssetName) => {
240
+ this.#assertCustomTokensStorageSupported()
240
241
  this.#assertSupportsCustomTokens(baseAssetName)
241
242
 
242
243
  try {
@@ -262,6 +263,7 @@ export class AssetsModule {
262
263
  baseAssetName,
263
264
  allowedStatusList = [STATUS.VERIFIED, STATUS.CURATED, STATUS.UNVERIFIED],
264
265
  }) => {
266
+ this.#assertCustomTokensStorageSupported()
265
267
  this.#assertSupportsCustomTokens(baseAssetName)
266
268
 
267
269
  const tokens = await Promise.all(
@@ -297,6 +299,8 @@ export class AssetsModule {
297
299
  }
298
300
 
299
301
  addRemoteTokens = async ({ tokenNames }) => {
302
+ this.#assertCustomTokensStorageSupported()
303
+
300
304
  const assets = this.getAssets()
301
305
  const tokenNamesToFetch = tokenNames.filter((tokenName) => !assets[tokenName])
302
306
 
@@ -326,6 +330,8 @@ export class AssetsModule {
326
330
  }
327
331
 
328
332
  updateTokens = async () => {
333
+ this.#assertCustomTokensStorageSupported()
334
+
329
335
  const doUpdate = await this.#isNextUpdateDate()
330
336
  if (!doUpdate) return
331
337
 
@@ -484,7 +490,15 @@ export class AssetsModule {
484
490
 
485
491
  // Custom Tokens storage
486
492
 
493
+ #assertCustomTokensStorageSupported = () => {
494
+ if (!this.#storage) {
495
+ throw new Error('Custom Tokens storage is not supported')
496
+ }
497
+ }
498
+
487
499
  #readCustomTokens = async () => {
500
+ if (!this.#storage) return []
501
+
488
502
  const tokens = await this.#storage.get(this.#storageDataKey)
489
503
  return mapValues(tokens, normalizeToken)
490
504
  }
@@ -519,7 +533,8 @@ export class AssetsModule {
519
533
  return !lastUpdateDate || Date.now() - lastUpdateDate > this.#customTokenUpdateInterval
520
534
  }
521
535
 
522
- clear = () =>
536
+ clear = async () =>
537
+ this.#storage &&
523
538
  Promise.all([
524
539
  // should we also delete icons?
525
540
  this.#storage.delete(this.#storageDataKey),
package/module/index.js CHANGED
@@ -8,8 +8,8 @@ const assetsModuleDefinition = {
8
8
  factory: createAssetsModule,
9
9
  dependencies: [
10
10
  'assetsAtom',
11
- 'storage',
12
- 'iconsStorage',
11
+ 'storage?',
12
+ 'iconsStorage?',
13
13
  'assetPlugins',
14
14
  'combinedAssetsList?',
15
15
  'validateCustomToken?',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/assets-feature",
3
- "version": "5.8.3",
3
+ "version": "5.10.0",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Assets module, clients and apis",
6
6
  "main": "index.js",
@@ -61,14 +61,14 @@
61
61
  "@exodus/osmosis-plugin": "^1.0.0",
62
62
  "@exodus/public-key-provider": "^2.4.1",
63
63
  "@exodus/public-key-store": "^1.2.2",
64
- "@exodus/redux-dependency-injection": "^3.2.3",
64
+ "@exodus/redux-dependency-injection": "^4.0.0",
65
65
  "@exodus/storage-memory": "^2.1.1",
66
- "@exodus/wallet-accounts": "^16.8.2",
66
+ "@exodus/wallet-accounts": "^16.8.3",
67
67
  "@exodus/wild-emitter": "^1.0.0",
68
68
  "bip39": "^3.1.0",
69
69
  "events": "^3.3.0",
70
70
  "msw": "^2.0.0",
71
71
  "redux": "^4.0.0"
72
72
  },
73
- "gitHead": "c6840317806103687455d7e31c5ca1d1c1e741f8"
73
+ "gitHead": "e2f868c4a8177092caa51255fc1a564b16f0a907"
74
74
  }