@talismn/balances 0.0.0-pr2043-20250629051139 → 0.0.0-pr2043-20250629090111
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.
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ChainConnector } from "@talismn/chain-connector";
|
2
2
|
import { ChainConnectorEvm } from "@talismn/chain-connector-evm";
|
3
|
-
import { ChaindataProvider,
|
3
|
+
import { ChaindataProvider, DotNetworkId, EthNetworkId, Token } from "@talismn/chaindata-provider";
|
4
4
|
import { AddressesByToken, BalanceJson, Balances, SubscriptionCallback, UnsubscribeFn } from "./types";
|
5
5
|
export type ChainMeta<Extra extends Record<string, unknown> | null> = {
|
6
6
|
miniMetadata: `0x${string}` | null;
|
@@ -51,15 +51,15 @@ export interface BalanceModule<TModuleType extends string, TTokenType extends Se
|
|
51
51
|
export declare const DefaultBalanceModule: <TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTokenConfig extends ExtendableTokenConfig = DefaultTokenConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams>(type: TModuleType) => BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTokenConfig, TTransferParams>;
|
52
52
|
interface BalanceModuleSubstrate<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta, TModuleConfig extends ExtendableModuleConfig, TTokenConfig extends ExtendableTokenConfig, TTransferParams extends ExtendableTransferParams> extends BalanceModuleCommon<TModuleType, TTokenType, TTransferParams> {
|
53
53
|
/** Pre-processes any substrate chain metadata required by this module ahead of time */
|
54
|
-
fetchSubstrateChainMeta(chainId:
|
54
|
+
fetchSubstrateChainMeta(chainId: DotNetworkId, moduleConfig?: TModuleConfig, metadataRpc?: `0x${string}`): Promise<TChainMeta | null>;
|
55
55
|
/** Detects which tokens are available on a given substrate chain */
|
56
|
-
fetchSubstrateChainTokens(chainId:
|
56
|
+
fetchSubstrateChainTokens(chainId: DotNetworkId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig, tokens?: TTokenConfig[]): Promise<Record<TTokenType["id"], TTokenType>>;
|
57
57
|
}
|
58
58
|
interface BalanceModuleEvm<TModuleType extends string, TTokenType extends SelectableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTokenConfig extends ExtendableTokenConfig = DefaultTokenConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> extends BalanceModuleCommon<TModuleType, TTokenType, TTransferParams> {
|
59
59
|
/** Pre-processes any evm chain metadata required by this module ahead of time */
|
60
|
-
fetchEvmChainMeta(chainId:
|
60
|
+
fetchEvmChainMeta(chainId: EthNetworkId, moduleConfig?: TModuleConfig): Promise<TChainMeta | null>;
|
61
61
|
/** Detects which tokens are available on a given evm chain */
|
62
|
-
fetchEvmChainTokens(chainId:
|
62
|
+
fetchEvmChainTokens(chainId: EthNetworkId, chainMeta: TChainMeta, moduleConfig?: TModuleConfig, tokens?: TTokenConfig[]): Promise<Record<TTokenType["id"], TTokenType>>;
|
63
63
|
}
|
64
64
|
export type SubscriptionResultWithStatus = {
|
65
65
|
status: "initialising" | "live";
|
@@ -75,7 +75,7 @@ const DefaultBalanceModule = type => ({
|
|
75
75
|
|
76
76
|
var pkg = {
|
77
77
|
name: "@talismn/balances",
|
78
|
-
version: "0.0.0-pr2043-
|
78
|
+
version: "0.0.0-pr2043-20250629090111"};
|
79
79
|
|
80
80
|
var log = anylogger__default.default(pkg.name);
|
81
81
|
|
@@ -378,8 +378,7 @@ class Balance {
|
|
378
378
|
//
|
379
379
|
// This means that those rates are always available for calculating the uniswapv2 rates,
|
380
380
|
// regardless of whether or not the underlying erc20s are actually in chaindata and enabled.
|
381
|
-
if (this.isSource("evm-uniswapv2") && this.token?.type === "evm-uniswapv2"
|
382
|
-
) {
|
381
|
+
if (this.isSource("evm-uniswapv2") && this.token?.type === "evm-uniswapv2") {
|
383
382
|
const tokenId0 = chaindataProvider.evmErc20TokenId(this.networkId, this.token.tokenAddress0);
|
384
383
|
const tokenId1 = chaindataProvider.evmErc20TokenId(this.networkId, this.token.tokenAddress1);
|
385
384
|
const decimals = this.token.decimals;
|
@@ -4666,7 +4665,6 @@ class QueryCache {
|
|
4666
4665
|
}
|
4667
4666
|
|
4668
4667
|
// build queries for token/address pairs which have not been queried before
|
4669
|
-
// const miniMetadatas = await firstValueFrom(commonMetadataObservable)
|
4670
4668
|
const uniqueChainIds = lodash.keys(byNetwork); // getUniqueChainIds(queryResults.newAddressesByToken, tokens)
|
4671
4669
|
const chainStorageCoders = buildStorageCoders({
|
4672
4670
|
chainIds: uniqueChainIds,
|
@@ -75,7 +75,7 @@ const DefaultBalanceModule = type => ({
|
|
75
75
|
|
76
76
|
var pkg = {
|
77
77
|
name: "@talismn/balances",
|
78
|
-
version: "0.0.0-pr2043-
|
78
|
+
version: "0.0.0-pr2043-20250629090111"};
|
79
79
|
|
80
80
|
var log = anylogger__default.default(pkg.name);
|
81
81
|
|
@@ -378,8 +378,7 @@ class Balance {
|
|
378
378
|
//
|
379
379
|
// This means that those rates are always available for calculating the uniswapv2 rates,
|
380
380
|
// regardless of whether or not the underlying erc20s are actually in chaindata and enabled.
|
381
|
-
if (this.isSource("evm-uniswapv2") && this.token?.type === "evm-uniswapv2"
|
382
|
-
) {
|
381
|
+
if (this.isSource("evm-uniswapv2") && this.token?.type === "evm-uniswapv2") {
|
383
382
|
const tokenId0 = chaindataProvider.evmErc20TokenId(this.networkId, this.token.tokenAddress0);
|
384
383
|
const tokenId1 = chaindataProvider.evmErc20TokenId(this.networkId, this.token.tokenAddress1);
|
385
384
|
const decimals = this.token.decimals;
|
@@ -4666,7 +4665,6 @@ class QueryCache {
|
|
4666
4665
|
}
|
4667
4666
|
|
4668
4667
|
// build queries for token/address pairs which have not been queried before
|
4669
|
-
// const miniMetadatas = await firstValueFrom(commonMetadataObservable)
|
4670
4668
|
const uniqueChainIds = lodash.keys(byNetwork); // getUniqueChainIds(queryResults.newAddressesByToken, tokens)
|
4671
4669
|
const chainStorageCoders = buildStorageCoders({
|
4672
4670
|
chainIds: uniqueChainIds,
|
@@ -61,7 +61,7 @@ const DefaultBalanceModule = type => ({
|
|
61
61
|
|
62
62
|
var pkg = {
|
63
63
|
name: "@talismn/balances",
|
64
|
-
version: "0.0.0-pr2043-
|
64
|
+
version: "0.0.0-pr2043-20250629090111"};
|
65
65
|
|
66
66
|
var log = anylogger(pkg.name);
|
67
67
|
|
@@ -364,8 +364,7 @@ class Balance {
|
|
364
364
|
//
|
365
365
|
// This means that those rates are always available for calculating the uniswapv2 rates,
|
366
366
|
// regardless of whether or not the underlying erc20s are actually in chaindata and enabled.
|
367
|
-
if (this.isSource("evm-uniswapv2") && this.token?.type === "evm-uniswapv2"
|
368
|
-
) {
|
367
|
+
if (this.isSource("evm-uniswapv2") && this.token?.type === "evm-uniswapv2") {
|
369
368
|
const tokenId0 = evmErc20TokenId(this.networkId, this.token.tokenAddress0);
|
370
369
|
const tokenId1 = evmErc20TokenId(this.networkId, this.token.tokenAddress1);
|
371
370
|
const decimals = this.token.decimals;
|
@@ -4652,7 +4651,6 @@ class QueryCache {
|
|
4652
4651
|
}
|
4653
4652
|
|
4654
4653
|
// build queries for token/address pairs which have not been queried before
|
4655
|
-
// const miniMetadatas = await firstValueFrom(commonMetadataObservable)
|
4656
4654
|
const uniqueChainIds = keys(byNetwork); // getUniqueChainIds(queryResults.newAddressesByToken, tokens)
|
4657
4655
|
const chainStorageCoders = buildStorageCoders({
|
4658
4656
|
chainIds: uniqueChainIds,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@talismn/balances",
|
3
|
-
"version": "0.0.0-pr2043-
|
3
|
+
"version": "0.0.0-pr2043-20250629090111",
|
4
4
|
"author": "Talisman",
|
5
5
|
"homepage": "https://talisman.xyz",
|
6
6
|
"license": "GPL-3.0-or-later",
|
@@ -35,13 +35,13 @@
|
|
35
35
|
"scale-ts": "^1.6.1",
|
36
36
|
"viem": "^2.27.3",
|
37
37
|
"zod": "^3.25.62",
|
38
|
-
"@talismn/chain-connector-evm": "0.0.0-pr2043-
|
39
|
-
"@talismn/
|
40
|
-
"@talismn/sapi": "0.0.0-pr2043-
|
38
|
+
"@talismn/chain-connector-evm": "0.0.0-pr2043-20250629090111",
|
39
|
+
"@talismn/chain-connector": "0.0.0-pr2043-20250629090111",
|
40
|
+
"@talismn/sapi": "0.0.0-pr2043-20250629090111",
|
41
|
+
"@talismn/chaindata-provider": "0.0.0-pr2043-20250629090111",
|
41
42
|
"@talismn/scale": "0.1.2",
|
42
|
-
"@talismn/token-rates": "0.0.0-pr2043-
|
43
|
-
"@talismn/util": "0.0.0-pr2043-
|
44
|
-
"@talismn/chain-connector": "0.0.0-pr2043-20250629051139"
|
43
|
+
"@talismn/token-rates": "0.0.0-pr2043-20250629090111",
|
44
|
+
"@talismn/util": "0.0.0-pr2043-20250629090111"
|
45
45
|
},
|
46
46
|
"devDependencies": {
|
47
47
|
"@polkadot/api-contract": "16.1.2",
|
@@ -56,8 +56,8 @@
|
|
56
56
|
"jest": "^29.7.0",
|
57
57
|
"ts-jest": "^29.2.5",
|
58
58
|
"typescript": "^5.6.3",
|
59
|
-
"@talismn/
|
60
|
-
"@talismn/
|
59
|
+
"@talismn/tsconfig": "0.0.2",
|
60
|
+
"@talismn/eslint-config": "0.0.3"
|
61
61
|
},
|
62
62
|
"peerDependencies": {
|
63
63
|
"@polkadot/api-contract": "*",
|