@talismn/balances 0.9.12 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/declarations/src/BalancesProvider.d.ts +33 -0
- package/dist/declarations/src/getMiniMetadatas/getMetadataRpc.d.ts +3 -0
- package/dist/declarations/src/getMiniMetadatas/getSpecVersion.d.ts +6 -0
- package/dist/declarations/src/getMiniMetadatas/index.d.ts +5 -0
- package/dist/declarations/src/index.d.ts +2 -5
- package/dist/declarations/src/modules/abis/index.d.ts +2 -0
- package/dist/declarations/src/modules/evm-erc20/config.d.ts +3 -0
- package/dist/declarations/src/modules/evm-erc20/fetchBalances.d.ts +3 -0
- package/dist/declarations/src/modules/evm-erc20/fetchTokens.d.ts +3 -0
- package/dist/declarations/src/modules/evm-erc20/getMiniMetadata.d.ts +3 -0
- package/dist/declarations/src/modules/evm-erc20/getTransferCallData.d.ts +3 -0
- package/dist/declarations/src/modules/evm-erc20/index.d.ts +2 -0
- package/dist/declarations/src/modules/evm-erc20/module.d.ts +3 -0
- package/dist/declarations/src/modules/evm-erc20/subscribeBalances.d.ts +3 -0
- package/dist/declarations/src/modules/evm-erc20/types.d.ts +14 -0
- package/dist/declarations/src/modules/evm-erc20/utils.d.ts +6 -0
- package/dist/declarations/src/modules/evm-native/config.d.ts +3 -0
- package/dist/declarations/src/modules/evm-native/fetchBalances.d.ts +3 -0
- package/dist/declarations/src/modules/evm-native/fetchTokens.d.ts +3 -0
- package/dist/declarations/src/modules/evm-native/getMiniMetadata.d.ts +3 -0
- package/dist/declarations/src/modules/evm-native/getTransferCallData.d.ts +3 -0
- package/dist/declarations/src/modules/evm-native/index.d.ts +2 -0
- package/dist/declarations/src/modules/evm-native/module.d.ts +3 -0
- package/dist/declarations/src/modules/evm-native/subscribeBalances.d.ts +3 -0
- package/dist/declarations/src/modules/evm-native/types.d.ts +13 -0
- package/dist/declarations/src/modules/evm-uniswapv2/config.d.ts +3 -0
- package/dist/declarations/src/modules/evm-uniswapv2/fetchBalances.d.ts +3 -0
- package/dist/declarations/src/modules/evm-uniswapv2/fetchTokens.d.ts +3 -0
- package/dist/declarations/src/modules/evm-uniswapv2/getMiniMetadata.d.ts +3 -0
- package/dist/declarations/src/modules/evm-uniswapv2/getTransferCallData.d.ts +3 -0
- package/dist/declarations/src/modules/evm-uniswapv2/index.d.ts +2 -0
- package/dist/declarations/src/modules/evm-uniswapv2/module.d.ts +3 -0
- package/dist/declarations/src/modules/evm-uniswapv2/subscribeBalances.d.ts +3 -0
- package/dist/declarations/src/modules/evm-uniswapv2/types.d.ts +14 -0
- package/dist/declarations/src/modules/evm-uniswapv2/utils.d.ts +12 -0
- package/dist/declarations/src/modules/index.d.ts +117 -55
- package/dist/declarations/src/modules/shared/buildNetworkStorageCoders.d.ts +13 -0
- package/dist/declarations/src/modules/shared/errors.d.ts +11 -0
- package/dist/declarations/src/modules/shared/fetchRuntimeCallResult.d.ts +2 -0
- package/dist/declarations/src/modules/shared/index.d.ts +6 -0
- package/dist/declarations/src/modules/shared/rpcQueryPack.d.ts +10 -0
- package/dist/declarations/src/modules/shared/types.d.ts +12 -0
- package/dist/declarations/src/modules/shared/utils.d.ts +6 -0
- package/dist/declarations/src/modules/substrate-assets/buildQueries.d.ts +5 -0
- package/dist/declarations/src/modules/substrate-assets/config.d.ts +5 -0
- package/dist/declarations/src/modules/substrate-assets/fetchBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-assets/fetchTokens.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-assets/getMiniMetadata.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-assets/getTransferCallData.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-assets/index.d.ts +2 -0
- package/dist/declarations/src/modules/substrate-assets/module.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-assets/subscribeBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-assets/types.d.ts +14 -0
- package/dist/declarations/src/modules/substrate-foreignassets/buildQueries.d.ts +6 -0
- package/dist/declarations/src/modules/substrate-foreignassets/config.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-foreignassets/fetchBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-foreignassets/fetchTokens.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-foreignassets/getMiniMetadata.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-foreignassets/getTransferCallData.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-foreignassets/index.d.ts +2 -0
- package/dist/declarations/src/modules/substrate-foreignassets/module.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-foreignassets/subscribeBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-foreignassets/types.d.ts +14 -0
- package/dist/declarations/src/modules/substrate-hydration/config.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-hydration/fetchBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-hydration/fetchTokens.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-hydration/getMiniMetadata.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-hydration/getTransferCallData.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-hydration/index.d.ts +2 -0
- package/dist/declarations/src/modules/substrate-hydration/module.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-hydration/subscribeBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-hydration/types.d.ts +14 -0
- package/dist/declarations/src/modules/substrate-native/bittensor/getSubtensorStakingBalances.d.ts +9 -0
- package/dist/declarations/src/modules/substrate-native/config.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-native/fetchBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-native/fetchTokens.d.ts +8 -0
- package/dist/declarations/src/modules/substrate-native/getMiniMetadata.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-native/getTransferCallData.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-native/index.d.ts +4 -0
- package/dist/declarations/src/modules/substrate-native/module.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-native/queries/buildBaseQueries.d.ts +17 -0
- package/dist/declarations/src/modules/substrate-native/queries/buildNomPoolQueries.d.ts +5 -0
- package/dist/declarations/src/modules/substrate-native/subscribeBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-native/types.d.ts +25 -0
- package/dist/declarations/src/modules/substrate-psp22/config.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-psp22/fetchBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-psp22/fetchTokens.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-psp22/getMiniMetadata.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-psp22/getTransferCallData.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-psp22/index.d.ts +2 -0
- package/dist/declarations/src/modules/substrate-psp22/module.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-psp22/subscribeBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-psp22/types.d.ts +14 -0
- package/dist/declarations/src/modules/{util/makeContractCaller.d.ts → substrate-psp22/util.d.ts} +2 -1
- package/dist/declarations/src/modules/substrate-tokens/buildQueries.d.ts +5 -0
- package/dist/declarations/src/modules/substrate-tokens/config.d.ts +5 -0
- package/dist/declarations/src/modules/substrate-tokens/fetchBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-tokens/fetchTokens.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-tokens/getMiniMetadata.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-tokens/getTransferCallData.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-tokens/index.d.ts +2 -0
- package/dist/declarations/src/modules/substrate-tokens/module.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-tokens/subscribeBalances.d.ts +3 -0
- package/dist/declarations/src/modules/substrate-tokens/types.d.ts +23 -0
- package/dist/declarations/src/types/IBalanceModule.d.ts +87 -0
- package/dist/declarations/src/types/addresses.d.ts +0 -3
- package/dist/declarations/src/types/balances.d.ts +225 -75
- package/dist/declarations/src/types/balancetypes.d.ts +9 -41
- package/dist/declarations/src/types/chainConnectors.d.ts +6 -0
- package/dist/declarations/src/types/index.d.ts +2 -0
- package/dist/declarations/src/types/minimetadatas.d.ts +4 -31
- package/dist/declarations/src/types/tokens.d.ts +11 -0
- package/dist/declarations/src/version.d.ts +1 -0
- package/dist/talismn-balances.cjs.dev.js +4628 -5568
- package/dist/talismn-balances.cjs.prod.js +4628 -5568
- package/dist/talismn-balances.esm.js +4604 -5530
- package/package.json +15 -16
- package/dist/declarations/src/BalanceModule.d.ts +0 -73
- package/dist/declarations/src/EvmTokenFetcher.d.ts +0 -11
- package/dist/declarations/src/MiniMetadataUpdater.d.ts +0 -43
- package/dist/declarations/src/TalismanBalancesDatabase.d.ts +0 -11
- package/dist/declarations/src/modules/EvmErc20Module.d.ts +0 -33
- package/dist/declarations/src/modules/EvmNativeModule.d.ts +0 -26
- package/dist/declarations/src/modules/EvmUniswapV2Module.d.ts +0 -39
- package/dist/declarations/src/modules/SubstrateAssetsModule.d.ts +0 -38
- package/dist/declarations/src/modules/SubstrateEquilibriumModule.d.ts +0 -39
- package/dist/declarations/src/modules/SubstrateForeignAssetsModule.d.ts +0 -38
- package/dist/declarations/src/modules/SubstrateNativeModule/index.d.ts +0 -8
- package/dist/declarations/src/modules/SubstrateNativeModule/subscribeBase.d.ts +0 -5
- package/dist/declarations/src/modules/SubstrateNativeModule/subscribeCrowdloans.d.ts +0 -5
- package/dist/declarations/src/modules/SubstrateNativeModule/subscribeNompoolStaking.d.ts +0 -5
- package/dist/declarations/src/modules/SubstrateNativeModule/subscribeSubtensorStaking.d.ts +0 -5
- package/dist/declarations/src/modules/SubstrateNativeModule/types.d.ts +0 -49
- package/dist/declarations/src/modules/SubstrateNativeModule/util/QueryCache.d.ts +0 -13
- package/dist/declarations/src/modules/SubstrateNativeModule/util/SubNativeBalanceError.d.ts +0 -5
- package/dist/declarations/src/modules/SubstrateNativeModule/util/asObservable.d.ts +0 -10
- package/dist/declarations/src/modules/SubstrateNativeModule/util/buildQueries.d.ts +0 -13
- package/dist/declarations/src/modules/SubstrateNativeModule/util/crowdloanFundContributionsChildKey.d.ts +0 -4
- package/dist/declarations/src/modules/SubstrateNativeModule/util/detectMiniMetadataChanges.d.ts +0 -2
- package/dist/declarations/src/modules/SubstrateNativeModule/util/mergeBalances.d.ts +0 -13
- package/dist/declarations/src/modules/SubstrateNativeModule/util/sortChains.d.ts +0 -1
- package/dist/declarations/src/modules/SubstratePsp22Module.d.ts +0 -39
- package/dist/declarations/src/modules/SubstrateTokensModule.d.ts +0 -43
- package/dist/declarations/src/modules/abis/erc20.d.ts +0 -227
- package/dist/declarations/src/modules/util/InferBalanceModuleTypes.d.ts +0 -28
- package/dist/declarations/src/modules/util/RpcStateQueryHelper.d.ts +0 -19
- package/dist/declarations/src/modules/util/balances.d.ts +0 -8
- package/dist/declarations/src/modules/util/buildStorageCoders.d.ts +0 -34
- package/dist/declarations/src/modules/util/decodeOutput.d.ts +0 -13
- package/dist/declarations/src/modules/util/detectTransferMethod.d.ts +0 -11
- package/dist/declarations/src/modules/util/findChainMeta.d.ts +0 -8
- package/dist/declarations/src/modules/util/getUniqueChainIds.d.ts +0 -5
- package/dist/declarations/src/modules/util/index.d.ts +0 -10
- package/dist/declarations/src/modules/util/storageCompression.d.ts +0 -9
- package/dist/declarations/src/plugins.d.ts +0 -17
- package/dist/declarations/src/upgrades/2024-01-25-upgradeRemoveSymbolFromNativeTokenId.d.ts +0 -2
- package/dist/declarations/src/upgrades/2024-03-19-upgradeBalancesDataBlob.d.ts +0 -2
- package/dist/declarations/src/upgrades/index.d.ts +0 -2
- package/dist/declarations/src/util/hydrateChaindata.d.ts +0 -8
- package/dist/declarations/src/util/index.d.ts +0 -1
- package/plugins/dist/talismn-balances-plugins.cjs.d.ts +0 -1
- package/plugins/dist/talismn-balances-plugins.cjs.dev.js +0 -2
- package/plugins/dist/talismn-balances-plugins.cjs.js +0 -7
- package/plugins/dist/talismn-balances-plugins.cjs.prod.js +0 -2
- package/plugins/dist/talismn-balances-plugins.esm.js +0 -1
- package/plugins/package.json +0 -4
- /package/dist/declarations/src/modules/{SubstrateNativeModule/util → substrate-native/bittensor}/subtensor.d.ts +0 -0
- /package/dist/declarations/src/modules/{SubstrateNativeModule/util/balanceLockTypes.d.ts → substrate-native/util/lockTypes.d.ts} +0 -0
- /package/dist/declarations/src/modules/{SubstrateNativeModule → substrate-native}/util/nompoolAccountId.d.ts +0 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@talismn/balances",
|
3
|
-
"version": "0.
|
3
|
+
"version": "1.0.0",
|
4
4
|
"author": "Talisman",
|
5
5
|
"homepage": "https://talisman.xyz",
|
6
6
|
"license": "GPL-3.0-or-later",
|
@@ -15,8 +15,7 @@
|
|
15
15
|
"main": "dist/talismn-balances.cjs.js",
|
16
16
|
"module": "dist/talismn-balances.esm.js",
|
17
17
|
"files": [
|
18
|
-
"/dist"
|
19
|
-
"/plugins"
|
18
|
+
"/dist"
|
20
19
|
],
|
21
20
|
"engines": {
|
22
21
|
"node": ">=18"
|
@@ -27,20 +26,21 @@
|
|
27
26
|
"anylogger": "^1.0.11",
|
28
27
|
"bignumber.js": "^9.1.2",
|
29
28
|
"dexie": "^4.0.9",
|
30
|
-
"lodash": "4.17.21",
|
31
|
-
"
|
29
|
+
"lodash-es": "4.17.21",
|
30
|
+
"p-queue": "^8.1.0",
|
32
31
|
"pako": "^2.1.0",
|
33
32
|
"polkadot-api": "1.13.1",
|
34
33
|
"rxjs": "^7.8.1",
|
35
34
|
"scale-ts": "^1.6.1",
|
36
35
|
"viem": "^2.27.3",
|
37
|
-
"
|
38
|
-
"@talismn/chain-connector
|
39
|
-
"@talismn/chaindata-provider": "0.
|
40
|
-
"@talismn/
|
41
|
-
"@talismn/token-rates": "
|
42
|
-
"@talismn/
|
43
|
-
"@talismn/
|
36
|
+
"zod": "^3.25.62",
|
37
|
+
"@talismn/chain-connector": "1.0.0",
|
38
|
+
"@talismn/chaindata-provider": "1.0.0",
|
39
|
+
"@talismn/chain-connector-evm": "1.0.0",
|
40
|
+
"@talismn/token-rates": "3.0.0",
|
41
|
+
"@talismn/scale": "0.2.0",
|
42
|
+
"@talismn/sapi": "0.0.7",
|
43
|
+
"@talismn/util": "0.5.0"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
46
|
"@polkadot/api-contract": "16.1.2",
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"@polkadot/util-crypto": "13.5.1",
|
50
50
|
"@substrate/txwrapper-core": "7.5.3",
|
51
51
|
"@types/jest": "^29.5.14",
|
52
|
-
"@types/lodash": "^4.17.12",
|
52
|
+
"@types/lodash-es": "^4.17.12",
|
53
53
|
"@types/pako": "^2.0.3",
|
54
54
|
"eslint": "^8.57.1",
|
55
55
|
"jest": "^29.7.0",
|
@@ -67,8 +67,7 @@
|
|
67
67
|
},
|
68
68
|
"preconstruct": {
|
69
69
|
"entrypoints": [
|
70
|
-
"index.ts"
|
71
|
-
"plugins.ts"
|
70
|
+
"index.ts"
|
72
71
|
]
|
73
72
|
},
|
74
73
|
"eslintConfig": {
|
@@ -80,6 +79,6 @@
|
|
80
79
|
"scripts": {
|
81
80
|
"test": "jest",
|
82
81
|
"lint": "eslint src --max-warnings 0",
|
83
|
-
"clean": "rm -rf dist
|
82
|
+
"clean": "rm -rf dist .turbo node_modules"
|
84
83
|
}
|
85
84
|
}
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import { ChainConnector } from "@talismn/chain-connector";
|
2
|
-
import { ChainConnectorEvm } from "@talismn/chain-connector-evm";
|
3
|
-
import { ChaindataProvider, ChainId, Token } from "@talismn/chaindata-provider";
|
4
|
-
import { AddressesByToken, BalanceJson, Balances, SubscriptionCallback, UnsubscribeFn } from "./types";
|
5
|
-
export type BalancesCommonTransferMethods = "transfer_keep_alive" | "transfer_all";
|
6
|
-
export type BalancesTransferMethods = "transfer_allow_death" | BalancesCommonTransferMethods;
|
7
|
-
export type BalancesLegacyTransferMethods = "transfer" | BalancesCommonTransferMethods;
|
8
|
-
export type BalancesAllTransferMethods = BalancesLegacyTransferMethods | BalancesTransferMethods;
|
9
|
-
export type SelectableTokenType = Token;
|
10
|
-
export type ExtendableChainMeta = Record<string, unknown> | undefined;
|
11
|
-
export type DefaultChainMeta = undefined;
|
12
|
-
export type ExtendableModuleConfig = Record<string, unknown> | undefined;
|
13
|
-
export type DefaultModuleConfig = undefined;
|
14
|
-
export type BaseTransferParams = {
|
15
|
-
tokenId: string;
|
16
|
-
from: string;
|
17
|
-
to: string;
|
18
|
-
amount: string;
|
19
|
-
transferMethod: BalancesAllTransferMethods;
|
20
|
-
metadataRpc: `0x${string}`;
|
21
|
-
};
|
22
|
-
export type ExtendableTransferParams = BaseTransferParams | undefined;
|
23
|
-
export type DefaultTransferParams = undefined;
|
24
|
-
export type NewTransferParamsType<T extends Record<string, unknown>> = BaseTransferParams & T;
|
25
|
-
export type TransferTokenTx = {
|
26
|
-
type: "substrate";
|
27
|
-
callData: string;
|
28
|
-
};
|
29
|
-
export type ChainConnectors = {
|
30
|
-
substrate?: ChainConnector;
|
31
|
-
evm?: ChainConnectorEvm;
|
32
|
-
};
|
33
|
-
export type Hydrate = {
|
34
|
-
chainConnectors: ChainConnectors;
|
35
|
-
chaindataProvider: ChaindataProvider;
|
36
|
-
};
|
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> {
|
39
|
-
}
|
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> {
|
42
|
-
/** Pre-processes any substrate chain metadata required by this module ahead of time */
|
43
|
-
fetchSubstrateChainMeta(chainId: ChainId, moduleConfig?: TModuleConfig, metadataRpc?: `0x${string}`, systemProperties?: Record<string, any>): Promise<TChainMeta | null>;
|
44
|
-
/** Detects which tokens are available on a given substrate chain */
|
45
|
-
fetchSubstrateChainTokens(chainId: ChainId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig): Promise<Record<TTokenType["id"], TTokenType>>;
|
46
|
-
}
|
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> {
|
48
|
-
/** Pre-processes any evm chain metadata required by this module ahead of time */
|
49
|
-
fetchEvmChainMeta(chainId: ChainId, moduleConfig?: TModuleConfig): Promise<TChainMeta | null>;
|
50
|
-
/** Detects which tokens are available on a given evm chain */
|
51
|
-
fetchEvmChainTokens(chainId: ChainId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig): Promise<Record<TTokenType["id"], TTokenType>>;
|
52
|
-
}
|
53
|
-
export type SubscriptionResultWithStatus = {
|
54
|
-
status: "initialising" | "live";
|
55
|
-
data: BalanceJson[];
|
56
|
-
};
|
57
|
-
interface BalanceModuleCommon<TModuleType extends string, TTokenType extends SelectableTokenType, TTransferParams extends ExtendableTransferParams> {
|
58
|
-
get type(): TModuleType;
|
59
|
-
/**
|
60
|
-
* Subscribe to balances for this module with optional filtering.
|
61
|
-
*
|
62
|
-
* If subscriptions are not possible, this function should poll at some reasonable interval.
|
63
|
-
*/
|
64
|
-
subscribeBalances({ addressesByToken, initialBalances, }: {
|
65
|
-
addressesByToken: AddressesByToken<TTokenType>;
|
66
|
-
initialBalances?: BalanceJson[];
|
67
|
-
}, callback: SubscriptionCallback<Balances | SubscriptionResultWithStatus>): Promise<UnsubscribeFn>;
|
68
|
-
/** Fetch balances for this module with optional filtering */
|
69
|
-
fetchBalances(addressesByToken: AddressesByToken<TTokenType>): Promise<Balances>;
|
70
|
-
/** Prepare a tx to transfer some tokens from this module */
|
71
|
-
transferToken(transferParams: TTransferParams): Promise<TransferTokenTx | null>;
|
72
|
-
}
|
73
|
-
export {};
|
@@ -1,11 +0,0 @@
|
|
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
|
-
}
|
@@ -1,43 +0,0 @@
|
|
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,11 +0,0 @@
|
|
1
|
-
import { Dexie } from "dexie";
|
2
|
-
import { MiniMetadata } from "./types";
|
3
|
-
export declare class TalismanBalancesDatabase extends Dexie {
|
4
|
-
balancesBlob: Dexie.Table<{
|
5
|
-
data: Uint8Array;
|
6
|
-
id: string;
|
7
|
-
}, string>;
|
8
|
-
miniMetadatas: Dexie.Table<MiniMetadata, string>;
|
9
|
-
constructor();
|
10
|
-
}
|
11
|
-
export declare const db: TalismanBalancesDatabase;
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import { BalancesConfigTokenParams, EvmNetworkId, Token } from "@talismn/chaindata-provider";
|
2
|
-
import { NewBalanceModule } from "../BalanceModule";
|
3
|
-
import { NewBalanceType } from "../types";
|
4
|
-
import { erc20Abi } from "./abis/erc20";
|
5
|
-
import { erc20BalancesAggregatorAbi } from "./abis/erc20BalancesAggregator";
|
6
|
-
export { erc20Abi, erc20BalancesAggregatorAbi };
|
7
|
-
type ModuleType = "evm-erc20";
|
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">;
|
28
|
-
declare module "@talismn/balances/plugins" {
|
29
|
-
interface PluginBalanceTypes {
|
30
|
-
"evm-erc20": EvmErc20Balance;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
export declare const EvmErc20Module: NewBalanceModule<ModuleType, EvmErc20Token | CustomEvmErc20Token, EvmErc20ChainMeta, EvmErc20ModuleConfig>;
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { BalancesConfigTokenParams, EvmNetworkId, Token } from "@talismn/chaindata-provider";
|
2
|
-
import { NewBalanceModule } from "../BalanceModule";
|
3
|
-
import { NewBalanceType } from "../types";
|
4
|
-
type ModuleType = "evm-native";
|
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">;
|
20
|
-
declare module "@talismn/balances/plugins" {
|
21
|
-
interface PluginBalanceTypes {
|
22
|
-
"evm-native": EvmNativeBalance;
|
23
|
-
}
|
24
|
-
}
|
25
|
-
export declare const EvmNativeModule: NewBalanceModule<ModuleType, EvmNativeToken | CustomEvmNativeToken, EvmNativeChainMeta, EvmNativeModuleConfig>;
|
26
|
-
export {};
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import { BalancesConfigTokenParams, EvmNetworkId, Token } from "@talismn/chaindata-provider";
|
2
|
-
import { NewBalanceModule } from "../BalanceModule";
|
3
|
-
import { NewBalanceType } from "../types";
|
4
|
-
import { uniswapV2PairAbi } from "./abis/uniswapV2Pair";
|
5
|
-
export { uniswapV2PairAbi };
|
6
|
-
type ModuleType = "evm-uniswapv2";
|
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">;
|
34
|
-
declare module "@talismn/balances/plugins" {
|
35
|
-
interface PluginBalanceTypes {
|
36
|
-
"evm-uniswapv2": EvmUniswapV2Balance;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
export declare const EvmUniswapV2Module: NewBalanceModule<ModuleType, EvmUniswapV2Token | CustomEvmUniswapV2Token, EvmUniswapV2ChainMeta, EvmUniswapV2ModuleConfig>;
|
@@ -1,38 +0,0 @@
|
|
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-assets";
|
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">;
|
22
|
-
declare module "@talismn/balances/plugins" {
|
23
|
-
interface PluginBalanceTypes {
|
24
|
-
"substrate-assets": SubAssetsBalance;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
export type SubAssetsTransferParams = NewTransferParamsType<{
|
28
|
-
registry: TypeRegistry;
|
29
|
-
blockHash: string;
|
30
|
-
blockNumber: number;
|
31
|
-
nonce: number;
|
32
|
-
specVersion: number;
|
33
|
-
transactionVersion: number;
|
34
|
-
tip?: string;
|
35
|
-
userExtensions?: ExtDef;
|
36
|
-
}>;
|
37
|
-
export declare const SubAssetsModule: NewBalanceModule<ModuleType, SubAssetsToken, SubAssetsChainMeta, SubAssetsModuleConfig, SubAssetsTransferParams>;
|
38
|
-
export {};
|
@@ -1,39 +0,0 @@
|
|
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,38 +0,0 @@
|
|
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-foreignassets";
|
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">;
|
22
|
-
declare module "@talismn/balances/plugins" {
|
23
|
-
interface PluginBalanceTypes {
|
24
|
-
"substrate-foreignassets": SubForeignAssetsBalance;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
export type SubForeignAssetsTransferParams = NewTransferParamsType<{
|
28
|
-
registry: TypeRegistry;
|
29
|
-
blockHash: string;
|
30
|
-
blockNumber: number;
|
31
|
-
nonce: number;
|
32
|
-
specVersion: number;
|
33
|
-
transactionVersion: number;
|
34
|
-
tip?: string;
|
35
|
-
userExtensions?: ExtDef;
|
36
|
-
}>;
|
37
|
-
export declare const SubForeignAssetsModule: NewBalanceModule<ModuleType, SubForeignAssetsToken, SubForeignAssetsChainMeta, SubForeignAssetsModuleConfig, SubForeignAssetsTransferParams>;
|
38
|
-
export {};
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { NewBalanceModule } from "../../BalanceModule";
|
2
|
-
import { CustomSubNativeToken, ModuleType, SubNativeChainMeta, SubNativeModuleConfig, SubNativeToken, SubNativeTransferParams } from "./types";
|
3
|
-
export { filterBaseLocks, getLockTitle } from "./util/balanceLockTypes";
|
4
|
-
export type { BalanceLockType } from "./util/balanceLockTypes";
|
5
|
-
export { subNativeTokenId } from "./types";
|
6
|
-
export type { CustomSubNativeToken, ModuleType, SubNativeBalance, SubNativeChainMeta, SubNativeModuleConfig, SubNativeToken, SubNativeTransferParams, } from "./types";
|
7
|
-
export * from "./util/subtensor";
|
8
|
-
export declare const SubNativeModule: NewBalanceModule<ModuleType, SubNativeToken | CustomSubNativeToken, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTransferParams>;
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import { ChainConnector } from "@talismn/chain-connector";
|
2
|
-
import { SubscriptionCallback } from "../../types";
|
3
|
-
import { RpcStateQuery } from "../util";
|
4
|
-
import { SubNativeBalance } from "./types";
|
5
|
-
export declare function subscribeBase(queries: RpcStateQuery<SubNativeBalance>[], chainConnector: ChainConnector, callback: SubscriptionCallback<SubNativeBalance[]>): Promise<import("../../types").UnsubscribeFn>;
|
@@ -1,5 +0,0 @@
|
|
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 +0,0 @@
|
|
1
|
-
import { ChainConnector } from "@talismn/chain-connector";
|
2
|
-
import { ChaindataProvider } from "@talismn/chaindata-provider";
|
3
|
-
import { AddressesByToken, SubscriptionCallback } from "../../types";
|
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 +0,0 @@
|
|
1
|
-
import { ChainConnector } from "@talismn/chain-connector";
|
2
|
-
import { ChaindataProvider } from "@talismn/chaindata-provider";
|
3
|
-
import { AddressesByToken, SubscriptionCallback } from "../../types";
|
4
|
-
import { SubNativeBalance, SubNativeToken } from "./types";
|
5
|
-
export declare function subscribeSubtensorStaking(chaindataProvider: ChaindataProvider, chainConnector: ChainConnector, addressesByToken: AddressesByToken<SubNativeToken>, callback: SubscriptionCallback<SubNativeBalance[]>): Promise<() => void>;
|
@@ -1,49 +0,0 @@
|
|
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 { NewTransferParamsType } from "../../BalanceModule";
|
5
|
-
import { NewBalanceType } from "../../types";
|
6
|
-
export { filterBaseLocks, getLockTitle } from "./util/balanceLockTypes";
|
7
|
-
export type { BalanceLockType } from "./util/balanceLockTypes";
|
8
|
-
export type ModuleType = "substrate-native";
|
9
|
-
export declare const moduleType: ModuleType;
|
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;
|
21
|
-
useLegacyTransferableCalculation?: boolean;
|
22
|
-
symbol?: string;
|
23
|
-
decimals?: number;
|
24
|
-
existentialDeposit?: string;
|
25
|
-
nominationPoolsPalletId?: string;
|
26
|
-
crowdloanPalletId?: string;
|
27
|
-
hasSubtensorPallet?: boolean;
|
28
|
-
miniMetadata?: string;
|
29
|
-
metadataVersion?: number;
|
30
|
-
};
|
31
|
-
export type SubNativeModuleConfig = {
|
32
|
-
disable?: boolean;
|
33
|
-
} & BalancesConfigTokenParams;
|
34
|
-
export type SubNativeBalance = NewBalanceType<ModuleType, "complex", "substrate">;
|
35
|
-
declare module "@talismn/balances/plugins" {
|
36
|
-
interface PluginBalanceTypes {
|
37
|
-
"substrate-native": SubNativeBalance;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
export type SubNativeTransferParams = NewTransferParamsType<{
|
41
|
-
registry: TypeRegistry;
|
42
|
-
blockHash: string;
|
43
|
-
blockNumber: number;
|
44
|
-
nonce: number;
|
45
|
-
specVersion: number;
|
46
|
-
transactionVersion: number;
|
47
|
-
tip?: string;
|
48
|
-
userExtensions?: ExtDef;
|
49
|
-
}>;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { ChaindataProvider } from "@talismn/chaindata-provider";
|
2
|
-
import { AddressesByToken } from "../../../types";
|
3
|
-
import { RpcStateQuery } from "../../util";
|
4
|
-
import { SubNativeBalance, SubNativeToken } from "../types";
|
5
|
-
export declare class QueryCache {
|
6
|
-
private chaindataProvider;
|
7
|
-
private balanceQueryCache;
|
8
|
-
private metadataSub;
|
9
|
-
constructor(chaindataProvider: ChaindataProvider);
|
10
|
-
ensureSetup(): void;
|
11
|
-
destroy(): void;
|
12
|
-
getQueries(addressesByToken: AddressesByToken<SubNativeToken>): Promise<RpcStateQuery<SubNativeBalance>[]>;
|
13
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { Observable } from "rxjs";
|
2
|
-
import { SubscriptionCallback, UnsubscribeFn } from "../../../types";
|
3
|
-
/**
|
4
|
-
* Converts a subscription function into an Observable
|
5
|
-
*
|
6
|
-
* The type of a subscription function which can be converted into an observable:
|
7
|
-
*
|
8
|
-
* <TArgs, TResult>(...arguments: TArgs, callback: SubscriptionCallback<TResult>) => UnsubscribeFn
|
9
|
-
*/
|
10
|
-
export declare const asObservable: <T extends unknown[], R>(handler: (...args: [...T, SubscriptionCallback<R>]) => UnsubscribeFn) => (...args: T) => Observable<R>;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { Chain, Token } from "@talismn/chaindata-provider";
|
2
|
-
import { AddressesByToken, MiniMetadata } from "../../../types";
|
3
|
-
import { RpcStateQuery, StorageCoders } from "../../util";
|
4
|
-
import { SubNativeBalance, SubNativeToken } from "../types";
|
5
|
-
export type QueryKey = string;
|
6
|
-
export declare function buildQueries(chains: Record<string, Chain>, tokens: Record<string, Token>, chainStorageCoders: StorageCoders<{
|
7
|
-
base: ["System", "Account"];
|
8
|
-
stakingLedger: ["Staking", "Ledger"];
|
9
|
-
reserves: ["Balances", "Reserves"];
|
10
|
-
holds: ["Balances", "Holds"];
|
11
|
-
locks: ["Balances", "Locks"];
|
12
|
-
freezes: ["Balances", "Freezes"];
|
13
|
-
}>, miniMetadatas: Map<string, MiniMetadata>, addressesByToken: AddressesByToken<SubNativeToken>): Promise<Record<QueryKey, Array<RpcStateQuery<SubNativeBalance>>>>;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { SubNativeBalance } from "../types";
|
2
|
-
export { filterBaseLocks, getLockTitle } from "./balanceLockTypes";
|
3
|
-
export type { BalanceLockType } from "./balanceLockTypes";
|
4
|
-
/**
|
5
|
-
* Function to merge two 'sub sources' of the same balance together, or
|
6
|
-
* two instances of the same balance with different values.
|
7
|
-
* @param balance1 SubNativeBalance
|
8
|
-
* @param balance2 SubNativeBalance
|
9
|
-
* @param source source that this merge is for (will discard previous values from that source)
|
10
|
-
* @param clear whether to clear the previous values from the source
|
11
|
-
* @returns SubNativeBalance
|
12
|
-
*/
|
13
|
-
export declare const mergeBalances: (balance1: SubNativeBalance | undefined, balance2: SubNativeBalance, source: string, clear: boolean) => SubNativeBalance;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const sortChains: (a: string, b: string) => 0 | 1 | -1;
|
@@ -1,39 +0,0 @@
|
|
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-psp22";
|
7
|
-
export type SubPsp22Token = Extract<Token, {
|
8
|
-
type: ModuleType;
|
9
|
-
}>;
|
10
|
-
export declare const subPsp22TokenId: (chainId: ChainId, tokenSymbol: string) => string;
|
11
|
-
export type SubPsp22ChainMeta = {
|
12
|
-
isTestnet: boolean;
|
13
|
-
};
|
14
|
-
export type SubPsp22ModuleConfig = {
|
15
|
-
tokens?: Array<{
|
16
|
-
symbol?: string;
|
17
|
-
decimals?: number;
|
18
|
-
ed?: string;
|
19
|
-
contractAddress?: string;
|
20
|
-
} & BalancesConfigTokenParams>;
|
21
|
-
};
|
22
|
-
export type SubPsp22Balance = NewBalanceType<ModuleType, "simple", "substrate">;
|
23
|
-
declare module "@talismn/balances/plugins" {
|
24
|
-
interface PluginBalanceTypes {
|
25
|
-
"substrate-psp22": SubPsp22Balance;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
export type SubPsp22TransferParams = 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 SubPsp22Module: NewBalanceModule<ModuleType, SubPsp22Token, SubPsp22ChainMeta, SubPsp22ModuleConfig, SubPsp22TransferParams>;
|
39
|
-
export {};
|