@talismn/balances-react 0.0.0-pr2111-20250723235646 → 0.0.0-pr2111-20250724004118
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/declarations/src/atoms/chaindata.d.ts +4 -181
- package/dist/declarations/src/hooks/useChaindata.d.ts +531 -7
- package/dist/talismn-balances-react.cjs.dev.js +12 -22
- package/dist/talismn-balances-react.cjs.prod.js +12 -22
- package/dist/talismn-balances-react.esm.js +11 -23
- package/package.json +6 -6
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NetworkList, TokenList } from "@talismn/chaindata-provider";
|
|
1
2
|
export declare const chaindataAtom: import("jotai").Atom<{
|
|
2
3
|
networks: ({
|
|
3
4
|
id: string;
|
|
@@ -564,7 +565,8 @@ export declare const networksAtom: import("jotai").Atom<Promise<({
|
|
|
564
565
|
"evm-uniswapv2"?: undefined;
|
|
565
566
|
} | undefined;
|
|
566
567
|
})[]>>;
|
|
567
|
-
export declare const networksByIdAtom: import("jotai").Atom<Promise<
|
|
568
|
+
export declare const networksByIdAtom: import("jotai").Atom<Promise<NetworkList>>;
|
|
569
|
+
export declare const dotNetworksByGenesisHashAtom: import("jotai").Atom<Promise<Record<string, {
|
|
568
570
|
id: string;
|
|
569
571
|
name: string;
|
|
570
572
|
nativeTokenId: string;
|
|
@@ -619,41 +621,6 @@ export declare const networksByIdAtom: import("jotai").Atom<Promise<import("loda
|
|
|
619
621
|
"substrate-foreignassets"?: undefined;
|
|
620
622
|
"substrate-hydration"?: undefined;
|
|
621
623
|
} | undefined;
|
|
622
|
-
} | {
|
|
623
|
-
id: string;
|
|
624
|
-
name: string;
|
|
625
|
-
nativeTokenId: string;
|
|
626
|
-
nativeCurrency: {
|
|
627
|
-
decimals: number;
|
|
628
|
-
symbol: string;
|
|
629
|
-
name: string;
|
|
630
|
-
coingeckoId?: string | undefined;
|
|
631
|
-
mirrorOf?: string | undefined;
|
|
632
|
-
logo?: string | undefined;
|
|
633
|
-
};
|
|
634
|
-
blockExplorerUrls: string[];
|
|
635
|
-
platform: "ethereum";
|
|
636
|
-
rpcs: string[];
|
|
637
|
-
isTestnet?: boolean | undefined;
|
|
638
|
-
isDefault?: boolean | undefined;
|
|
639
|
-
forceScan?: boolean | undefined;
|
|
640
|
-
logo?: string | undefined;
|
|
641
|
-
themeColor?: string | undefined;
|
|
642
|
-
substrateChainId?: string | undefined;
|
|
643
|
-
preserveGasEstimate?: boolean | undefined;
|
|
644
|
-
feeType?: "legacy" | "eip-1559" | undefined;
|
|
645
|
-
l2FeeType?: {
|
|
646
|
-
type: "op-stack";
|
|
647
|
-
} | {
|
|
648
|
-
type: "scroll";
|
|
649
|
-
l1GasPriceOracle: `0x${string}`;
|
|
650
|
-
} | undefined;
|
|
651
|
-
contracts?: Partial<Record<"Erc20Aggregator" | "Multicall3", `0x${string}`>> | undefined;
|
|
652
|
-
balancesConfig?: {
|
|
653
|
-
"evm-native"?: undefined;
|
|
654
|
-
"evm-erc20"?: undefined;
|
|
655
|
-
"evm-uniswapv2"?: undefined;
|
|
656
|
-
} | undefined;
|
|
657
624
|
}>>>;
|
|
658
625
|
export declare const tokensAtom: import("jotai").Atom<Promise<({
|
|
659
626
|
id: string;
|
|
@@ -800,148 +767,4 @@ export declare const tokensAtom: import("jotai").Atom<Promise<({
|
|
|
800
767
|
noDiscovery?: boolean | undefined;
|
|
801
768
|
mirrorOf?: string | undefined;
|
|
802
769
|
})[]>>;
|
|
803
|
-
export declare const tokensByIdAtom: import("jotai").Atom<Promise<
|
|
804
|
-
id: string;
|
|
805
|
-
networkId: string;
|
|
806
|
-
decimals: number;
|
|
807
|
-
symbol: string;
|
|
808
|
-
type: "evm-erc20";
|
|
809
|
-
platform: "ethereum";
|
|
810
|
-
contractAddress: `0x${string}`;
|
|
811
|
-
isDefault?: boolean | undefined;
|
|
812
|
-
name?: string | undefined;
|
|
813
|
-
logo?: string | undefined;
|
|
814
|
-
coingeckoId?: string | undefined;
|
|
815
|
-
noDiscovery?: boolean | undefined;
|
|
816
|
-
mirrorOf?: string | undefined;
|
|
817
|
-
} | {
|
|
818
|
-
id: string;
|
|
819
|
-
networkId: string;
|
|
820
|
-
decimals: number;
|
|
821
|
-
symbol: string;
|
|
822
|
-
type: "evm-native";
|
|
823
|
-
platform: "ethereum";
|
|
824
|
-
isDefault?: boolean | undefined;
|
|
825
|
-
name?: string | undefined;
|
|
826
|
-
logo?: string | undefined;
|
|
827
|
-
coingeckoId?: string | undefined;
|
|
828
|
-
noDiscovery?: boolean | undefined;
|
|
829
|
-
mirrorOf?: string | undefined;
|
|
830
|
-
} | {
|
|
831
|
-
id: string;
|
|
832
|
-
networkId: string;
|
|
833
|
-
decimals: number;
|
|
834
|
-
symbol: string;
|
|
835
|
-
type: "evm-uniswapv2";
|
|
836
|
-
platform: "ethereum";
|
|
837
|
-
contractAddress: `0x${string}`;
|
|
838
|
-
symbol0: string;
|
|
839
|
-
symbol1: string;
|
|
840
|
-
decimals0: number;
|
|
841
|
-
decimals1: number;
|
|
842
|
-
tokenAddress0: `0x${string}`;
|
|
843
|
-
tokenAddress1: `0x${string}`;
|
|
844
|
-
isDefault?: boolean | undefined;
|
|
845
|
-
name?: string | undefined;
|
|
846
|
-
logo?: string | undefined;
|
|
847
|
-
coingeckoId?: string | undefined;
|
|
848
|
-
noDiscovery?: boolean | undefined;
|
|
849
|
-
mirrorOf?: string | undefined;
|
|
850
|
-
isCustom?: boolean | undefined;
|
|
851
|
-
coingeckoId0?: string | undefined;
|
|
852
|
-
coingeckoId1?: string | undefined;
|
|
853
|
-
} | {
|
|
854
|
-
id: string;
|
|
855
|
-
networkId: string;
|
|
856
|
-
decimals: number;
|
|
857
|
-
symbol: string;
|
|
858
|
-
type: "substrate-assets";
|
|
859
|
-
platform: "polkadot";
|
|
860
|
-
assetId: string;
|
|
861
|
-
isSufficient: boolean;
|
|
862
|
-
existentialDeposit: string;
|
|
863
|
-
isDefault?: boolean | undefined;
|
|
864
|
-
name?: string | undefined;
|
|
865
|
-
logo?: string | undefined;
|
|
866
|
-
coingeckoId?: string | undefined;
|
|
867
|
-
noDiscovery?: boolean | undefined;
|
|
868
|
-
mirrorOf?: string | undefined;
|
|
869
|
-
isFrozen?: boolean | undefined;
|
|
870
|
-
} | {
|
|
871
|
-
id: string;
|
|
872
|
-
networkId: string;
|
|
873
|
-
decimals: number;
|
|
874
|
-
symbol: string;
|
|
875
|
-
type: "substrate-foreignassets";
|
|
876
|
-
platform: "polkadot";
|
|
877
|
-
onChainId: string;
|
|
878
|
-
isSufficient: boolean;
|
|
879
|
-
existentialDeposit: string;
|
|
880
|
-
isDefault?: boolean | undefined;
|
|
881
|
-
name?: string | undefined;
|
|
882
|
-
logo?: string | undefined;
|
|
883
|
-
coingeckoId?: string | undefined;
|
|
884
|
-
noDiscovery?: boolean | undefined;
|
|
885
|
-
mirrorOf?: string | undefined;
|
|
886
|
-
isFrozen?: boolean | undefined;
|
|
887
|
-
} | {
|
|
888
|
-
id: string;
|
|
889
|
-
networkId: string;
|
|
890
|
-
decimals: number;
|
|
891
|
-
symbol: string;
|
|
892
|
-
type: "substrate-native";
|
|
893
|
-
platform: "polkadot";
|
|
894
|
-
existentialDeposit: string;
|
|
895
|
-
isDefault?: boolean | undefined;
|
|
896
|
-
name?: string | undefined;
|
|
897
|
-
logo?: string | undefined;
|
|
898
|
-
coingeckoId?: string | undefined;
|
|
899
|
-
noDiscovery?: boolean | undefined;
|
|
900
|
-
mirrorOf?: string | undefined;
|
|
901
|
-
} | {
|
|
902
|
-
id: string;
|
|
903
|
-
networkId: string;
|
|
904
|
-
decimals: number;
|
|
905
|
-
symbol: string;
|
|
906
|
-
type: "substrate-psp22";
|
|
907
|
-
platform: "polkadot";
|
|
908
|
-
contractAddress: string;
|
|
909
|
-
isDefault?: boolean | undefined;
|
|
910
|
-
name?: string | undefined;
|
|
911
|
-
logo?: string | undefined;
|
|
912
|
-
coingeckoId?: string | undefined;
|
|
913
|
-
noDiscovery?: boolean | undefined;
|
|
914
|
-
mirrorOf?: string | undefined;
|
|
915
|
-
} | {
|
|
916
|
-
id: string;
|
|
917
|
-
networkId: string;
|
|
918
|
-
decimals: number;
|
|
919
|
-
symbol: string;
|
|
920
|
-
type: "substrate-tokens";
|
|
921
|
-
platform: "polkadot";
|
|
922
|
-
onChainId: string | number;
|
|
923
|
-
existentialDeposit: string;
|
|
924
|
-
isDefault?: boolean | undefined;
|
|
925
|
-
name?: string | undefined;
|
|
926
|
-
logo?: string | undefined;
|
|
927
|
-
coingeckoId?: string | undefined;
|
|
928
|
-
noDiscovery?: boolean | undefined;
|
|
929
|
-
mirrorOf?: string | undefined;
|
|
930
|
-
} | {
|
|
931
|
-
id: string;
|
|
932
|
-
networkId: string;
|
|
933
|
-
decimals: number;
|
|
934
|
-
symbol: string;
|
|
935
|
-
type: "substrate-hydration";
|
|
936
|
-
platform: "polkadot";
|
|
937
|
-
onChainId: number;
|
|
938
|
-
assetType: "Token" | "Erc20" | "External";
|
|
939
|
-
isSufficient: boolean;
|
|
940
|
-
existentialDeposit: string;
|
|
941
|
-
isDefault?: boolean | undefined;
|
|
942
|
-
name?: string | undefined;
|
|
943
|
-
logo?: string | undefined;
|
|
944
|
-
coingeckoId?: string | undefined;
|
|
945
|
-
noDiscovery?: boolean | undefined;
|
|
946
|
-
mirrorOf?: string | undefined;
|
|
947
|
-
}>>>;
|
|
770
|
+
export declare const tokensByIdAtom: import("jotai").Atom<Promise<TokenList>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NetworkId, TokenId } from "@talismn/chaindata-provider";
|
|
2
2
|
export declare const useChaindataProvider: () => import("@talismn/chaindata-provider").ChaindataProvider;
|
|
3
3
|
export declare const useChaindata: () => {
|
|
4
4
|
networks: ({
|
|
@@ -238,9 +238,533 @@ export declare const useChaindata: () => {
|
|
|
238
238
|
mirrorOf?: string | undefined;
|
|
239
239
|
})[];
|
|
240
240
|
};
|
|
241
|
-
export declare const useNetworks: () =>
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
241
|
+
export declare const useNetworks: () => ({
|
|
242
|
+
id: string;
|
|
243
|
+
name: string;
|
|
244
|
+
nativeTokenId: string;
|
|
245
|
+
nativeCurrency: {
|
|
246
|
+
decimals: number;
|
|
247
|
+
symbol: string;
|
|
248
|
+
name: string;
|
|
249
|
+
coingeckoId?: string | undefined;
|
|
250
|
+
mirrorOf?: string | undefined;
|
|
251
|
+
logo?: string | undefined;
|
|
252
|
+
};
|
|
253
|
+
blockExplorerUrls: string[];
|
|
254
|
+
genesisHash: `0x${string}`;
|
|
255
|
+
platform: "polkadot";
|
|
256
|
+
chainName: string;
|
|
257
|
+
specName: string;
|
|
258
|
+
specVersion: number;
|
|
259
|
+
account: "secp256k1" | "*25519";
|
|
260
|
+
prefix: number;
|
|
261
|
+
rpcs: string[];
|
|
262
|
+
topology: {
|
|
263
|
+
type: "standalone";
|
|
264
|
+
} | {
|
|
265
|
+
type: "relay";
|
|
266
|
+
} | {
|
|
267
|
+
type: "parachain";
|
|
268
|
+
relayId: string;
|
|
269
|
+
paraId: number;
|
|
270
|
+
};
|
|
271
|
+
isTestnet?: boolean | undefined;
|
|
272
|
+
isDefault?: boolean | undefined;
|
|
273
|
+
forceScan?: boolean | undefined;
|
|
274
|
+
logo?: string | undefined;
|
|
275
|
+
themeColor?: string | undefined;
|
|
276
|
+
chainspecQrUrl?: string | undefined;
|
|
277
|
+
latestMetadataQrUrl?: string | undefined;
|
|
278
|
+
oldPrefix?: number | undefined;
|
|
279
|
+
registryTypes?: any;
|
|
280
|
+
signedExtensions?: any;
|
|
281
|
+
hasCheckMetadataHash?: boolean | undefined;
|
|
282
|
+
hasExtrinsicSignatureTypePrefix?: boolean | undefined;
|
|
283
|
+
isUnknownFeeToken?: boolean | undefined;
|
|
284
|
+
balancesConfig?: {
|
|
285
|
+
"substrate-native"?: {
|
|
286
|
+
disable?: boolean | undefined;
|
|
287
|
+
} | undefined;
|
|
288
|
+
"substrate-assets"?: undefined;
|
|
289
|
+
"substrate-psp22"?: undefined;
|
|
290
|
+
"substrate-tokens"?: {
|
|
291
|
+
palletId?: string | undefined;
|
|
292
|
+
} | undefined;
|
|
293
|
+
"substrate-foreignassets"?: undefined;
|
|
294
|
+
"substrate-hydration"?: undefined;
|
|
295
|
+
} | undefined;
|
|
296
|
+
} | {
|
|
297
|
+
id: string;
|
|
298
|
+
name: string;
|
|
299
|
+
nativeTokenId: string;
|
|
300
|
+
nativeCurrency: {
|
|
301
|
+
decimals: number;
|
|
302
|
+
symbol: string;
|
|
303
|
+
name: string;
|
|
304
|
+
coingeckoId?: string | undefined;
|
|
305
|
+
mirrorOf?: string | undefined;
|
|
306
|
+
logo?: string | undefined;
|
|
307
|
+
};
|
|
308
|
+
blockExplorerUrls: string[];
|
|
309
|
+
platform: "ethereum";
|
|
310
|
+
rpcs: string[];
|
|
311
|
+
isTestnet?: boolean | undefined;
|
|
312
|
+
isDefault?: boolean | undefined;
|
|
313
|
+
forceScan?: boolean | undefined;
|
|
314
|
+
logo?: string | undefined;
|
|
315
|
+
themeColor?: string | undefined;
|
|
316
|
+
substrateChainId?: string | undefined;
|
|
317
|
+
preserveGasEstimate?: boolean | undefined;
|
|
318
|
+
feeType?: "legacy" | "eip-1559" | undefined;
|
|
319
|
+
l2FeeType?: {
|
|
320
|
+
type: "op-stack";
|
|
321
|
+
} | {
|
|
322
|
+
type: "scroll";
|
|
323
|
+
l1GasPriceOracle: `0x${string}`;
|
|
324
|
+
} | undefined;
|
|
325
|
+
contracts?: Partial<Record<"Erc20Aggregator" | "Multicall3", `0x${string}`>> | undefined;
|
|
326
|
+
balancesConfig?: {
|
|
327
|
+
"evm-native"?: undefined;
|
|
328
|
+
"evm-erc20"?: undefined;
|
|
329
|
+
"evm-uniswapv2"?: undefined;
|
|
330
|
+
} | undefined;
|
|
331
|
+
})[];
|
|
332
|
+
export declare const useNetworksById: () => import("@talismn/chaindata-provider").NetworkList;
|
|
333
|
+
export declare const useDotNetworksByGenesisHash: () => Record<string, {
|
|
334
|
+
id: string;
|
|
335
|
+
name: string;
|
|
336
|
+
nativeTokenId: string;
|
|
337
|
+
nativeCurrency: {
|
|
338
|
+
decimals: number;
|
|
339
|
+
symbol: string;
|
|
340
|
+
name: string;
|
|
341
|
+
coingeckoId?: string | undefined;
|
|
342
|
+
mirrorOf?: string | undefined;
|
|
343
|
+
logo?: string | undefined;
|
|
344
|
+
};
|
|
345
|
+
blockExplorerUrls: string[];
|
|
346
|
+
genesisHash: `0x${string}`;
|
|
347
|
+
platform: "polkadot";
|
|
348
|
+
chainName: string;
|
|
349
|
+
specName: string;
|
|
350
|
+
specVersion: number;
|
|
351
|
+
account: "secp256k1" | "*25519";
|
|
352
|
+
prefix: number;
|
|
353
|
+
rpcs: string[];
|
|
354
|
+
topology: {
|
|
355
|
+
type: "standalone";
|
|
356
|
+
} | {
|
|
357
|
+
type: "relay";
|
|
358
|
+
} | {
|
|
359
|
+
type: "parachain";
|
|
360
|
+
relayId: string;
|
|
361
|
+
paraId: number;
|
|
362
|
+
};
|
|
363
|
+
isTestnet?: boolean | undefined;
|
|
364
|
+
isDefault?: boolean | undefined;
|
|
365
|
+
forceScan?: boolean | undefined;
|
|
366
|
+
logo?: string | undefined;
|
|
367
|
+
themeColor?: string | undefined;
|
|
368
|
+
chainspecQrUrl?: string | undefined;
|
|
369
|
+
latestMetadataQrUrl?: string | undefined;
|
|
370
|
+
oldPrefix?: number | undefined;
|
|
371
|
+
registryTypes?: any;
|
|
372
|
+
signedExtensions?: any;
|
|
373
|
+
hasCheckMetadataHash?: boolean | undefined;
|
|
374
|
+
hasExtrinsicSignatureTypePrefix?: boolean | undefined;
|
|
375
|
+
isUnknownFeeToken?: boolean | undefined;
|
|
376
|
+
balancesConfig?: {
|
|
377
|
+
"substrate-native"?: {
|
|
378
|
+
disable?: boolean | undefined;
|
|
379
|
+
} | undefined;
|
|
380
|
+
"substrate-assets"?: undefined;
|
|
381
|
+
"substrate-psp22"?: undefined;
|
|
382
|
+
"substrate-tokens"?: {
|
|
383
|
+
palletId?: string | undefined;
|
|
384
|
+
} | undefined;
|
|
385
|
+
"substrate-foreignassets"?: undefined;
|
|
386
|
+
"substrate-hydration"?: undefined;
|
|
387
|
+
} | undefined;
|
|
388
|
+
}>;
|
|
389
|
+
export declare const useNetwork: (networkId?: NetworkId) => {
|
|
390
|
+
id: string;
|
|
391
|
+
name: string;
|
|
392
|
+
nativeTokenId: string;
|
|
393
|
+
nativeCurrency: {
|
|
394
|
+
decimals: number;
|
|
395
|
+
symbol: string;
|
|
396
|
+
name: string;
|
|
397
|
+
coingeckoId?: string | undefined;
|
|
398
|
+
mirrorOf?: string | undefined;
|
|
399
|
+
logo?: string | undefined;
|
|
400
|
+
};
|
|
401
|
+
blockExplorerUrls: string[];
|
|
402
|
+
genesisHash: `0x${string}`;
|
|
403
|
+
platform: "polkadot";
|
|
404
|
+
chainName: string;
|
|
405
|
+
specName: string;
|
|
406
|
+
specVersion: number;
|
|
407
|
+
account: "secp256k1" | "*25519";
|
|
408
|
+
prefix: number;
|
|
409
|
+
rpcs: string[];
|
|
410
|
+
topology: {
|
|
411
|
+
type: "standalone";
|
|
412
|
+
} | {
|
|
413
|
+
type: "relay";
|
|
414
|
+
} | {
|
|
415
|
+
type: "parachain";
|
|
416
|
+
relayId: string;
|
|
417
|
+
paraId: number;
|
|
418
|
+
};
|
|
419
|
+
isTestnet?: boolean | undefined;
|
|
420
|
+
isDefault?: boolean | undefined;
|
|
421
|
+
forceScan?: boolean | undefined;
|
|
422
|
+
logo?: string | undefined;
|
|
423
|
+
themeColor?: string | undefined;
|
|
424
|
+
chainspecQrUrl?: string | undefined;
|
|
425
|
+
latestMetadataQrUrl?: string | undefined;
|
|
426
|
+
oldPrefix?: number | undefined;
|
|
427
|
+
registryTypes?: any;
|
|
428
|
+
signedExtensions?: any;
|
|
429
|
+
hasCheckMetadataHash?: boolean | undefined;
|
|
430
|
+
hasExtrinsicSignatureTypePrefix?: boolean | undefined;
|
|
431
|
+
isUnknownFeeToken?: boolean | undefined;
|
|
432
|
+
balancesConfig?: {
|
|
433
|
+
"substrate-native"?: {
|
|
434
|
+
disable?: boolean | undefined;
|
|
435
|
+
} | undefined;
|
|
436
|
+
"substrate-assets"?: undefined;
|
|
437
|
+
"substrate-psp22"?: undefined;
|
|
438
|
+
"substrate-tokens"?: {
|
|
439
|
+
palletId?: string | undefined;
|
|
440
|
+
} | undefined;
|
|
441
|
+
"substrate-foreignassets"?: undefined;
|
|
442
|
+
"substrate-hydration"?: undefined;
|
|
443
|
+
} | undefined;
|
|
444
|
+
} | {
|
|
445
|
+
id: string;
|
|
446
|
+
name: string;
|
|
447
|
+
nativeTokenId: string;
|
|
448
|
+
nativeCurrency: {
|
|
449
|
+
decimals: number;
|
|
450
|
+
symbol: string;
|
|
451
|
+
name: string;
|
|
452
|
+
coingeckoId?: string | undefined;
|
|
453
|
+
mirrorOf?: string | undefined;
|
|
454
|
+
logo?: string | undefined;
|
|
455
|
+
};
|
|
456
|
+
blockExplorerUrls: string[];
|
|
457
|
+
platform: "ethereum";
|
|
458
|
+
rpcs: string[];
|
|
459
|
+
isTestnet?: boolean | undefined;
|
|
460
|
+
isDefault?: boolean | undefined;
|
|
461
|
+
forceScan?: boolean | undefined;
|
|
462
|
+
logo?: string | undefined;
|
|
463
|
+
themeColor?: string | undefined;
|
|
464
|
+
substrateChainId?: string | undefined;
|
|
465
|
+
preserveGasEstimate?: boolean | undefined;
|
|
466
|
+
feeType?: "legacy" | "eip-1559" | undefined;
|
|
467
|
+
l2FeeType?: {
|
|
468
|
+
type: "op-stack";
|
|
469
|
+
} | {
|
|
470
|
+
type: "scroll";
|
|
471
|
+
l1GasPriceOracle: `0x${string}`;
|
|
472
|
+
} | undefined;
|
|
473
|
+
contracts?: Partial<Record<"Erc20Aggregator" | "Multicall3", `0x${string}`>> | undefined;
|
|
474
|
+
balancesConfig?: {
|
|
475
|
+
"evm-native"?: undefined;
|
|
476
|
+
"evm-erc20"?: undefined;
|
|
477
|
+
"evm-uniswapv2"?: undefined;
|
|
478
|
+
} | undefined;
|
|
479
|
+
};
|
|
480
|
+
export declare const useTokens: () => ({
|
|
481
|
+
id: string;
|
|
482
|
+
networkId: string;
|
|
483
|
+
decimals: number;
|
|
484
|
+
symbol: string;
|
|
485
|
+
type: "evm-erc20";
|
|
486
|
+
platform: "ethereum";
|
|
487
|
+
contractAddress: `0x${string}`;
|
|
488
|
+
isDefault?: boolean | undefined;
|
|
489
|
+
name?: string | undefined;
|
|
490
|
+
logo?: string | undefined;
|
|
491
|
+
coingeckoId?: string | undefined;
|
|
492
|
+
noDiscovery?: boolean | undefined;
|
|
493
|
+
mirrorOf?: string | undefined;
|
|
494
|
+
} | {
|
|
495
|
+
id: string;
|
|
496
|
+
networkId: string;
|
|
497
|
+
decimals: number;
|
|
498
|
+
symbol: string;
|
|
499
|
+
type: "evm-native";
|
|
500
|
+
platform: "ethereum";
|
|
501
|
+
isDefault?: boolean | undefined;
|
|
502
|
+
name?: string | undefined;
|
|
503
|
+
logo?: string | undefined;
|
|
504
|
+
coingeckoId?: string | undefined;
|
|
505
|
+
noDiscovery?: boolean | undefined;
|
|
506
|
+
mirrorOf?: string | undefined;
|
|
507
|
+
} | {
|
|
508
|
+
id: string;
|
|
509
|
+
networkId: string;
|
|
510
|
+
decimals: number;
|
|
511
|
+
symbol: string;
|
|
512
|
+
type: "evm-uniswapv2";
|
|
513
|
+
platform: "ethereum";
|
|
514
|
+
contractAddress: `0x${string}`;
|
|
515
|
+
symbol0: string;
|
|
516
|
+
symbol1: string;
|
|
517
|
+
decimals0: number;
|
|
518
|
+
decimals1: number;
|
|
519
|
+
tokenAddress0: `0x${string}`;
|
|
520
|
+
tokenAddress1: `0x${string}`;
|
|
521
|
+
isDefault?: boolean | undefined;
|
|
522
|
+
name?: string | undefined;
|
|
523
|
+
logo?: string | undefined;
|
|
524
|
+
coingeckoId?: string | undefined;
|
|
525
|
+
noDiscovery?: boolean | undefined;
|
|
526
|
+
mirrorOf?: string | undefined;
|
|
527
|
+
isCustom?: boolean | undefined;
|
|
528
|
+
coingeckoId0?: string | undefined;
|
|
529
|
+
coingeckoId1?: string | undefined;
|
|
530
|
+
} | {
|
|
531
|
+
id: string;
|
|
532
|
+
networkId: string;
|
|
533
|
+
decimals: number;
|
|
534
|
+
symbol: string;
|
|
535
|
+
type: "substrate-assets";
|
|
536
|
+
platform: "polkadot";
|
|
537
|
+
assetId: string;
|
|
538
|
+
isSufficient: boolean;
|
|
539
|
+
existentialDeposit: string;
|
|
540
|
+
isDefault?: boolean | undefined;
|
|
541
|
+
name?: string | undefined;
|
|
542
|
+
logo?: string | undefined;
|
|
543
|
+
coingeckoId?: string | undefined;
|
|
544
|
+
noDiscovery?: boolean | undefined;
|
|
545
|
+
mirrorOf?: string | undefined;
|
|
546
|
+
isFrozen?: boolean | undefined;
|
|
547
|
+
} | {
|
|
548
|
+
id: string;
|
|
549
|
+
networkId: string;
|
|
550
|
+
decimals: number;
|
|
551
|
+
symbol: string;
|
|
552
|
+
type: "substrate-foreignassets";
|
|
553
|
+
platform: "polkadot";
|
|
554
|
+
onChainId: string;
|
|
555
|
+
isSufficient: boolean;
|
|
556
|
+
existentialDeposit: string;
|
|
557
|
+
isDefault?: boolean | undefined;
|
|
558
|
+
name?: string | undefined;
|
|
559
|
+
logo?: string | undefined;
|
|
560
|
+
coingeckoId?: string | undefined;
|
|
561
|
+
noDiscovery?: boolean | undefined;
|
|
562
|
+
mirrorOf?: string | undefined;
|
|
563
|
+
isFrozen?: boolean | undefined;
|
|
564
|
+
} | {
|
|
565
|
+
id: string;
|
|
566
|
+
networkId: string;
|
|
567
|
+
decimals: number;
|
|
568
|
+
symbol: string;
|
|
569
|
+
type: "substrate-native";
|
|
570
|
+
platform: "polkadot";
|
|
571
|
+
existentialDeposit: string;
|
|
572
|
+
isDefault?: boolean | undefined;
|
|
573
|
+
name?: string | undefined;
|
|
574
|
+
logo?: string | undefined;
|
|
575
|
+
coingeckoId?: string | undefined;
|
|
576
|
+
noDiscovery?: boolean | undefined;
|
|
577
|
+
mirrorOf?: string | undefined;
|
|
578
|
+
} | {
|
|
579
|
+
id: string;
|
|
580
|
+
networkId: string;
|
|
581
|
+
decimals: number;
|
|
582
|
+
symbol: string;
|
|
583
|
+
type: "substrate-psp22";
|
|
584
|
+
platform: "polkadot";
|
|
585
|
+
contractAddress: string;
|
|
586
|
+
isDefault?: boolean | undefined;
|
|
587
|
+
name?: string | undefined;
|
|
588
|
+
logo?: string | undefined;
|
|
589
|
+
coingeckoId?: string | undefined;
|
|
590
|
+
noDiscovery?: boolean | undefined;
|
|
591
|
+
mirrorOf?: string | undefined;
|
|
592
|
+
} | {
|
|
593
|
+
id: string;
|
|
594
|
+
networkId: string;
|
|
595
|
+
decimals: number;
|
|
596
|
+
symbol: string;
|
|
597
|
+
type: "substrate-tokens";
|
|
598
|
+
platform: "polkadot";
|
|
599
|
+
onChainId: string | number;
|
|
600
|
+
existentialDeposit: string;
|
|
601
|
+
isDefault?: boolean | undefined;
|
|
602
|
+
name?: string | undefined;
|
|
603
|
+
logo?: string | undefined;
|
|
604
|
+
coingeckoId?: string | undefined;
|
|
605
|
+
noDiscovery?: boolean | undefined;
|
|
606
|
+
mirrorOf?: string | undefined;
|
|
607
|
+
} | {
|
|
608
|
+
id: string;
|
|
609
|
+
networkId: string;
|
|
610
|
+
decimals: number;
|
|
611
|
+
symbol: string;
|
|
612
|
+
type: "substrate-hydration";
|
|
613
|
+
platform: "polkadot";
|
|
614
|
+
onChainId: number;
|
|
615
|
+
assetType: "Token" | "Erc20" | "External";
|
|
616
|
+
isSufficient: boolean;
|
|
617
|
+
existentialDeposit: string;
|
|
618
|
+
isDefault?: boolean | undefined;
|
|
619
|
+
name?: string | undefined;
|
|
620
|
+
logo?: string | undefined;
|
|
621
|
+
coingeckoId?: string | undefined;
|
|
622
|
+
noDiscovery?: boolean | undefined;
|
|
623
|
+
mirrorOf?: string | undefined;
|
|
624
|
+
})[];
|
|
625
|
+
export declare const useTokensById: () => import("@talismn/chaindata-provider").TokenList;
|
|
626
|
+
export declare const useToken: (tokenId?: TokenId) => {
|
|
627
|
+
id: string;
|
|
628
|
+
networkId: string;
|
|
629
|
+
decimals: number;
|
|
630
|
+
symbol: string;
|
|
631
|
+
type: "evm-erc20";
|
|
632
|
+
platform: "ethereum";
|
|
633
|
+
contractAddress: `0x${string}`;
|
|
634
|
+
isDefault?: boolean | undefined;
|
|
635
|
+
name?: string | undefined;
|
|
636
|
+
logo?: string | undefined;
|
|
637
|
+
coingeckoId?: string | undefined;
|
|
638
|
+
noDiscovery?: boolean | undefined;
|
|
639
|
+
mirrorOf?: string | undefined;
|
|
640
|
+
} | {
|
|
641
|
+
id: string;
|
|
642
|
+
networkId: string;
|
|
643
|
+
decimals: number;
|
|
644
|
+
symbol: string;
|
|
645
|
+
type: "evm-native";
|
|
646
|
+
platform: "ethereum";
|
|
647
|
+
isDefault?: boolean | undefined;
|
|
648
|
+
name?: string | undefined;
|
|
649
|
+
logo?: string | undefined;
|
|
650
|
+
coingeckoId?: string | undefined;
|
|
651
|
+
noDiscovery?: boolean | undefined;
|
|
652
|
+
mirrorOf?: string | undefined;
|
|
653
|
+
} | {
|
|
654
|
+
id: string;
|
|
655
|
+
networkId: string;
|
|
656
|
+
decimals: number;
|
|
657
|
+
symbol: string;
|
|
658
|
+
type: "evm-uniswapv2";
|
|
659
|
+
platform: "ethereum";
|
|
660
|
+
contractAddress: `0x${string}`;
|
|
661
|
+
symbol0: string;
|
|
662
|
+
symbol1: string;
|
|
663
|
+
decimals0: number;
|
|
664
|
+
decimals1: number;
|
|
665
|
+
tokenAddress0: `0x${string}`;
|
|
666
|
+
tokenAddress1: `0x${string}`;
|
|
667
|
+
isDefault?: boolean | undefined;
|
|
668
|
+
name?: string | undefined;
|
|
669
|
+
logo?: string | undefined;
|
|
670
|
+
coingeckoId?: string | undefined;
|
|
671
|
+
noDiscovery?: boolean | undefined;
|
|
672
|
+
mirrorOf?: string | undefined;
|
|
673
|
+
isCustom?: boolean | undefined;
|
|
674
|
+
coingeckoId0?: string | undefined;
|
|
675
|
+
coingeckoId1?: string | undefined;
|
|
676
|
+
} | {
|
|
677
|
+
id: string;
|
|
678
|
+
networkId: string;
|
|
679
|
+
decimals: number;
|
|
680
|
+
symbol: string;
|
|
681
|
+
type: "substrate-assets";
|
|
682
|
+
platform: "polkadot";
|
|
683
|
+
assetId: string;
|
|
684
|
+
isSufficient: boolean;
|
|
685
|
+
existentialDeposit: string;
|
|
686
|
+
isDefault?: boolean | undefined;
|
|
687
|
+
name?: string | undefined;
|
|
688
|
+
logo?: string | undefined;
|
|
689
|
+
coingeckoId?: string | undefined;
|
|
690
|
+
noDiscovery?: boolean | undefined;
|
|
691
|
+
mirrorOf?: string | undefined;
|
|
692
|
+
isFrozen?: boolean | undefined;
|
|
693
|
+
} | {
|
|
694
|
+
id: string;
|
|
695
|
+
networkId: string;
|
|
696
|
+
decimals: number;
|
|
697
|
+
symbol: string;
|
|
698
|
+
type: "substrate-foreignassets";
|
|
699
|
+
platform: "polkadot";
|
|
700
|
+
onChainId: string;
|
|
701
|
+
isSufficient: boolean;
|
|
702
|
+
existentialDeposit: string;
|
|
703
|
+
isDefault?: boolean | undefined;
|
|
704
|
+
name?: string | undefined;
|
|
705
|
+
logo?: string | undefined;
|
|
706
|
+
coingeckoId?: string | undefined;
|
|
707
|
+
noDiscovery?: boolean | undefined;
|
|
708
|
+
mirrorOf?: string | undefined;
|
|
709
|
+
isFrozen?: boolean | undefined;
|
|
710
|
+
} | {
|
|
711
|
+
id: string;
|
|
712
|
+
networkId: string;
|
|
713
|
+
decimals: number;
|
|
714
|
+
symbol: string;
|
|
715
|
+
type: "substrate-native";
|
|
716
|
+
platform: "polkadot";
|
|
717
|
+
existentialDeposit: string;
|
|
718
|
+
isDefault?: boolean | undefined;
|
|
719
|
+
name?: string | undefined;
|
|
720
|
+
logo?: string | undefined;
|
|
721
|
+
coingeckoId?: string | undefined;
|
|
722
|
+
noDiscovery?: boolean | undefined;
|
|
723
|
+
mirrorOf?: string | undefined;
|
|
724
|
+
} | {
|
|
725
|
+
id: string;
|
|
726
|
+
networkId: string;
|
|
727
|
+
decimals: number;
|
|
728
|
+
symbol: string;
|
|
729
|
+
type: "substrate-psp22";
|
|
730
|
+
platform: "polkadot";
|
|
731
|
+
contractAddress: string;
|
|
732
|
+
isDefault?: boolean | undefined;
|
|
733
|
+
name?: string | undefined;
|
|
734
|
+
logo?: string | undefined;
|
|
735
|
+
coingeckoId?: string | undefined;
|
|
736
|
+
noDiscovery?: boolean | undefined;
|
|
737
|
+
mirrorOf?: string | undefined;
|
|
738
|
+
} | {
|
|
739
|
+
id: string;
|
|
740
|
+
networkId: string;
|
|
741
|
+
decimals: number;
|
|
742
|
+
symbol: string;
|
|
743
|
+
type: "substrate-tokens";
|
|
744
|
+
platform: "polkadot";
|
|
745
|
+
onChainId: string | number;
|
|
746
|
+
existentialDeposit: string;
|
|
747
|
+
isDefault?: boolean | undefined;
|
|
748
|
+
name?: string | undefined;
|
|
749
|
+
logo?: string | undefined;
|
|
750
|
+
coingeckoId?: string | undefined;
|
|
751
|
+
noDiscovery?: boolean | undefined;
|
|
752
|
+
mirrorOf?: string | undefined;
|
|
753
|
+
} | {
|
|
754
|
+
id: string;
|
|
755
|
+
networkId: string;
|
|
756
|
+
decimals: number;
|
|
757
|
+
symbol: string;
|
|
758
|
+
type: "substrate-hydration";
|
|
759
|
+
platform: "polkadot";
|
|
760
|
+
onChainId: number;
|
|
761
|
+
assetType: "Token" | "Erc20" | "External";
|
|
762
|
+
isSufficient: boolean;
|
|
763
|
+
existentialDeposit: string;
|
|
764
|
+
isDefault?: boolean | undefined;
|
|
765
|
+
name?: string | undefined;
|
|
766
|
+
logo?: string | undefined;
|
|
767
|
+
coingeckoId?: string | undefined;
|
|
768
|
+
noDiscovery?: boolean | undefined;
|
|
769
|
+
mirrorOf?: string | undefined;
|
|
770
|
+
};
|
|
@@ -65,17 +65,20 @@ const filteredChaindataAtom = jotai.atom(async get => {
|
|
|
65
65
|
const chaindata = await get(chaindataAtom);
|
|
66
66
|
const networks = chaindata.networks.filter(n => (enabledNetworkIds?.includes(n.id) || n.isDefault) && (enableTestnets || !n.isTestnet));
|
|
67
67
|
const networksById = lodashEs.keyBy(networks, n => n.id);
|
|
68
|
+
const dotNetworksByGenesisHash = lodashEs.keyBy(networks.filter(n => n.platform === "polkadot"), n => n.genesisHash);
|
|
68
69
|
const tokens = chaindata.tokens.filter(token => (enabledTokenIds?.includes(token.id) || token.isDefault) && networksById[token.networkId]);
|
|
69
70
|
const tokensById = lodashEs.keyBy(tokens, t => t.id);
|
|
70
71
|
return {
|
|
71
72
|
networks,
|
|
72
73
|
networksById,
|
|
74
|
+
dotNetworksByGenesisHash,
|
|
73
75
|
tokens,
|
|
74
76
|
tokensById
|
|
75
77
|
};
|
|
76
78
|
});
|
|
77
79
|
const networksAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).networks);
|
|
78
80
|
const networksByIdAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).networksById);
|
|
81
|
+
const dotNetworksByGenesisHashAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).dotNetworksByGenesisHash);
|
|
79
82
|
const tokensAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).tokens);
|
|
80
83
|
const tokensByIdAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).tokensById);
|
|
81
84
|
|
|
@@ -250,28 +253,13 @@ const useChainConnectors = () => jotai.useAtomValue(chainConnectorsAtom);
|
|
|
250
253
|
|
|
251
254
|
const useChaindataProvider = () => jotai.useAtomValue(chaindataProviderAtom);
|
|
252
255
|
const useChaindata = () => jotai.useAtomValue(chaindataAtom);
|
|
253
|
-
const useNetworks = () =>
|
|
254
|
-
const useNetworksById = () =>
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const useNetwork = networkId => {
|
|
261
|
-
const networksById = useNetworksById();
|
|
262
|
-
return networksById[networkId ?? ""] ?? null;
|
|
263
|
-
};
|
|
264
|
-
const useTokens = () => useChaindata().tokens;
|
|
265
|
-
const useTokensById = () => {
|
|
266
|
-
const {
|
|
267
|
-
tokens
|
|
268
|
-
} = useChaindata();
|
|
269
|
-
return react.useMemo(() => lodashEs.keyBy(tokens, t => t.id), [tokens]);
|
|
270
|
-
};
|
|
271
|
-
const useToken = tokenId => {
|
|
272
|
-
const tokensById = useTokensById();
|
|
273
|
-
return tokensById[tokenId ?? ""] ?? null;
|
|
274
|
-
};
|
|
256
|
+
const useNetworks = () => jotai.useAtomValue(networksAtom);
|
|
257
|
+
const useNetworksById = () => jotai.useAtomValue(networksByIdAtom);
|
|
258
|
+
const useDotNetworksByGenesisHash = () => jotai.useAtomValue(dotNetworksByGenesisHashAtom);
|
|
259
|
+
const useNetwork = networkId => jotai.useAtomValue(networksByIdAtom)[networkId ?? ""] ?? null;
|
|
260
|
+
const useTokens = () => jotai.useAtomValue(tokensAtom);
|
|
261
|
+
const useTokensById = () => jotai.useAtomValue(tokensByIdAtom);
|
|
262
|
+
const useToken = tokenId => jotai.useAtomValue(tokensByIdAtom)[tokenId ?? ""] ?? null;
|
|
275
263
|
|
|
276
264
|
const useTokenRates = () => jotai.useAtomValue(tokenRatesAtom);
|
|
277
265
|
const useTokenRate = tokenId => useTokenRates()[tokenId ?? ""] ?? undefined;
|
|
@@ -340,6 +328,7 @@ exports.chaindataAtom = chaindataAtom;
|
|
|
340
328
|
exports.chaindataProviderAtom = chaindataProviderAtom;
|
|
341
329
|
exports.coinsApiConfigAtom = coinsApiConfigAtom;
|
|
342
330
|
exports.cryptoWaitReadyAtom = cryptoWaitReadyAtom;
|
|
331
|
+
exports.dotNetworksByGenesisHashAtom = dotNetworksByGenesisHashAtom;
|
|
343
332
|
exports.enableTestnetsAtom = enableTestnetsAtom;
|
|
344
333
|
exports.enabledChainsAtom = enabledChainsAtom;
|
|
345
334
|
exports.enabledTokensAtom = enabledTokensAtom;
|
|
@@ -354,6 +343,7 @@ exports.useBalancesStatus = useBalancesStatus;
|
|
|
354
343
|
exports.useChainConnectors = useChainConnectors;
|
|
355
344
|
exports.useChaindata = useChaindata;
|
|
356
345
|
exports.useChaindataProvider = useChaindataProvider;
|
|
346
|
+
exports.useDotNetworksByGenesisHash = useDotNetworksByGenesisHash;
|
|
357
347
|
exports.useNetwork = useNetwork;
|
|
358
348
|
exports.useNetworks = useNetworks;
|
|
359
349
|
exports.useNetworksById = useNetworksById;
|
|
@@ -65,17 +65,20 @@ const filteredChaindataAtom = jotai.atom(async get => {
|
|
|
65
65
|
const chaindata = await get(chaindataAtom);
|
|
66
66
|
const networks = chaindata.networks.filter(n => (enabledNetworkIds?.includes(n.id) || n.isDefault) && (enableTestnets || !n.isTestnet));
|
|
67
67
|
const networksById = lodashEs.keyBy(networks, n => n.id);
|
|
68
|
+
const dotNetworksByGenesisHash = lodashEs.keyBy(networks.filter(n => n.platform === "polkadot"), n => n.genesisHash);
|
|
68
69
|
const tokens = chaindata.tokens.filter(token => (enabledTokenIds?.includes(token.id) || token.isDefault) && networksById[token.networkId]);
|
|
69
70
|
const tokensById = lodashEs.keyBy(tokens, t => t.id);
|
|
70
71
|
return {
|
|
71
72
|
networks,
|
|
72
73
|
networksById,
|
|
74
|
+
dotNetworksByGenesisHash,
|
|
73
75
|
tokens,
|
|
74
76
|
tokensById
|
|
75
77
|
};
|
|
76
78
|
});
|
|
77
79
|
const networksAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).networks);
|
|
78
80
|
const networksByIdAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).networksById);
|
|
81
|
+
const dotNetworksByGenesisHashAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).dotNetworksByGenesisHash);
|
|
79
82
|
const tokensAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).tokens);
|
|
80
83
|
const tokensByIdAtom = jotai.atom(async get => (await get(filteredChaindataAtom)).tokensById);
|
|
81
84
|
|
|
@@ -250,28 +253,13 @@ const useChainConnectors = () => jotai.useAtomValue(chainConnectorsAtom);
|
|
|
250
253
|
|
|
251
254
|
const useChaindataProvider = () => jotai.useAtomValue(chaindataProviderAtom);
|
|
252
255
|
const useChaindata = () => jotai.useAtomValue(chaindataAtom);
|
|
253
|
-
const useNetworks = () =>
|
|
254
|
-
const useNetworksById = () =>
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const useNetwork = networkId => {
|
|
261
|
-
const networksById = useNetworksById();
|
|
262
|
-
return networksById[networkId ?? ""] ?? null;
|
|
263
|
-
};
|
|
264
|
-
const useTokens = () => useChaindata().tokens;
|
|
265
|
-
const useTokensById = () => {
|
|
266
|
-
const {
|
|
267
|
-
tokens
|
|
268
|
-
} = useChaindata();
|
|
269
|
-
return react.useMemo(() => lodashEs.keyBy(tokens, t => t.id), [tokens]);
|
|
270
|
-
};
|
|
271
|
-
const useToken = tokenId => {
|
|
272
|
-
const tokensById = useTokensById();
|
|
273
|
-
return tokensById[tokenId ?? ""] ?? null;
|
|
274
|
-
};
|
|
256
|
+
const useNetworks = () => jotai.useAtomValue(networksAtom);
|
|
257
|
+
const useNetworksById = () => jotai.useAtomValue(networksByIdAtom);
|
|
258
|
+
const useDotNetworksByGenesisHash = () => jotai.useAtomValue(dotNetworksByGenesisHashAtom);
|
|
259
|
+
const useNetwork = networkId => jotai.useAtomValue(networksByIdAtom)[networkId ?? ""] ?? null;
|
|
260
|
+
const useTokens = () => jotai.useAtomValue(tokensAtom);
|
|
261
|
+
const useTokensById = () => jotai.useAtomValue(tokensByIdAtom);
|
|
262
|
+
const useToken = tokenId => jotai.useAtomValue(tokensByIdAtom)[tokenId ?? ""] ?? null;
|
|
275
263
|
|
|
276
264
|
const useTokenRates = () => jotai.useAtomValue(tokenRatesAtom);
|
|
277
265
|
const useTokenRate = tokenId => useTokenRates()[tokenId ?? ""] ?? undefined;
|
|
@@ -340,6 +328,7 @@ exports.chaindataAtom = chaindataAtom;
|
|
|
340
328
|
exports.chaindataProviderAtom = chaindataProviderAtom;
|
|
341
329
|
exports.coinsApiConfigAtom = coinsApiConfigAtom;
|
|
342
330
|
exports.cryptoWaitReadyAtom = cryptoWaitReadyAtom;
|
|
331
|
+
exports.dotNetworksByGenesisHashAtom = dotNetworksByGenesisHashAtom;
|
|
343
332
|
exports.enableTestnetsAtom = enableTestnetsAtom;
|
|
344
333
|
exports.enabledChainsAtom = enabledChainsAtom;
|
|
345
334
|
exports.enabledTokensAtom = enabledTokensAtom;
|
|
@@ -354,6 +343,7 @@ exports.useBalancesStatus = useBalancesStatus;
|
|
|
354
343
|
exports.useChainConnectors = useChainConnectors;
|
|
355
344
|
exports.useChaindata = useChaindata;
|
|
356
345
|
exports.useChaindataProvider = useChaindataProvider;
|
|
346
|
+
exports.useDotNetworksByGenesisHash = useDotNetworksByGenesisHash;
|
|
357
347
|
exports.useNetwork = useNetwork;
|
|
358
348
|
exports.useNetworks = useNetworks;
|
|
359
349
|
exports.useNetworksById = useNetworksById;
|
|
@@ -60,17 +60,20 @@ const filteredChaindataAtom = atom(async get => {
|
|
|
60
60
|
const chaindata = await get(chaindataAtom);
|
|
61
61
|
const networks = chaindata.networks.filter(n => (enabledNetworkIds?.includes(n.id) || n.isDefault) && (enableTestnets || !n.isTestnet));
|
|
62
62
|
const networksById = keyBy(networks, n => n.id);
|
|
63
|
+
const dotNetworksByGenesisHash = keyBy(networks.filter(n => n.platform === "polkadot"), n => n.genesisHash);
|
|
63
64
|
const tokens = chaindata.tokens.filter(token => (enabledTokenIds?.includes(token.id) || token.isDefault) && networksById[token.networkId]);
|
|
64
65
|
const tokensById = keyBy(tokens, t => t.id);
|
|
65
66
|
return {
|
|
66
67
|
networks,
|
|
67
68
|
networksById,
|
|
69
|
+
dotNetworksByGenesisHash,
|
|
68
70
|
tokens,
|
|
69
71
|
tokensById
|
|
70
72
|
};
|
|
71
73
|
});
|
|
72
74
|
const networksAtom = atom(async get => (await get(filteredChaindataAtom)).networks);
|
|
73
75
|
const networksByIdAtom = atom(async get => (await get(filteredChaindataAtom)).networksById);
|
|
76
|
+
const dotNetworksByGenesisHashAtom = atom(async get => (await get(filteredChaindataAtom)).dotNetworksByGenesisHash);
|
|
74
77
|
const tokensAtom = atom(async get => (await get(filteredChaindataAtom)).tokens);
|
|
75
78
|
const tokensByIdAtom = atom(async get => (await get(filteredChaindataAtom)).tokensById);
|
|
76
79
|
|
|
@@ -245,28 +248,13 @@ const useChainConnectors = () => useAtomValue(chainConnectorsAtom);
|
|
|
245
248
|
|
|
246
249
|
const useChaindataProvider = () => useAtomValue(chaindataProviderAtom);
|
|
247
250
|
const useChaindata = () => useAtomValue(chaindataAtom);
|
|
248
|
-
const useNetworks = () =>
|
|
249
|
-
const useNetworksById = () =>
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const useNetwork = networkId => {
|
|
256
|
-
const networksById = useNetworksById();
|
|
257
|
-
return networksById[networkId ?? ""] ?? null;
|
|
258
|
-
};
|
|
259
|
-
const useTokens = () => useChaindata().tokens;
|
|
260
|
-
const useTokensById = () => {
|
|
261
|
-
const {
|
|
262
|
-
tokens
|
|
263
|
-
} = useChaindata();
|
|
264
|
-
return useMemo(() => keyBy(tokens, t => t.id), [tokens]);
|
|
265
|
-
};
|
|
266
|
-
const useToken = tokenId => {
|
|
267
|
-
const tokensById = useTokensById();
|
|
268
|
-
return tokensById[tokenId ?? ""] ?? null;
|
|
269
|
-
};
|
|
251
|
+
const useNetworks = () => useAtomValue(networksAtom);
|
|
252
|
+
const useNetworksById = () => useAtomValue(networksByIdAtom);
|
|
253
|
+
const useDotNetworksByGenesisHash = () => useAtomValue(dotNetworksByGenesisHashAtom);
|
|
254
|
+
const useNetwork = networkId => useAtomValue(networksByIdAtom)[networkId ?? ""] ?? null;
|
|
255
|
+
const useTokens = () => useAtomValue(tokensAtom);
|
|
256
|
+
const useTokensById = () => useAtomValue(tokensByIdAtom);
|
|
257
|
+
const useToken = tokenId => useAtomValue(tokensByIdAtom)[tokenId ?? ""] ?? null;
|
|
270
258
|
|
|
271
259
|
const useTokenRates = () => useAtomValue(tokenRatesAtom);
|
|
272
260
|
const useTokenRate = tokenId => useTokenRates()[tokenId ?? ""] ?? undefined;
|
|
@@ -303,4 +291,4 @@ const BalancesProvider = ({
|
|
|
303
291
|
});
|
|
304
292
|
};
|
|
305
293
|
|
|
306
|
-
export { BalancesProvider, allAddressesAtom, balancesAtom, chainConnectorsAtom, chaindataAtom, chaindataProviderAtom, coinsApiConfigAtom, cryptoWaitReadyAtom, enableTestnetsAtom, enabledChainsAtom, enabledTokensAtom, getStaleChains, networksAtom, networksByIdAtom, tokenRatesAtom, tokensAtom, tokensByIdAtom, useBalances, useBalancesStatus, useChainConnectors, useChaindata, useChaindataProvider, useNetwork, useNetworks, useNetworksById, useSetBalancesAddresses, useToken, useTokenRate, useTokenRates, useTokens, useTokensById };
|
|
294
|
+
export { BalancesProvider, allAddressesAtom, balancesAtom, chainConnectorsAtom, chaindataAtom, chaindataProviderAtom, coinsApiConfigAtom, cryptoWaitReadyAtom, dotNetworksByGenesisHashAtom, enableTestnetsAtom, enabledChainsAtom, enabledTokensAtom, getStaleChains, networksAtom, networksByIdAtom, tokenRatesAtom, tokensAtom, tokensByIdAtom, useBalances, useBalancesStatus, useChainConnectors, useChaindata, useChaindataProvider, useDotNetworksByGenesisHash, useNetwork, useNetworks, useNetworksById, useSetBalancesAddresses, useToken, useTokenRate, useTokenRates, useTokens, useTokensById };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talismn/balances-react",
|
|
3
|
-
"version": "0.0.0-pr2111-
|
|
3
|
+
"version": "0.0.0-pr2111-20250724004118",
|
|
4
4
|
"author": "Talisman",
|
|
5
5
|
"homepage": "https://talisman.xyz",
|
|
6
6
|
"license": "GPL-3.0-or-later",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"lodash-es": "4.17.21",
|
|
31
31
|
"react-use": "^17.5.1",
|
|
32
32
|
"rxjs": "^7.8.1",
|
|
33
|
-
"@talismn/balances": "0.0.0-pr2111-
|
|
33
|
+
"@talismn/balances": "0.0.0-pr2111-20250724004118",
|
|
34
34
|
"@talismn/chain-connector": "1.0.0",
|
|
35
35
|
"@talismn/chain-connector-evm": "1.0.0",
|
|
36
|
-
"@talismn/chaindata-provider": "1.0.0",
|
|
37
|
-
"@talismn/connection-meta": "0.2.18",
|
|
38
36
|
"@talismn/scale": "0.2.0",
|
|
37
|
+
"@talismn/connection-meta": "0.2.18",
|
|
38
|
+
"@talismn/chaindata-provider": "1.0.0",
|
|
39
39
|
"@talismn/token-rates": "3.0.0",
|
|
40
40
|
"@talismn/util": "0.5.0"
|
|
41
41
|
},
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"react": "^18.3.1",
|
|
49
49
|
"ts-jest": "^29.2.5",
|
|
50
50
|
"typescript": "^5.6.3",
|
|
51
|
-
"@talismn/
|
|
52
|
-
"@talismn/
|
|
51
|
+
"@talismn/tsconfig": "0.0.2",
|
|
52
|
+
"@talismn/eslint-config": "0.0.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@polkadot/util-crypto": "*",
|