@talismn/chaindata-provider 1.0.1 → 1.1.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.
Files changed (31) hide show
  1. package/dist/declarations/src/chaindata/index.d.ts +1 -0
  2. package/dist/declarations/src/chaindata/networks/EthNetwork.d.ts +4 -4
  3. package/dist/declarations/src/chaindata/networks/Network.d.ts +29 -4
  4. package/dist/declarations/src/chaindata/networks/SolNetwork.d.ts +35 -0
  5. package/dist/declarations/src/chaindata/networks/index.d.ts +1 -0
  6. package/dist/declarations/src/chaindata/shared/SolanaAddress.d.ts +3 -0
  7. package/dist/declarations/src/chaindata/shared/index.d.ts +1 -0
  8. package/dist/declarations/src/chaindata/tokens/SolNativeToken.d.ts +28 -0
  9. package/dist/declarations/src/chaindata/tokens/SolSplToken.d.ts +30 -0
  10. package/dist/declarations/src/chaindata/tokens/Token.d.ts +113 -1
  11. package/dist/declarations/src/chaindata/tokens/index.d.ts +2 -0
  12. package/dist/declarations/src/chaindata/utils.d.ts +48 -1
  13. package/dist/declarations/src/constants.d.ts +2 -2
  14. package/dist/declarations/src/getBlockExplorerUrls.d.ts +24 -0
  15. package/dist/declarations/src/index.d.ts +8 -3
  16. package/dist/declarations/src/provider/ChaindataProvider.d.ts +79 -12
  17. package/dist/declarations/src/state/combinedChaindata.d.ts +11 -0
  18. package/dist/declarations/src/state/defaultChaindata.d.ts +59 -3
  19. package/dist/declarations/src/state/githubChaindata.d.ts +303 -0
  20. package/dist/declarations/src/state/net.d.ts +57 -2
  21. package/dist/declarations/src/state/oldDb.d.ts +1 -0
  22. package/dist/declarations/src/state/schema.d.ts +220 -8
  23. package/dist/talismn-chaindata-provider.cjs.dev.js +1051 -777
  24. package/dist/talismn-chaindata-provider.cjs.prod.js +1051 -777
  25. package/dist/talismn-chaindata-provider.esm.js +1039 -781
  26. package/package.json +8 -8
  27. package/dist/declarations/src/legacy/index.d.ts +0 -3
  28. package/dist/declarations/src/provider/index.d.ts +0 -2
  29. package/dist/declarations/src/state/db.d.ts +0 -11
  30. package/dist/declarations/src/state/index.d.ts +0 -2
  31. package/dist/declarations/src/upgrades/index.d.ts +0 -1
@@ -3,3 +3,4 @@ export * from "./tokens";
3
3
  export * from "./networks";
4
4
  export * from "./miniMetadata";
5
5
  export * from "./utils";
6
+ export * from "./shared";
@@ -37,10 +37,10 @@ export declare const EthNetworkSchema: z.ZodObject<{
37
37
  type: z.ZodLiteral<"scroll">;
38
38
  l1GasPriceOracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
39
39
  }, z.core.$strict>]>>;
40
- contracts: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodEnum<{
41
- Erc20Aggregator: "Erc20Aggregator";
42
- Multicall3: "Multicall3";
43
- }>, z.ZodNever]>, z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
40
+ contracts: z.ZodOptional<z.ZodObject<{
41
+ Erc20Aggregator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
42
+ Multicall3: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
43
+ }, z.core.$strict>>;
44
44
  balancesConfig: z.ZodOptional<z.ZodObject<{
45
45
  "evm-native": z.ZodOptional<z.ZodUndefined>;
46
46
  "evm-erc20": z.ZodOptional<z.ZodUndefined>;
@@ -89,15 +89,40 @@ export declare const NetworkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
89
89
  type: z.ZodLiteral<"scroll">;
90
90
  l1GasPriceOracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
91
91
  }, z.core.$strict>]>>;
92
- contracts: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodEnum<{
93
- Erc20Aggregator: "Erc20Aggregator";
94
- Multicall3: "Multicall3";
95
- }>, z.ZodNever]>, z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
92
+ contracts: z.ZodOptional<z.ZodObject<{
93
+ Erc20Aggregator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
94
+ Multicall3: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
95
+ }, z.core.$strict>>;
96
96
  balancesConfig: z.ZodOptional<z.ZodObject<{
97
97
  "evm-native": z.ZodOptional<z.ZodUndefined>;
98
98
  "evm-erc20": z.ZodOptional<z.ZodUndefined>;
99
99
  "evm-uniswapv2": z.ZodOptional<z.ZodUndefined>;
100
100
  }, z.core.$strict>>;
