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

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 +11 -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
@@ -198,14 +198,10 @@ export class CosmosAccountImpl {
198
198
  return dec.truncate().toString();
199
199
  })();
200
200
 
201
- const modularChainInfo = this.chainGetter.getModularChain(this.chainId);
202
- if (!("cosmos" in modularChainInfo)) {
203
- throw new Error("cosmos module is not supported on this chain");
204
- }
205
-
206
201
  Bech32Address.validate(
207
202
  recipient,
208
- modularChainInfo.cosmos.bech32Config?.bech32PrefixAccAddr
203
+ this.chainGetter.getChain(this.chainId).bech32Config
204
+ ?.bech32PrefixAccAddr
209
205
  );
210
206
 
211
207
  const isThorchain = this.chainId.startsWith("thorchain-");
@@ -346,13 +342,8 @@ export class CosmosAccountImpl {
346
342
  onBroadcasted(txHash);
347
343
  }
348
344
 
349
- const modularChainInfo = this.chainGetter.getModularChain(this.chainId);
350
- if (!("cosmos" in modularChainInfo)) {
351
- throw new Error("cosmos module is not supported on this chain");
352
- }
353
-
354
345
  const txTracer = new TendermintTxTracer(
355
- modularChainInfo.cosmos.rpc,
346
+ this.chainGetter.getChain(this.chainId).rpc,
356
347
  "/websocket",
357
348
  {
358
349
  wsObject: this.txOpts.wsObject,
@@ -428,19 +419,16 @@ export class CosmosAccountImpl {
428
419
  }
429
420
  }
430
421
 
431
- const modularChainInfo = this.chainGetter.getModularChain(this.chainId);
432
- if (!("cosmos" in modularChainInfo)) {
433
- throw new Error("cosmos module is not supported on this chain");
434
- }
435
-
436
422
  const account = await BaseAccount.fetchFromRest(
437
- modularChainInfo.cosmos.rest,
423
+ this.chainGetter.getChain(this.chainId).rest,
438
424
  this.base.bech32Address,
439
425
  true
440
426
  );
441
427
 
442
428
  const useEthereumSign =
443
- modularChainInfo.cosmos.features?.includes("eth-key-sign") === true;
429
+ this.chainGetter
430
+ .getChain(this.chainId)
431
+ .features?.includes("eth-key-sign") === true;
444
432
 
445
433
  const eip712Signing = useEthereumSign && this.base.isNanoLedger;
446
434
 
@@ -477,12 +465,12 @@ export class CosmosAccountImpl {
477
465
  memo: escapeHTML(memo),
478
466
  };
479
467
 
468
+ const chainInfo = this.chainGetter.getChain(this.chainId);
480
469
  const chainIsInjective = this.chainId.startsWith("injective");
481
470
  const chainIsStratos = this.chainId.startsWith("stratos");
482
471
  const ethSignPlainJson: boolean =
483
- !!modularChainInfo.cosmos.features?.includes(
484
- "evm-ledger-sign-plain-json"
485
- );
472
+ chainInfo.features &&
473
+ chainInfo.features.includes("evm-ledger-sign-plain-json");
486
474
 
487
475
  if (eip712Signing) {
488
476
  if (chainIsInjective) {
@@ -537,7 +525,10 @@ export class CosmosAccountImpl {
537
525
  return await experimentalSignEIP712CosmosTx_v0(
538
526
  this.chainId,
539
527
  this.base.bech32Address,
540
- getEip712TypedDataBasedOnChainInfo(modularChainInfo.cosmos, msgs),
528
+ getEip712TypedDataBasedOnChainInfo(
529
+ this.chainGetter.getChain(this.chainId),
530
+ msgs
531
+ ),
541
532
  signDoc,
542
533
  signOptions
543
534
  );
@@ -556,7 +547,7 @@ export class CosmosAccountImpl {
556
547
  {
557
548
  typeUrl: (() => {
558
549
  if (
559
- modularChainInfo.cosmos.features?.includes(
550
+ chainInfo.hasFeature(
560
551
  "/cosmos.evm.types.v1.ExtensionOptionsWeb3Tx"
561
552
  )
562
553
  ) {
@@ -607,19 +598,11 @@ export class CosmosAccountImpl {
607
598
  return "/stratos.crypto.v1.ethsecp256k1.PubKey";
608
599
  }
609
600
 
610
- if (
611
- modularChainInfo.cosmos.features?.includes(
612
- "eth-secp256k1-cosmos"
613
- )
614
- ) {
601
+ if (chainInfo.hasFeature("eth-secp256k1-cosmos")) {
615
602
  return "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey";
616
603
  }
617
604
 
618
- if (
619
- modularChainInfo.cosmos.features?.includes(
620
- "eth-secp256k1-initia"
621
- )
622
- ) {
605
+ if (chainInfo.hasFeature("eth-secp256k1-initia")) {
623
606
  return "/initia.crypto.v1beta1.ethsecp256k1.PubKey";
624
607
  }
625
608
 
@@ -688,10 +671,10 @@ export class CosmosAccountImpl {
688
671
  tx: Uint8Array;
689
672
  signDoc: SignDoc;
690
673
  }> {
691
- const modularChainInfoImpl = this.chainGetter.getModularChainInfoImpl(
692
- this.chainId
693
- );
694
- const useEthereumSign = modularChainInfoImpl.hasFeature("eth-key-sign");
674
+ const useEthereumSign =
675
+ this.chainGetter
676
+ .getChain(this.chainId)
677
+ .features?.includes("eth-key-sign") === true;
695
678
 
696
679
  const chainIsInjective = this.chainId.startsWith("injective");
697
680
  const chainIsStratos = this.chainId.startsWith("stratos");
@@ -729,10 +712,18 @@ export class CosmosAccountImpl {
729
712
  return "/stratos.crypto.v1.ethsecp256k1.PubKey";
730
713
  }
731
714
 
732
- if (modularChainInfoImpl.hasFeature("eth-secp256k1-cosmos")) {
715
+ if (
716
+ this.chainGetter
717
+ .getChain(this.chainId)
718
+ .hasFeature("eth-secp256k1-cosmos")
719
+ ) {
733
720
  return "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey";
734
721
  }
735
- if (modularChainInfoImpl.hasFeature("eth-secp256k1-initia")) {
722
+ if (
723
+ this.chainGetter
724
+ .getChain(this.chainId)
725
+ .hasFeature("eth-secp256k1-initia")
726
+ ) {
736
727
  return "/initia.crypto.v1beta1.ethsecp256k1.PubKey";
737
728
  }
738
729
  return "/ethermint.crypto.v1.ethsecp256k1.PubKey";
@@ -800,13 +791,8 @@ export class CosmosAccountImpl {
800
791
  ): Promise<{
801
792
  gasUsed: number;
802
793
  }> {
803
- const modularChainInfo = this.chainGetter.getModularChain(this.chainId);
804
- if (!("cosmos" in modularChainInfo)) {
805
- throw new Error("cosmos module is not supported on this chain");
806
- }
807
-
808
794
  const account = await BaseAccount.fetchFromRest(
809
- modularChainInfo.cosmos.rest,
795
+ this.chainGetter.getChain(this.chainId).rest,
810
796
  this.base.bech32Address,
811
797
  true
812
798
  );
@@ -846,7 +832,7 @@ export class CosmosAccountImpl {
846
832
 
847
833
  // TODO: Add response type
848
834
  const result = await simpleFetch<any>(
849
- modularChainInfo.cosmos.rest,
835
+ this.chainGetter.getChain(this.chainId).rest,
850
836
  "/cosmos/tx/v1beta1/simulate",
851
837
  {
852
838
  method: "POST",
@@ -1045,28 +1031,16 @@ export class CosmosAccountImpl {
1045
1031
  const destinationChainId =
1046
1032
  channels[channels.length - 1].counterpartyChainId;
1047
1033
 
1048
- const destinationChainInfo =
1049
- this.chainGetter.getModularChain(destinationChainId);
1050
-
1051
- if (!("cosmos" in destinationChainInfo)) {
1052
- throw new Error("cosmos module is not supported on this chain");
1053
- }
1034
+ const destinationChainInfo = this.chainGetter.getChain(destinationChainId);
1054
1035
 
1055
1036
  Bech32Address.validate(
1056
1037
  recipient,
1057
- destinationChainInfo.cosmos.bech32Config?.bech32PrefixAccAddr
1038
+ destinationChainInfo.bech32Config?.bech32PrefixAccAddr
1058
1039
  );
1059
1040
 
1060
- const counterpartyChainInfo = this.chainGetter.getModularChain(
1041
+ const counterpartyChainBech32Config = this.chainGetter.getChain(
1061
1042
  channels[0].counterpartyChainId
1062
- );
1063
- if (!("cosmos" in counterpartyChainInfo)) {
1064
- throw new Error("cosmos module is not supported on this chain");
1065
- }
1066
-
1067
- const counterpartyChainBech32Config =
1068
- counterpartyChainInfo.cosmos.bech32Config;
1069
-
1043
+ ).bech32Config;
1070
1044
  if (counterpartyChainBech32Config == null) {
1071
1045
  throw new Error("Counterparty chain bech32 config is not set");
1072
1046
  }
@@ -1077,15 +1051,18 @@ export class CosmosAccountImpl {
1077
1051
  currency,
1078
1052
  async () => {
1079
1053
  if (channels.length === 1) {
1080
- if (!counterpartyChainBech32Config) {
1054
+ const chainInfo = this.chainGetter.getChain(
1055
+ channels[0].counterpartyChainId
1056
+ );
1057
+ if (!chainInfo.bech32Config) {
1081
1058
  throw new Error("Bech32 config is not set");
1082
1059
  }
1083
1060
  return Bech32Address.fromBech32(recipient).toBech32(
1084
- counterpartyChainInfo.cosmos.bech32Config.bech32PrefixAccAddr
1061
+ chainInfo.bech32Config.bech32PrefixAccAddr
1085
1062
  );
1086
1063
  }
1087
1064
  const channel = channels[0];
1088
- const destChainInfo = this.chainGetter.getModularChain(
1065
+ const destChainInfo = this.chainGetter.getChain(
1089
1066
  channel.counterpartyChainId
1090
1067
  );
1091
1068
 
@@ -1123,20 +1100,15 @@ export class CosmosAccountImpl {
1123
1100
  for (let i = 0; i < loopChannels.length; i++) {
1124
1101
  const channel = loopChannels[i];
1125
1102
  if (i === loopChannels.length - 1) {
1126
- const chainInfo = this.chainGetter.getModularChain(
1103
+ const chainInfo = this.chainGetter.getChain(
1127
1104
  channel.counterpartyChainId
1128
1105
  );
1129
-
1130
- if (!("cosmos" in chainInfo)) {
1131
- throw new Error("cosmos module is not supported on this chain");
1132
- }
1133
-
1134
- if (!chainInfo.cosmos.bech32Config) {
1106
+ if (!chainInfo.bech32Config) {
1135
1107
  throw new Error("Bech32 config is not set");
1136
1108
  }
1137
1109
  Bech32Address.validate(
1138
1110
  recipient,
1139
- chainInfo.cosmos.bech32Config.bech32PrefixAccAddr
1111
+ chainInfo.bech32Config.bech32PrefixAccAddr
1140
1112
  );
1141
1113
  const forward = {
1142
1114
  receiver: recipient,
@@ -1155,7 +1127,7 @@ export class CosmosAccountImpl {
1155
1127
 
1156
1128
  lastForward = forward;
1157
1129
  } else {
1158
- const destChainInfo = this.chainGetter.getModularChain(
1130
+ const destChainInfo = this.chainGetter.getChain(
1159
1131
  channel.counterpartyChainId
1160
1132
  );
1161
1133
 
@@ -1283,9 +1255,10 @@ export class CosmosAccountImpl {
1283
1255
  );
1284
1256
  }
1285
1257
 
1286
- const useEthereumSign = this.chainGetter
1287
- .getModularChainInfoImpl(this.chainId)
1288
- .hasFeature("eth-key-sign");
1258
+ const useEthereumSign =
1259
+ this.chainGetter
1260
+ .getChain(this.chainId)
1261
+ .features?.includes("eth-key-sign") === true;
1289
1262
 
1290
1263
  const eip712Signing = useEthereumSign && this.base.isNanoLedger;
1291
1264
  const chainIsInjective = this.chainId.startsWith("injective");
@@ -1349,7 +1322,7 @@ export class CosmosAccountImpl {
1349
1322
  this.chainId.startsWith("injective") ||
1350
1323
  this.chainId.startsWith("stride") ||
1351
1324
  this.chainGetter
1352
- .getModularChainInfoImpl(this.chainId)
1325
+ .getChain(this.chainId)
1353
1326
  .hasFeature("ibc-go-v7-hot-fix")
1354
1327
  ) {
1355
1328
  return true;
@@ -1573,21 +1546,15 @@ export class CosmosAccountImpl {
1573
1546
  }
1574
1547
 
1575
1548
  makeRevokeMsg(grantee: string, messageType: string) {
1576
- const modularChainInfoImpl = this.chainGetter.getModularChainInfoImpl(
1577
- this.chainId
1578
- );
1579
- if (!("cosmos" in modularChainInfoImpl.embedded)) {
1580
- throw new Error("cosmos module is not supported on this chain");
1581
- }
1582
-
1583
1549
  Bech32Address.validate(
1584
1550
  grantee,
1585
- modularChainInfoImpl.embedded.cosmos.bech32Config?.bech32PrefixAccAddr
1551
+ this.chainGetter.getChain(this.chainId).bech32Config?.bech32PrefixAccAddr
1586
1552
  );
1587
1553
 
1554
+ const chainInfo = this.chainGetter.getChain(this.chainId);
1588
1555
  const msg =
1589
- ChainIdHelper.parse(this.chainId).identifier === "osmosis" ||
1590
- modularChainInfoImpl.hasFeature("authz-msg-revoke-fixed")
1556
+ chainInfo.chainIdentifier === "osmosis" ||
1557
+ chainInfo.hasFeature("authz-msg-revoke-fixed")
1591
1558
  ? {
1592
1559
  type: "cosmos-sdk/MsgRevoke",
1593
1560
  value: {
@@ -1628,17 +1595,12 @@ export class CosmosAccountImpl {
1628
1595
  }
1629
1596
 
1630
1597
  makeDelegateTx(amount: string, validatorAddress: string) {
1631
- const modularChainInfo = this.chainGetter.getModularChain(this.chainId);
1632
- if (!("cosmos" in modularChainInfo)) {
1633
- throw new Error("cosmos module is not supported on this chain");
1634
- }
1635
-
1636
1598
  Bech32Address.validate(
1637
1599
  validatorAddress,
1638
- modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
1600
+ this.chainGetter.getChain(this.chainId).bech32Config?.bech32PrefixValAddr
1639
1601
  );
1640
1602
 
1641
- const currency = modularChainInfo.cosmos.stakeCurrency;
1603
+ const currency = this.chainGetter.getChain(this.chainId).stakeCurrency;
1642
1604
 
1643
1605
  if (!currency) {
1644
1606
  throw new Error("Stake currency is null");
@@ -1745,11 +1707,7 @@ export class CosmosAccountImpl {
1745
1707
  onFulfill?: (tx: any) => void;
1746
1708
  }
1747
1709
  ) {
1748
- const modularChainInfo = this.chainGetter.getModularChain(this.chainId);
1749
- if (!("cosmos" in modularChainInfo)) {
1750
- throw new Error("cosmos module is not supported on this chain");
1751
- }
1752
- const currency = modularChainInfo.cosmos.stakeCurrency;
1710
+ const currency = this.chainGetter.getChain(this.chainId).stakeCurrency;
1753
1711
 
1754
1712
  if (!currency) {
1755
1713
  throw new Error("Stake currency is null");
@@ -1809,17 +1767,12 @@ export class CosmosAccountImpl {
1809
1767
  }
1810
1768
 
1811
1769
  makeUndelegateTx(amount: string, validatorAddress: string) {
1812
- const modularChainInfo = this.chainGetter.getModularChain(this.chainId);
1813
- if (!("cosmos" in modularChainInfo)) {
1814
- throw new Error("cosmos module is not supported on this chain");
1815
- }
1816
-
1817
1770
  Bech32Address.validate(
1818
1771
  validatorAddress,
1819
- modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
1772
+ this.chainGetter.getChain(this.chainId).bech32Config?.bech32PrefixValAddr
1820
1773
  );
1821
1774
 
1822
- const currency = modularChainInfo.cosmos.stakeCurrency;
1775
+ const currency = this.chainGetter.getChain(this.chainId).stakeCurrency;
1823
1776
 
1824
1777
  if (!currency) {
1825
1778
  throw new Error("Stake currency is null");
@@ -1961,20 +1914,16 @@ export class CosmosAccountImpl {
1961
1914
  srcValidatorAddress: string,
1962
1915
  dstValidatorAddress: string
1963
1916
  ) {
1964
- const modularChainInfo = this.chainGetter.getModularChain(this.chainId);
1965
- if (!("cosmos" in modularChainInfo)) {
1966
- throw new Error("cosmos module is not supported on this chain");
1967
- }
1968
1917
  Bech32Address.validate(
1969
1918
  srcValidatorAddress,
1970
- modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
1919
+ this.chainGetter.getChain(this.chainId).bech32Config?.bech32PrefixValAddr
1971
1920
  );
1972
1921
  Bech32Address.validate(
1973
1922
  dstValidatorAddress,
1974
- modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
1923
+ this.chainGetter.getChain(this.chainId).bech32Config?.bech32PrefixValAddr
1975
1924
  );
1976
1925
 
1977
- const currency = modularChainInfo.cosmos.stakeCurrency;
1926
+ const currency = this.chainGetter.getChain(this.chainId).stakeCurrency;
1978
1927
 
1979
1928
  if (!currency) {
1980
1929
  throw new Error("Stake currency is null");
@@ -2109,15 +2058,11 @@ export class CosmosAccountImpl {
2109
2058
  }
2110
2059
 
2111
2060
  makeWithdrawDelegationRewardTx(validatorAddresses: string[]) {
2112
- const modularChainInfo = this.chainGetter.getModularChain(this.chainId);
2113
- if (!("cosmos" in modularChainInfo)) {
2114
- throw new Error("cosmos module is not supported on this chain");
2115
- }
2116
-
2117
2061
  for (const validatorAddress of validatorAddresses) {
2118
2062
  Bech32Address.validate(
2119
2063
  validatorAddress,
2120
- modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
2064
+ this.chainGetter.getChain(this.chainId).bech32Config
2065
+ ?.bech32PrefixValAddr
2121
2066
  );
2122
2067
  }
2123
2068
 
@@ -110,14 +110,10 @@ export class CosmwasmAccountImpl {
110
110
  throw new Error("Currency is not cw20");
111
111
  }
112
112
 
113
- const chainInfo = this.chainGetter.getModularChain(this.chainId);
114
- if (!("cosmos" in chainInfo)) {
115
- throw new Error("cosmos module is not supported on this chain");
116
- }
117
-
118
113
  Bech32Address.validate(
119
114
  recipient,
120
- chainInfo.cosmos.bech32Config?.bech32PrefixAccAddr
115
+ this.chainGetter.getChain(this.chainId).bech32Config
116
+ ?.bech32PrefixAccAddr
121
117
  );
122
118
 
123
119
  return this.makeExecuteContractTx(
@@ -164,14 +160,9 @@ export class CosmwasmAccountImpl {
164
160
  onFulfill?: (tx: any) => void;
165
161
  }
166
162
  ) {
167
- const chainInfo = this.chainGetter.getModularChain(this.chainId);
168
- if (!("cosmos" in chainInfo)) {
169
- throw new Error("cosmos module is not supported on this chain");
170
- }
171
-
172
163
  Bech32Address.validate(
173
164
  contractAddress,
174
- chainInfo.cosmos.bech32Config?.bech32PrefixAccAddr
165
+ this.chainGetter.getChain(this.chainId).bech32Config?.bech32PrefixAccAddr
175
166
  );
176
167
 
177
168
  const msg = {
@@ -104,11 +104,6 @@ export class SecretAccountImpl {
104
104
  ) {
105
105
  const denomHelper = new DenomHelper(currency.coinMinimalDenom);
106
106
 
107
- const chainInfo = this.chainGetter.getModularChain(this.chainId);
108
- if (!("cosmos" in chainInfo)) {
109
- throw new Error("cosmos module is not supported on this chain");
110
- }
111
-
112
107
  if (denomHelper.type === "secret20") {
113
108
  const actualAmount = (() => {
114
109
  let dec = new Dec(amount);
@@ -122,7 +117,8 @@ export class SecretAccountImpl {
122
117
 
123
118
  Bech32Address.validate(
124
119
  recipient,
125
- chainInfo.cosmos.bech32Config?.bech32PrefixAccAddr
120
+ this.chainGetter.getChain(this.chainId).bech32Config
121
+ ?.bech32PrefixAccAddr
126
122
  );
127
123
 
128
124
  return this.makeExecuteSecretContractTx(
@@ -208,14 +204,9 @@ export class SecretAccountImpl {
208
204
  onFulfill?: (tx: any) => void;
209
205
  }
210
206
  ) {
211
- const chainInfo = this.chainGetter.getModularChain(this.chainId);
212
- if (!("cosmos" in chainInfo)) {
213
- throw new Error("cosmos module is not supported on this chain");
214
- }
215
-
216
207
  Bech32Address.validate(
217
208
  contractAddress,
218
- chainInfo.cosmos.bech32Config?.bech32PrefixAccAddr
209
+ this.chainGetter.getChain(this.chainId).bech32Config?.bech32PrefixAccAddr
219
210
  );
220
211
 
221
212
  let encryptedMsg: Uint8Array;
@@ -74,18 +74,18 @@ export class AccountStore<
74
74
 
75
75
  getAccount(chainId: string): AccountSetReturn {
76
76
  // XXX: 이렇게 쪼개진건 modular chain info가 추가되면서 이 경우도 따로 처리하기 위함임...
77
- if (this.chainGetter.hasModularChain(chainId)) {
77
+ if (this.chainGetter.hasChain(chainId)) {
78
78
  // chain identifier를 통한 접근도 허용하기 위해서 chainGetter를 통해 접근하도록 함.
79
- return this.get(this.chainGetter.getModularChain(chainId).chainId);
79
+ return this.get(this.chainGetter.getChain(chainId).chainId);
80
80
  }
81
81
  return this.get(chainId);
82
82
  }
83
83
 
84
84
  hasAccount(chainId: string): boolean {
85
85
  // XXX: 이렇게 쪼개진건 modular chain info가 추가되면서 이 경우도 따로 처리하기 위함임...
86
- if (this.chainGetter.hasModularChain(chainId)) {
86
+ if (this.chainGetter.hasChain(chainId)) {
87
87
  // chain identifier를 통한 접근도 허용하기 위해서 chainGetter를 통해 접근하도록 함.
88
- return this.has(this.chainGetter.getModularChain(chainId).chainId);
88
+ return this.has(this.chainGetter.getChain(chainId).chainId);
89
89
  }
90
90
  return this.has(chainId);
91
91
  }