@talismn/balances 0.0.0-pr2043-20250619170346 → 0.0.0-pr2043-20250620074243

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.
@@ -6,6 +6,11 @@ export type ChainMeta<Extra extends Record<string, unknown> | null> = {
6
6
  miniMetadata: `0x${string}` | null;
7
7
  extra: Extra;
8
8
  };
9
+ export type TokenConfig = object;
10
+ export type BalancesConfig<ModConfig extends object | undefined, TokenConfig extends object | undefined> = {
11
+ config?: ModConfig;
12
+ tokens?: TokenConfig[];
13
+ };
9
14
  export type BalancesCommonTransferMethods = "transfer_keep_alive" | "transfer_all";
10
15
  export type BalancesTransferMethods = "transfer_allow_death" | BalancesCommonTransferMethods;
11
16
  export type BalancesLegacyTransferMethods = "transfer" | BalancesCommonTransferMethods;
@@ -14,7 +19,9 @@ export type SelectableTokenType = Token;
14
19
  export type ExtendableChainMeta = ChainMeta<Record<string, unknown> | null>;
15
20
  export type DefaultChainMeta = ChainMeta<null>;
16
21
  export type ExtendableModuleConfig = Record<string, unknown> | undefined;
22
+ export type ExtendableTokenConfig = Record<string, unknown> | undefined;
17
23
  export type DefaultModuleConfig = undefined;