101
+ }, z.core.$strict>, z.ZodObject<{
102
+ id: z.ZodString;
103
+ isTestnet: z.ZodOptional<z.ZodBoolean>;
104
+ isDefault: z.ZodOptional<z.ZodBoolean>;
105
+ forceScan: z.ZodOptional<z.ZodBoolean>;
106
+ name: z.ZodString;
107
+ logo: z.ZodOptional<z.ZodString>;
108
+ nativeTokenId: z.ZodString;
109
+ nativeCurrency: z.ZodObject<{
110
+ decimals: z.ZodUInt32;
111
+ symbol: z.ZodString;
112
+ name: z.ZodString;
113
+ coingeckoId: z.ZodOptional<z.ZodString>;
114
+ mirrorOf: z.ZodOptional<z.ZodString>;
115
+ logo: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$strict>;
117
+ themeColor: z.ZodOptional<z.ZodString>;
118
+ blockExplorerUrls: z.ZodDefault<z.ZodArray<z.ZodURL>>;
119
+ platform: z.ZodLiteral<"solana">;
120
+ genesisHash: z.ZodString;
121
+ rpcs: z.ZodArray<z.ZodURL>;
122
+ balancesConfig: z.ZodOptional<z.ZodObject<{
123
+ "sol-native": z.ZodOptional<z.ZodUndefined>;
124
+ "sol-spl": z.ZodOptional<z.ZodUndefined>;
125
+ }, z.core.$strict>>;
101
126
  }, z.core.$strict>]>;
102
127
  export type Network = z.infer<typeof NetworkSchema>;
103
128
  export type NetworkId = Network["id"];
@@ -0,0 +1,35 @@
1
+ import z from "zod/v4";
2
+ export declare const SolNetworkBalancesConfigSchema: z.ZodObject<{
3
+ "sol-native": z.ZodOptional<z.ZodUndefined>;
4
+ "sol-spl": z.ZodOptional<z.ZodUndefined>;
5
+ }, z.core.$strict>;
6
+ export type SolNetworkBalancesConfig = z.infer<typeof SolNetworkBalancesConfigSchema>;
7
+ export declare const SolNetworkSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ isTestnet: z.ZodOptional<z.ZodBoolean>;
10
+ isDefault: z.ZodOptional<z.ZodBoolean>;
11
+ forceScan: z.ZodOptional<z.ZodBoolean>;
12
+ name: z.ZodString;
13
+ logo: z.ZodOptional<z.ZodString>;
14
+ nativeTokenId: z.ZodString;
15
+ nativeCurrency: z.ZodObject<{
16
+ decimals: z.ZodUInt32;
17
+ symbol: z.ZodString;
18
+ name: z.ZodString;
19
+ coingeckoId: z.ZodOptional<z.ZodString>;
20
+ mirrorOf: z.ZodOptional<z.ZodString>;
21
+ logo: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strict>;
23
+ themeColor: z.ZodOptional<z.ZodString>;
24
+ blockExplorerUrls: z.ZodDefault<z.ZodArray<z.ZodURL>>;
25
+ platform: z.ZodLiteral<"solana">;
26
+ genesisHash: z.ZodString;
27
+ rpcs: z.ZodArray<z.ZodURL>;
28
+ balancesConfig: z.ZodOptional<z.ZodObject<{
29
+ "sol-native": z.ZodOptional<z.ZodUndefined>;
30
+ "sol-spl": z.ZodOptional<z.ZodUndefined>;
31
+ }, z.core.$strict>>;
32
+ }, z.core.$strict>;
33
+ export type SolNetwork = z.infer<typeof SolNetworkSchema>;
34
+ export type SolNetworkId = SolNetwork["id"];
35
+ export type SolNetworkList = Record<SolNetworkId, SolNetwork>;
@@ -1,4 +1,5 @@
1
1
  export * from "./NetworkBase";
2
2
  export * from "./DotNetwork";
3
3
  export * from "./EthNetwork";
4
+ export * from "./SolNetwork";
4
5
  export * from "./Network";
@@ -0,0 +1,3 @@
1
+ import z from "zod/v4";
2
+ export declare const SolanaAddressSchema: z.ZodString;
3
+ export type SolanaAddress = z.infer<typeof SolanaAddressSchema>;
@@ -1,2 +1,3 @@
1
1
  export * from "./HexString";
2
2
  export * from "./EthereumAddress";
