@talismn/balances 0.0.0-pr2043-20250623151554 → 0.0.0-pr2043-20250623165247

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 +1 @@
1
- export declare const sortChains: (a: string, b: string) => 0 | 1 | -1;
1
+ export declare const sortChainsNativeTokensByPriority: (a: string, b: string) => 0 | 1 | -1;
@@ -243,7 +243,6 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
243
243
  symbol: string;
244
244
  type: "substrate-psp22";
245
245
  platform: "polkadot";
246
- existentialDeposit: string;
247
246
  contractAddress: string;
248
247
  isDefault?: boolean | undefined;
249
248
  name?: string | undefined;
@@ -324,7 +324,6 @@ export declare class Balance {
324
324
  symbol: string;
325
325
  type: "substrate-psp22";
326
326
  platform: "polkadot";
327
- existentialDeposit: string;
328
327
  contractAddress: string;
329
328
  isDefault?: boolean | undefined;
330
329
  name?: string | undefined;
@@ -126,7 +126,7 @@ class EvmTokenFetcher {
126
126
 
127
127
  var pkg = {
128
128
  name: "@talismn/balances",
129
- version: "0.0.0-pr2043-20250623151554"};
129
+ version: "0.0.0-pr2043-20250623165247"};
130
130
 
131
131
  var log = anylogger__default.default(pkg.name);
132
132
 
@@ -4760,14 +4760,11 @@ class QueryCache {
4760
4760
  }
4761
4761
  }
4762
4762
 
