@keplr-wallet/stores 0.12.300-rc.0 → 0.12.304

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