3
+ export * from "./SolanaAddress";
@@ -0,0 +1,28 @@
1
+ import z from "zod/v4";
2
+ import { SolNetworkId } from "../networks/SolNetwork";
3
+ import { TokenId } from "./Token";
4
+ declare const TOKEN_TYPE = "sol-native";
5
+ export declare const SolNativeTokenSchema: z.ZodObject<{
6
+ id: z.ZodString;
7
+ networkId: z.ZodString;
8
+ isDefault: z.ZodOptional<z.ZodBoolean>;
9
+ decimals: z.ZodInt;
10
+ symbol: z.ZodString;
11
+ name: z.ZodOptional<z.ZodString>;
12
+ logo: z.ZodOptional<z.ZodString>;
13
+ coingeckoId: z.ZodOptional<z.ZodString>;
14
+ noDiscovery: z.ZodOptional<z.ZodBoolean>;
15
+ mirrorOf: z.ZodOptional<z.ZodString>;
16
+ type: z.ZodLiteral<"sol-native">;
17
+ platform: z.ZodLiteral<"solana">;
18
+ }, z.core.$strict>;
19
+ export type SolNativeToken = z.infer<typeof SolNativeTokenSchema>;
20
+ export declare const SolNativeBalancesConfigSchema: z.ZodUndefined;
21
+ export type SolNativeBalancesConfig = z.infer<typeof SolNativeBalancesConfigSchema>;
22
+ export type SolNativeTokenIdSpecs = {
23
+ type: typeof TOKEN_TYPE;
24
+ networkId: SolNetworkId;
25
+ };
26
+ export declare const solNativeTokenId: (networkId: SolNetworkId) => string;
27
+ export declare const parseSolNativeTokenId: (tokenId: TokenId) => SolNativeTokenIdSpecs;
28
+ export {};
@@ -0,0 +1,30 @@
1
+ import z from "zod/v4";
2
+ import { SolNetworkId } from "../networks";
3
+ import { TokenId } from "./Token";
4
+ declare const TOKEN_TYPE = "sol-spl";
5
+ export declare const SolSplTokenSchema: z.ZodObject<{
6
+ id: z.ZodString;
7
+ networkId: z.ZodString;
8
+ isDefault: z.ZodOptional<z.ZodBoolean>;
9
+ decimals: z.ZodInt;
10
+ symbol: z.ZodString;
11
+ name: z.ZodOptional<z.ZodString>;
12
+ logo: z.ZodOptional<z.ZodString>;
13
+ coingeckoId: z.ZodOptional<z.ZodString>;
14
+ noDiscovery: z.ZodOptional<z.ZodBoolean>;
15
+ mirrorOf: z.ZodOptional<z.ZodString>;
16
+ type: z.ZodLiteral<"sol-spl">;
17
+ platform: z.ZodLiteral<"solana">;
18
+ mintAddress: z.ZodString;
19
+ }, z.core.$strict>;
20
+ export type SolSplToken = z.infer<typeof SolSplTokenSchema>;
21
+ export declare const SolSplBalancesConfigSchema: z.ZodUndefined;
22
+ export type SolSplBalancesConfig = z.infer<typeof SolSplBalancesConfigSchema>;
23
+ export type SolSplTokenIdSpecs = {
24
+ type: typeof TOKEN_TYPE;
25
+ networkId: SolNetworkId;
26
+ mintAddress: string;
27
+ };
28
+ export declare const solSplTokenId: (networkId: string, mintAddress: string) => string;
29
+ export declare const parseSolSplTokenId: (tokenId: TokenId) => SolSplTokenIdSpecs;
30
+ export {};
@@ -2,6 +2,8 @@ import z from "zod/v4";
2
2
  import { EvmErc20TokenIdSpecs } from "./EvmErc20Token";
3
3
  import { EvmNativeTokenIdSpecs } from "./EvmNativeToken";
4
4
  import { EvmUniswapV2TokenIdSpecs } from "./EvmUniswapV2Token";
5
+ import { SolNativeToken } from "./SolNativeToken";
6
+ import { SolSplToken } from "./SolSplToken";
5
7
  import { SubAssetTokenIdSpecs } from "./SubstrateAssetsToken";
6
8
  import { ForeignAssetsTokenIdSpecs } from "./SubstrateForeignAssetsToken";
7
9
  import { SubHydrationToken } from "./SubstrateHydrationToken";
