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