@talismn/balances 0.9.11 → 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
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { NetworkList, TokenList } from "@talismn/chaindata-provider";
|
2
2
|
import { TokenRateCurrency, TokenRates, TokenRatesList } from "@talismn/token-rates";
|
3
3
|
import { NonFunctionProperties } from "@talismn/util";
|
4
4
|
import { Amount, AmountWithLabel, BalanceJson, BalanceJsonList, BalanceStatusTypes, ExtraAmount, IBalance, LockedAmount } from "./balancetypes";
|
@@ -19,8 +19,7 @@ export type NarrowBalanceType<S extends IBalance, P> = S extends {
|
|
19
19
|
export type BalanceSource = BalanceJson["source"];
|
20
20
|
/** TODO: Remove this in favour of a frontend-friendly `ChaindataProvider` */
|
21
21
|
export type HydrateDb = Partial<{
|
22
|
-
|
23
|
-
evmNetworks: SimpleEvmNetworkList;
|
22
|
+
networks: NetworkList;
|
24
23
|
tokens: TokenList;
|
25
24
|
tokenRates: TokenRatesList;
|
26
25
|
}>;
|
@@ -30,7 +29,7 @@ export type BalanceSearchQuery = Partial<NonFunctionProperties<Balance>> | ((bal
|
|
30
29
|
*/
|
31
30
|
export declare class Balances {
|
32
31
|
#private;
|
33
|
-
constructor(balances: Balances | BalanceJsonList | Balance[] | BalanceJson[] | Balance, hydrate?: HydrateDb);
|
32
|
+
constructor(balances: Balances | BalanceJsonList | Balance[] | IBalance[] | BalanceJson[] | Balance, hydrate?: HydrateDb);
|
34
33
|
/**
|
35
34
|
* Calling toJSON on a collection of balances will return the underlying BalanceJsonList.
|
36
35
|
*/
|
@@ -114,106 +113,258 @@ export declare class Balances {
|
|
114
113
|
*/
|
115
114
|
get sum(): SumBalancesFormatter;
|
116
115
|
}
|
117
|
-
export declare const getBalanceId: (balance:
|
116
|
+
export declare const getBalanceId: (balance: Pick<IBalance, "address" | "tokenId">) => string;
|
118
117
|
/**
|
119
118
|
* An individual balance.
|
120
119
|
*/
|
121
120
|
export declare class Balance {
|
122
121
|
#private;
|
123
|
-
constructor(storage: BalanceJson, hydrate?: HydrateDb);
|
122
|
+
constructor(storage: BalanceJson | IBalance, hydrate?: HydrateDb);
|
124
123
|
toJSON: () => BalanceJson;
|
125
124
|
isSource: (source: BalanceSource) => boolean;
|
126
125
|
hydrate: (hydrate?: HydrateDb) => void;
|
127
126
|
get id(): string;
|
128
|
-
get source():
|
127
|
+
get source(): string;
|
129
128
|
get status(): import("./balancetypes").BalanceStatus;
|
130
129
|
get address(): string;
|
131
|
-
get
|
132
|
-
get
|
133
|
-
|
134
|
-
|
130
|
+
get networkId(): string;
|
131
|
+
get network(): {
|
132
|
+
id: string;
|
133
|
+
name: string;
|
134
|
+
nativeTokenId: string;
|
135
|
+
nativeCurrency: {
|
136
|
+
decimals: number;
|
137
|
+
symbol: string;
|
138
|
+
name: string;
|
139
|
+
coingeckoId?: string | undefined;
|
140
|
+
mirrorOf?: string | undefined;
|
141
|
+
logo?: string | undefined;
|
142
|
+
};
|
143
|
+
blockExplorerUrls: string[];
|
144
|
+
genesisHash: `0x${string}`;
|
145
|
+
platform: "polkadot";
|
146
|
+
chainName: string;
|
147
|
+
specName: string;
|
148
|
+
specVersion: number;
|
149
|
+
account: "secp256k1" | "*25519";
|
150
|
+
prefix: number;
|
151
|
+
rpcs: string[];
|
152
|
+
topology: {
|
153
|
+
type: "standalone";
|
154
|
+
} | {
|
155
|
+
type: "relay";
|
156
|
+
} | {
|
157
|
+
type: "parachain";
|
158
|
+
relayId: string;
|
159
|
+
paraId: number;
|
160
|
+
};
|
161
|
+
isTestnet?: boolean | undefined;
|
162
|
+
isDefault?: boolean | undefined;
|
163
|
+
forceScan?: boolean | undefined;
|
164
|
+
logo?: string | undefined;
|
165
|
+
themeColor?: string | undefined;
|
166
|
+
chainspecQrUrl?: string | undefined;
|
167
|
+
latestMetadataQrUrl?: string | undefined;
|
168
|
+
oldPrefix?: number | undefined;
|
169
|
+
registryTypes?: any;
|
170
|
+
signedExtensions?: any;
|
171
|
+
hasCheckMetadataHash?: boolean | undefined;
|
172
|
+
hasExtrinsicSignatureTypePrefix?: boolean | undefined;
|
173
|
+
isUnknownFeeToken?: boolean | undefined;
|
174
|
+
balancesConfig?: {
|
175
|
+
"substrate-native"?: {
|
176
|
+
disable?: boolean | undefined;
|
177
|
+
} | undefined;
|
178
|
+
"substrate-assets"?: undefined;
|
179
|
+
"substrate-psp22"?: undefined;
|
180
|
+
"substrate-tokens"?: {
|
181
|
+
palletId?: string | undefined;
|
182
|
+
} | undefined;
|
183
|
+
"substrate-foreignassets"?: undefined;
|
184
|
+
"substrate-hydration"?: undefined;
|
185
|
+
} | undefined;
|
186
|
+
} | {
|
187
|
+
id: string;
|
188
|
+
name: string;
|
189
|
+
nativeTokenId: string;
|
190
|
+
nativeCurrency: {
|
191
|
+
decimals: number;
|
192
|
+
symbol: string;
|
193
|
+
name: string;
|
194
|
+
coingeckoId?: string | undefined;
|
195
|
+
mirrorOf?: string | undefined;
|
196
|
+
logo?: string | undefined;
|
197
|
+
};
|
198
|
+
blockExplorerUrls: string[];
|
199
|
+
platform: "ethereum";
|
200
|
+
rpcs: string[];
|
201
|
+
isTestnet?: boolean | undefined;
|
202
|
+
isDefault?: boolean | undefined;
|
203
|
+
forceScan?: boolean | undefined;
|
204
|
+
logo?: string | undefined;
|
205
|
+
themeColor?: string | undefined;
|
206
|
+
substrateChainId?: string | undefined;
|
207
|
+
preserveGasEstimate?: boolean | undefined;
|
208
|
+
feeType?: "legacy" | "eip-1559" | undefined;
|
209
|
+
l2FeeType?: {
|
210
|
+
type: "op-stack";
|
211
|
+
} | {
|
212
|
+
type: "scroll";
|
213
|
+
l1GasPriceOracle: `0x${string}`;
|
214
|
+
} | undefined;
|
215
|
+
contracts?: Partial<Record<"Erc20Aggregator" | "Multicall3", `0x${string}`>> | undefined;
|
216
|
+
balancesConfig?: {
|
217
|
+
"evm-native"?: undefined;
|
218
|
+
"evm-erc20"?: undefined;
|
219
|
+
"evm-uniswapv2"?: undefined;
|
220
|
+
} | undefined;
|
221
|
+
} | null;
|
135
222
|
get tokenId(): string;
|
136
|
-
get token():
|
223
|
+
get token(): {
|
224
|
+
id: string;
|
225
|
+
networkId: string;
|
226
|
+
decimals: number;
|
227
|
+
symbol: string;
|
137
228
|
type: "evm-erc20";
|
138
|
-
|
139
|
-
contractAddress: string
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
229
|
+
platform: "ethereum";
|
230
|
+
contractAddress: `0x${string}`;
|
231
|
+
isDefault?: boolean | undefined;
|
232
|
+
name?: string | undefined;
|
233
|
+
logo?: string | undefined;
|
234
|
+
coingeckoId?: string | undefined;
|
235
|
+
noDiscovery?: boolean | undefined;
|
236
|
+
mirrorOf?: string | undefined;
|
237
|
+
} | {
|
238
|
+
id: string;
|
239
|
+
networkId: string;
|
240
|
+
decimals: number;
|
241
|
+
symbol: string;
|
146
242
|
type: "evm-native";
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
243
|
+
platform: "ethereum";
|
244
|
+
isDefault?: boolean | undefined;
|
245
|
+
name?: string | undefined;
|
246
|
+
logo?: string | undefined;
|
247
|
+
coingeckoId?: string | undefined;
|
248
|
+
noDiscovery?: boolean | undefined;
|
249
|
+
mirrorOf?: string | undefined;
|
250
|
+
} | {
|
251
|
+
id: string;
|
252
|
+
networkId: string;
|
253
|
+
decimals: number;
|
254
|
+
symbol: string;
|
153
255
|
type: "evm-uniswapv2";
|
154
|
-
|
155
|
-
contractAddress: string
|
256
|
+
platform: "ethereum";
|
257
|
+
contractAddress: `0x${string}`;
|
156
258
|
symbol0: string;
|
157
259
|
symbol1: string;
|
158
260
|
decimals0: number;
|
159
261
|
decimals1: number;
|
160
|
-
tokenAddress0: string
|
161
|
-
tokenAddress1: string
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
262
|
+
tokenAddress0: `0x${string}`;
|
263
|
+
tokenAddress1: `0x${string}`;
|
264
|
+
isDefault?: boolean | undefined;
|
265
|
+
name?: string | undefined;
|
266
|
+
logo?: string | undefined;
|
267
|
+
coingeckoId?: string | undefined;
|
268
|
+
noDiscovery?: boolean | undefined;
|
269
|
+
mirrorOf?: string | undefined;
|
270
|
+
isCustom?: boolean | undefined;
|
271
|
+
coingeckoId0?: string | undefined;
|
272
|
+
coingeckoId1?: string | undefined;
|
273
|
+
} | {
|
274
|
+
id: string;
|
275
|
+
networkId: string;
|
276
|
+
decimals: number;
|
277
|
+
symbol: string;
|
168
278
|
type: "substrate-assets";
|
169
|
-
|
170
|
-
existentialDeposit: string;
|
279
|
+
platform: "polkadot";
|
171
280
|
assetId: string;
|
172
|
-
|
173
|
-
chain: {
|
174
|
-
id: import("@talismn/chaindata-provider").ChainId;
|
175
|
-
};
|
176
|
-
}) | (import("@talismn/chaindata-provider/dist/declarations/src/types/Token/types").TokenBase & {
|
177
|
-
type: "substrate-equilibrium";
|
178
|
-
} & {
|
281
|
+
isSufficient: boolean;
|
179
282
|
existentialDeposit: string;
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
283
|
+
isDefault?: boolean | undefined;
|
284
|
+
name?: string | undefined;
|
285
|
+
logo?: string | undefined;
|
286
|
+
coingeckoId?: string | undefined;
|
287
|
+
noDiscovery?: boolean | undefined;
|
288
|
+
mirrorOf?: string | undefined;
|
289
|
+
isFrozen?: boolean | undefined;
|
290
|
+
} | {
|
291
|
+
id: string;
|
292
|
+
networkId: string;
|
293
|
+
decimals: number;
|
294
|
+
symbol: string;
|
185
295
|
type: "substrate-foreignassets";
|
186
|
-
|
187
|
-
existentialDeposit: string;
|
296
|
+
platform: "polkadot";
|
188
297
|
onChainId: string;
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
298
|
+
isSufficient: boolean;
|
299
|
+
existentialDeposit: string;
|
300
|
+
isDefault?: boolean | undefined;
|
301
|
+
name?: string | undefined;
|
302
|
+
logo?: string | undefined;
|
303
|
+
coingeckoId?: string | undefined;
|
304
|
+
noDiscovery?: boolean | undefined;
|
305
|
+
mirrorOf?: string | undefined;
|
306
|
+
isFrozen?: boolean | undefined;
|
307
|
+
} | {
|
308
|
+
id: string;
|
309
|
+
networkId: string;
|
310
|
+
decimals: number;
|
311
|
+
symbol: string;
|
194
312
|
type: "substrate-native";
|
195
|
-
|
313
|
+
platform: "polkadot";
|
196
314
|
existentialDeposit: string;
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
315
|
+
isDefault?: boolean | undefined;
|
316
|
+
name?: string | undefined;
|
317
|
+
logo?: string | undefined;
|
318
|
+
coingeckoId?: string | undefined;
|
319
|
+
noDiscovery?: boolean | undefined;
|
320
|
+
mirrorOf?: string | undefined;
|
321
|
+
} | {
|
322
|
+
id: string;
|
323
|
+
networkId: string;
|
324
|
+
decimals: number;
|
325
|
+
symbol: string;
|
201
326
|
type: "substrate-psp22";
|
202
|
-
|
203
|
-
existentialDeposit: string;
|
327
|
+
platform: "polkadot";
|
204
328
|
contractAddress: string;
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
329
|
+
isDefault?: boolean | undefined;
|
330
|
+
name?: string | undefined;
|
331
|
+
logo?: string | undefined;
|
332
|
+
coingeckoId?: string | undefined;
|
333
|
+
noDiscovery?: boolean | undefined;
|
334
|
+
mirrorOf?: string | undefined;
|
335
|
+
} | {
|
336
|
+
id: string;
|
337
|
+
networkId: string;
|
338
|
+
decimals: number;
|
339
|
+
symbol: string;
|
209
340
|
type: "substrate-tokens";
|
210
|
-
|
211
|
-
existentialDeposit: string;
|
341
|
+
platform: "polkadot";
|
212
342
|
onChainId: string | number;
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
343
|
+
existentialDeposit: string;
|
344
|
+
isDefault?: boolean | undefined;
|
345
|
+
name?: string | undefined;
|
346
|
+
logo?: string | undefined;
|
347
|
+
coingeckoId?: string | undefined;
|
348
|
+
noDiscovery?: boolean | undefined;
|
349
|
+
mirrorOf?: string | undefined;
|
350
|
+
} | {
|
351
|
+
id: string;
|
352
|
+
networkId: string;
|
353
|
+
decimals: number;
|
354
|
+
symbol: string;
|
355
|
+
type: "substrate-hydration";
|
356
|
+
platform: "polkadot";
|
357
|
+
onChainId: number;
|
358
|
+
assetType: "Token" | "Erc20" | "External";
|
359
|
+
isSufficient: boolean;
|
360
|
+
existentialDeposit: string;
|
361
|
+
isDefault?: boolean | undefined;
|
362
|
+
name?: string | undefined;
|
363
|
+
logo?: string | undefined;
|
364
|
+
coingeckoId?: string | undefined;
|
365
|
+
noDiscovery?: boolean | undefined;
|
366
|
+
mirrorOf?: string | undefined;
|
367
|
+
} | null;
|
217
368
|
get decimals(): number | null;
|
218
369
|
get rates(): TokenRates | null;
|
219
370
|
/**
|
@@ -248,7 +399,6 @@ export declare class Balance {
|
|
248
399
|
/** The frozen balance of this token. Is included in the free amount. */
|
249
400
|
get locked(): BalanceFormatter;
|
250
401
|
get locks(): FormattedAmount<AmountWithLabel<string>, string>[];
|
251
|
-
get crowdloans(): FormattedAmount<AmountWithLabel<string>, string>[];
|
252
402
|
get nompools(): FormattedAmount<AmountWithLabel<string>, string>[];
|
253
403
|
get subtensor(): FormattedAmount<AmountWithLabel<string>, string>[];
|
254
404
|
/** The extra balance of this token */
|
@@ -1,28 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import { ChainId, EvmChainId, EvmNetworkId, SubChainId, TokenId } from "@talismn/chaindata-provider";
|
1
|
+
import { NetworkId, TokenId } from "@talismn/chaindata-provider";
|
3
2
|
import { Address } from "./addresses";
|
4
|
-
/**
|
5
|
-
* `BalanceTypes` is an automatically determined sub-selection of `PluginBalanceTypes`.
|
6
|
-
*
|
7
|
-
* It is the same list, but with any invalid `BalanceType` definitions filtered out.
|
8
|
-
*/
|
9
|
-
export type BalanceTypes = {
|
10
|
-
[BalanceType in keyof PluginBalanceTypes]: PluginBalanceTypes[BalanceType] extends IBalance ? PluginBalanceTypes[BalanceType] : never;
|
11
|
-
};
|
12
|
-
/**
|
13
|
-
* The `BalanceJson` sum type, which is a union of all of the possible `BalanceTypes`.
|
14
|
-
*
|
15
|
-
* Each variant comes from a plugin in use by the consuming app.
|
16
|
-
*
|
17
|
-
* For example, in an app with the `substrate-native`, `evm-native`, `substrate-tokens` and `evm-erc20` plugins:
|
18
|
-
*
|
19
|
-
* type BalanceJson = SubNativeBalance | EvmNativeBalance | SubTokensBalance | EvmErc20Balance
|
20
|
-
*
|
21
|
-
* If `BalanceTypes` is empty then `BalanceJson` will fall back to the common `IBalance` interface, which every balance must implement.
|
22
|
-
*/
|
23
|
-
export type BalanceJson = BalanceTypes[keyof BalanceTypes] extends never ? IBalance : BalanceTypes[keyof BalanceTypes];
|
24
|
-
/** A collection of `BalanceJson` objects */
|
25
|
-
export type BalanceJsonList = Record<string, BalanceJson>;
|
26
3
|
export type BalanceStatus = "live" | "cache" | "stale";
|
27
4
|
type IBalanceBase = {
|
28
5
|
/** The module that this balance was retrieved by */
|
@@ -34,17 +11,7 @@ type IBalanceBase = {
|
|
34
11
|
address: Address;
|
35
12
|
/** The token this balance is for */
|
36
13
|
tokenId: TokenId;
|
37
|
-
|
38
|
-
type IBalanceBaseEvm = {
|
39
|
-
/** WIP, use `chainId` or `evmNetworkId` for now */
|
40
|
-
multiChainId: EvmChainId;
|
41
|
-
/** The evm chain this balance is on */
|
42
|
-
evmNetworkId: EvmNetworkId;
|
43
|
-
};
|
44
|
-
type IBalanceBaseSubstrate = {
|
45
|
-
multiChainId: SubChainId;
|
46
|
-
/** The substrate chain this balance is on */
|
47
|
-
chainId: ChainId;
|
14
|
+
networkId: NetworkId;
|
48
15
|
};
|
49
16
|
type IBalanceSimpleValues = {
|
50
17
|
/** For balance types with a simple value, this is the value of the balance (eg, evm native token balance) */
|
@@ -57,19 +24,20 @@ type IBalanceComplexValues = {
|
|
57
24
|
value?: undefined;
|
58
25
|
};
|
59
26
|
/** `IBalance` is a common interface which all balance types must implement. */
|
60
|
-
export type IBalance = IBalanceBase & (IBalanceSimpleValues | IBalanceComplexValues)
|
61
|
-
export type
|
62
|
-
|
27
|
+
export type IBalance = IBalanceBase & (IBalanceSimpleValues | IBalanceComplexValues);
|
28
|
+
export type BalanceJson = IBalance;
|
29
|
+
/** A collection of `BalanceJson` objects */
|
30
|
+
export type BalanceJsonList = Record<string, BalanceJson>;
|
63
31
|
/** An unlabelled amount of a balance */
|
64
32
|
export type Amount = string;
|
65
|
-
export type BalanceStatusTypes = "free" | "reserved" | "locked" | "extra" | "
|
33
|
+
export type BalanceStatusTypes = "free" | "reserved" | "locked" | "extra" | "nompool" | "subtensor";
|
66
34
|
/** A labelled amount of a balance */
|
67
35
|
type BaseAmountWithLabel<TLabel extends string> = {
|
68
36
|
type: BalanceStatusTypes;
|
69
37
|
/**
|
70
38
|
* For modules which fetch balances via module sources, the source is equivalent to previous 'subSource' field
|
71
39
|
* on the parent balance object
|
72
|
-
* e.g. `staking`
|
40
|
+
* e.g. `staking`
|
73
41
|
**/
|
74
42
|
source?: string;
|
75
43
|
label: TLabel;
|
@@ -101,7 +69,7 @@ export type ExtraAmount<TLabel extends string> = BaseAmountWithLabel<TLabel> & {
|
|
101
69
|
includeInTotal?: boolean;
|
102
70
|
};
|
103
71
|
/** Used by plugins to help define their custom `BalanceType` */
|
104
|
-
export type NewBalanceType<TModuleType extends string, TBalanceValueType extends "simple" | "complex"
|
72
|
+
export type NewBalanceType<TModuleType extends string, TBalanceValueType extends "simple" | "complex"> = IBalanceBase & (TBalanceValueType extends "simple" ? IBalanceSimpleValues : IBalanceComplexValues) & {
|
105
73
|
source: TModuleType;
|
106
74
|
};
|
107
75
|
export {};
|
@@ -1,33 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { AnyMiniMetadata } from "@talismn/chaindata-provider";
|
2
2
|
/** For fast db access, you can calculate the primary key for a miniMetadata using this method */
|
3
|
-
export declare const deriveMiniMetadataId: ({ source, chainId,
|
4
|
-
export type
|
5
|
-
|
6
|
-
"good"
|
7
|
-
/** Metadata exists, but needs to be updated */
|
8
|
-
| "outdated"
|
9
|
-
/** Metadata doesn't exist */
|
10
|
-
| "none";
|
11
|
-
export type MiniMetadata = {
|
12
|
-
/** The DB id for this metadata */
|
13
|
-
id: string;
|
14
|
-
/** The balance module which created this miniMetadata */
|
15
|
-
source: string;
|
16
|
-
/** The chain this miniMetadata came from */
|
17
|
-
chainId: ChainId;
|
18
|
-
/** The chain specName which this miniMetadata is valid for */
|
19
|
-
specName: string;
|
20
|
-
/** The chain specVersion which this miniMetadata is valid for */
|
21
|
-
specVersion: string;
|
22
|
-
/** The JSON-encoded chain balancesConfig which this miniMetadata is valid for */
|
23
|
-
balancesConfig: string;
|
24
|
-
/** The version of the metadata format e.g. 13, 14, 15, etc */
|
25
|
-
version: number;
|
26
|
-
/** The miniMetadata encoded as a hex string */
|
27
|
-
data: `0x${string}` | null;
|
28
|
-
/**
|
29
|
-
* Some balance modules need a little bit of extra data in addition to the miniMetadata.
|
30
|
-
* They can store that data as a JSON-encoded string here.
|
31
|
-
*/
|
32
|
-
extra: string;
|
3
|
+
export declare const deriveMiniMetadataId: ({ source, chainId, specVersion, }: Pick<AnyMiniMetadata, "source" | "chainId" | "specVersion">) => string;
|
4
|
+
export type MiniMetadata<Extra = unknown> = Omit<AnyMiniMetadata, "extra"> & {
|
5
|
+
extra: Extra;
|
33
6
|
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export declare const TokenConfigBaseSchema: import("zod/v4").ZodObject<{
|
2
|
+
symbol: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
|
3
|
+
networkId: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
|
4
|
+
isDefault: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodBoolean>>;
|
5
|
+
decimals: import("zod/v4").ZodOptional<import("zod/v4").ZodInt>;
|
6
|
+
name: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
|
7
|
+
logo: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
|
8
|
+
coingeckoId: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
|
9
|
+
noDiscovery: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodBoolean>>;
|
10
|
+
mirrorOf: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
|
11
|
+
}, import("zod/v4/core").$strict>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { MINIMETADATA_VERSION } from "@talismn/chaindata-provider";
|