@@ -159,6 +161,33 @@ export declare const TokenSchemaBase: z.ZodDiscriminatedUnion<[z.ZodObject<{
159
161
  }>;
160
162
  isSufficient: z.ZodBoolean;
161
163
  existentialDeposit: z.ZodString;
164
+ }, z.core.$strict>, z.ZodObject<{
165
+ id: z.ZodString;
166
+ networkId: z.ZodString;
167
+ isDefault: z.ZodOptional<z.ZodBoolean>;
168
+ decimals: z.ZodInt;
169
+ symbol: z.ZodString;
170
+ name: z.ZodOptional<z.ZodString>;
171
+ logo: z.ZodOptional<z.ZodString>;
172
+ coingeckoId: z.ZodOptional<z.ZodString>;
173
+ noDiscovery: z.ZodOptional<z.ZodBoolean>;
174
+ mirrorOf: z.ZodOptional<z.ZodString>;
175
+ type: z.ZodLiteral<"sol-native">;
176
+ platform: z.ZodLiteral<"solana">;
177
+ }, z.core.$strict>, z.ZodObject<{
178
+ id: z.ZodString;
179
+ networkId: z.ZodString;
180
+ isDefault: z.ZodOptional<z.ZodBoolean>;
181
+ decimals: z.ZodInt;
182
+ symbol: z.ZodString;
183
+ name: z.ZodOptional<z.ZodString>;
184
+ logo: z.ZodOptional<z.ZodString>;
185
+ coingeckoId: z.ZodOptional<z.ZodString>;
186
+ noDiscovery: z.ZodOptional<z.ZodBoolean>;
187
+ mirrorOf: z.ZodOptional<z.ZodString>;
188
+ type: z.ZodLiteral<"sol-spl">;
189
+ platform: z.ZodLiteral<"solana">;
190
+ mintAddress: z.ZodString;
162
191
  }, z.core.$strict>]>;