4763
- const RELAY_TOKENS = ["polkadot-substrate-native", "kusama-substrate-native"];
4764
- const PUBLIC_GOODS_TOKENS = ["polkadot-asset-hub-substrate-native", "kusama-asset-hub-substrate-native"];
4765
- const sortChains = (a, b) => {
4763
+ const IMPORTANT_TOKENS = [chaindataProvider.subNativeTokenId("polkadot"), chaindataProvider.subNativeTokenId("kusama"), chaindataProvider.subNativeTokenId("polkadot-asset-hub"), chaindataProvider.subNativeTokenId("kusama-asset-hub"), chaindataProvider.subNativeTokenId("bittensor")];
4764
+ const sortChainsNativeTokensByPriority = (a, b) => {
4766
4765
  // polkadot and kusama should be checked first
4767
- if (RELAY_TOKENS.includes(a)) return -1;
4768
- if (RELAY_TOKENS.includes(b)) return 1;
4769
- if (PUBLIC_GOODS_TOKENS.includes(a)) return -1;
4770
- if (PUBLIC_GOODS_TOKENS.includes(b)) return 1;
4766
+ if (IMPORTANT_TOKENS.includes(a)) return -1;
4767
+ if (IMPORTANT_TOKENS.includes(b)) return 1;
4771
4768
  return 0;
4772
4769
  };
4773
4770
 
@@ -4833,7 +4830,7 @@ const SubNativeModule = hydrate => {
4833
4830
  const positiveBalanceTokens = subNativeBalances.pipe(rxjs.map(balances => Array.from(new Set(Object.values(balances).map(b => b.tokenId)))), rxjs.share());
4834
4831
 
4835
4832
  // tokens that will be subscribed to, simply a slice of the positive balance tokens of size MAX_SUBSCRIPTION_SIZE
4836
- const subscriptionTokens = positiveBalanceTokens.pipe(rxjs.map(tokens => tokens.sort(sortChains).slice(0, MAX_SUBSCRIPTION_SIZE)));
4833
+ const subscriptionTokens = positiveBalanceTokens.pipe(rxjs.map(tokens => tokens.sort(sortChainsNativeTokensByPriority).slice(0, MAX_SUBSCRIPTION_SIZE)));
4837
4834
 
4838
4835
  // an initialised balance is one where we have received a response for any type of 'subsource',
4839
4836
  // until then they are initialising. We only need to maintain one map of tokens to addresses for this
@@ -4962,7 +4959,7 @@ const SubNativeModule = hydrate => {
4962
4959
  // do one poll to get things started
4963
4960
  const currentBalances = subNativeBalances.getValue();
4964
4961
  const currentTokens = new Set(Object.values(currentBalances).map(b => b.tokenId));
4965
- const nonCurrentTokens = Object.keys(addressesByToken).filter(tokenId => !currentTokens.has(tokenId)).sort(sortChains);
4962
+ const nonCurrentTokens = Object.keys(addressesByToken).filter(tokenId => !currentTokens.has(tokenId)).sort(sortChainsNativeTokensByPriority);
4966
4963
 
4967
4964
  // break nonCurrentTokens into chunks of POLLING_WINDOW_SIZE
4968
4965
  const pool = new PQueue__default.default({
@@ -6430,8 +6427,7 @@ const SubPsp22Module = hydrate => {
6430
6427
  name: tokenConfig?.name || symbol,
6431
6428
  logo: tokenConfig?.logo,
6432
6429
  contractAddress,
6433
- networkId: chainId,
6434
- existentialDeposit: "0" // TODO: Discuss if this is needed for PSP22 tokens
6430
+ networkId: chainId
6435
6431
  };
6436
6432
  if (tokenConfig?.coingeckoId) token.coingeckoId = tokenConfig?.coingeckoId;
6437
6433
  if (tokenConfig?.mirrorOf) token.mirrorOf = tokenConfig?.mirrorOf;
@@ -126,7 +126,7 @@ class EvmTokenFetcher {
126
126
 
127
127
  var pkg = {
128
128
  name: "@talismn/balances",
129
- version: "0.0.0-pr2043-20250623151554"};
129
+ version: "0.0.0-pr2043-20250623165247"};
130
130
 
131
131
  var log = anylogger__default.default(pkg.name);
132
132
 
@@ -4760,14 +4760,11 @@ class QueryCache {
4760
4760
  }
4761
4761
  }
4762
4762
 
4763
- const RELAY_TOKENS = ["polkadot-substrate-native", "kusama-substrate-native"];
4764
- const PUBLIC_GOODS_TOKENS = ["polkadot-asset-hub-substrate-native", "kusama-asset-hub-substrate-native"];
4765
- const sortChains = (a, b) => {
4763
+ const IMPORTANT_TOKENS = [chaindataProvider.subNativeTokenId("polkadot"), chaindataProvider.subNativeTokenId("kusama"), chaindataProvider.subNativeTokenId("polkadot-asset-hub"), chaindataProvider.subNativeTokenId("kusama-asset-hub"), chaindataProvider.subNativeTokenId("bittensor")];
4764
+ const sortChainsNativeTokensByPriority = (a, b) => {
4766
4765
  // polkadot and kusama should be checked first
4767
- if (RELAY_TOKENS.includes(a)) return -1;
4768
- if (RELAY_TOKENS.includes(b)) return 1;
4769
- if (PUBLIC_GOODS_TOKENS.includes(a)) return -1;
4770
- if (PUBLIC_GOODS_TOKENS.includes(b)) return 1;
4766
+ if (IMPORTANT_TOKENS.includes(a)) return -1;
4767
+ if (IMPORTANT_TOKENS.includes(b)) return 1;
4771
4768
  return 0;
4772
4769
  };
4773
4770
 
@@ -4833,7 +4830,7 @@ const SubNativeModule = hydrate => {
4833
4830
  const positiveBalanceTokens = subNativeBalances.pipe(rxjs.map(balances => Array.from(new Set(Object.values(balances).map(b => b.tokenId)))), rxjs.share());
4834
4831
 
4835
4832
  // tokens that will be subscribed to, simply a slice of the positive balance tokens of size MAX_SUBSCRIPTION_SIZE
4836
- const subscriptionTokens = positiveBalanceTokens.pipe(rxjs.map(tokens => tokens.sort(sortChains).slice(0, MAX_SUBSCRIPTION_SIZE)));
4833
+ const subscriptionTokens = positiveBalanceTokens.pipe(rxjs.map(tokens => tokens.sort(sortChainsNativeTokensByPriority).slice(0, MAX_SUBSCRIPTION_SIZE)));
4837
4834
 
4838
4835
  // an initialised balance is one where we have received a response for any type of 'subsource',
4839
4836
  // until then they are initialising. We only need to maintain one map of tokens to addresses for this
@@ -4962,7 +4959,7 @@ const SubNativeModule = hydrate => {
4962
4959
  // do one poll to get things started
4963
4960
  const currentBalances = subNativeBalances.getValue();
4964
4961
  const currentTokens = new Set(Object.values(currentBalances).map(b => b.tokenId));
4965
- const nonCurrentTokens = Object.keys(addressesByToken).filter(tokenId => !currentTokens.has(tokenId)).sort(sortChains);
4962
+ const nonCurrentTokens = Object.keys(addressesByToken).filter(tokenId => !currentTokens.has(tokenId)).sort(sortChainsNativeTokensByPriority);
4966
4963
 
4967
4964
  // break nonCurrentTokens into chunks of POLLING_WINDOW_SIZE
4968
4965
  const pool = new PQueue__default.default({
@@ -6430,8 +6427,7 @@ const SubPsp22Module = hydrate => {
6430
6427
  name: tokenConfig?.name || symbol,
6431
6428
  logo: tokenConfig?.logo,
6432
6429
  contractAddress,
6433
- networkId: chainId,
6434
- existentialDeposit: "0" // TODO: Discuss if this is needed for PSP22 tokens
6430
+ networkId: chainId
6435
6431
  };
6436
6432
  if (tokenConfig?.coingeckoId) token.coingeckoId = tokenConfig?.coingeckoId;
6437
6433
  if (tokenConfig?.mirrorOf) token.mirrorOf = tokenConfig?.mirrorOf;
@@ -112,7 +112,7 @@ class EvmTokenFetcher {
112
112
 
113
113
  var pkg = {
114
114
  name: "@talismn/balances",
115
- version: "0.0.0-pr2043-20250623151554"};
115
+ version: "0.0.0-pr2043-20250623165247"};
116
116
 
117
117
  var log = anylogger(pkg.name);
118
118
 
@@ -4746,14 +4746,11 @@ class QueryCache {
4746
4746
  }
4747
4747
  }
4748
4748
 
4749
- const RELAY_TOKENS = ["polkadot-substrate-native", "kusama-substrate-native"];
4750
- const PUBLIC_GOODS_TOKENS = ["polkadot-asset-hub-substrate-native", "kusama-asset-hub-substrate-native"];
4751
- const sortChains = (a, b) => {
4749
+ const IMPORTANT_TOKENS = [subNativeTokenId("polkadot"), subNativeTokenId("kusama"), subNativeTokenId("polkadot-asset-hub"), subNativeTokenId("kusama-asset-hub"), subNativeTokenId("bittensor")];
4750
+ const sortChainsNativeTokensByPriority = (a, b) => {
4752
4751
  // polkadot and kusama should be checked first
4753
- if (RELAY_TOKENS.includes(a)) return -1;
4754
- if (RELAY_TOKENS.includes(b)) return 1;
4755
- if (PUBLIC_GOODS_TOKENS.includes(a)) return -1;
4756
- if (PUBLIC_GOODS_TOKENS.includes(b)) return 1;
4752
+ if (IMPORTANT_TOKENS.includes(a)) return -1;
4753
+ if (IMPORTANT_TOKENS.includes(b)) return 1;
4757
4754
  return 0;
4758
4755
  };
4759
4756
 
@@ -4819,7 +4816,7 @@ const SubNativeModule = hydrate => {
4819
4816
  const positiveBalanceTokens = subNativeBalances.pipe(map(balances => Array.from(new Set(Object.values(balances).map(b => b.tokenId)))), share());
4820
4817
 
4821
4818
  // tokens that will be subscribed to, simply a slice of the positive balance tokens of size MAX_SUBSCRIPTION_SIZE
4822
- const subscriptionTokens = positiveBalanceTokens.pipe(map(tokens => tokens.sort(sortChains).slice(0, MAX_SUBSCRIPTION_SIZE)));
4819
+ const subscriptionTokens = positiveBalanceTokens.pipe(map(tokens => tokens.sort(sortChainsNativeTokensByPriority).slice(0, MAX_SUBSCRIPTION_SIZE)));
4823
4820
 
4824
4821
  // an initialised balance is one where we have received a response for any type of 'subsource',
4825
4822
  // until then they are initialising. We only need to maintain one map of tokens to addresses for this
@@ -4948,7 +4945,7 @@ const SubNativeModule = hydrate => {
4948
4945
  // do one poll to get things started
4949
4946
  const currentBalances = subNativeBalances.getValue();
4950
4947
  const currentTokens = new Set(Object.values(currentBalances).map(b => b.tokenId));
4951
- const nonCurrentTokens = Object.keys(addressesByToken).filter(tokenId => !currentTokens.has(tokenId)).sort(sortChains);
4948
+ const nonCurrentTokens = Object.keys(addressesByToken).filter(tokenId => !currentTokens.has(tokenId)).sort(sortChainsNativeTokensByPriority);
4952
4949
 
4953
4950
  // break nonCurrentTokens into chunks of POLLING_WINDOW_SIZE
4954
4951
  const pool = new PQueue({
@@ -6416,8 +6413,7 @@ const SubPsp22Module = hydrate => {
6416
6413
  name: tokenConfig?.name || symbol,
6417
6414
  logo: tokenConfig?.logo,
6418
6415
  contractAddress,
6419
- networkId: chainId,
6420
- existentialDeposit: "0" // TODO: Discuss if this is needed for PSP22 tokens
6416
+ networkId: chainId
6421
6417
  };
6422
6418
  if (tokenConfig?.coingeckoId) token.coingeckoId = tokenConfig?.coingeckoId;
6423
6419
  if (tokenConfig?.mirrorOf) token.mirrorOf = tokenConfig?.mirrorOf;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/balances",
3
- "version": "0.0.0-pr2043-20250623151554",
3
+ "version": "0.0.0-pr2043-20250623165247",
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-20250623151554",
39
- "@talismn/chain-connector": "0.0.0-pr2043-20250623151554",
40
- "@talismn/chaindata-provider": "0.0.0-pr2043-20250623151554",
41
- "@talismn/sapi": "0.0.0-pr2043-20250623151554",
38
+ "@talismn/chain-connector": "0.0.0-pr2043-20250623165247",
39
+ "@talismn/chain-connector-evm": "0.0.0-pr2043-20250623165247",
40
+ "@talismn/chaindata-provider": "0.0.0-pr2043-20250623165247",
42
41
  "@talismn/scale": "0.1.2",
43
- "@talismn/util": "0.0.0-pr2043-20250623151554",
44
- "@talismn/token-rates": "0.0.0-pr2043-20250623151554"
42
+ "@talismn/sapi": "0.0.0-pr2043-20250623165247",
43
+ "@talismn/token-rates": "0.0.0-pr2043-20250623165247",
44
+ "@talismn/util": "0.0.0-pr2043-20250623165247"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@polkadot/api-contract": "16.1.2",