@talismn/balances 0.0.0-pr2043-20250703063959 → 0.0.0-pr2059-20250626001054
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/declarations/src/BalanceModule.d.ts +12 -23
- package/dist/declarations/src/EvmTokenFetcher.d.ts +11 -0
- package/dist/declarations/src/MiniMetadataUpdater.d.ts +43 -0
- package/dist/declarations/src/index.d.ts +3 -0
- package/dist/declarations/src/modules/EvmErc20Module.d.ts +23 -20
- package/dist/declarations/src/modules/EvmNativeModule.d.ts +18 -19
- package/dist/declarations/src/modules/EvmUniswapV2Module.d.ts +30 -28
- package/dist/declarations/src/modules/SubstrateAssetsModule.d.ts +18 -20
- package/dist/declarations/src/modules/SubstrateEquilibriumModule.d.ts +39 -0
- package/dist/declarations/src/modules/SubstrateForeignAssetsModule.d.ts +18 -20
- package/dist/declarations/src/modules/SubstrateNativeModule/index.d.ts +4 -17
- package/dist/declarations/src/modules/SubstrateNativeModule/subscribeCrowdloans.d.ts +5 -0
- package/dist/declarations/src/modules/SubstrateNativeModule/subscribeNompoolStaking.d.ts +3 -3
- package/dist/declarations/src/modules/SubstrateNativeModule/subscribeSubtensorStaking.d.ts +3 -3
- package/dist/declarations/src/modules/SubstrateNativeModule/types.d.ts +23 -6
- package/dist/declarations/src/modules/SubstrateNativeModule/util/QueryCache.d.ts +6 -6
- package/dist/declarations/src/modules/SubstrateNativeModule/util/buildQueries.d.ts +4 -5
- package/dist/declarations/src/modules/SubstrateNativeModule/util/crowdloanFundContributionsChildKey.d.ts +4 -0
- package/dist/declarations/src/modules/SubstrateNativeModule/util/detectMiniMetadataChanges.d.ts +2 -0
- package/dist/declarations/src/modules/SubstrateNativeModule/util/sortChains.d.ts +1 -1
- package/dist/declarations/src/modules/SubstratePsp22Module.d.ts +19 -20
- package/dist/declarations/src/modules/SubstrateTokensModule.d.ts +22 -22
- package/dist/declarations/src/modules/index.d.ts +38 -213
- package/dist/declarations/src/modules/util/InferBalanceModuleTypes.d.ts +3 -5
- package/dist/declarations/src/modules/util/buildStorageCoders.d.ts +7 -16
- package/dist/declarations/src/modules/util/findChainMeta.d.ts +8 -0
- package/dist/declarations/src/modules/util/getUniqueChainIds.d.ts +2 -2
- package/dist/declarations/src/modules/util/index.d.ts +1 -0
- package/dist/declarations/src/types/balances.d.ts +72 -203
- package/dist/declarations/src/types/balancetypes.d.ts +18 -8
- package/dist/declarations/src/types/minimetadatas.d.ts +24 -6
- package/dist/declarations/src/util/hydrateChaindata.d.ts +8 -0
- package/dist/declarations/src/util/index.d.ts +1 -0
- package/dist/talismn-balances.cjs.dev.js +2099 -1424
- package/dist/talismn-balances.cjs.prod.js +2099 -1424
- package/dist/talismn-balances.esm.js +2083 -1414
- package/package.json +8 -9
- package/dist/declarations/src/getMiniMetadata/getMetadataRpc.d.ts +0 -3
- package/dist/declarations/src/getMiniMetadata/getMiniMetadatas.d.ts +0 -4
- package/dist/declarations/src/getMiniMetadata/getSpecVersion.d.ts +0 -6
- package/dist/declarations/src/getMiniMetadata/getUpdatedMiniMetadatas.d.ts +0 -4
- package/dist/declarations/src/getMiniMetadata/index.d.ts +0 -5
- package/dist/declarations/src/libVersion.d.ts +0 -1
- package/dist/declarations/src/modules/SubstrateNativeModule/util/systemProperties.d.ts +0 -5
- package/dist/declarations/src/modules/util/getAddresssesByTokenByNetwork.d.ts +0 -3
- package/dist/declarations/src/types/tokens.d.ts +0 -11
@@ -1,27 +1,16 @@
|
|
1
1
|
import { ChainConnector } from "@talismn/chain-connector";
|
2
2
|
import { ChainConnectorEvm } from "@talismn/chain-connector-evm";
|
3
|
-
import { ChaindataProvider,
|
3
|
+
import { ChaindataProvider, ChainId, Token } from "@talismn/chaindata-provider";
|
4
4
|
import { AddressesByToken, BalanceJson, Balances, SubscriptionCallback, UnsubscribeFn } from "./types";
|
5
|
-
export type ChainMeta<Extra extends Record<string, unknown> | null> = {
|
6
|
-
miniMetadata: `0x${string}` | null;
|
7
|
-
extra: Extra;
|
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
|
-
};
|
14
5
|
export type BalancesCommonTransferMethods = "transfer_keep_alive" | "transfer_all";
|
15
6
|
export type BalancesTransferMethods = "transfer_allow_death" | BalancesCommonTransferMethods;
|
16
7
|
export type BalancesLegacyTransferMethods = "transfer" | BalancesCommonTransferMethods;
|
17
8
|
export type BalancesAllTransferMethods = BalancesLegacyTransferMethods | BalancesTransferMethods;
|
18
9
|
export type SelectableTokenType = Token;
|
19
|
-
export type ExtendableChainMeta =
|
20
|
-
export type DefaultChainMeta =
|
10
|
+
export type ExtendableChainMeta = Record<string, unknown> | undefined;
|
11
|
+
export type DefaultChainMeta = undefined;
|
21
12
|
export type ExtendableModuleConfig = Record<string, unknown> | undefined;
|
22
|
-
export type ExtendableTokenConfig = Record<string, unknown> | undefined;
|
23
13
|
export type DefaultModuleConfig = undefined;
|
24
|
-
export type DefaultTokenConfig = undefined;
|
25
14
|
export type BaseTransferParams = {
|
26
15
|
tokenId: string;
|
27
16
|
from: string;
|
@@ -45,21 +34,21 @@ export type Hydrate = {
|
|
45
34
|
chainConnectors: ChainConnectors;
|
46
35
|
chaindataProvider: ChaindataProvider;
|
47
36
|
};
|
48
|
-
export type NewBalanceModule<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig,
|
49
|
-
export interface BalanceModule<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig,
|
37
|
+
export type NewBalanceModule<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> = (hydrate: Hydrate) => BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams>;
|
38
|
+
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> {
|
50
39
|
}
|
51
|
-
export declare const DefaultBalanceModule: <TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig,
|
52
|
-
interface BalanceModuleSubstrate<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta, TModuleConfig extends ExtendableModuleConfig
|
40
|
+
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>;
|
41
|
+
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> {
|
53
42
|
/** Pre-processes any substrate chain metadata required by this module ahead of time */
|
54
|
-
fetchSubstrateChainMeta(chainId:
|
43
|
+
fetchSubstrateChainMeta(chainId: ChainId, moduleConfig?: TModuleConfig, metadataRpc?: `0x${string}`, systemProperties?: Record<string, any>): Promise<TChainMeta | null>;
|
55
44
|
/** Detects which tokens are available on a given substrate chain */
|
56
|
-
fetchSubstrateChainTokens(chainId:
|
45
|
+
fetchSubstrateChainTokens(chainId: ChainId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig): Promise<Record<TTokenType["id"], TTokenType>>;
|
57
46
|
}
|
58
|
-
interface BalanceModuleEvm<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig,
|
47
|
+
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> {
|
59
48
|
/** Pre-processes any evm chain metadata required by this module ahead of time */
|
60
|
-
fetchEvmChainMeta(chainId:
|
49
|
+
fetchEvmChainMeta(chainId: ChainId, moduleConfig?: TModuleConfig): Promise<TChainMeta | null>;
|
61
50
|
/** Detects which tokens are available on a given evm chain */
|
62
|
-
fetchEvmChainTokens(chainId:
|
51
|
+
fetchEvmChainTokens(chainId: ChainId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig): Promise<Record<TTokenType["id"], TTokenType>>;
|
63
52
|
}
|
64
53
|
export type SubscriptionResultWithStatus = {
|
65
54
|
status: "initialising" | "live";
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { ChaindataProvider, EvmNetworkId } from "@talismn/chaindata-provider";
|
2
|
+
import { AnyBalanceModule } from "./modules/util";
|
3
|
+
/**
|
4
|
+
* Fetches tokens for EVM networks.
|
5
|
+
*/
|
6
|
+
export declare class EvmTokenFetcher {
|
7
|
+
#private;
|
8
|
+
constructor(chaindataProvider: ChaindataProvider, balanceModules: Array<AnyBalanceModule>);
|
9
|
+
update(evmNetworkIds: EvmNetworkId[]): Promise<void>;
|
10
|
+
private updateEvmNetworks;
|
11
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { Chain, ChaindataProvider, ChainId } from "@talismn/chaindata-provider";
|
2
|
+
import { ChainConnectors } from "./BalanceModule";
|
3
|
+
import { AnyBalanceModule } from "./modules/util";
|
4
|
+
import { MiniMetadata, MiniMetadataStatus } from "./types";
|
5
|
+
/**
|
6
|
+
* A substrate dapp needs access to a set of types when it wants to communicate with a blockchain node.
|
7
|
+
*
|
8
|
+
* These types are used to encode requests & decode responses via the SCALE codec.
|
9
|
+
* Each chain generally has its own set of types.
|
10
|
+
*
|
11
|
+
* Substrate provides a construct to retrieve these types from a blockchain node.
|
12
|
+
* The chain metadata.
|
13
|
+
*
|
14
|
+
* The metadata includes the types required for any communication with the chain,
|
15
|
+
* including lots of methods which are not relevant to balance fetching.
|
16
|
+
*
|
17
|
+
* As such, the metadata can clock in at around 1-2MB per chain, which is a lot of storage
|
18
|
+
* for browser-based dapps which want to connect to lots of chains.
|
19
|
+
*
|
20
|
+
* By utilizing the wonderful [scale-ts](https://github.com/unstoppablejs/unstoppablejs/tree/main/packages/scale-ts#readme) library,
|
21
|
+
* we can trim the chain metadata down so that it only includes the types we need for balance fetching.
|
22
|
+
*
|
23
|
+
* Each balance module has a function to do just that, `BalanceModule::fetchSubstrateChainMeta`.
|
24
|
+
*
|
25
|
+
* But, we only want to run this operation when necessary.
|
26
|
+
*
|
27
|
+
* The purpose of this class, `MiniMetadataUpdater`, is to maintain a local cache of
|
28
|
+
* trimmed-down metadatas, which we'll refer to as `MiniMetadatas`.
|
29
|
+
*/
|
30
|
+
export declare class MiniMetadataUpdater {
|
31
|
+
#private;
|
32
|
+
constructor(chainConnectors: ChainConnectors, chaindataProvider: ChaindataProvider, balanceModules: Array<AnyBalanceModule>);
|
33
|
+
/** Subscribe to the metadata for a chain */
|
34
|
+
subscribe(chainId: ChainId): import("rxjs").Observable<MiniMetadata>;
|
35
|
+
update(chainIds: ChainId[]): Promise<void>;
|
36
|
+
statuses(chains: Array<Pick<Chain, "id" | "specName" | "specVersion" | "balancesConfig">>): Promise<{
|
37
|
+
wantedIdsByChain: Map<string, string[]>;
|
38
|
+
statusesByChain: Map<string, MiniMetadataStatus>;
|
39
|
+
}>;
|
40
|
+
hydrateFromChaindata(): Promise<boolean>;
|
41
|
+
hydrateCustomChains(): Promise<boolean>;
|
42
|
+
private updateSubstrateChains;
|
43
|
+
}
|
@@ -1,30 +1,33 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule } from "../BalanceModule";
|
1
|
+
import { BalancesConfigTokenParams, EvmNetworkId, Token } from "@talismn/chaindata-provider";
|
2
|
+
import { NewBalanceModule } from "../BalanceModule";
|
4
3
|
import { NewBalanceType } from "../types";
|
5
4
|
import { erc20Abi } from "./abis/erc20";
|
6
5
|
import { erc20BalancesAggregatorAbi } from "./abis/erc20BalancesAggregator";
|
7
6
|
export { erc20Abi, erc20BalancesAggregatorAbi };
|
8
7
|
type ModuleType = "evm-erc20";
|
9
|
-
export type
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
8
|
+
export type EvmErc20Token = Extract<Token, {
|
9
|
+
type: ModuleType;
|
10
|
+
isCustom?: true;
|
11
|
+
}>;
|
12
|
+
export type CustomEvmErc20Token = Extract<Token, {
|
13
|
+
type: ModuleType;
|
14
|
+
isCustom: true;
|
15
|
+
}>;
|
16
|
+
export declare const evmErc20TokenId: (chainId: EvmNetworkId, tokenContractAddress: EvmErc20Token["contractAddress"]) => string;
|
17
|
+
export type EvmErc20ChainMeta = {
|
18
|
+
isTestnet: boolean;
|
19
|
+
};
|
20
|
+
export type EvmErc20ModuleConfig = {
|
21
|
+
tokens?: Array<{
|
22
|
+
symbol?: string;
|
23
|
+
decimals?: number;
|
24
|
+
contractAddress?: string;
|
25
|
+
} & BalancesConfigTokenParams>;
|
26
|
+
};
|
27
|
+
export type EvmErc20Balance = NewBalanceType<ModuleType, "simple", "ethereum">;
|
25
28
|
declare module "@talismn/balances/plugins" {
|
26
29
|
interface PluginBalanceTypes {
|
27
30
|
"evm-erc20": EvmErc20Balance;
|
28
31
|
}
|
29
32
|
}
|
30
|
-
export declare const EvmErc20Module: NewBalanceModule<ModuleType, EvmErc20Token, EvmErc20ChainMeta, EvmErc20ModuleConfig
|
33
|
+
export declare const EvmErc20Module: NewBalanceModule<ModuleType, EvmErc20Token | CustomEvmErc20Token, EvmErc20ChainMeta, EvmErc20ModuleConfig>;
|
@@ -1,27 +1,26 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule } from "../BalanceModule";
|
1
|
+
import { BalancesConfigTokenParams, EvmNetworkId, Token } from "@talismn/chaindata-provider";
|
2
|
+
import { NewBalanceModule } from "../BalanceModule";
|
4
3
|
import { NewBalanceType } from "../types";
|
5
4
|
type ModuleType = "evm-native";
|
6
|
-
export type
|
7
|
-
|
8
|
-
|
9
|
-
export
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}
|
20
|
-
export type
|
5
|
+
export type EvmNativeToken = Extract<Token, {
|
6
|
+
type: ModuleType;
|
7
|
+
}>;
|
8
|
+
export type CustomEvmNativeToken = Extract<Token, {
|
9
|
+
type: ModuleType;
|
10
|
+
}>;
|
11
|
+
export declare const evmNativeTokenId: (chainId: EvmNetworkId) => string;
|
12
|
+
export type EvmNativeChainMeta = {
|
13
|
+
isTestnet: boolean;
|
14
|
+
};
|
15
|
+
export type EvmNativeModuleConfig = {
|
16
|
+
symbol?: string;
|
17
|
+
decimals?: number;
|
18
|
+
} & BalancesConfigTokenParams;
|
19
|
+
export type EvmNativeBalance = NewBalanceType<ModuleType, "simple", "ethereum">;
|
21
20
|
declare module "@talismn/balances/plugins" {
|
22
21
|
interface PluginBalanceTypes {
|
23
22
|
"evm-native": EvmNativeBalance;
|
24
23
|
}
|
25
24
|
}
|
26
|
-
export declare const EvmNativeModule: NewBalanceModule<ModuleType, EvmNativeToken, EvmNativeChainMeta, EvmNativeModuleConfig
|
25
|
+
export declare const EvmNativeModule: NewBalanceModule<ModuleType, EvmNativeToken | CustomEvmNativeToken, EvmNativeChainMeta, EvmNativeModuleConfig>;
|
27
26
|
export {};
|
@@ -1,37 +1,39 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule } from "../BalanceModule";
|
1
|
+
import { BalancesConfigTokenParams, EvmNetworkId, Token } from "@talismn/chaindata-provider";
|
2
|
+
import { NewBalanceModule } from "../BalanceModule";
|
4
3
|
import { NewBalanceType } from "../types";
|
5
4
|
import { uniswapV2PairAbi } from "./abis/uniswapV2Pair";
|
6
5
|
export { uniswapV2PairAbi };
|
7
6
|
type ModuleType = "evm-uniswapv2";
|
8
|
-
export type
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
7
|
+
export type EvmUniswapV2Token = Extract<Token, {
|
8
|
+
type: ModuleType;
|
9
|
+
isCustom?: true;
|
10
|
+
}>;
|
11
|
+
export type CustomEvmUniswapV2Token = Extract<Token, {
|
12
|
+
type: ModuleType;
|
13
|
+
isCustom: true;
|
14
|
+
}>;
|
15
|
+
export declare const evmUniswapV2TokenId: (chainId: EvmNetworkId, contractAddress: EvmUniswapV2Token["contractAddress"]) => string;
|
16
|
+
export type EvmUniswapV2ChainMeta = {
|
17
|
+
isTestnet: boolean;
|
18
|
+
};
|
19
|
+
export type EvmUniswapV2ModuleConfig = {
|
20
|
+
pools?: Array<{
|
21
|
+
contractAddress?: string;
|
22
|
+
decimals?: number;
|
23
|
+
symbol0?: string;
|
24
|
+
symbol1?: string;
|
25
|
+
decimals0?: number;
|
26
|
+
decimals1?: number;
|
27
|
+
tokenAddress0?: string;
|
28
|
+
tokenAddress1?: string;
|
29
|
+
coingeckoId0?: string;
|
30
|
+
coingeckoId1?: string;
|
31
|
+
} & BalancesConfigTokenParams>;
|
32
|
+
};
|
33
|
+
export type EvmUniswapV2Balance = NewBalanceType<"evm-uniswapv2", "complex", "ethereum">;
|
32
34
|
declare module "@talismn/balances/plugins" {
|
33
35
|
interface PluginBalanceTypes {
|
34
36
|
"evm-uniswapv2": EvmUniswapV2Balance;
|
35
37
|
}
|
36
38
|
}
|
37
|
-
export declare const EvmUniswapV2Module: NewBalanceModule<ModuleType, EvmUniswapV2Token, EvmUniswapV2ChainMeta, EvmUniswapV2ModuleConfig
|
39
|
+
export declare const EvmUniswapV2Module: NewBalanceModule<ModuleType, EvmUniswapV2Token | CustomEvmUniswapV2Token, EvmUniswapV2ChainMeta, EvmUniswapV2ModuleConfig>;
|
@@ -1,26 +1,24 @@
|
|
1
1
|
import { TypeRegistry } from "@polkadot/types";
|
2
2
|
import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
|
3
|
-
import {
|
4
|
-
import
|
5
|
-
import { ChainMeta, DefaultModuleConfig, NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
|
3
|
+
import { BalancesConfigTokenParams, ChainId, Token } from "@talismn/chaindata-provider";
|
4
|
+
import { NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
|
6
5
|
import { NewBalanceType } from "../types";
|
7
6
|
type ModuleType = "substrate-assets";
|
8
|
-
export type
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
export type
|
23
|
-
export type SubAssetsBalance = NewBalanceType<ModuleType, "complex">;
|
7
|
+
export type SubAssetsToken = Extract<Token, {
|
8
|
+
type: ModuleType;
|
9
|
+
}>;
|
10
|
+
export declare const subAssetTokenId: (chainId: ChainId, assetId: string, tokenSymbol: string) => string;
|
11
|
+
export type SubAssetsChainMeta = {
|
12
|
+
isTestnet: boolean;
|
13
|
+
miniMetadata?: string;
|
14
|
+
metadataVersion?: number;
|
15
|
+
};
|
16
|
+
export type SubAssetsModuleConfig = {
|
17
|
+
tokens?: Array<{
|
18
|
+
assetId: string | number;
|
19
|
+
} & BalancesConfigTokenParams>;
|
20
|
+
};
|
21
|
+
export type SubAssetsBalance = NewBalanceType<ModuleType, "complex", "substrate">;
|
24
22
|
declare module "@talismn/balances/plugins" {
|
25
23
|
interface PluginBalanceTypes {
|
26
24
|
"substrate-assets": SubAssetsBalance;
|
@@ -36,5 +34,5 @@ export type SubAssetsTransferParams = NewTransferParamsType<{
|
|
36
34
|
tip?: string;
|
37
35
|
userExtensions?: ExtDef;
|
38
36
|
}>;
|
39
|
-
export declare const SubAssetsModule: NewBalanceModule<ModuleType, SubAssetsToken, SubAssetsChainMeta, SubAssetsModuleConfig,
|
37
|
+
export declare const SubAssetsModule: NewBalanceModule<ModuleType, SubAssetsToken, SubAssetsChainMeta, SubAssetsModuleConfig, SubAssetsTransferParams>;
|
40
38
|
export {};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { TypeRegistry } from "@polkadot/types";
|
2
|
+
import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
|
3
|
+
import { BalancesConfigTokenParams, ChainId, Token } from "@talismn/chaindata-provider";
|
4
|
+
import { NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
|
5
|
+
import { NewBalanceType } from "../types";
|
6
|
+
type ModuleType = "substrate-equilibrium";
|
7
|
+
export type SubEquilibriumToken = Extract<Token, {
|
8
|
+
type: ModuleType;
|
9
|
+
}>;
|
10
|
+
export declare const subEquilibriumTokenId: (chainId: ChainId, tokenSymbol: string) => string;
|
11
|
+
export type SubEquilibriumChainMeta = {
|
12
|
+
isTestnet: boolean;
|
13
|
+
miniMetadata?: string;
|
14
|
+
metadataVersion?: number;
|
15
|
+
};
|
16
|
+
export type SubEquilibriumModuleConfig = {
|
17
|
+
disable?: boolean;
|
18
|
+
tokens?: Array<{
|
19
|
+
assetId?: string;
|
20
|
+
} & BalancesConfigTokenParams>;
|
21
|
+
};
|
22
|
+
export type SubEquilibriumBalance = NewBalanceType<ModuleType, "simple", "substrate">;
|
23
|
+
declare module "@talismn/balances/plugins" {
|
24
|
+
interface PluginBalanceTypes {
|
25
|
+
"substrate-equilibrium": SubEquilibriumBalance;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
export type SubEquilibriumTransferParams = NewTransferParamsType<{
|
29
|
+
registry: TypeRegistry;
|
30
|
+
blockHash: string;
|
31
|
+
blockNumber: number;
|
32
|
+
nonce: number;
|
33
|
+
specVersion: number;
|
34
|
+
transactionVersion: number;
|
35
|
+
tip?: string;
|
36
|
+
userExtensions?: ExtDef;
|
37
|
+
}>;
|
38
|
+
export declare const SubEquilibriumModule: NewBalanceModule<ModuleType, SubEquilibriumToken, SubEquilibriumChainMeta, SubEquilibriumModuleConfig, SubEquilibriumTransferParams>;
|
39
|
+
export {};
|
@@ -1,26 +1,24 @@
|
|
1
1
|
import { TypeRegistry } from "@polkadot/types";
|
2
2
|
import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
|
3
|
-
import {
|
4
|
-
import
|
5
|
-
import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
|
3
|
+
import { BalancesConfigTokenParams, ChainId, Token } from "@talismn/chaindata-provider";
|
4
|
+
import { NewBalanceModule, NewTransferParamsType } from "../BalanceModule";
|
6
5
|
import { NewBalanceType } from "../types";
|
7
6
|
type ModuleType = "substrate-foreignassets";
|
8
|
-
export type
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
export type
|
23
|
-
export type SubForeignAssetsBalance = NewBalanceType<ModuleType, "complex">;
|
7
|
+
export type SubForeignAssetsToken = Extract<Token, {
|
8
|
+
type: ModuleType;
|
9
|
+
}>;
|
10
|
+
export declare const subForeignAssetTokenId: (chainId: ChainId, tokenSymbol: string) => string;
|
11
|
+
export type SubForeignAssetsChainMeta = {
|
12
|
+
isTestnet: boolean;
|
13
|
+
miniMetadata?: string;
|
14
|
+
metadataVersion?: number;
|
15
|
+
};
|
16
|
+
export type SubForeignAssetsModuleConfig = {
|
17
|
+
tokens?: Array<{
|
18
|
+
onChainId: string;
|
19
|
+
} & BalancesConfigTokenParams>;
|
20
|
+
};
|
21
|
+
export type SubForeignAssetsBalance = NewBalanceType<ModuleType, "complex", "substrate">;
|
24
22
|
declare module "@talismn/balances/plugins" {
|
25
23
|
interface PluginBalanceTypes {
|
26
24
|
"substrate-foreignassets": SubForeignAssetsBalance;
|
@@ -36,5 +34,5 @@ export type SubForeignAssetsTransferParams = NewTransferParamsType<{
|
|
36
34
|
tip?: string;
|
37
35
|
userExtensions?: ExtDef;
|
38
36
|
}>;
|
39
|
-
export declare const SubForeignAssetsModule: NewBalanceModule<ModuleType, SubForeignAssetsToken, SubForeignAssetsChainMeta, SubForeignAssetsModuleConfig,
|
37
|
+
export declare const SubForeignAssetsModule: NewBalanceModule<ModuleType, SubForeignAssetsToken, SubForeignAssetsChainMeta, SubForeignAssetsModuleConfig, SubForeignAssetsTransferParams>;
|
40
38
|
export {};
|
@@ -1,21 +1,8 @@
|
|
1
|
-
import { SubNativeToken } from "@talismn/chaindata-provider";
|
2
|
-
import z from "zod/v4";
|
3
1
|
import { NewBalanceModule } from "../../BalanceModule";
|
4
|
-
import { ModuleType, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTransferParams } from "./types";
|
2
|
+
import { CustomSubNativeToken, ModuleType, SubNativeChainMeta, SubNativeModuleConfig, SubNativeToken, SubNativeTransferParams } from "./types";
|
5
3
|
export { filterBaseLocks, getLockTitle } from "./util/balanceLockTypes";
|
6
4
|
export type { BalanceLockType } from "./util/balanceLockTypes";
|
7
|
-
export
|
5
|
+
export { subNativeTokenId } from "./types";
|
6
|
+
export type { CustomSubNativeToken, ModuleType, SubNativeBalance, SubNativeChainMeta, SubNativeModuleConfig, SubNativeToken, SubNativeTransferParams, } from "./types";
|
8
7
|
export * from "./util/subtensor";
|
9
|
-
export declare const
|
10
|
-
symbol: z.ZodOptional<z.ZodString>;
|
11
|
-
networkId: z.ZodOptional<z.ZodString>;
|
12
|
-
isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
13
|
-
decimals: z.ZodOptional<z.ZodInt>;
|
14
|
-
name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
15
|
-
logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
16
|
-
coingeckoId: z.ZodOptional<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, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTokenConfig, SubNativeTransferParams>;
|
8
|
+
export declare const SubNativeModule: NewBalanceModule<ModuleType, SubNativeToken | CustomSubNativeToken, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTransferParams>;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
2
|
+
import { ChaindataProvider } from "@talismn/chaindata-provider";
|
3
|
+
import { AddressesByToken, SubscriptionCallback } from "../../types";
|
4
|
+
import { CustomSubNativeToken, SubNativeBalance, SubNativeToken } from "./types";
|
5
|
+
export declare function subscribeCrowdloans(chaindataProvider: ChaindataProvider, chainConnector: ChainConnector, addressesByToken: AddressesByToken<SubNativeToken | CustomSubNativeToken>, callback: SubscriptionCallback<SubNativeBalance[]>): Promise<() => void>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ChainConnector } from "@talismn/chain-connector";
|
2
|
-
import { ChaindataProvider
|
2
|
+
import { ChaindataProvider } from "@talismn/chaindata-provider";
|
3
3
|
import { AddressesByToken, SubscriptionCallback } from "../../types";
|
4
|
-
import { SubNativeBalance } from "./types";
|
5
|
-
export declare function subscribeNompoolStaking(chaindataProvider: ChaindataProvider, chainConnector: ChainConnector, addressesByToken: AddressesByToken<SubNativeToken>, callback: SubscriptionCallback<SubNativeBalance[]
|
4
|
+
import { SubNativeBalance, SubNativeToken } from "./types";
|
5
|
+
export declare function subscribeNompoolStaking(chaindataProvider: ChaindataProvider, chainConnector: ChainConnector, addressesByToken: AddressesByToken<SubNativeToken>, callback: SubscriptionCallback<SubNativeBalance[]>): Promise<() => void>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ChainConnector } from "@talismn/chain-connector";
|
2
|
-
import { ChaindataProvider
|
2
|
+
import { ChaindataProvider } from "@talismn/chaindata-provider";
|
3
3
|
import { AddressesByToken, SubscriptionCallback } from "../../types";
|
4
|
-
import { SubNativeBalance } from "./types";
|
5
|
-
export declare function subscribeSubtensorStaking(chaindataProvider: ChaindataProvider, chainConnector: ChainConnector, addressesByToken: AddressesByToken<SubNativeToken>, callback: SubscriptionCallback<SubNativeBalance[]
|
4
|
+
import { SubNativeBalance, SubNativeToken } from "./types";
|
5
|
+
export declare function subscribeSubtensorStaking(chaindataProvider: ChaindataProvider, chainConnector: ChainConnector, addressesByToken: AddressesByToken<SubNativeToken>, callback: SubscriptionCallback<SubNativeBalance[]>): Promise<() => void>;
|
@@ -1,20 +1,37 @@
|
|
1
1
|
import { TypeRegistry } from "@polkadot/types";
|
2
2
|
import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
|
3
|
-
import {
|
4
|
-
import {
|
3
|
+
import { BalancesConfigTokenParams, ChainId, Token } from "@talismn/chaindata-provider";
|
4
|
+
import { NewTransferParamsType } from "../../BalanceModule";
|
5
5
|
import { NewBalanceType } from "../../types";
|
6
6
|
export { filterBaseLocks, getLockTitle } from "./util/balanceLockTypes";
|
7
7
|
export type { BalanceLockType } from "./util/balanceLockTypes";
|
8
8
|
export type ModuleType = "substrate-native";
|
9
9
|
export declare const moduleType: ModuleType;
|
10
|
-
export type
|
10
|
+
export type SubNativeToken = Extract<Token, {
|
11
|
+
type: ModuleType;
|
12
|
+
isCustom?: true;
|
13
|
+
}>;
|
14
|
+
export type CustomSubNativeToken = Extract<Token, {
|
15
|
+
type: ModuleType;
|
16
|
+
isCustom: true;
|
17
|
+
}>;
|
18
|
+
export declare const subNativeTokenId: (chainId: ChainId) => string;
|
19
|
+
export type SubNativeChainMeta = {
|
20
|
+
isTestnet: boolean;
|
11
21
|
useLegacyTransferableCalculation?: boolean;
|
22
|
+
symbol?: string;
|
23
|
+
decimals?: number;
|
12
24
|
existentialDeposit?: string;
|
13
25
|
nominationPoolsPalletId?: string;
|
26
|
+
crowdloanPalletId?: string;
|
14
27
|
hasSubtensorPallet?: boolean;
|
15
|
-
|
16
|
-
|
17
|
-
|
28
|
+
miniMetadata?: string;
|
29
|
+
metadataVersion?: number;
|
30
|
+
};
|
31
|
+
export type SubNativeModuleConfig = {
|
32
|
+
disable?: boolean;
|
33
|
+
} & BalancesConfigTokenParams;
|
34
|
+
export type SubNativeBalance = NewBalanceType<ModuleType, "complex", "substrate">;
|
18
35
|
declare module "@talismn/balances/plugins" {
|
19
36
|
interface PluginBalanceTypes {
|
20
37
|
"substrate-native": SubNativeBalance;
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import {
|
2
|
-
import { ChaindataProvider, SubNativeToken } from "@talismn/chaindata-provider";
|
1
|
+
import { ChaindataProvider } from "@talismn/chaindata-provider";
|
3
2
|
import { AddressesByToken } from "../../../types";
|
4
3
|
import { RpcStateQuery } from "../../util";
|
5
|
-
import { SubNativeBalance } from "../types";
|
4
|
+
import { SubNativeBalance, SubNativeToken } from "../types";
|
6
5
|
export declare class QueryCache {
|
7
|
-
#private;
|
8
6
|
private chaindataProvider;
|
9
|
-
private miniMetadatas;
|
10
7
|
private balanceQueryCache;
|
11
|
-
|
8
|
+
private metadataSub;
|
9
|
+
constructor(chaindataProvider: ChaindataProvider);
|
10
|
+
ensureSetup(): void;
|
11
|
+
destroy(): void;
|
12
12
|
getQueries(addressesByToken: AddressesByToken<SubNativeToken>): Promise<RpcStateQuery<SubNativeBalance>[]>;
|
13
13
|
}
|
@@ -1,14 +1,13 @@
|
|
1
|
-
import {
|
2
|
-
import { SubNativeModule } from "..";
|
1
|
+
import { Chain, Token } from "@talismn/chaindata-provider";
|
3
2
|
import { AddressesByToken, MiniMetadata } from "../../../types";
|
4
3
|
import { RpcStateQuery, StorageCoders } from "../../util";
|
5
|
-
import { SubNativeBalance } from "../types";
|
4
|
+
import { SubNativeBalance, SubNativeToken } from "../types";
|
6
5
|
export type QueryKey = string;
|
7
|
-
export declare function buildQueries(chains: Record<string,
|
6
|
+
export declare function buildQueries(chains: Record<string, Chain>, tokens: Record<string, Token>, chainStorageCoders: StorageCoders<{
|
8
7
|
base: ["System", "Account"];
|
9
8
|
stakingLedger: ["Staking", "Ledger"];
|
10
9
|
reserves: ["Balances", "Reserves"];
|
11
10
|
holds: ["Balances", "Holds"];
|
12
11
|
locks: ["Balances", "Locks"];
|
13
12
|
freezes: ["Balances", "Freezes"];
|
14
|
-
}>, miniMetadatas: Map<
|
13
|
+
}>, miniMetadatas: Map<string, MiniMetadata>, addressesByToken: AddressesByToken<SubNativeToken>): Promise<Record<QueryKey, Array<RpcStateQuery<SubNativeBalance>>>>;
|
@@ -1 +1 @@
|
|
1
|
-
export declare const
|
1
|
+
export declare const sortChains: (a: string, b: string) => 0 | 1 | -1;
|