163
192
  export declare const TokenTypeSchema: z.ZodEnum<{
164
193
  "substrate-native": "substrate-native";
@@ -170,12 +199,14 @@ export declare const TokenTypeSchema: z.ZodEnum<{
170
199
  "evm-native": "evm-native";
171
200
  "evm-erc20": "evm-erc20";
172
201
  "evm-uniswapv2": "evm-uniswapv2";
202
+ "sol-native": "sol-native";
203
+ "sol-spl": "sol-spl";
173
204
  }>;
174
205
  export type Token = z.infer<typeof TokenSchemaBase>;
175
206
  export type TokenId = Token["id"];
176
207
  export type TokenList = Record<TokenId, Token>;
177
208
  export type TokenType = z.infer<typeof TokenTypeSchema>;
178
- export type TokenIdSpecs<T extends TokenType> = T extends "evm-erc20" ? EvmErc20TokenIdSpecs : T extends "evm-native" ? EvmNativeTokenIdSpecs : T extends "evm-uniswapv2" ? EvmUniswapV2TokenIdSpecs : T extends "substrate-assets" ? SubAssetTokenIdSpecs : T extends "substrate-foreignassets" ? ForeignAssetsTokenIdSpecs : T extends "substrate-native" ? SubNativeTokenIdSpecs : T extends "substrate-psp22" ? SubPsp22TokenIdSpecs : T extends "substrate-tokens" ? SubTokensTokenIdSpecs : T extends "substrate-hydration" ? SubHydrationToken : never;
209
+ export type TokenIdSpecs<T extends TokenType> = T extends "evm-erc20" ? EvmErc20TokenIdSpecs : T extends "evm-native" ? EvmNativeTokenIdSpecs : T extends "evm-uniswapv2" ? EvmUniswapV2TokenIdSpecs : T extends "substrate-assets" ? SubAssetTokenIdSpecs : T extends "substrate-foreignassets" ? ForeignAssetsTokenIdSpecs : T extends "substrate-native" ? SubNativeTokenIdSpecs : T extends "substrate-psp22" ? SubPsp22TokenIdSpecs : T extends "substrate-tokens" ? SubTokensTokenIdSpecs : T extends "substrate-hydration" ? SubHydrationToken : T extends "sol-native" ? SolNativeToken : T extends "sol-spl" ? SolSplToken : never;
179
210
  export declare const TokenSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject<{
180
211
  id: z.ZodString;
181
212
  networkId: z.ZodString;
@@ -324,6 +355,33 @@ export declare const TokenSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject
324
355
  }>;
325
356
  isSufficient: z.ZodBoolean;
326
357
  existentialDeposit: z.ZodString;
358
+ }, z.core.$strict>, z.ZodObject<{
359
+ id: z.ZodString;
360
+ networkId: z.ZodString;
361
+ isDefault: z.ZodOptional<z.ZodBoolean>;
362
+ decimals: z.ZodInt;
363
+ symbol: z.ZodString;
364
+ name: z.ZodOptional<z.ZodString>;
365
+ logo: z.ZodOptional<z.ZodString>;
366
+ coingeckoId: z.ZodOptional<z.ZodString>;
367
+ noDiscovery: z.ZodOptional<z.ZodBoolean>;
368
+ mirrorOf: z.ZodOptional<z.ZodString>;
369
+ type: z.ZodLiteral<"sol-native">;
370
+ platform: z.ZodLiteral<"solana">;
371
+ }, z.core.$strict>, z.ZodObject<{
372
+ id: z.ZodString;
373
+ networkId: z.ZodString;
374
+ isDefault: z.ZodOptional<z.ZodBoolean>;
375
+ decimals: z.ZodInt;
376
+ symbol: z.ZodString;
377
+ name: z.ZodOptional<z.ZodString>;
378
+ logo: z.ZodOptional<z.ZodString>;
379
+ coingeckoId: z.ZodOptional<z.ZodString>;
380
+ noDiscovery: z.ZodOptional<z.ZodBoolean>;
381
+ mirrorOf: z.ZodOptional<z.ZodString>;
382
+ type: z.ZodLiteral<"sol-spl">;
383
+ platform: z.ZodLiteral<"solana">;
384
+ mintAddress: z.ZodString;
327
385
  }, z.core.$strict>]>, z.ZodTransform<{
328
386
  id: string;
329
387
  networkId: string;
@@ -468,6 +526,33 @@ export declare const TokenSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject
468
526
  coingeckoId?: string | undefined;
469
527
  noDiscovery?: boolean | undefined;
470
528
  mirrorOf?: string | undefined;
529
+ } | {
530
+ id: string;
531
+ networkId: string;
532
+ decimals: number;
533
+ symbol: string;
534
+ type: "sol-native";
535
+ platform: "solana";
536
+ isDefault?: boolean | undefined;
537
+ name?: string | undefined;
538
+ logo?: string | undefined;
539
+ coingeckoId?: string | undefined;
540
+ noDiscovery?: boolean | undefined;
541
+ mirrorOf?: string | undefined;
542
+ } | {
543
+ id: string;
544
+ networkId: string;
545
+ decimals: number;
546
+ symbol: string;
547
+ type: "sol-spl";
548
+ platform: "solana";
549
+ mintAddress: string;
550
+ isDefault?: boolean | undefined;
551
+ name?: string | undefined;
552
+ logo?: string | undefined;
553
+ coingeckoId?: string | undefined;
554
+ noDiscovery?: boolean | undefined;
555
+ mirrorOf?: string | undefined;
471
556
  }, {
472
557
  id: string;
473
558
  networkId: string;
@@ -612,4 +697,31 @@ export declare const TokenSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject
612
697
  coingeckoId?: string | undefined;
613
698
  noDiscovery?: boolean | undefined;
614
699
  mirrorOf?: string | undefined;
700
+ } | {
701
+ id: string;
702
+ networkId: string;
703
+ decimals: number;
704
+ symbol: string;
705
+ type: "sol-native";
706
+ platform: "solana";
707
+ isDefault?: boolean | undefined;
708
+ name?: string | undefined;
709
+ logo?: string | undefined;
710
+ coingeckoId?: string | undefined;
711
+ noDiscovery?: boolean | undefined;
712
+ mirrorOf?: string | undefined;
713
+ } | {
714
+ id: string;
715
+ networkId: string;
716
+ decimals: number;
717
+ symbol: string;
718
+ type: "sol-spl";
719
+ platform: "solana";
720
+ mintAddress: string;
721
+ isDefault?: boolean | undefined;
722
+ name?: string | undefined;
723
+ logo?: string | undefined;
724
+ coingeckoId?: string | undefined;
725
+ noDiscovery?: boolean | undefined;
726
+ mirrorOf?: string | undefined;
615
727
  }>>;
@@ -1,6 +1,8 @@
1
1
  export * from "./EvmErc20Token";
2
2
  export * from "./EvmNativeToken";
3
3
  export * from "./EvmUniswapV2Token";
4
+ export * from "./SolNativeToken";
5
+ export * from "./SolSplToken";
4
6
  export * from "./SubstrateAssetsToken";
5
7
  export * from "./SubstrateForeignAssetsToken";
6
8
  export * from "./SubstrateNativeToken";
@@ -92,13 +92,42 @@ export declare const isNetworkEth: (network: Network | null | undefined) => netw
92
92
  type: "scroll";
93
93
  l1GasPriceOracle: `0x${string}`;
94
94
  } | undefined;
95
- contracts?: Partial<Record<"Erc20Aggregator" | "Multicall3", `0x${string}`>> | undefined;
95
+ contracts?: {
96
+ Erc20Aggregator?: `0x${string}` | undefined;
97
+ Multicall3?: `0x${string}` | undefined;
98
+ } | undefined;
96
99
  balancesConfig?: {
97
100
  "evm-native"?: undefined;
98
101
  "evm-erc20"?: undefined;
99
102
  "evm-uniswapv2"?: undefined;
100
103
  } | undefined;