24
+ export type DefaultTokenConfig = undefined;
18
25
  export type BaseTransferParams = {
19
26
  tokenId: string;
20
27
  from: string;
@@ -38,21 +45,21 @@ export type Hydrate = {
38
45
  chainConnectors: ChainConnectors;
39
46
  chaindataProvider: ChaindataProvider;
40
47
  };
41
- export type NewBalanceModule<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> = (hydrate: Hydrate) => BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams>;
42
- export interface BalanceModule<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> extends BalanceModuleSubstrate<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams>, BalanceModuleEvm<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams> {
48
+ export type NewBalanceModule<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTokenConfig extends ExtendableTokenConfig = DefaultTokenConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> = (hydrate: Hydrate) => BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTokenConfig, TTransferParams>;
49
+ export interface BalanceModule<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTokenConfig extends ExtendableTokenConfig = DefaultTokenConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> extends BalanceModuleSubstrate<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTokenConfig, TTransferParams>, BalanceModuleEvm<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTokenConfig, TTransferParams> {
43
50
  }
44
- export declare const DefaultBalanceModule: <TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams>(type: TModuleType) => BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams>;
45
- interface BalanceModuleSubstrate<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> extends BalanceModuleCommon<TModuleType, TTokenType, TTransferParams> {
51
+ export declare const DefaultBalanceModule: <TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTokenConfig extends ExtendableTokenConfig = DefaultTokenConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams>(type: TModuleType) => BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTokenConfig, TTransferParams>;
52
+ interface BalanceModuleSubstrate<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta, TModuleConfig extends ExtendableModuleConfig, TTokenConfig extends ExtendableTokenConfig, TTransferParams extends ExtendableTransferParams> extends BalanceModuleCommon<TModuleType, TTokenType, TTransferParams> {
46
53
  /** Pre-processes any substrate chain metadata required by this module ahead of time */
47
54
  fetchSubstrateChainMeta(chainId: ChainId, moduleConfig?: TModuleConfig, metadataRpc?: `0x${string}`): Promise<TChainMeta | null>;
48
55
  /** Detects which tokens are available on a given substrate chain */
49
- fetchSubstrateChainTokens(chainId: ChainId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig): Promise<Record<TTokenType["id"], TTokenType>>;
56
+ fetchSubstrateChainTokens(chainId: ChainId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig, tokens?: TTokenConfig[]): Promise<Record<TTokenType["id"], TTokenType>>;
50
57
  }
51
- interface BalanceModuleEvm<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> extends BalanceModuleCommon<TModuleType, TTokenType, TTransferParams> {
58
+ interface BalanceModuleEvm<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTokenConfig extends ExtendableTokenConfig = DefaultTokenConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> extends BalanceModuleCommon<TModuleType, TTokenType, TTransferParams> {
52
59
  /** Pre-processes any evm chain metadata required by this module ahead of time */
53
60
  fetchEvmChainMeta(chainId: ChainId, moduleConfig?: TModuleConfig): Promise<TChainMeta | null>;
54
61
  /** Detects which tokens are available on a given evm chain */
55
- fetchEvmChainTokens(chainId: ChainId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig): Promise<Record<TTokenType["id"], TTokenType>>;
62
+ fetchEvmChainTokens(chainId: ChainId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig, tokens?: TTokenConfig[]): Promise<Record<TTokenType["id"], TTokenType>>;
56
63
  }
57
64
  export type SubscriptionResultWithStatus = {
58
65
  status: "initialising" | "live";
@@ -1,23 +1,30 @@
1
- import { BalancesConfigTokenParams, CustomEvmErc20Token, EvmErc20Token } from "@talismn/chaindata-provider";
2
- import { DefaultChainMeta, NewBalanceModule } from "../BalanceModule";
1
+ import { CustomEvmErc20Token, EvmErc20Token } from "@talismn/chaindata-provider";
2
+ import z from "zod/v4";
3
+ import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule } from "../BalanceModule";
3
4
  import { NewBalanceType } from "../types";
4
5
  import { erc20Abi } from "./abis/erc20";
5
6
  import { erc20BalancesAggregatorAbi } from "./abis/erc20BalancesAggregator";
6
7
  export { erc20Abi, erc20BalancesAggregatorAbi };
7
8
  type ModuleType = "evm-erc20";
8
9
  export type EvmErc20ChainMeta = DefaultChainMeta;
9
- export type EvmErc20ModuleConfig = {
10
- tokens?: Array<{
11
- symbol?: string;
12
- decimals?: number;
13
- name?: string;
14
- contractAddress?: `0x${string}`;
15
- } & BalancesConfigTokenParams>;
16
- };
10
+ export type EvmErc20ModuleConfig = DefaultModuleConfig;
11
+ export declare const EvmErc20TokenConfigSchema: z.ZodObject<{
12
+ symbol: z.ZodOptional<z.ZodString>;
13
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
14
+ decimals: z.ZodOptional<z.ZodInt>;
15
+ name: z.ZodOptional<z.ZodString>;
16
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
17
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
18
+ networkId: z.ZodOptional<z.ZodString>;
19
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
20
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
21
+ contractAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
22
+ }, z.core.$strict>;
23
+ export type EvmErc20TokenConfig = z.infer<typeof EvmErc20TokenConfigSchema>;
17
24
  export type EvmErc20Balance = NewBalanceType<ModuleType, "simple">;
18
25
  declare module "@talismn/balances/plugins" {
19
26
  interface PluginBalanceTypes {
20
27
  "evm-erc20": EvmErc20Balance;
21
28
  }
22
29
  }
23
- export declare const EvmErc20Module: NewBalanceModule<ModuleType, EvmErc20Token | CustomEvmErc20Token, EvmErc20ChainMeta, EvmErc20ModuleConfig>;
30
+ export declare const EvmErc20Module: NewBalanceModule<ModuleType, EvmErc20Token | CustomEvmErc20Token, EvmErc20ChainMeta, EvmErc20ModuleConfig, EvmErc20TokenConfig>;
@@ -1,14 +1,27 @@
1
- import { BalancesConfigTokenParams, CustomEvmNativeToken, EvmNativeToken } from "@talismn/chaindata-provider";
2
- import { DefaultChainMeta, NewBalanceModule } from "../BalanceModule";
1
+ import { CustomEvmNativeToken, EvmNativeToken } from "@talismn/chaindata-provider";
2
+ import z from "zod/v4";
3
+ import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule } from "../BalanceModule";
3
4
  import { NewBalanceType } from "../types";
4
5
  type ModuleType = "evm-native";
5
6
  export type EvmNativeChainMeta = DefaultChainMeta;
6
- export type EvmNativeModuleConfig = BalancesConfigTokenParams;
7
+ export type EvmNativeModuleConfig = DefaultModuleConfig;
7
8
  export type EvmNativeBalance = NewBalanceType<ModuleType, "simple">;
9
+ export declare const EvmNativeTokenConfigSchema: z.ZodObject<{
10
+ symbol: z.ZodOptional<z.ZodString>;
11
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
12
+ decimals: z.ZodOptional<z.ZodInt>;
13
+ name: z.ZodOptional<z.ZodString>;
14
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
15
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
16
+ networkId: z.ZodOptional<z.ZodString>;
17
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
18
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
19
+ }, z.core.$strict>;
20
+ export type EvmNativeTokenConfig = z.infer<typeof EvmNativeTokenConfigSchema>;
8
21
  declare module "@talismn/balances/plugins" {
9
22
  interface PluginBalanceTypes {
10
23
  "evm-native": EvmNativeBalance;
11
24
  }
12
25
  }
13
- export declare const EvmNativeModule: NewBalanceModule<ModuleType, EvmNativeToken | CustomEvmNativeToken, EvmNativeChainMeta, EvmNativeModuleConfig>;
26
+ export declare const EvmNativeModule: NewBalanceModule<ModuleType, EvmNativeToken | CustomEvmNativeToken, EvmNativeChainMeta, EvmNativeModuleConfig, EvmNativeTokenConfig>;
14
27
  export {};
@@ -1,28 +1,37 @@
1
- import { BalancesConfigTokenParams, CustomEvmUniswapV2Token, EvmUniswapV2Token } from "@talismn/chaindata-provider";
2
- import { DefaultChainMeta, NewBalanceModule } from "../BalanceModule";
1
+ import { CustomEvmUniswapV2Token, EvmUniswapV2Token } from "@talismn/chaindata-provider";
2
+ import z from "zod/v4";
3
+ import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule } from "../BalanceModule";
3
4
  import { NewBalanceType } from "../types";
4
5
  import { uniswapV2PairAbi } from "./abis/uniswapV2Pair";
5
6
  export { uniswapV2PairAbi };
6
7
  type ModuleType = "evm-uniswapv2";
7
8
  export type EvmUniswapV2ChainMeta = DefaultChainMeta;
8
- export type EvmUniswapV2ModuleConfig = {
9
- pools?: Array<{
10
- contractAddress?: `0x${string}`;
11
- decimals?: number;
12
- symbol0?: string;
13
- symbol1?: string;
14
- decimals0?: number;
15
- decimals1?: number;
16
- tokenAddress0?: `0x${string}`;
17
- tokenAddress1?: `0x${string}`;
18
- coingeckoId0?: string;
19
- coingeckoId1?: string;
20
- } & BalancesConfigTokenParams>;
21
- };
9
+ export declare const EvmUniswapV2TokenConfigSchema: z.ZodObject<{
10
+ symbol: z.ZodOptional<z.ZodString>;
11
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
12
+ decimals: z.ZodOptional<z.ZodInt>;
13
+ name: z.ZodOptional<z.ZodString>;
14
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
15
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
16
+ networkId: z.ZodOptional<z.ZodString>;
17
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
18
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
19
+ contractAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
20
+ symbol0: z.ZodOptional<z.ZodString>;
21
+ symbol1: z.ZodOptional<z.ZodString>;
22
+ decimals0: z.ZodOptional<z.ZodInt>;
23
+ decimals1: z.ZodOptional<z.ZodInt>;
24
+ tokenAddress0: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
25
+ tokenAddress1: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
26
+ coingeckoId0: z.ZodOptional<z.ZodOptional<z.ZodString>>;
27
+ coingeckoId1: z.ZodOptional<z.ZodOptional<z.ZodString>>;
28
+ }, z.core.$strict>;
29
+ export type EvmUniswapV2TokenConfig = z.infer<typeof EvmUniswapV2TokenConfigSchema>;
30
+ export type EvmUniswapV2ModuleConfig = DefaultModuleConfig;
22
31
  export type EvmUniswapV2Balance = NewBalanceType<"evm-uniswapv2", "complex">;
23
32
  declare module "@talismn/balances/plugins" {
24
33
  interface PluginBalanceTypes {
25
34
  "evm-uniswapv2": EvmUniswapV2Balance;
26
35
  }
27
36
  }
28
- export declare const EvmUniswapV2Module: NewBalanceModule<ModuleType, EvmUniswapV2Token | CustomEvmUniswapV2Token, EvmUniswapV2ChainMeta, EvmUniswapV2ModuleConfig>;
37
+ export declare const EvmUniswapV2Module: NewBalanceModule<ModuleType, EvmUniswapV2Token | CustomEvmUniswapV2Token, EvmUniswapV2ChainMeta, EvmUniswapV2ModuleConfig, EvmUniswapV2TokenConfig>;
@@ -1,15 +1,26 @@
1
1
  import { TypeRegistry } from "@polkadot/types";
2
2
  import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
3
- import { BalancesConfigTokenParams, SubAssetsToken } from "@talismn/chaindata-provider";
4
- import { ChainMeta, NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
3
+ import { SubAssetsToken } from "@talismn/chaindata-provider";
4
+ import z from "zod/v4";
5
+ import { ChainMeta, DefaultModuleConfig, NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
5
6
  import { NewBalanceType } from "../types";
6
7
  type ModuleType = "substrate-assets";
7
8
  export type SubAssetsChainMeta = ChainMeta<null>;
8
- export type SubAssetsModuleConfig = {
9
- tokens?: Array<{
10
- assetId: number | string;
11
- } & BalancesConfigTokenParams>;
12
- };
9
+ export declare const SubAssetsTokenConfigSchema: z.ZodObject<{
10
+ symbol: z.ZodOptional<z.ZodString>;
11
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
12
+ decimals: z.ZodOptional<z.ZodInt>;
13
+ name: z.ZodOptional<z.ZodString>;
14
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
15
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
16
+ networkId: z.ZodOptional<z.ZodString>;
17
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
18
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
19
+ assetId: z.ZodPipe<z.ZodUnion<readonly [z.ZodUInt32, z.ZodString]>, z.ZodTransform<string, string | number>>;
20
+ existentialDeposit: z.ZodString;
21
+ }, z.core.$strict>;
22
+ export type SubAssetsTokenConfig = z.infer<typeof SubAssetsTokenConfigSchema>;
23
+ export type SubAssetsModuleConfig = DefaultModuleConfig;
13
24
  export type SubAssetsBalance = NewBalanceType<ModuleType, "complex">;
14
25
  declare module "@talismn/balances/plugins" {
15
26
  interface PluginBalanceTypes {
@@ -26,5 +37,5 @@ export type SubAssetsTransferParams = NewTransferParamsType<{
26
37
  tip?: string;
27
38
  userExtensions?: ExtDef;
28
39
  }>;
29
- export declare const SubAssetsModule: NewBalanceModule<ModuleType, SubAssetsToken, SubAssetsChainMeta, SubAssetsModuleConfig, SubAssetsTransferParams>;
40
+ export declare const SubAssetsModule: NewBalanceModule<ModuleType, SubAssetsToken, SubAssetsChainMeta, SubAssetsModuleConfig, SubAssetsTokenConfig, SubAssetsTransferParams>;
30
41
  export {};
@@ -1,15 +1,26 @@
1
1
  import { TypeRegistry } from "@polkadot/types";
2
2
  import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
3
- import { BalancesConfigTokenParams, SubForeignAssetsToken } from "@talismn/chaindata-provider";
4
- import { DefaultChainMeta, NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
3
+ import { SubForeignAssetsToken } from "@talismn/chaindata-provider";
4
+ import z from "zod/v4";
5
+ import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
5
6
  import { NewBalanceType } from "../types";
6
7
  type ModuleType = "substrate-foreignassets";
7
8
  export type SubForeignAssetsChainMeta = DefaultChainMeta;
8
- export type SubForeignAssetsModuleConfig = {
9
- tokens?: Array<{
10
- onChainId: string;
11
- } & BalancesConfigTokenParams>;
12
- };
9
+ export declare const SubForeignAssetsTokenConfigSchema: z.ZodObject<{
10
+ symbol: z.ZodOptional<z.ZodString>;
11
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
12
+ decimals: z.ZodOptional<z.ZodInt>;
13
+ name: z.ZodOptional<z.ZodString>;
14
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
15
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
16
+ networkId: z.ZodOptional<z.ZodString>;
17
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
18
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
19
+ onChainId: z.ZodString;
20
+ existentialDeposit: z.ZodString;
21
+ }, z.core.$strict>;
22
+ export type SubForeignAssetsTokenConfig = z.infer<typeof SubForeignAssetsTokenConfigSchema>;
23
+ export type SubForeignAssetsModuleConfig = DefaultModuleConfig;
13
24
  export type SubForeignAssetsBalance = NewBalanceType<ModuleType, "complex">;
14
25
  declare module "@talismn/balances/plugins" {
15
26
  interface PluginBalanceTypes {
@@ -26,5 +37,5 @@ export type SubForeignAssetsTransferParams = NewTransferParamsType<{
26
37
  tip?: string;
27
38
  userExtensions?: ExtDef;
28
39
  }>;
29
- export declare const SubForeignAssetsModule: NewBalanceModule<ModuleType, SubForeignAssetsToken, SubForeignAssetsChainMeta, SubForeignAssetsModuleConfig, SubForeignAssetsTransferParams>;
40
+ export declare const SubForeignAssetsModule: NewBalanceModule<ModuleType, SubForeignAssetsToken, SubForeignAssetsChainMeta, SubForeignAssetsModuleConfig, SubForeignAssetsTokenConfig, SubForeignAssetsTransferParams>;
30
41
  export {};
@@ -1,8 +1,21 @@
1
1
  import { CustomSubNativeToken, SubNativeToken } from "@talismn/chaindata-provider";
2
+ import z from "zod/v4";
2
3
  import { NewBalanceModule } from "../../BalanceModule";
3
4
  import { ModuleType, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTransferParams } from "./types";
4
5
  export { filterBaseLocks, getLockTitle } from "./util/balanceLockTypes";
5
6
  export type { BalanceLockType } from "./util/balanceLockTypes";
6
7
  export type { ModuleType, SubNativeBalance, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTransferParams, } from "./types";
7
8
  export * from "./util/subtensor";
8
- export declare const SubNativeModule: NewBalanceModule<ModuleType, SubNativeToken | CustomSubNativeToken, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTransferParams>;
9
+ export declare const SubNativeTokenConfigSchema: z.ZodObject<{
10
+ symbol: z.ZodOptional<z.ZodString>;
11
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
12
+ decimals: z.ZodOptional<z.ZodInt>;
13
+ name: z.ZodOptional<z.ZodString>;
14
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
15
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
16
+ networkId: z.ZodOptional<z.ZodString>;
17
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
18
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
19
+ }, z.core.$strict>;
20
+ export type SubNativeTokenConfig = z.infer<typeof SubNativeTokenConfigSchema>;
21
+ export declare const SubNativeModule: NewBalanceModule<ModuleType, SubNativeToken | CustomSubNativeToken, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTokenConfig, SubNativeTransferParams>;
@@ -1,6 +1,6 @@
1
1
  import { TypeRegistry } from "@polkadot/types";
2
2
  import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
3
- import { BalancesConfigTokenParams } from "@talismn/chaindata-provider";
3
+ import { SubNativeBalancesConfig } from "@talismn/chaindata-provider";
4
4
  import { ChainMeta, NewTransferParamsType } from "../../BalanceModule";
5
5
  import { NewBalanceType } from "../../types";
6
6
  export { filterBaseLocks, getLockTitle } from "./util/balanceLockTypes";
@@ -14,9 +14,7 @@ export type SubNativeChainMeta = ChainMeta<{
14
14
  crowdloanPalletId?: string;
15
15
  hasSubtensorPallet?: boolean;
16
16
  } | null>;
17
- export type SubNativeModuleConfig = {
18
- disable?: boolean;
19
- } & BalancesConfigTokenParams;
17
+ export type SubNativeModuleConfig = SubNativeBalancesConfig;
20
18
  export type SubNativeBalance = NewBalanceType<ModuleType, "complex">;
21
19
  declare module "@talismn/balances/plugins" {
22
20
  interface PluginBalanceTypes {
@@ -1,18 +1,26 @@
1
1
  import { TypeRegistry } from "@polkadot/types";
2
2
  import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
3
- import { BalancesConfigTokenParams, SubPsp22Token } from "@talismn/chaindata-provider";
4
- import { DefaultChainMeta, NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
3
+ import { SubPsp22Token } from "@talismn/chaindata-provider";
4
+ import z from "zod/v4";
5
+ import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
5
6
  import { NewBalanceType } from "../types";
6
7
  type ModuleType = "substrate-psp22";
8
+ export declare const SubPsp22TokenConfigSchema: z.ZodObject<{
9
+ symbol: z.ZodOptional<z.ZodString>;
10
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
11
+ decimals: z.ZodOptional<z.ZodInt>;
12
+ name: z.ZodOptional<z.ZodString>;
13
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
14
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
15
+ networkId: z.ZodOptional<z.ZodString>;
16
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
17
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
18
+ contractAddress: z.ZodString;
19
+ existentialDeposit: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strict>;
21
+ export type SubPsp22TokenConfig = z.infer<typeof SubPsp22TokenConfigSchema>;
7
22
  export type SubPsp22ChainMeta = DefaultChainMeta;
8
- export type SubPsp22ModuleConfig = {
9
- tokens?: Array<{
10
- symbol?: string;
11
- decimals?: number;
12
- ed?: string;
13
- contractAddress: string;
14
- } & BalancesConfigTokenParams>;
15
- };
23
+ export type SubPsp22ModuleConfig = DefaultModuleConfig;
16
24
  export type SubPsp22Balance = NewBalanceType<ModuleType, "simple">;
17
25
  declare module "@talismn/balances/plugins" {
18
26
  interface PluginBalanceTypes {
@@ -29,5 +37,5 @@ export type SubPsp22TransferParams = NewTransferParamsType<{
29
37
  tip?: string;
30
38
  userExtensions?: ExtDef;
31
39
  }>;
32
- export declare const SubPsp22Module: NewBalanceModule<ModuleType, SubPsp22Token, SubPsp22ChainMeta, SubPsp22ModuleConfig, SubPsp22TransferParams>;
40
+ export declare const SubPsp22Module: NewBalanceModule<ModuleType, SubPsp22Token, SubPsp22ChainMeta, SubPsp22ModuleConfig, SubPsp22TokenConfig, SubPsp22TransferParams>;
33
41
  export {};
@@ -1,21 +1,28 @@
1
1
  import { TypeRegistry } from "@polkadot/types";
2
2
  import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
3
- import { BalancesConfigTokenParams, SubTokensToken } from "@talismn/chaindata-provider";
3
+ import { SubTokensBalancesConfig, SubTokensToken } from "@talismn/chaindata-provider";
4
+ import z from "zod/v4";
4
5
  import { ChainMeta, NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
5
6
  import { NewBalanceType } from "../types";
6
7
  type ModuleType = "substrate-tokens";
8
+ export declare const SubTokensTokenConfigSchema: z.ZodObject<{
9
+ symbol: z.ZodOptional<z.ZodString>;
10
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
11
+ decimals: z.ZodOptional<z.ZodInt>;
12
+ name: z.ZodOptional<z.ZodString>;
13
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
14
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
15
+ networkId: z.ZodOptional<z.ZodString>;
16
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
17
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
18
+ onChainId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
19
+ existentialDeposit: z.ZodString;
20
+ }, z.core.$strict>;
21
+ export type SubTokensTokenConfig = z.infer<typeof SubTokensTokenConfigSchema>;
7
22
  export type SubTokensChainMeta = ChainMeta<{
8
23
  palletId?: string;
9
24
  }>;
10
- export type SubTokensModuleConfig = {
11
- palletId?: string;
12
- tokens?: Array<{
13
- symbol?: string;
14
- decimals?: number;
15
- ed?: string;
16
- onChainId?: string | number;
17
- } & BalancesConfigTokenParams>;
18
- };
25
+ export type SubTokensModuleConfig = SubTokensBalancesConfig;
19
26
  export type SubTokensBalance = NewBalanceType<ModuleType, "complex">;
20
27
  declare module "@talismn/balances/plugins" {
21
28
  interface PluginBalanceTypes {
@@ -32,5 +39,5 @@ export type SubTokensTransferParams = NewTransferParamsType<{
32
39
  tip?: string;
33
40
  userExtensions?: ExtDef;
34
41
  }>;
35
- export declare const SubTokensModule: NewBalanceModule<ModuleType, SubTokensToken, SubTokensChainMeta, SubTokensModuleConfig, SubTokensTransferParams>;
42
+ export declare const SubTokensModule: NewBalanceModule<ModuleType, SubTokensToken, SubTokensChainMeta, SubTokensModuleConfig, SubTokensTokenConfig, SubTokensTransferParams>;
36
43
  export {};
@@ -28,7 +28,18 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
28
28
  coingeckoId?: string | undefined;
29
29
  noDiscovery?: boolean | undefined;
30
30
  mirrorOf?: string | undefined;
31
- }, import("..").DefaultChainMeta, import("./EvmErc20Module").EvmErc20ModuleConfig> | import("..").NewBalanceModule<"evm-native", {
31
+ }, import("..").DefaultChainMeta, undefined, {
32
+ contractAddress: `0x${string}`;
33
+ symbol?: string | undefined;
34
+ isDefault?: boolean | undefined;
35
+ decimals?: number | undefined;
36
+ name?: string | undefined;
37
+ logo?: string | undefined;
38
+ coingeckoId?: string | undefined;
39
+ networkId?: string | undefined;
40
+ noDiscovery?: boolean | undefined;
41
+ mirrorOf?: string | undefined;
42
+ }> | import("..").NewBalanceModule<"evm-native", {
32
43
  id: string;
33
44
  decimals: number;
34
45
  symbol: string;
@@ -55,7 +66,17 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
55
66
  coingeckoId?: string | undefined;
56
67
  noDiscovery?: boolean | undefined;
57
68
  mirrorOf?: string | undefined;
58
- }, import("..").DefaultChainMeta, import("@talismn/chaindata-provider").BalancesConfigTokenParams> | import("..").NewBalanceModule<"evm-uniswapv2", {
69
+ }, import("..").DefaultChainMeta, undefined, {
70
+ symbol?: string | undefined;
71
+ isDefault?: boolean | undefined;
72
+ decimals?: number | undefined;
73
+ name?: string | undefined;
74
+ logo?: string | undefined;
75
+ coingeckoId?: string | undefined;
76
+ networkId?: string | undefined;
77
+ noDiscovery?: boolean | undefined;
78
+ mirrorOf?: string | undefined;
79
+ }> | import("..").NewBalanceModule<"evm-uniswapv2", {
59
80
  id: string;
60
81
  decimals: number;
61
82
  symbol: string;
@@ -101,7 +122,26 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
101
122
  mirrorOf?: string | undefined;
102
123
  coingeckoId0?: string | undefined;
103
124
  coingeckoId1?: string | undefined;
104
- }, import("..").DefaultChainMeta, import("./EvmUniswapV2Module").EvmUniswapV2ModuleConfig> | import("..").NewBalanceModule<"substrate-assets", {
125
+ }, import("..").DefaultChainMeta, undefined, {
126
+ contractAddress: `0x${string}`;
127
+ symbol?: string | undefined;
128
+ isDefault?: boolean | undefined;
129
+ decimals?: number | undefined;
130
+ name?: string | undefined;
131
+ logo?: string | undefined;
132
+ coingeckoId?: string | undefined;
133
+ networkId?: string | undefined;
134
+ noDiscovery?: boolean | undefined;
135
+ mirrorOf?: string | undefined;
136
+ symbol0?: string | undefined;
137
+ symbol1?: string | undefined;
138
+ decimals0?: number | undefined;
139
+ decimals1?: number | undefined;
140
+ tokenAddress0?: `0x${string}` | undefined;
141
+ tokenAddress1?: `0x${string}` | undefined;
142
+ coingeckoId0?: string | undefined;
143
+ coingeckoId1?: string | undefined;
144
+ }> | import("..").NewBalanceModule<"substrate-assets", {
105
145
  id: string;
106
146
  decimals: number;
107
147
  symbol: string;
@@ -117,7 +157,19 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
117
157
  noDiscovery?: boolean | undefined;
118
158
  mirrorOf?: string | undefined;
119
159
  isFrozen?: boolean | undefined;
120
- }, import("./SubstrateAssetsModule").SubAssetsChainMeta, import("./SubstrateAssetsModule").SubAssetsModuleConfig, import("./SubstrateAssetsModule").SubAssetsTransferParams> | import("..").NewBalanceModule<"substrate-foreignassets", {
160
+ }, import("./SubstrateAssetsModule").SubAssetsChainMeta, undefined, {
161
+ assetId: string;
162
+ existentialDeposit: string;
163
+ symbol?: string | undefined;
164
+ isDefault?: boolean | undefined;
165
+ decimals?: number | undefined;
166
+ name?: string | undefined;
167
+ logo?: string | undefined;
168
+ coingeckoId?: string | undefined;
169
+ networkId?: string | undefined;
170
+ noDiscovery?: boolean | undefined;
171
+ mirrorOf?: string | undefined;
172
+ }, import("./SubstrateAssetsModule").SubAssetsTransferParams> | import("..").NewBalanceModule<"substrate-foreignassets", {
121
173
  id: string;
122
174
  decimals: number;
123
175
  symbol: string;
@@ -133,7 +185,19 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
133
185
  noDiscovery?: boolean | undefined;
134
186
  mirrorOf?: string | undefined;
135
187
  isFrozen?: boolean | undefined;
136
- }, import("..").DefaultChainMeta, import("./SubstrateForeignAssetsModule").SubForeignAssetsModuleConfig, import("./SubstrateForeignAssetsModule").SubForeignAssetsTransferParams> | import("..").NewBalanceModule<"substrate-native", {
188
+ }, import("..").DefaultChainMeta, undefined, {
189
+ onChainId: string;
190
+ existentialDeposit: string;
191
+ symbol?: string | undefined;
192
+ isDefault?: boolean | undefined;
193
+ decimals?: number | undefined;
194
+ name?: string | undefined;
195
+ logo?: string | undefined;
196
+ coingeckoId?: string | undefined;
197
+ networkId?: string | undefined;
198
+ noDiscovery?: boolean | undefined;
199
+ mirrorOf?: string | undefined;
200
+ }, import("./SubstrateForeignAssetsModule").SubForeignAssetsTransferParams> | import("..").NewBalanceModule<"substrate-native", {
137
201
  id: string;
138
202
  decimals: number;
139
203
  symbol: string;
@@ -162,7 +226,19 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
162
226
  coingeckoId?: string | undefined;
163
227
  noDiscovery?: boolean | undefined;
164
228
  mirrorOf?: string | undefined;
165
- }, import("./SubstrateNativeModule").SubNativeChainMeta, import("./SubstrateNativeModule").SubNativeModuleConfig, import("./SubstrateNativeModule").SubNativeTransferParams> | import("..").NewBalanceModule<"substrate-psp22", {
229
+ }, import("./SubstrateNativeModule").SubNativeChainMeta, {
230
+ disable?: boolean | undefined;
231
+ }, {
232
+ symbol?: string | undefined;
233
+ isDefault?: boolean | undefined;
234
+ decimals?: number | undefined;
235
+ name?: string | undefined;
236
+ logo?: string | undefined;
237
+ coingeckoId?: string | undefined;
238
+ networkId?: string | undefined;
239
+ noDiscovery?: boolean | undefined;
240
+ mirrorOf?: string | undefined;
241
+ }, import("./SubstrateNativeModule").SubNativeTransferParams> | import("..").NewBalanceModule<"substrate-psp22", {
166
242
  id: string;
167
243
  decimals: number;
168
244
  symbol: string;
@@ -177,7 +253,19 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
177
253
  coingeckoId?: string | undefined;
178
254
  noDiscovery?: boolean | undefined;
179
255
  mirrorOf?: string | undefined;
180
- }, import("..").DefaultChainMeta, import("./SubstratePsp22Module").SubPsp22ModuleConfig, import("./SubstratePsp22Module").SubPsp22TransferParams> | import("..").NewBalanceModule<"substrate-tokens", {
256
+ }, import("..").DefaultChainMeta, undefined, {
257
+ contractAddress: string;
258
+ symbol?: string | undefined;
259
+ isDefault?: boolean | undefined;
260
+ decimals?: number | undefined;
261
+ name?: string | undefined;
262
+ logo?: string | undefined;
263
+ coingeckoId?: string | undefined;
264
+ networkId?: string | undefined;
265
+ noDiscovery?: boolean | undefined;
266
+ mirrorOf?: string | undefined;
267
+ existentialDeposit?: string | undefined;
268
+ }, import("./SubstratePsp22Module").SubPsp22TransferParams> | import("..").NewBalanceModule<"substrate-tokens", {
181
269
  id: string;
182
270
  decimals: number;
183
271
  symbol: string;
@@ -192,7 +280,21 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
192
280
  coingeckoId?: string | undefined;
193
281
  noDiscovery?: boolean | undefined;
194
282
  mirrorOf?: string | undefined;
195
- }, import("./SubstrateTokensModule").SubTokensChainMeta, import("./SubstrateTokensModule").SubTokensModuleConfig, import("./SubstrateTokensModule").SubTokensTransferParams>)[];
283
+ }, import("./SubstrateTokensModule").SubTokensChainMeta, {
284
+ palletId?: string | undefined;
285
+ }, {
286
+ onChainId: string | number;
287
+ existentialDeposit: string;
288
+ symbol?: string | undefined;
289
+ isDefault?: boolean | undefined;
290
+ decimals?: number | undefined;
291
+ name?: string | undefined;
292
+ logo?: string | undefined;
293
+ coingeckoId?: string | undefined;
294
+ networkId?: string | undefined;
295
+ noDiscovery?: boolean | undefined;
296
+ mirrorOf?: string | undefined;
297
+ }, import("./SubstrateTokensModule").SubTokensTransferParams>)[];
196
298
  export * from "./EvmErc20Module";
197
299
  export * from "./EvmNativeModule";
198
300
  export * from "./EvmUniswapV2Module";
@@ -1,6 +1,6 @@
1
1
  import { BalanceModule, NewBalanceModule } from "../../BalanceModule";
2
- export type AnyBalanceModule = BalanceModule<any, any, any, any, any>;
3
- export type AnyNewBalanceModule = NewBalanceModule<any, any, any, any, any>;
2
+ export type AnyBalanceModule = BalanceModule<any, any, any, any, any, any>;
3
+ export type AnyNewBalanceModule = NewBalanceModule<any, any, any, any, any, any>;
4
4
  /**
5
5
  * The following `Infer*` collection of generic types can be used when you want to
6
6
  * extract one of the generic type arguments from an existing BalanceModule.
@@ -13,11 +13,12 @@ export type AnyNewBalanceModule = NewBalanceModule<any, any, any, any, any>;
13
13
  * string as input, and then return some data associated with that module with the correct type:
14
14
  * function getChainMeta<T extends AnyBalanceModule>(type: InferModuleType<T>): InferChainMeta<T> | undefined
15
15
  */
16
- type InferBalanceModuleTypes<T extends AnyNewBalanceModule> = T extends NewBalanceModule<infer TModuleType, infer TTokenType, infer TChainMeta, infer TModuleConfig, infer TTransferParams> ? {
16
+ type InferBalanceModuleTypes<T extends AnyNewBalanceModule> = T extends NewBalanceModule<infer TModuleType, infer TTokenType, infer TChainMeta, infer TModuleConfig, infer TTokenConfig, infer TTransferParams> ? {
17
17
  TModuleType: TModuleType;
18
18
  TTokenType: TTokenType;
19
19
  TChainMeta: TChainMeta;
20
20
  TModuleConfig: TModuleConfig;
21
+ TTokenConfig: TTokenConfig;
21
22
  TTransferParams: TTransferParams;
22
23
  } : never;
23
24
  export type InferModuleType<T extends AnyNewBalanceModule> = InferBalanceModuleTypes<T>["TModuleType"];
@@ -25,4 +26,5 @@ export type InferTokenType<T extends AnyNewBalanceModule> = InferBalanceModuleTy
25
26
  export type InferChainMeta<T extends AnyNewBalanceModule> = InferBalanceModuleTypes<T>["TChainMeta"];
26
27
  export type InferModuleConfig<T extends AnyNewBalanceModule> = InferBalanceModuleTypes<T>["TModuleConfig"];
27
28
  export type InferTransferParams<T extends AnyNewBalanceModule> = InferBalanceModuleTypes<T>["TTransferParams"];
29
+ export type InferTTokenConfig<T extends AnyNewBalanceModule> = InferBalanceModuleTypes<T>["TTokenConfig"];
28
30
  export {};