@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.
- package/build/account/babylon.js +19 -7
- package/build/account/babylon.js.map +1 -1
- package/build/account/base.js +7 -5
- package/build/account/base.js.map +1 -1
- package/build/account/cosmos.js +97 -54
- package/build/account/cosmos.js.map +1 -1
- package/build/account/cosmwasm.js +10 -2
- package/build/account/cosmwasm.js.map +1 -1
- package/build/account/secret.js +10 -2
- package/build/account/secret.js.map +1 -1
- package/build/account/store.js +4 -4
- package/build/account/store.js.map +1 -1
- package/build/chain/base.d.ts +122 -1
- package/build/chain/base.js +601 -40
- package/build/chain/base.js.map +1 -1
- package/build/chain/types.d.ts +27 -1
- package/build/common/utils/index.d.ts +2 -2
- package/build/common/utils/index.js.map +1 -1
- package/build/lsm/currency-registrar.js +7 -7
- package/build/lsm/currency-registrar.js.map +1 -1
- package/build/query/balances.js +24 -11
- package/build/query/balances.js.map +1 -1
- package/build/query/chain-query.js +2 -2
- package/build/query/chain-query.js.map +1 -1
- package/build/query/chain-rpc-query.js +2 -2
- package/build/query/chain-rpc-query.js.map +1 -1
- package/build/query/cosmos/balance/balances.js +8 -4
- package/build/query/cosmos/balance/balances.js.map +1 -1
- package/build/query/cosmos/balance/spendable.js +3 -2
- package/build/query/cosmos/balance/spendable.js.map +1 -1
- package/build/query/cosmos/ibc/channel.js +3 -2
- package/build/query/cosmos/ibc/channel.js.map +1 -1
- package/build/query/cosmos/ibc/client-state.js +2 -2
- package/build/query/cosmos/ibc/client-state.js.map +1 -1
- package/build/query/cosmos/ibc/denom-trace.js +6 -8
- package/build/query/cosmos/ibc/denom-trace.js.map +1 -1
- package/build/query/cosmos/staking/babylon-btc-delegation-reward.js +3 -2
- package/build/query/cosmos/staking/babylon-btc-delegation-reward.js.map +1 -1
- package/build/query/cosmos/staking/delegations.js +5 -4
- package/build/query/cosmos/staking/delegations.js.map +1 -1
- package/build/query/cosmos/staking/initia-delegations.js +8 -6
- package/build/query/cosmos/staking/initia-delegations.js.map +1 -1
- package/build/query/cosmos/staking/initia-unbonding-delegations.js +6 -5
- package/build/query/cosmos/staking/initia-unbonding-delegations.js.map +1 -1
- package/build/query/cosmos/staking/initia-validators.js +3 -3
- package/build/query/cosmos/staking/initia-validators.js.map +1 -1
- package/build/query/cosmos/staking/pool.js +3 -3
- package/build/query/cosmos/staking/pool.js.map +1 -1
- package/build/query/cosmos/staking/rewards.js +13 -10
- package/build/query/cosmos/staking/rewards.js.map +1 -1
- package/build/query/cosmos/staking/unbonding-delegations.js +3 -3
- package/build/query/cosmos/staking/unbonding-delegations.js.map +1 -1
- package/build/query/cosmos/staking/validators.js +2 -3
- package/build/query/cosmos/staking/validators.js.map +1 -1
- package/build/query/cosmwasm/contract-query.js +2 -2
- package/build/query/cosmwasm/contract-query.js.map +1 -1
- package/build/query/cosmwasm/cw20-balance.js +7 -4
- package/build/query/cosmwasm/cw20-balance.js.map +1 -1
- package/build/query/cosmwasm/neutron/staking-rewards.js +10 -8
- package/build/query/cosmwasm/neutron/staking-rewards.js.map +1 -1
- package/build/query/noble/swap/simulate-swap.js +1 -1
- package/build/query/noble/swap/simulate-swap.js.map +1 -1
- package/build/query/osmosis/txfees/fee-tokens/index.js +8 -4
- package/build/query/osmosis/txfees/fee-tokens/index.js.map +1 -1
- package/build/query/secret-wasm/secret20-balance.js +7 -5
- package/build/query/secret-wasm/secret20-balance.js.map +1 -1
- package/build/token-factory/currency-registrar.js +1 -1
- package/build/token-factory/currency-registrar.js.map +1 -1
- package/package.json +11 -11
- package/src/account/babylon.ts +21 -7
- package/src/account/base.ts +7 -5
- package/src/account/cosmos.ts +125 -66
- package/src/account/cosmwasm.ts +12 -3
- package/src/account/secret.ts +12 -3
- package/src/account/store.ts +4 -4
- package/src/chain/base.ts +816 -34
- package/src/chain/types.ts +27 -1
- package/src/common/utils/index.ts +2 -2
- package/src/lsm/currency-registrar.ts +9 -7
- package/src/query/balances.ts +30 -13
- package/src/query/chain-query.ts +6 -2
- package/src/query/chain-rpc-query.ts +6 -2
- package/src/query/cosmos/balance/balances.ts +8 -4
- package/src/query/cosmos/balance/spendable.ts +3 -3
- package/src/query/cosmos/ibc/channel.ts +5 -2
- package/src/query/cosmos/ibc/client-state.ts +2 -2
- package/src/query/cosmos/ibc/denom-trace.ts +7 -7
- package/src/query/cosmos/staking/babylon-btc-delegation-reward.ts +5 -2
- package/src/query/cosmos/staking/delegations.ts +9 -4
- package/src/query/cosmos/staking/initia-delegations.ts +14 -7
- package/src/query/cosmos/staking/initia-unbonding-delegations.ts +12 -6
- package/src/query/cosmos/staking/initia-validators.ts +5 -3
- package/src/query/cosmos/staking/pool.ts +3 -3
- package/src/query/cosmos/staking/rewards.ts +13 -10
- package/src/query/cosmos/staking/unbonding-delegations.ts +7 -3
- package/src/query/cosmos/staking/validators.ts +4 -3
- package/src/query/cosmwasm/contract-query.ts +4 -2
- package/src/query/cosmwasm/cw20-balance.ts +8 -5
- package/src/query/cosmwasm/neutron/staking-rewards.ts +10 -8
- package/src/query/noble/swap/simulate-swap.ts +1 -1
- package/src/query/osmosis/txfees/fee-tokens/index.ts +8 -4
- package/src/query/secret-wasm/secret20-balance.ts +7 -5
- package/src/token-factory/currency-registrar.ts +1 -1
package/src/account/cosmos.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
437
|
+
modularChainInfo.cosmos.rest,
|
|
424
438
|
this.base.bech32Address,
|
|
425
439
|
true
|
|
426
440
|
);
|
|
427
441
|
|
|
428
442
|
const useEthereumSign =
|
|
429
|
-
|
|
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
|
-
|
|
473
|
-
|
|
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
|
-
|
|
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 (
|
|
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 (
|
|
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
|
|
675
|
-
this.
|
|
676
|
-
|
|
677
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
|
1060
|
+
const counterpartyChainInfo = this.chainGetter.getModularChain(
|
|
1042
1061
|
channels[0].counterpartyChainId
|
|
1043
|
-
)
|
|
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
|
-
|
|
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
|
-
|
|
1084
|
+
counterpartyChainInfo.cosmos.bech32Config.bech32PrefixAccAddr
|
|
1062
1085
|
);
|
|
1063
1086
|
}
|
|
1064
1087
|
const channel = channels[0];
|
|
1065
|
-
const destChainInfo = this.chainGetter.
|
|
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.
|
|
1126
|
+
const chainInfo = this.chainGetter.getModularChain(
|
|
1104
1127
|
channel.counterpartyChainId
|
|
1105
1128
|
);
|
|
1106
|
-
|
|
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.
|
|
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.
|
|
1260
|
-
|
|
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
|
-
.
|
|
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
|
-
|
|
1585
|
+
modularChainInfoImpl.embedded.cosmos.bech32Config?.bech32PrefixAccAddr
|
|
1552
1586
|
);
|
|
1553
1587
|
|
|
1554
|
-
const chainInfo = this.chainGetter.getChain(this.chainId);
|
|
1555
1588
|
const msg =
|
|
1556
|
-
|
|
1557
|
-
|
|
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
|
-
|
|
1638
|
+
modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
|
|
1601
1639
|
);
|
|
1602
1640
|
|
|
1603
|
-
const currency =
|
|
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
|
|
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
|
-
|
|
1819
|
+
modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
|
|
1773
1820
|
);
|
|
1774
1821
|
|
|
1775
|
-
const currency =
|
|
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
|
-
|
|
1970
|
+
modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
|
|
1920
1971
|
);
|
|
1921
1972
|
Bech32Address.validate(
|
|
1922
1973
|
dstValidatorAddress,
|
|
1923
|
-
|
|
1974
|
+
modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
|
|
1924
1975
|
);
|
|
1925
1976
|
|
|
1926
|
-
const currency =
|
|
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
|
-
|
|
2065
|
-
?.bech32PrefixValAddr
|
|
2120
|
+
modularChainInfo.cosmos.bech32Config?.bech32PrefixValAddr
|
|
2066
2121
|
);
|
|
2067
2122
|
}
|
|
2068
2123
|
|
|
@@ -2148,6 +2203,10 @@ export class CosmosAccountImpl {
|
|
|
2148
2203
|
},
|
|
2149
2204
|
};
|
|
2150
2205
|
|
|
2206
|
+
if (!cctpMsg.value.destination_domain) {
|
|
2207
|
+
delete cctpMsg.value.destination_domain;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2151
2210
|
const sendMsgValue = JSON.parse(rawSendMsg);
|
|
2152
2211
|
const sendMsg = {
|
|
2153
2212
|
type: this.msgOpts.send.native.type,
|
package/src/account/cosmwasm.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
174
|
+
chainInfo.cosmos.bech32Config?.bech32PrefixAccAddr
|
|
166
175
|
);
|
|
167
176
|
|
|
168
177
|
const msg = {
|
package/src/account/secret.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
218
|
+
chainInfo.cosmos.bech32Config?.bech32PrefixAccAddr
|
|
210
219
|
);
|
|
211
220
|
|
|
212
221
|
let encryptedMsg: Uint8Array;
|
package/src/account/store.ts
CHANGED
|
@@ -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.
|
|
77
|
+
if (this.chainGetter.hasModularChain(chainId)) {
|
|
78
78
|
// chain identifier를 통한 접근도 허용하기 위해서 chainGetter를 통해 접근하도록 함.
|
|
79
|
-
return this.get(this.chainGetter.
|
|
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.
|
|
86
|
+
if (this.chainGetter.hasModularChain(chainId)) {
|
|
87
87
|
// chain identifier를 통한 접근도 허용하기 위해서 chainGetter를 통해 접근하도록 함.
|
|
88
|
-
return this.has(this.chainGetter.
|
|
88
|
+
return this.has(this.chainGetter.getModularChain(chainId).chainId);
|
|
89
89
|
}
|
|
90
90
|
return this.has(chainId);
|
|
91
91
|
}
|