@keplr-wallet/stores 0.12.298 → 0.12.300-rc.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.
Files changed (103) hide show
  1. package/build/account/babylon.js +19 -7
  2. package/build/account/babylon.js.map +1 -1
  3. package/build/account/base.js +7 -5
  4. package/build/account/base.js.map +1 -1
  5. package/build/account/cosmos.js +97 -54
  6. package/build/account/cosmos.js.map +1 -1
  7. package/build/account/cosmwasm.js +10 -2
  8. package/build/account/cosmwasm.js.map +1 -1
  9. package/build/account/secret.js +10 -2
  10. package/build/account/secret.js.map +1 -1
  11. package/build/account/store.js +4 -4
  12. package/build/account/store.js.map +1 -1
  13. package/build/chain/base.d.ts +122 -1
  14. package/build/chain/base.js +601 -40
  15. package/build/chain/base.js.map +1 -1
  16. package/build/chain/types.d.ts +27 -1
  17. package/build/common/utils/index.d.ts +2 -2
  18. package/build/common/utils/index.js.map +1 -1
  19. package/build/lsm/currency-registrar.js +7 -7
  20. package/build/lsm/currency-registrar.js.map +1 -1
  21. package/build/query/balances.js +24 -11
  22. package/build/query/balances.js.map +1 -1
  23. package/build/query/chain-query.js +2 -2
  24. package/build/query/chain-query.js.map +1 -1
  25. package/build/query/chain-rpc-query.js +2 -2
  26. package/build/query/chain-rpc-query.js.map +1 -1
  27. package/build/query/cosmos/balance/balances.js +8 -4
  28. package/build/query/cosmos/balance/balances.js.map +1 -1
  29. package/build/query/cosmos/balance/spendable.js +3 -2
  30. package/build/query/cosmos/balance/spendable.js.map +1 -1
  31. package/build/query/cosmos/ibc/channel.js +3 -2
  32. package/build/query/cosmos/ibc/channel.js.map +1 -1
  33. package/build/query/cosmos/ibc/client-state.js +2 -2
  34. package/build/query/cosmos/ibc/client-state.js.map +1 -1
  35. package/build/query/cosmos/ibc/denom-trace.js +6 -8
  36. package/build/query/cosmos/ibc/denom-trace.js.map +1 -1
  37. package/build/query/cosmos/staking/babylon-btc-delegation-reward.js +3 -2
  38. package/build/query/cosmos/staking/babylon-btc-delegation-reward.js.map +1 -1
  39. package/build/query/cosmos/staking/delegations.js +5 -4
  40. package/build/query/cosmos/staking/delegations.js.map +1 -1
  41. package/build/query/cosmos/staking/initia-delegations.js +8 -6
  42. package/build/query/cosmos/staking/initia-delegations.js.map +1 -1
  43. package/build/query/cosmos/staking/initia-unbonding-delegations.js +6 -5
  44. package/build/query/cosmos/staking/initia-unbonding-delegations.js.map +1 -1
  45. package/build/query/cosmos/staking/initia-validators.js +3 -3
  46. package/build/query/cosmos/staking/initia-validators.js.map +1 -1
  47. package/build/query/cosmos/staking/pool.js +3 -3
  48. package/build/query/cosmos/staking/pool.js.map +1 -1
  49. package/build/query/cosmos/staking/rewards.js +13 -10
  50. package/build/query/cosmos/staking/rewards.js.map +1 -1
  51. package/build/query/cosmos/staking/unbonding-delegations.js +3 -3
  52. package/build/query/cosmos/staking/unbonding-delegations.js.map +1 -1
  53. package/build/query/cosmos/staking/validators.js +2 -3
  54. package/build/query/cosmos/staking/validators.js.map +1 -1
  55. package/build/query/cosmwasm/contract-query.js +2 -2
  56. package/build/query/cosmwasm/contract-query.js.map +1 -1
  57. package/build/query/cosmwasm/cw20-balance.js +7 -4
  58. package/build/query/cosmwasm/cw20-balance.js.map +1 -1
  59. package/build/query/cosmwasm/neutron/staking-rewards.js +10 -8
  60. package/build/query/cosmwasm/neutron/staking-rewards.js.map +1 -1
  61. package/build/query/noble/swap/simulate-swap.js +1 -1
  62. package/build/query/noble/swap/simulate-swap.js.map +1 -1
  63. package/build/query/osmosis/txfees/fee-tokens/index.js +8 -4
  64. package/build/query/osmosis/txfees/fee-tokens/index.js.map +1 -1
  65. package/build/query/secret-wasm/secret20-balance.js +7 -5
  66. package/build/query/secret-wasm/secret20-balance.js.map +1 -1
  67. package/build/token-factory/currency-registrar.js +1 -1
  68. package/build/token-factory/currency-registrar.js.map +1 -1
  69. package/package.json +11 -11
  70. package/src/account/babylon.ts +21 -7
  71. package/src/account/base.ts +7 -5
  72. package/src/account/cosmos.ts +125 -66
  73. package/src/account/cosmwasm.ts +12 -3
  74. package/src/account/secret.ts +12 -3
  75. package/src/account/store.ts +4 -4
  76. package/src/chain/base.ts +816 -34
  77. package/src/chain/types.ts +27 -1
  78. package/src/common/utils/index.ts +2 -2
  79. package/src/lsm/currency-registrar.ts +9 -7
  80. package/src/query/balances.ts +30 -13
  81. package/src/query/chain-query.ts +6 -2
  82. package/src/query/chain-rpc-query.ts +6 -2
  83. package/src/query/cosmos/balance/balances.ts +8 -4
  84. package/src/query/cosmos/balance/spendable.ts +3 -3
  85. package/src/query/cosmos/ibc/channel.ts +5 -2
  86. package/src/query/cosmos/ibc/client-state.ts +2 -2
  87. package/src/query/cosmos/ibc/denom-trace.ts +7 -7
  88. package/src/query/cosmos/staking/babylon-btc-delegation-reward.ts +5 -2
  89. package/src/query/cosmos/staking/delegations.ts +9 -4
  90. package/src/query/cosmos/staking/initia-delegations.ts +14 -7
  91. package/src/query/cosmos/staking/initia-unbonding-delegations.ts +12 -6
  92. package/src/query/cosmos/staking/initia-validators.ts +5 -3
  93. package/src/query/cosmos/staking/pool.ts +3 -3
  94. package/src/query/cosmos/staking/rewards.ts +13 -10
  95. package/src/query/cosmos/staking/unbonding-delegations.ts +7 -3
  96. package/src/query/cosmos/staking/validators.ts +4 -3
  97. package/src/query/cosmwasm/contract-query.ts +4 -2
  98. package/src/query/cosmwasm/cw20-balance.ts +8 -5
  99. package/src/query/cosmwasm/neutron/staking-rewards.ts +10 -8
  100. package/src/query/noble/swap/simulate-swap.ts +1 -1
  101. package/src/query/osmosis/txfees/fee-tokens/index.ts +8 -4
  102. package/src/query/secret-wasm/secret20-balance.ts +7 -5
  103. package/src/token-factory/currency-registrar.ts +1 -1