101
104
  };
105
+ export declare const isNetworkSol: (network: Network | null | undefined) => network is {
106
+ id: string;
107
+ name: string;
108
+ nativeTokenId: string;
109
+ nativeCurrency: {
110
+ decimals: number;
111
+ symbol: string;
112
+ name: string;
113
+ coingeckoId?: string | undefined;
114
+ mirrorOf?: string | undefined;
115
+ logo?: string | undefined;
116
+ };
117
+ blockExplorerUrls: string[];
118
+ platform: "solana";
119
+ genesisHash: string;
120
+ rpcs: string[];
121
+ isTestnet?: boolean | undefined;
122
+ isDefault?: boolean | undefined;
123
+ forceScan?: boolean | undefined;
124
+ logo?: string | undefined;
125
+ themeColor?: string | undefined;
126
+ balancesConfig?: {
127
+ "sol-native"?: undefined;
128
+ "sol-spl"?: undefined;
129
+ } | undefined;
130
+ };
102
131
  export declare const getNetworkGenesisHash: <Net extends Network, Res = Net extends DotNetwork ? DotNetwork["genesisHash"] : undefined>(network: Net | null | undefined) => Res;
103
132
  export type TokenOfType<T extends TokenType> = Extract<Token, {
104
133
  type: T;
@@ -108,9 +137,11 @@ export type TokenOfPlatform<P extends NetworkPlatform> = Extract<Token, {
108
137
  }>;
109
138
  export type DotToken = TokenOfPlatform<"polkadot">;
110
139
  export type EthToken = TokenOfPlatform<"ethereum">;
140
+ export type SolToken = TokenOfPlatform<"solana">;
111
141
  export declare const isTokenOfPlatform: <P extends NetworkPlatform>(token: Token | null | undefined, platform: P) => token is TokenOfPlatform<P>;
112
142
  export declare const isTokenEth: (token: Token | null | undefined) => token is TokenOfPlatform<"ethereum">;
113
143
  export declare const isTokenDot: (token: Token | null | undefined) => token is TokenOfPlatform<"polkadot">;
144
+ export declare const isTokenSol: (token: Token | null | undefined) => token is TokenOfPlatform<"solana">;
114
145
  export declare const isTokenNeedExistentialDeposit: (token: Token) => token is {
115
146
  id: string;
116
147
  networkId: string;
@@ -347,11 +378,27 @@ export declare const isTokenEvmUniswapV2: (token: Token | null | undefined) => t
347
378
  coingeckoId0?: string | undefined;
348
379
  coingeckoId1?: string | undefined;
349
380
  };
381
+ export declare const isTokenSolSpl: (token: Token | null | undefined) => token is {
382
+ id: string;
383
+ networkId: string;
384
+ decimals: number;
385
+ symbol: string;
386
+ type: "sol-spl";
387
+ platform: "solana";
388
+ mintAddress: string;
389
+ isDefault?: boolean | undefined;
390
+ name?: string | undefined;
391
+ logo?: string | undefined;
392
+ coingeckoId?: string | undefined;
393
+ noDiscovery?: boolean | undefined;
394
+ mirrorOf?: string | undefined;
395
+ };
350
396
  export declare const parseTokenId: <T extends TokenType>(tokenId: TokenId) => TokenIdSpecs<T>;
351
397
  export declare const networkIdFromTokenId: (tokenId: TokenId) => Network["id"];
352
398
  declare const PLATFORM_NATIVE_TOKENS: {
353
399
  polkadot: "substrate-native";
354
400
  ethereum: "evm-native";
401
+ solana: "sol-native";
355
402
  };
356
403
  export type NativeTokenType<P extends NetworkPlatform = NetworkPlatform> = (typeof PLATFORM_NATIVE_TOKENS)[P];
357
404
  export type NativeToken<P extends NetworkPlatform = NetworkPlatform> = Extract<Token, {
@@ -3,8 +3,8 @@ export declare const githubCdn = "https://raw.githubusercontent.com";
3
3
  export declare const githubChaindataOrg = "TalismanSociety";
4
4
  export declare const githubChaindataRepo = "chaindata";
5
5
  export declare const githubChaindataBranch = "main";
6
- export declare const githubChaindataDistDir = "pub/v4";
6
+ export declare const githubChaindataDistDir = "pub/v5";
7
7
  export declare const githubChaindataBaseUrl = "https://raw.githubusercontent.com/TalismanSociety/chaindata/main";
8
- export declare const githubChaindataDistUrl = "https://raw.githubusercontent.com/TalismanSociety/chaindata/main/pub/v4";
8
+ export declare const githubChaindataDistUrl = "https://raw.githubusercontent.com/TalismanSociety/chaindata/main/pub/v5";
9
9
  export declare const githubChaindataChainsAssetsDir = "assets/chains";
10
10
  export declare const githubChaindataTokensAssetsDir = "assets/tokens";
@@ -0,0 +1,24 @@
1
+ import { Network } from "./chaindata";
2
+ type ExplorerQuery = {
3
+ type: "address";
4
+ address: string;
5
+ } | {
6
+ type: "account";
7
+ address: string;
8
+ } | {
9
+ type: "transaction";
10
+ id: string;
11
+ } | {
12
+ type: "block";
13
+ id: string | number | bigint;
14
+ } | {
15
+ type: "extrinsic";
16
+ blockNumber: number | bigint;
17
+ extrinsicIndex: number;
18
+ } | {
19
+ type: "extrinsic-unknown";
20
+ hash: `0x${string}`;
21
+ };
22
+ export declare const getBlockExplorerUrls: (network: Network, query: ExplorerQuery) => string[];
23
+ export declare const getBlockExplorerLabel: (blockExplorerUrl: string) => string;
24
+ export {};
@@ -1,6 +1,11 @@
1
1
  export * from "./chaindata";
2
- export * from "./provider";
2
+ export * from "./provider/ChaindataProviderInterface";
3
+ export * from "./provider/ChaindataProvider";
3
4
  export * from "./util";
4
- export * from "./legacy";
5
+ export * from "./legacy/Chain";
6
+ export * from "./legacy/EvmNetwork";
7
+ export * from "./legacy/TalismanChaindataDatabase";
8
+ export * from "./getBlockExplorerUrls";
5
9
  export { MINIMETADATA_VERSION } from "./constants";
6
- export { ChaindataFileSchema, CustomChaindataSchema, type Chaindata, type CustomChaindata, } from "./state";
10
+ export { getCleanNetwork, getCleanToken, isNetworkCustom, isNetworkKnown, isTokenCustom, isTokenKnown, isTokenTestnet, } from "./state/combinedChaindata";
11
+ export { ChaindataFileSchema, CustomChaindataSchema, type Chaindata, type CustomChaindata, } from "./state/schema";
@@ -1,13 +1,32 @@
1
1
  import { Observable } from "rxjs";
2
- import { IChaindataProvider } from ".";
3
- import { DotNetwork, Network, NetworkId, NetworkOfPlatform, NetworkPlatform, Token, TokenId, TokenOfType, TokenType } from "../chaindata";
4
- import { CustomChaindata } from "../state";
2
+ import { AnyMiniMetadata, DotNetwork, Network, NetworkId, NetworkOfPlatform, NetworkPlatform, Token, TokenId, TokenOfType, TokenType } from "../chaindata";
3
+ import { CustomChaindata } from "../state/schema";
4
+ import { IChaindataProvider } from "./ChaindataProviderInterface";
5
+ /**
6
+ * This type will be used for in-memory storage of chaindata.
7
+ *
8
+ * Provide a Subject<ChaindataStorage> and subscribe to changes to persist the data to disk.
9
+ * Instantiate ChaindataProvider with this subject to restore persisted data from disk.
10
+ */
11
+ export type ChaindataStorage = {
12
+ networks: Network[];
13
+ tokens: Token[];
14
+ miniMetadatas: AnyMiniMetadata[];
15
+ };
5
16
  export type ChaindataProviderOptions = {
17
+ persistedStorage?: ChaindataStorage | Promise<ChaindataStorage | undefined>;
6
18
  customChaindata$?: Observable<CustomChaindata> | CustomChaindata;
7
19
  };
8
20
  export declare class ChaindataProvider implements IChaindataProvider {
9
21
  #private;
10
- constructor(options?: ChaindataProviderOptions);
22
+ constructor({ persistedStorage, customChaindata$ }?: ChaindataProviderOptions);
23
+ /**
24
+ * Subscribe to this observable and save its contents somewhere persistent.
25
+ *
26
+ * Instantiate `new ChaindataProvider({ persistedStorage })` with the saved contents
27
+ * to prevent the need to wait for them to download on every startup.
28
+ */
29
+ get storage$(): Observable<ChaindataStorage>;
11
30
  /**
12
31
  * Mini metadatas
13
32
  */
@@ -212,6 +231,33 @@ export declare class ChaindataProvider implements IChaindataProvider {
212
231
  coingeckoId?: string | undefined;
213
232
  noDiscovery?: boolean | undefined;
214
233
  mirrorOf?: string | undefined;
234
+ } | {
235
+ id: string;
236
+ networkId: string;
237
+ decimals: number;
238
+ symbol: string;
239
+ type: "sol-native";
240
+ platform: "solana";
241
+ isDefault?: boolean | undefined;
242
+ name?: string | undefined;
243
+ logo?: string | undefined;
244
+ coingeckoId?: string | undefined;
245
+ noDiscovery?: boolean | undefined;
246
+ mirrorOf?: string | undefined;
247
+ } | {
248
+ id: string;
249
+ networkId: string;
250
+ decimals: number;
251
+ symbol: string;
252
+ type: "sol-spl";
253
+ platform: "solana";
254
+ mintAddress: string;
255
+ isDefault?: boolean | undefined;
256
+ name?: string | undefined;
257
+ logo?: string | undefined;
258
+ coingeckoId?: string | undefined;
259
+ noDiscovery?: boolean | undefined;
260
+ mirrorOf?: string | undefined;
215
261
  })[]>;
216
262
  getTokens$<T extends TokenType | undefined, R extends T extends TokenType ? TokenOfType<T> : Token>(type?: T): Observable<R[]>;
217
263
  getTokens<T extends TokenType | undefined, R extends T extends TokenType ? TokenOfType<T> : Token>(type?: T): Promise<R[]>;
@@ -308,12 +354,40 @@ export declare class ChaindataProvider implements IChaindataProvider {
308
354
  type: "scroll";
309
355
  l1GasPriceOracle: `0x${string}`;
310
356
  } | undefined;
311
- contracts?: Partial<Record<"Erc20Aggregator" | "Multicall3", `0x${string}`>> | undefined;
357
+ contracts?: {
358
+ Erc20Aggregator?: `0x${string}` | undefined;
359
+ Multicall3?: `0x${string}` | undefined;
360
+ } | undefined;
312
361
  balancesConfig?: {
313
362
  "evm-native"?: undefined;
314
363
  "evm-erc20"?: undefined;
315
364
  "evm-uniswapv2"?: undefined;
316
365
  } | undefined;
366
+ } | {
367
+ id: string;
368
+ name: string;
369
+ nativeTokenId: string;
370
+ nativeCurrency: {
371
+ decimals: number;
372
+ symbol: string;
373
+ name: string;
374
+ coingeckoId?: string | undefined;
375
+ mirrorOf?: string | undefined;
376
+ logo?: string | undefined;
377
+ };
378
+ blockExplorerUrls: string[];
379
+ platform: "solana";
380
+ genesisHash: string;
381
+ rpcs: string[];
382
+ isTestnet?: boolean | undefined;
383
+ isDefault?: boolean | undefined;
384
+ forceScan?: boolean | undefined;
385
+ logo?: string | undefined;
386
+ themeColor?: string | undefined;
387
+ balancesConfig?: {
388
+ "sol-native"?: undefined;
389
+ "sol-spl"?: undefined;
390
+ } | undefined;
317
391
  })[]>;
