@talismn/chaindata-provider 1.0.2 → 1.1.1

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 (30) hide show
  1. package/dist/declarations/src/chaindata/index.d.ts +1 -0
  2. package/dist/declarations/src/chaindata/networks/Network.d.ts +25 -0
  3. package/dist/declarations/src/chaindata/networks/SolNetwork.d.ts +35 -0
  4. package/dist/declarations/src/chaindata/networks/index.d.ts +1 -0
  5. package/dist/declarations/src/chaindata/shared/SolanaAddress.d.ts +3 -0
  6. package/dist/declarations/src/chaindata/shared/index.d.ts +1 -0
  7. package/dist/declarations/src/chaindata/tokens/SolNativeToken.d.ts +28 -0
  8. package/dist/declarations/src/chaindata/tokens/SolSplToken.d.ts +30 -0
  9. package/dist/declarations/src/chaindata/tokens/Token.d.ts +113 -1
  10. package/dist/declarations/src/chaindata/tokens/index.d.ts +2 -0
  11. package/dist/declarations/src/chaindata/utils.d.ts +44 -0
  12. package/dist/declarations/src/constants.d.ts +2 -2
  13. package/dist/declarations/src/getBlockExplorerUrls.d.ts +24 -0
  14. package/dist/declarations/src/index.d.ts +8 -3
  15. package/dist/declarations/src/provider/ChaindataProvider.d.ts +75 -11
  16. package/dist/declarations/src/state/combinedChaindata.d.ts +11 -0
  17. package/dist/declarations/src/state/defaultChaindata.d.ts +55 -2
  18. package/dist/declarations/src/state/githubChaindata.d.ts +303 -0
  19. package/dist/declarations/src/state/net.d.ts +53 -1
  20. package/dist/declarations/src/state/oldDb.d.ts +1 -0
  21. package/dist/declarations/src/state/schema.d.ts +212 -0
  22. package/dist/talismn-chaindata-provider.cjs.dev.js +990 -747
  23. package/dist/talismn-chaindata-provider.cjs.prod.js +990 -747
  24. package/dist/talismn-chaindata-provider.esm.js +978 -751
  25. package/package.json +7 -7
  26. package/dist/declarations/src/legacy/index.d.ts +0 -3
  27. package/dist/declarations/src/provider/index.d.ts +0 -2
  28. package/dist/declarations/src/state/db.d.ts +0 -11
  29. package/dist/declarations/src/state/index.d.ts +0 -2
  30. 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";
@@ -98,6 +98,31 @@ export declare const NetworkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
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";
@@ -102,6 +102,32 @@ export declare const isNetworkEth: (network: Network | null | undefined) => netw
102
102
  "evm-uniswapv2"?: undefined;
103
103
  } | undefined;
104
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
+ };
105
131
  export declare const getNetworkGenesisHash: <Net extends Network, Res = Net extends DotNetwork ? DotNetwork["genesisHash"] : undefined>(network: Net | null | undefined) => Res;
106
132
  export type TokenOfType<T extends TokenType> = Extract<Token, {
107
133
  type: T;
@@ -111,9 +137,11 @@ export type TokenOfPlatform<P extends NetworkPlatform> = Extract<Token, {
111
137
  }>;
112
138
  export type DotToken = TokenOfPlatform<"polkadot">;
113
139
  export type EthToken = TokenOfPlatform<"ethereum">;
140
+ export type SolToken = TokenOfPlatform<"solana">;
114
141
  export declare const isTokenOfPlatform: <P extends NetworkPlatform>(token: Token | null | undefined, platform: P) => token is TokenOfPlatform<P>;
115
142
  export declare const isTokenEth: (token: Token | null | undefined) => token is TokenOfPlatform<"ethereum">;
116
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">;
117
145
  export declare const isTokenNeedExistentialDeposit: (token: Token) => token is {
118
146
  id: string;
119
147
  networkId: string;
@@ -350,11 +378,27 @@ export declare const isTokenEvmUniswapV2: (token: Token | null | undefined) => t
350
378
  coingeckoId0?: string | undefined;
351
379
  coingeckoId1?: string | undefined;
352
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
+ };
353
396
  export declare const parseTokenId: <T extends TokenType>(tokenId: TokenId) => TokenIdSpecs<T>;
354
397
  export declare const networkIdFromTokenId: (tokenId: TokenId) => Network["id"];
355
398
  declare const PLATFORM_NATIVE_TOKENS: {
356
399
  polkadot: "substrate-native";
357
400
  ethereum: "evm-native";
401
+ solana: "sol-native";
358
402
  };
359
403
  export type NativeTokenType<P extends NetworkPlatform = NetworkPlatform> = (typeof PLATFORM_NATIVE_TOKENS)[P];
360
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[]>;
@@ -317,6 +363,31 @@ export declare class ChaindataProvider implements IChaindataProvider {
317
363
  "evm-erc20"?: undefined;
318
364
  "evm-uniswapv2"?: undefined;
319
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;
320
391
  })[]>;