@@ -96,7 +96,7 @@ export class ObservableQueryValidatorsInner extends ObservableChainQuery<Validat
96
96
  }
97
97
 
98
98
  protected override canFetch(): boolean {
99
- if (!this.chainGetter.getChain(this.chainId).stakeCurrency) {
99
+ if (!this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency) {
100
100
  return false;
101
101
  }
102
102
  return super.canFetch();
@@ -185,8 +185,9 @@ export class ObservableQueryValidatorsInner extends ObservableChainQuery<Validat
185
185
  return;
186
186
  }
187
187
 
188
- const chainInfo = this.chainGetter.getChain(this.chainId);
189
- const stakeCurrency = chainInfo.stakeCurrency;
188
+ const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
189
+ this.chainId
190
+ ).stakeCurrency;
190
191
 
191
192
  if (!stakeCurrency) {
192
193
  return;
@@ -30,8 +30,10 @@ export class ObservableCosmwasmContractChainQuery<
30
30
  super.onStart();
31
31
 
32
32
  this.disposer = autorun(() => {
33
- const chainInfo = this.chainGetter.getChain(this.chainId);
34
- if (chainInfo.features && chainInfo.features.includes("wasmd_0.24+")) {
33
+ const modularChainInfoImpl = this.chainGetter.getModularChainInfoImpl(
34
+ this.chainId
35
+ );
36
+ if (modularChainInfoImpl.hasFeature("wasmd_0.24+")) {
35
37
  if (this.url.startsWith("/wasm/v1/")) {
36
38
  this.setUrl(`/cosmwasm${this.url}`);
37
39
  }
@@ -35,10 +35,12 @@ export class ObservableQueryCw20BalanceImpl
35
35
  get balance(): CoinPretty {
36
36
  const denom = this.denomHelper.denom;
37
37
 
38
- const chainInfo = this.chainGetter.getChain(this.chainId);
39
- const currency = chainInfo.currencies.find(
40
- (cur) => cur.coinMinimalDenom === denom
38
+ const modularChainInfoImpl = this.chainGetter.getModularChainInfoImpl(
39
+ this.chainId
41
40
  );
41
+ const currency = modularChainInfoImpl
42
+ .getCurrencies()
43
+ .find((cur) => cur.coinMinimalDenom === denom);
42
44
 
43
45
  // TODO: Infer the currency according to its denom (such if denom is `uatom` -> `Atom` with decimal 6)?
44
46
  if (!currency) {
@@ -56,8 +58,9 @@ export class ObservableQueryCw20BalanceImpl
56
58
  get currency(): AppCurrency {
57
59
  const denom = this.denomHelper.denom;
58
60
 
59
- const chainInfo = this.chainGetter.getChain(this.chainId);
60
- return chainInfo.forceFindCurrency(denom);
61
+ return this.chainGetter
62
+ .getModularChainInfoImpl(this.chainId)
63
+ .forceFindCurrency(denom);
61
64
  }
62
65
  }
63
66
 
@@ -41,23 +41,24 @@ class ObservableQueryNeutronStakingRewardsInner extends ObservableCosmwasmContra
41
41
  @computed
42
42
  get pendingReward(): CoinPretty {
43
43
  if (!this.response?.data?.pending_rewards) {
44
- const chainInfo = this.chainGetter.getChain(this.chainId);
44
+ const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
45
45
  const defaultCurrency =
46
- chainInfo.stakeCurrency || chainInfo.currencies[0];
46
+ chainInfo.stakeCurrency || chainInfo.getCurrencies()[0];
47
47
 
48
48
  return new CoinPretty(defaultCurrency, new Int(0)).ready(false);
49
49
  }
50
50
 
51
51
  const reward = this.response.data.pending_rewards;
52
52
  if (!reward.denom || !reward.amount) {
53
- const chainInfo = this.chainGetter.getChain(this.chainId);
53
+ const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
54
54
  const defaultCurrency =
55
- chainInfo.stakeCurrency || chainInfo.currencies[0];
55
+ chainInfo.stakeCurrency || chainInfo.getCurrencies()[0];
56
56
 
57
57
  return new CoinPretty(defaultCurrency, new Int(0)).ready(false);
58
58
  }
59
- const chainInfo = this.chainGetter.getChain(this.chainId);
60
- const currency = chainInfo.forceFindCurrency(reward.denom);
59
+ const currency = this.chainGetter
60
+ .getModularChainInfoImpl(this.chainId)
61
+ .forceFindCurrency(reward.denom);
61
62
 
62
63
  return new CoinPretty(currency, new Int(reward.amount)).ready(
63
64
  !this.isFetching
@@ -73,8 +74,9 @@ class ObservableQueryNeutronStakingRewardsInner extends ObservableCosmwasmContra
73
74
  if (!reward.denom || !reward.amount) {
74
75
  return undefined;
75
76
  }
76
- const chainInfo = this.chainGetter.getChain(this.chainId);
77
- return chainInfo.findCurrency(reward.denom);
77
+ return this.chainGetter
78
+ .getModularChainInfoImpl(this.chainId)
79
+ .findCurrency(reward.denom);
78
80
  }
79
81
  }
80
82
 
@@ -72,7 +72,7 @@ export class ObservableQueryNobleSwapSimulateSwapInner extends ObservableChainQu
72
72
 
73
73
  return new CoinPretty(
74
74
  this.chainGetter
75
- .getChain(this.chainId)
75
+ .getModularChainInfoImpl(this.chainId)
76
76
  .forceFindCurrency(this.response.data.result.denom),
77
77
  this.response.data.result.amount
78
78
  );
@@ -27,9 +27,12 @@ export class ObservableQueryTxFeesFeeTokens extends ObservableChainQuery<FeeToke
27
27
  ) {
28
28
  super.onReceiveResponse(response);
29
29
 
30
- const chainInfo = this.chainGetter.getChain(this.chainId);
30
+ const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
31
31
  const denoms = response.data.fee_tokens.map((token) => token.denom);
32
- chainInfo.addUnknownDenoms(...denoms);
32
+ chainInfo.addUnknownDenoms({
33
+ module: "cosmos",
34
+ coinMinimalDenoms: denoms,
35
+ });
33
36
  }
34
37
 
35
38
  @computed
@@ -63,9 +66,10 @@ export class ObservableQueryTxFeesFeeTokens extends ObservableChainQuery<FeeToke
63
66
 
64
67
  const res: FeeCurrency[] = [];
65
68
 
66
- const chainInfo = this.chainGetter.getChain(this.chainId);
67
69
  for (const token of this.response.data.fee_tokens) {
68
- const currency = chainInfo.findCurrency(token.denom);
70
+ const currency = this.chainGetter
71
+ .getModularChainInfoImpl(this.chainId)
72
+ .findCurrency(token.denom);
69
73
  if (currency) {
70
74
  res.push(currency);
71
75
  }
@@ -33,7 +33,7 @@ export class ObservableQuerySecret20BalanceImpl
33
33
  throw new Error(`Denom helper must be secret20: ${denomHelper.denom}`);
34
34
  }
35
35
  const currency = chainGetter
36
- .getChain(chainId)
36
+ .getModularChainInfoImpl(chainId)
37
37
  .forceFindCurrency(denomHelper.denom);
38
38
  let viewingKey = "";
39
39
  if ("type" in currency && currency.type === "secret20") {
@@ -92,8 +92,9 @@ export class ObservableQuerySecret20BalanceImpl
92
92
  get balance(): CoinPretty {
93
93
  const denom = this.denomHelper.denom;
94
94
 
95
- const chainInfo = this.chainGetter.getChain(this.chainId);
96
- const currency = chainInfo.findCurrency(denom);
95
+ const currency = this.chainGetter
96
+ .getModularChainInfoImpl(this.chainId)
97
+ .findCurrency(denom);
97
98
 
98
99
  // TODO: Infer the currency according to its denom (such if denom is `uatom` -> `Atom` with decimal 6)?
99
100
  if (!currency) {
@@ -111,8 +112,9 @@ export class ObservableQuerySecret20BalanceImpl
111
112
  get currency(): AppCurrency {
112
113
  const denom = this.denomHelper.denom;
113
114
 
114
- const chainInfo = this.chainGetter.getChain(this.chainId);
115
- return chainInfo.forceFindCurrency(denom);
115
+ return this.chainGetter
116
+ .getModularChainInfoImpl(this.chainId)
117
+ .forceFindCurrency(denom);
116
118
  }
117
119
  }
118
120
 
@@ -72,7 +72,7 @@ export class TokenFactoryCurrencyRegistrar {
72
72
  return;
73
73
  }
74
74
 
75
- if (!this.chainStore.hasChain(chainId)) {
75
+ if (!this.chainStore.hasModularChain(chainId)) {
76
76
  return;
77
77
  }
78
78