318
392
  getNetworks$<P extends NetworkPlatform | undefined, R = P extends NetworkPlatform ? NetworkOfPlatform<P> : Network>(platform?: P): Observable<R[]>;
319
393
  getNetworks<P extends NetworkPlatform | undefined, R = P extends NetworkPlatform ? NetworkOfPlatform<P> : Network>(platform?: P): Promise<R[]>;
@@ -493,10 +567,3 @@ export declare class ChaindataProvider implements IChaindataProvider {
493
567
  } | undefined;
494
568
  }>;
495
569
  }
496
- export declare const isNetworkCustom: (network: Network) => boolean;
497
- export declare const isNetworkKnown: (network: Network) => boolean;
498
- export declare const isTokenCustom: (token: Token) => boolean;
499
- export declare const isTokenKnown: (token: Token) => boolean;
500
- export declare const isTokenTestnet: (token: Token) => boolean;
501
- export declare const getCleanNetwork: (network: Network) => Network;
502
- export declare const getCleanToken: (token: Token) => Token;
@@ -0,0 +1,11 @@
1
+ import { Observable } from "rxjs";
2
+ import { Network, Token } from "../chaindata";
3
+ import { Chaindata, CustomChaindata } from "./schema";
4
+ export declare const getCombinedChaindata$: (default$: Observable<Chaindata>, custom$: Observable<CustomChaindata> | CustomChaindata | undefined) => Observable<Chaindata>;
5
+ export declare const isNetworkCustom: (network: Network) => boolean;
6
+ export declare const isNetworkKnown: (network: Network) => boolean;
7
+ export declare const isTokenCustom: (token: Token) => boolean;
8
+ export declare const isTokenKnown: (token: Token) => boolean;
9
+ export declare const isTokenTestnet: (token: Token) => boolean;
10
+ export declare const getCleanNetwork: (network: Network) => Network;
11
+ export declare const getCleanToken: (token: Token) => Token;