@exodus/assets-feature 5.8.2 → 5.9.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.9.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@5.8.3...@exodus/assets-feature@5.9.0) (2024-08-01)
7
+
8
+ ### Features
9
+
10
+ - make assetsModule storage optional ([#8025](https://github.com/ExodusMovement/exodus-hydra/issues/8025)) ([42382f8](https://github.com/ExodusMovement/exodus-hydra/commit/42382f8151d44064dc3bedb7b84c94f5449be770))
11
+
12
+ ## [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)
13
+
14
+ ### Bug Fixes
15
+
16
+ - mark optional configs as optional and remove unused configs ([#8075](https://github.com/ExodusMovement/exodus-hydra/issues/8075)) ([c1c990d](https://github.com/ExodusMovement/exodus-hydra/commit/c1c990dfcea35874d4bbc8429e97688e17977a9f))
17
+
6
18
  ## [5.8.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@5.8.1...@exodus/assets-feature@5.8.2) (2024-07-25)
7
19
 
8
20
  ### Bug Fixes
package/client/index.js CHANGED
@@ -15,7 +15,7 @@ const assetsClientInterfaceDefinition = {
15
15
  'feeMonitors',
16
16
  'transactionSigner',
17
17
  'publicKeyProvider',
18
- 'config',
18
+ 'config?',
19
19
  ],
20
20
  public: true,
21
21
  }
@@ -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,12 +8,12 @@ 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?',
16
- 'config',
16
+ 'config?',
17
17
  'fetch',
18
18
  'logger',
19
19
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/assets-feature",
3
- "version": "5.8.2",
3
+ "version": "5.9.0",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Assets module, clients and apis",
6
6
  "main": "index.js",
@@ -44,7 +44,7 @@
44
44
  "reselect": "^3.0.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@exodus/available-assets": "^8.4.0",
47
+ "@exodus/available-assets": "^8.4.1",
48
48
  "@exodus/bip44-constants": "^195.0.0",
49
49
  "@exodus/bitcoin-meta": "^1.0.1",
50
50
  "@exodus/bitcoin-plugin": "^1.0.3",
@@ -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": "3995391eb48639b2d60ced5224a6a8f4902a2466"
73
+ "gitHead": "1b2ceb2e525b770405bf19091caa70a8ac2ec1de"
74
74
  }