@rango-dev/widget-embedded 0.30.1-next.2 → 0.30.1-next.4
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/dist/components/Quote/Quote.styles.d.ts +1 -1
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts +1 -1
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/services/cacheService.d.ts +21 -0
- package/dist/services/cacheService.d.ts.map +1 -0
- package/dist/store/slices/config.d.ts +2 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +2 -1
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/utils/data.d.ts +20 -0
- package/dist/store/utils/data.d.ts.map +1 -0
- package/dist/store/utils/data.test.d.ts +2 -0
- package/dist/store/utils/data.test.d.ts.map +1 -0
- package/dist/store/utils/index.d.ts +2 -0
- package/dist/store/utils/index.d.ts.map +1 -0
- package/dist/test-utils/fixtures.d.ts +1 -0
- package/dist/test-utils/fixtures.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +1 -1
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +2 -2
- package/src/containers/Wallets/Wallets.tsx +7 -2
- package/src/services/cacheService.ts +35 -0
- package/src/store/slices/config.ts +39 -1
- package/src/store/slices/data.test.ts +84 -0
- package/src/store/slices/data.ts +44 -24
- package/src/store/utils/data.test.ts +175 -0
- package/src/store/utils/data.ts +117 -0
- package/src/store/utils/index.ts +1 -0
- package/src/test-utils/fixtures.ts +14 -7
- package/src/types/wallets.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AppStoreState } from '../store/app';
|
|
2
|
-
import type { TokenHash, WidgetConfig } from '../types';
|
|
2
|
+
import type { Blockchain, TokenHash, WidgetConfig } from '../types';
|
|
3
3
|
import type { BlockchainMeta, EvmBlockchainMeta, Token } from 'rango-sdk';
|
|
4
4
|
|
|
5
5
|
import { faker } from '@faker-js/faker';
|
|
@@ -231,13 +231,20 @@ export function createInitialAppStore() {
|
|
|
231
231
|
blockchains: blockchains.map((b) => b.name),
|
|
232
232
|
});
|
|
233
233
|
|
|
234
|
+
const tokensMapByTokenHash: Map<TokenHash, Token> = new Map();
|
|
235
|
+
const tokensMapByBlockchainName: Record<Blockchain, TokenHash[]> = {};
|
|
236
|
+
tokens.forEach((token) => {
|
|
237
|
+
const tokenHash = createTokenHash(token);
|
|
238
|
+
if (!tokensMapByBlockchainName[token.blockchain]) {
|
|
239
|
+
tokensMapByBlockchainName[token.blockchain] = [];
|
|
240
|
+
}
|
|
241
|
+
tokensMapByTokenHash.set(tokenHash, token);
|
|
242
|
+
tokensMapByBlockchainName[token.blockchain].push(tokenHash);
|
|
243
|
+
});
|
|
244
|
+
|
|
234
245
|
return {
|
|
235
|
-
_tokensMapByTokenHash:
|
|
236
|
-
|
|
237
|
-
const tokenHash = createTokenHash(token);
|
|
238
|
-
return [tokenHash, token];
|
|
239
|
-
})
|
|
240
|
-
),
|
|
246
|
+
_tokensMapByTokenHash: tokensMapByTokenHash,
|
|
247
|
+
_tokensMapByBlockchainName: tokensMapByBlockchainName,
|
|
241
248
|
_blockchainsMapByName: new Map<string, BlockchainMeta>(
|
|
242
249
|
blockchains.map((meta) => [meta.name, meta])
|
|
243
250
|
),
|