321
392
  getNetworks$<P extends NetworkPlatform | undefined, R = P extends NetworkPlatform ? NetworkOfPlatform<P> : Network>(platform?: P): Observable<R[]>;
322
393
  getNetworks<P extends NetworkPlatform | undefined, R = P extends NetworkPlatform ? NetworkOfPlatform<P> : Network>(platform?: P): Promise<R[]>;
@@ -496,10 +567,3 @@ export declare class ChaindataProvider implements IChaindataProvider {
496
567
  } | undefined;
497
568
  }>;
498
569
  }
499
- export declare const isNetworkCustom: (network: Network) => boolean;
500
- export declare const isNetworkKnown: (network: Network) => boolean;
501
- export declare const isTokenCustom: (token: Token) => boolean;
502
- export declare const isTokenKnown: (token: Token) => boolean;
503
- export declare const isTokenTestnet: (token: Token) => boolean;
504
- export declare const getCleanNetwork: (network: Network) => Network;
505
- 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;
@@ -1,5 +1,6 @@
1
- import { Observable } from "rxjs";
2
- export declare const defaultChaindata$: Observable<{
1
+ import { Observable, Subject } from "rxjs";
2
+ import { ChaindataStorage } from "../provider/ChaindataProvider";
3
+ export declare const getDefaultChaindata$: (storage$: Subject<ChaindataStorage>) => Observable<{
3
4
  networks: ({
4
5
  id: string;
5
6
  name: string;
@@ -93,6 +94,31 @@ export declare const defaultChaindata$: Observable<{
93
94
  "evm-erc20"?: undefined;
94
95
  "evm-uniswapv2"?: undefined;
95
96
  } | undefined;
97
+ } | {
98
+ id: string;
99
+ name: string;
100
+ nativeTokenId: string;
101
+ nativeCurrency: {
102
+ decimals: number;
103
+ symbol: string;
104
+ name: string;
105
+ coingeckoId?: string | undefined;
106
+ mirrorOf?: string | undefined;
107
+ logo?: string | undefined;
108
+ };
109
+ blockExplorerUrls: string[];
110
+ platform: "solana";
111
+ genesisHash: string;
112
+ rpcs: string[];
113
+ isTestnet?: boolean | undefined;
114
+ isDefault?: boolean | undefined;
115
+ forceScan?: boolean | undefined;
116
+ logo?: string | undefined;
117
+ themeColor?: string | undefined;
118
+ balancesConfig?: {
119
+ "sol-native"?: undefined;
120
+ "sol-spl"?: undefined;
121
+ } | undefined;
96
122
  })[];
97
123
  tokens: ({
98
124
  id: string;
@@ -238,6 +264,33 @@ export declare const defaultChaindata$: Observable<{
238
264
  coingeckoId?: string | undefined;
239
265
  noDiscovery?: boolean | undefined;
240
266
  mirrorOf?: string | undefined;
267
+ } | {
268
+ id: string;
269
+ networkId: string;
270
+ decimals: number;
271
+ symbol: string;
272
+ type: "sol-native";
273
+ platform: "solana";
274
+ isDefault?: boolean | undefined;
275
+ name?: string | undefined;
276
+ logo?: string | undefined;
277
+ coingeckoId?: string | undefined;
278
+ noDiscovery?: boolean | undefined;
279
+ mirrorOf?: string | undefined;
280
+ } | {
281
+ id: string;
282
+ networkId: string;
283
+ decimals: number;
284
+ symbol: string;
285
+ type: "sol-spl";
286
+ platform: "solana";
287
+ mintAddress: string;
288
+ isDefault?: boolean | undefined;
289
+ name?: string | undefined;
290
+ logo?: string | undefined;
291
+ coingeckoId?: string | undefined;
292
+ noDiscovery?: boolean | undefined;
293
+ mirrorOf?: string | undefined;
241
294
  })[];
242
295
  miniMetadatas: {
243
296
  id: string;