@talismn/balances 0.0.0-pr2136-20250814030903 → 0.0.0-pr2136-20250815050739
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 +0 -1
- package/dist/declarations/src/getMiniMetadatas/getMetadataRpc.d.ts +2 -2
- package/dist/declarations/src/getMiniMetadatas/getSpecVersion.d.ts +2 -2
- package/dist/declarations/src/getMiniMetadatas/index.d.ts +2 -2
- package/dist/declarations/src/modules/index.d.ts +0 -23
- package/dist/declarations/src/modules/shared/errors.d.ts +1 -1
- package/dist/declarations/src/modules/shared/fetchRuntimeCallResult.d.ts +2 -2
- package/dist/declarations/src/modules/shared/rpcQueryPack.d.ts +3 -3
- package/dist/declarations/src/modules/substrate-native/bittensor/getSubtensorStakingBalances.d.ts +2 -2
- package/dist/declarations/src/modules/substrate-native/fetchTokens.d.ts +2 -2
- package/dist/declarations/src/modules/substrate-psp22/util.d.ts +2 -2
- package/dist/declarations/src/types/IBalanceModule.d.ts +19 -26
- package/dist/declarations/src/types/balances.d.ts +4 -52
- package/dist/declarations/src/types/balancetypes.d.ts +4 -0
- package/dist/declarations/src/types/chainConnectors.d.ts +4 -4
- package/dist/talismn-balances.cjs.dev.js +254 -759
- package/dist/talismn-balances.cjs.prod.js +254 -759
- package/dist/talismn-balances.esm.js +246 -747
- package/package.json +8 -13
- package/dist/declarations/src/modules/sol-native/config.d.ts +0 -3
- package/dist/declarations/src/modules/sol-native/fetchBalances.d.ts +0 -3
- package/dist/declarations/src/modules/sol-native/fetchTokens.d.ts +0 -3
- package/dist/declarations/src/modules/sol-native/getMiniMetadata.d.ts +0 -3
- package/dist/declarations/src/modules/sol-native/getTransferCallData.d.ts +0 -3
- package/dist/declarations/src/modules/sol-native/index.d.ts +0 -2
- package/dist/declarations/src/modules/sol-native/module.d.ts +0 -3
- package/dist/declarations/src/modules/sol-native/subscribeBalances.d.ts +0 -3
- package/dist/declarations/src/modules/sol-native/types.d.ts +0 -13
- package/dist/declarations/src/modules/sol-spl/config.d.ts +0 -3
- package/dist/declarations/src/modules/sol-spl/fetchBalances.d.ts +0 -3
- package/dist/declarations/src/modules/sol-spl/fetchTokens.d.ts +0 -3
- package/dist/declarations/src/modules/sol-spl/getMiniMetadata.d.ts +0 -3
- package/dist/declarations/src/modules/sol-spl/getTransferCallData.d.ts +0 -3
- package/dist/declarations/src/modules/sol-spl/index.d.ts +0 -2
- package/dist/declarations/src/modules/sol-spl/module.d.ts +0 -3
- package/dist/declarations/src/modules/sol-spl/subscribeBalances.d.ts +0 -3
- package/dist/declarations/src/modules/sol-spl/types.d.ts +0 -14
@@ -21,7 +21,6 @@ export declare class BalancesProvider {
|
|
21
21
|
private getNetworkBalances$;
|
22
22
|
private getPolkadotNetworkModuleBalances$;
|
23
23
|
private getEthereumNetworkModuleBalances$;
|
24
|
-
private getSolanaNetworkModuleBalances$;
|
25
24
|
private updateStorage$;
|
26
25
|
private getNetworkMiniMetadatas$;
|
27
26
|
private getNetworkSpecVersion$;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import {
|
1
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
2
2
|
import { DotNetworkId } from "@talismn/chaindata-provider";
|
3
|
-
export declare const getMetadataRpc: (chainConnector:
|
3
|
+
export declare const getMetadataRpc: (chainConnector: ChainConnector, networkId: DotNetworkId) => Promise<`0x${string}`>;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
2
2
|
import { DotNetworkId } from "@talismn/chaindata-provider";
|
3
3
|
/**
|
4
4
|
* fetches the spec version of a network. current request is cached in case of multiple calls (all balance modules will kick in at once)
|
5
5
|
*/
|
6
|
-
export declare const getSpecVersion: (chainConnector:
|
6
|
+
export declare const getSpecVersion: (chainConnector: ChainConnector, networkId: DotNetworkId) => Promise<number>;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
2
2
|
import { ChaindataProvider, DotNetworkId } from "@talismn/chaindata-provider";
|
3
3
|
import { MiniMetadata } from "../types";
|
4
4
|
export { getSpecVersion } from "./getSpecVersion";
|
5
|
-
export declare const getMiniMetadatas: (chainConnector:
|
5
|
+
export declare const getMiniMetadatas: (chainConnector: ChainConnector, chaindataProvider: ChaindataProvider, networkId: DotNetworkId, specVersion?: number) => Promise<MiniMetadata[]>;
|
@@ -108,27 +108,6 @@ export declare const BALANCE_MODULES: (import("../types/IBalanceModule").IBalanc
|
|
108
108
|
coingeckoId?: string | undefined;
|
109
109
|
noDiscovery?: boolean | undefined;
|
110
110
|
mirrorOf?: string | undefined;
|
111
|
-
}, unknown, unknown> | import("../types/IBalanceModule").IBalanceModule<"sol-native", {
|
112
|
-
symbol?: string | undefined;
|
113
|
-
networkId?: string | undefined;
|
114
|
-
isDefault?: boolean | undefined;
|
115
|
-
decimals?: number | undefined;
|
116
|
-
name?: string | undefined;
|
117
|
-
logo?: string | undefined;
|
118
|
-
coingeckoId?: string | undefined;
|
119
|
-
noDiscovery?: boolean | undefined;
|
120
|
-
mirrorOf?: string | undefined;
|
121
|
-
}, unknown, unknown> | import("../types/IBalanceModule").IBalanceModule<"sol-spl", {
|
122
|
-
mintAddress: string;
|
123
|
-
symbol?: string | undefined;
|
124
|
-
networkId?: string | undefined;
|
125
|
-
isDefault?: boolean | undefined;
|
126
|
-
decimals?: number | undefined;
|
127
|
-
name?: string | undefined;
|
128
|
-
logo?: string | undefined;
|
129
|
-
coingeckoId?: string | undefined;
|
130
|
-
noDiscovery?: boolean | undefined;
|
131
|
-
mirrorOf?: string | undefined;
|
132
111
|
}, unknown, unknown>)[];
|
133
112
|
export type AnyBalanceModule = (typeof BALANCE_MODULES)[number];
|
134
113
|
export * from "./evm-native";
|
@@ -140,7 +119,5 @@ export * from "./substrate-foreignassets";
|
|
140
119
|
export * from "./substrate-hydration";
|
141
120
|
export * from "./substrate-psp22";
|
142
121
|
export * from "./substrate-tokens";
|
143
|
-
export * from "./sol-native";
|
144
|
-
export * from "./sol-spl";
|
145
122
|
export * from "./abis";
|
146
123
|
export * from "../types/IBalanceModule";
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
export declare const fetchRuntimeCallResult: <T>(connector:
|
1
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
2
|
+
export declare const fetchRuntimeCallResult: <T>(connector: ChainConnector, networkId: string, metadataRpc: `0x${string}`, apiName: string, method: string, args: unknown[]) => Promise<T>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
2
2
|
import { DotNetworkId } from "@talismn/chaindata-provider";
|
3
3
|
import { Observable } from "rxjs";
|
4
4
|
export type MaybeStateKey = `0x${string}` | null;
|
@@ -6,5 +6,5 @@ export type RpcQueryPack<T> = {
|
|
6
6
|
stateKeys: MaybeStateKey[];
|
7
7
|
decodeResult: (changes: MaybeStateKey[]) => T;
|
8
8
|
};
|
9
|
-
export declare const fetchRpcQueryPack: <T>(connector:
|
10
|
-
export declare const getRpcQueryPack$: <T>(connector:
|
9
|
+
export declare const fetchRpcQueryPack: <T>(connector: ChainConnector, networkId: DotNetworkId, queries: RpcQueryPack<T>[]) => Promise<T[]>;
|
10
|
+
export declare const getRpcQueryPack$: <T>(connector: ChainConnector, networkId: DotNetworkId, queries: RpcQueryPack<T>[], timeout?: number | false) => Observable<T[]>;
|
package/dist/declarations/src/modules/substrate-native/bittensor/getSubtensorStakingBalances.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import {
|
1
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
2
2
|
import { DotNetworkId } from "@talismn/chaindata-provider";
|
3
3
|
import { Observable } from "rxjs";
|
4
4
|
import { AmountWithLabel, MiniMetadata } from "../../../types";
|
5
5
|
import { BalanceDef } from "../../shared";
|
6
6
|
import { MiniMetadataExtra } from "../config";
|
7
7
|
type StakingValuesByAddress = Record<string, Array<AmountWithLabel<string>>>;
|
8
|
-
export declare const getSubtensorStakingBalances$: (connector:
|
8
|
+
export declare const getSubtensorStakingBalances$: (connector: ChainConnector, networkId: DotNetworkId, balanceDefs: BalanceDef<"substrate-native">[], miniMetadata: MiniMetadata<MiniMetadataExtra>) => Observable<StakingValuesByAddress>;
|
9
9
|
export {};
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
2
2
|
import { IBalanceModule } from "../../types/IBalanceModule";
|
3
3
|
import { MiniMetadataExtra, MODULE_TYPE, ModuleConfig, TokenConfig } from "./config";
|
4
4
|
export declare const fetchTokens: IBalanceModule<typeof MODULE_TYPE, TokenConfig, ModuleConfig, MiniMetadataExtra>["fetchTokens"];
|
5
|
-
export declare const getChainProperties: (connector:
|
5
|
+
export declare const getChainProperties: (connector: ChainConnector, networkId: string) => Promise<{
|
6
6
|
tokenDecimals: number;
|
7
7
|
tokenSymbol: string;
|
8
8
|
}>;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { TypeRegistry } from "@polkadot/types";
|
2
2
|
import { ContractExecResult } from "@polkadot/types/interfaces";
|
3
|
-
import {
|
3
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
4
4
|
export declare const makeContractCaller: ({ chainConnector, chainId, registry, }: {
|
5
|
-
chainConnector:
|
5
|
+
chainConnector: ChainConnector;
|
6
6
|
chainId: string;
|
7
7
|
registry: TypeRegistry;
|
8
8
|
}) => <T extends Uint8Array | {
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import type {
|
2
|
-
import {
|
3
|
-
import { DotNetworkId, EthNetworkId,
|
1
|
+
import type { ChainConnector } from "@talismn/chain-connector";
|
2
|
+
import type { ChainConnectorEvm } from "@talismn/chain-connector-evm";
|
3
|
+
import { DotNetworkId, EthNetworkId, Token, TokenId, TokenOfType, TokenType } from "@talismn/chaindata-provider";
|
4
4
|
import { Observable } from "rxjs";
|
5
5
|
import type { Address, IBalance, MiniMetadata } from ".";
|
6
6
|
export type TokenPlatform<T extends TokenType> = TokenOfType<T>["platform"];
|
7
|
-
export type PlatformConnector<P extends TokenPlatform<TokenType>> = P extends "ethereum" ?
|
7
|
+
export type PlatformConnector<P extends TokenPlatform<TokenType>> = P extends "ethereum" ? ChainConnectorEvm : P extends "polkadot" ? ChainConnector : never;
|
8
8
|
type DotTransferCallData = {
|
9
9
|
address: string;
|
10
10
|
method: `0x${string}`;
|
@@ -15,9 +15,8 @@ type EthTransferCallData = {
|
|
15
15
|
data: `0x${string}`;
|
16
16
|
value?: string;
|
17
17
|
};
|
18
|
-
type SolTransferCallData = TransactionInstruction[];
|
19
18
|
export type BalanceTransferType = "keep-alive" | "all" | "allow-death";
|
20
|
-
type CallDataOf<P extends TokenPlatform<TokenType>> = P extends "ethereum" ? EthTransferCallData : P extends "polkadot" ? DotTransferCallData :
|
19
|
+
type CallDataOf<P extends TokenPlatform<TokenType>> = P extends "ethereum" ? EthTransferCallData : P extends "polkadot" ? DotTransferCallData : never;
|
21
20
|
export type TokensWithAddresses = Array<[Token, Address[]]>;
|
22
21
|
export type FetchBalanceErrors = Array<{
|
23
22
|
tokenId: TokenId;
|
@@ -40,35 +39,35 @@ export interface IBalanceModule<Type extends TokenType, TokenConfig = unknown, M
|
|
40
39
|
fetchTokens: (arg: TokenPlatform<Type> extends "polkadot" ? {
|
41
40
|
networkId: DotNetworkId;
|
42
41
|
tokens: TokenConfig[];
|
43
|
-
connector:
|
42
|
+
connector: ChainConnector;
|
44
43
|
miniMetadata: MiniMetadata<MiniMetadataExtra>;
|
45
44
|
cache: Record<TokenId, unknown>;
|
46
|
-
} : {
|
47
|
-
networkId:
|
45
|
+
} : TokenPlatform<Type> extends "ethereum" ? {
|
46
|
+
networkId: EthNetworkId;
|
48
47
|
tokens: TokenConfig[];
|
49
|
-
connector:
|
48
|
+
connector: ChainConnectorEvm;
|
50
49
|
cache: Record<TokenId, unknown>;
|
51
|
-
}) => Promise<TokenOfType<Type>[]>;
|
50
|
+
} : never) => Promise<TokenOfType<Type>[]>;
|
52
51
|
fetchBalances: (arg: TokenPlatform<Type> extends "polkadot" ? {
|
53
52
|
networkId: DotNetworkId;
|
54
53
|
tokensWithAddresses: TokensWithAddresses;
|
55
|
-
connector:
|
54
|
+
connector: ChainConnector;
|
56
55
|
miniMetadata: MiniMetadata<MiniMetadataExtra>;
|
57
|
-
} : {
|
56
|
+
} : TokenPlatform<Type> extends "ethereum" ? {
|
58
57
|
networkId: EthNetworkId;
|
59
58
|
tokensWithAddresses: TokensWithAddresses;
|
60
|
-
connector:
|
61
|
-
}) => Promise<FetchBalanceResults>;
|
59
|
+
connector: ChainConnectorEvm;
|
60
|
+
} : never) => Promise<FetchBalanceResults>;
|
62
61
|
subscribeBalances: (arg: TokenPlatform<Type> extends "polkadot" ? {
|
63
62
|
networkId: DotNetworkId;
|
64
63
|
tokensWithAddresses: TokensWithAddresses;
|
65
|
-
connector:
|
64
|
+
connector: ChainConnector;
|
66
65
|
miniMetadata: MiniMetadata<MiniMetadataExtra>;
|
67
|
-
} : {
|
66
|
+
} : TokenPlatform<Type> extends "ethereum" ? {
|
68
67
|
networkId: EthNetworkId;
|
69
68
|
tokensWithAddresses: TokensWithAddresses;
|
70
|
-
connector:
|
71
|
-
}) => Observable<FetchBalanceResults>;
|
69
|
+
connector: ChainConnectorEvm;
|
70
|
+
} : never) => Observable<FetchBalanceResults>;
|
72
71
|
getTransferCallData: (arg: TokenPlatform<Type> extends "polkadot" ? {
|
73
72
|
from: string;
|
74
73
|
to: string;
|
@@ -76,19 +75,13 @@ export interface IBalanceModule<Type extends TokenType, TokenConfig = unknown, M
|
|
76
75
|
token: Token;
|
77
76
|
metadataRpc: `0x${string}`;
|
78
77
|
type: BalanceTransferType;
|
79
|
-
connector:
|
78
|
+
connector: ChainConnector;
|
80
79
|
config?: ModuleConfig;
|
81
80
|
} : TokenPlatform<Type> extends "ethereum" ? {
|
82
81
|
from: string;
|
83
82
|
to: string;
|
84
83
|
value: string;
|
85
84
|
token: Token;
|
86
|
-
} : TokenPlatform<Type> extends "solana" ? {
|
87
|
-
from: string;
|
88
|
-
to: string;
|
89
|
-
value: string;
|
90
|
-
token: Token;
|
91
|
-
connector: PlatformConnector<TokenPlatform<Type>>;
|
92
85
|
} : never) => CallDataOf<TokenPlatform<Type>> | Promise<CallDataOf<TokenPlatform<Type>>>;
|
93
86
|
}
|
94
87
|
export {};
|
@@ -8,6 +8,10 @@ type FormattedAmount<GenericAmount extends AmountWithLabel<TLabel>, TLabel exten
|
|
8
8
|
export declare function excludeFromTransferableAmount(locks: Amount | FormattedAmount<LockedAmount<string>, string> | Array<FormattedAmount<LockedAmount<string>, string>>): bigint;
|
9
9
|
export declare function excludeFromFeePayableLocks(locks: Amount | LockedAmount<string> | Array<LockedAmount<string>>): Array<LockedAmount<string>>;
|
10
10
|
export declare function includeInTotalExtraAmount(extra?: FormattedAmount<ExtraAmount<string>, string> | Array<FormattedAmount<ExtraAmount<string>, string>>): bigint;
|
11
|
+
/**
|
12
|
+
* Have the importing library define its Token and BalanceJson enums (as a sum type of all plugins) and pass them into some
|
13
|
+
* internal global typescript context, which is then picked up on by this module.
|
14
|
+
*/
|
11
15
|
/** A utility type used to extract the underlying `BalanceType` of a specific source from a generalised `BalanceJson` */
|
12
16
|
export type NarrowBalanceType<S extends IBalance, P> = S extends {
|
13
17
|
source: P;
|
@@ -217,31 +221,6 @@ export declare class Balance {
|
|
217
221
|
"evm-erc20"?: undefined;
|
218
222
|
"evm-uniswapv2"?: undefined;
|
219
223
|
} | undefined;
|
220
|
-
} | {
|
221
|
-
id: string;
|
222
|
-
name: string;
|
223
|
-
nativeTokenId: string;
|
224
|
-
nativeCurrency: {
|
225
|
-
decimals: number;
|
226
|
-
symbol: string;
|
227
|
-
name: string;
|
228
|
-
coingeckoId?: string | undefined;
|
229
|
-
mirrorOf?: string | undefined;
|
230
|
-
logo?: string | undefined;
|
231
|
-
};
|
232
|
-
blockExplorerUrls: string[];
|
233
|
-
platform: "solana";
|
234
|
-
genesisHash: string;
|
235
|
-
rpcs: string[];
|
236
|
-
isTestnet?: boolean | undefined;
|
237
|
-
isDefault?: boolean | undefined;
|
238
|
-
forceScan?: boolean | undefined;
|
239
|
-
logo?: string | undefined;
|
240
|
-
themeColor?: string | undefined;
|
241
|
-
balancesConfig?: {
|
242
|
-
"sol-native"?: undefined;
|
243
|
-
"sol-spl"?: undefined;
|
244
|
-
} | undefined;
|
245
224
|
} | null;
|
246
225
|
get tokenId(): string;
|
247
226
|
get token(): {
|
@@ -388,33 +367,6 @@ export declare class Balance {
|
|
388
367
|
coingeckoId?: string | undefined;
|
389
368
|
noDiscovery?: boolean | undefined;
|
390
369
|
mirrorOf?: string | undefined;
|
391
|
-
} | {
|
392
|
-
id: string;
|
393
|
-
networkId: string;
|
394
|
-
decimals: number;
|
395
|
-
symbol: string;
|
396
|
-
type: "sol-native";
|
397
|
-
platform: "solana";
|
398
|
-
isDefault?: boolean | undefined;
|
399
|
-
name?: string | undefined;
|
400
|
-
logo?: string | undefined;
|
401
|
-
coingeckoId?: string | undefined;
|
402
|
-
noDiscovery?: boolean | undefined;
|
403
|
-
mirrorOf?: string | undefined;
|
404
|
-
} | {
|
405
|
-
id: string;
|
406
|
-
networkId: string;
|
407
|
-
decimals: number;
|
408
|
-
symbol: string;
|
409
|
-
type: "sol-spl";
|
410
|
-
platform: "solana";
|
411
|
-
mintAddress: string;
|
412
|
-
isDefault?: boolean | undefined;
|
413
|
-
name?: string | undefined;
|
414
|
-
logo?: string | undefined;
|
415
|
-
coingeckoId?: string | undefined;
|
416
|
-
noDiscovery?: boolean | undefined;
|
417
|
-
mirrorOf?: string | undefined;
|
418
370
|
} | null;
|
419
371
|
get decimals(): number | null;
|
420
372
|
get rates(): TokenRates | null;
|
@@ -68,4 +68,8 @@ export type ExtraAmount<TLabel extends string> = BaseAmountWithLabel<TLabel> & {
|
|
68
68
|
/** If set to true, this extra amount will be included in the calculation of the total amount of this balance. */
|
69
69
|
includeInTotal?: boolean;
|
70
70
|
};
|
71
|
+
/** Used by plugins to help define their custom `BalanceType` */
|
72
|
+
export type NewBalanceType<TModuleType extends string, TBalanceValueType extends "simple" | "complex"> = IBalanceBase & (TBalanceValueType extends "simple" ? IBalanceSimpleValues : IBalanceComplexValues) & {
|
73
|
+
source: TModuleType;
|
74
|
+
};
|
71
75
|
export {};
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { ChainConnector } from "@talismn/chain-connector";
|
2
|
+
import { ChainConnectorEvm } from "@talismn/chain-connector-evm";
|
2
3
|
export type ChainConnectors = {
|
3
|
-
substrate?:
|
4
|
-
evm?:
|
5
|
-
solana?: IChainConnectorSol;
|
4
|
+
substrate?: ChainConnector;
|
5
|
+
evm?: ChainConnectorEvm;
|
6
6
|
};
|