@keplr-wallet/stores 0.13.13 → 0.13.15-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 +11 -7
- package/build/account/babylon.js.map +1 -1
- package/build/account/base.d.ts +2 -2
- package/build/account/base.js +10 -12
- package/build/account/base.js.map +1 -1
- package/build/account/cosmos.js +62 -58
- package/build/account/cosmos.js.map +1 -1
- package/build/account/cosmwasm.js +5 -2
- package/build/account/cosmwasm.js.map +1 -1
- package/build/account/secret.js +5 -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/account/utils.d.ts +4 -2
- package/build/account/utils.js.map +1 -1
- package/build/chain/base.d.ts +10 -113
- package/build/chain/base.js +80 -784
- package/build/chain/base.js.map +1 -1
- package/build/chain/index.d.ts +2 -0
- package/build/chain/index.js +2 -0
- package/build/chain/index.js.map +1 -1
- package/build/chain/modular.d.ts +124 -0
- package/build/chain/modular.js +484 -0
- package/build/chain/modular.js.map +1 -0
- package/build/chain/types.d.ts +6 -53
- package/build/chain/unwrap.d.ts +3 -0
- package/build/chain/unwrap.js +84 -0
- package/build/chain/unwrap.js.map +1 -0
- package/build/chain/v2-helpers.d.ts +9 -0
- package/build/chain/v2-helpers.js +58 -0
- package/build/chain/v2-helpers.js.map +1 -0
- package/build/common/utils/index.d.ts +4 -3
- package/build/common/utils/index.js.map +1 -1
- package/build/lsm/currency-registrar.js +12 -7
- package/build/lsm/currency-registrar.js.map +1 -1
- package/build/query/balances.js +12 -10
- package/build/query/balances.js.map +1 -1
- package/build/query/chain-query.d.ts +4 -1
- package/build/query/chain-query.js +19 -2
- package/build/query/chain-query.js.map +1 -1
- package/build/query/chain-rpc-query.d.ts +4 -1
- package/build/query/chain-rpc-query.js +19 -2
- package/build/query/chain-rpc-query.js.map +1 -1
- package/build/query/cosmos/authz/index.d.ts +1 -0
- package/build/query/cosmos/authz/index.js +15 -0
- package/build/query/cosmos/authz/index.js.map +1 -1
- package/build/query/cosmos/balance/balances.js +4 -4
- package/build/query/cosmos/balance/balances.js.map +1 -1
- package/build/query/cosmos/balance/spendable.js +2 -2
- package/build/query/cosmos/balance/spendable.js.map +1 -1
- package/build/query/cosmos/ibc/channel.js +4 -2
- package/build/query/cosmos/ibc/channel.js.map +1 -1
- package/build/query/cosmos/ibc/client-state.js +4 -2
- package/build/query/cosmos/ibc/client-state.js.map +1 -1
- package/build/query/cosmos/ibc/denom-trace.js +6 -4
- package/build/query/cosmos/ibc/denom-trace.js.map +1 -1
- package/build/query/cosmos/staking/babylon-btc-delegation-reward.js +5 -2
- package/build/query/cosmos/staking/babylon-btc-delegation-reward.js.map +1 -1
- package/build/query/cosmos/staking/delegations.js +9 -4
- package/build/query/cosmos/staking/delegations.js.map +1 -1
- package/build/query/cosmos/staking/initia-delegations.js +12 -6
- package/build/query/cosmos/staking/initia-delegations.js.map +1 -1
- package/build/query/cosmos/staking/initia-unbonding-delegations.js +10 -5
- package/build/query/cosmos/staking/initia-unbonding-delegations.js.map +1 -1
- package/build/query/cosmos/staking/initia-validators.js +7 -4
- package/build/query/cosmos/staking/initia-validators.js.map +1 -1
- package/build/query/cosmos/staking/pool.js +13 -11
- package/build/query/cosmos/staking/pool.js.map +1 -1
- package/build/query/cosmos/staking/rewards.js +25 -22
- package/build/query/cosmos/staking/rewards.js.map +1 -1
- package/build/query/cosmos/staking/unbonding-delegations.js +7 -3
- package/build/query/cosmos/staking/unbonding-delegations.js.map +1 -1
- package/build/query/cosmos/staking/validators.js +5 -3
- package/build/query/cosmos/staking/validators.js.map +1 -1
- package/build/query/cosmwasm/contract-query.js +4 -2
- package/build/query/cosmwasm/contract-query.js.map +1 -1
- package/build/query/cosmwasm/cw20-balance.js +4 -4
- package/build/query/cosmwasm/cw20-balance.js.map +1 -1
- package/build/query/cosmwasm/neutron/staking-rewards.js +11 -8
- package/build/query/cosmwasm/neutron/staking-rewards.js.map +1 -1
- package/build/query/index.d.ts +1 -0
- package/build/query/index.js +1 -0
- package/build/query/index.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 +4 -4
- package/build/query/osmosis/txfees/fee-tokens/index.js.map +1 -1
- package/build/query/secret-wasm/secret20-balance.js +5 -5
- package/build/query/secret-wasm/secret20-balance.js.map +1 -1
- package/build/token-factory/currency-registrar.js +5 -1
- package/build/token-factory/currency-registrar.js.map +1 -1
- package/package.json +11 -11
- package/src/account/babylon.ts +20 -8
- package/src/account/base.ts +21 -16
- package/src/account/cosmos.ts +95 -63
- package/src/account/cosmwasm.ts +5 -4
- package/src/account/secret.ts +5 -4
- package/src/account/store.ts +4 -4
- package/src/account/utils.ts +1 -2
- package/src/chain/base.ts +92 -991
- package/src/chain/index.ts +2 -0
- package/src/chain/modular.ts +664 -0
- package/src/chain/types.ts +6 -81
- package/src/chain/unwrap.ts +149 -0
- package/src/chain/v2-helpers.ts +74 -0
- package/src/common/utils/index.ts +4 -3
- package/src/lsm/currency-registrar.ts +12 -8
- package/src/query/balances.ts +17 -12
- package/src/query/chain-query.ts +24 -4
- package/src/query/chain-rpc-query.ts +24 -4
- package/src/query/cosmos/authz/index.ts +1 -0
- package/src/query/cosmos/balance/balances.ts +4 -4
- package/src/query/cosmos/balance/spendable.ts +2 -2
- package/src/query/cosmos/ibc/channel.ts +4 -3
- package/src/query/cosmos/ibc/client-state.ts +4 -3
- package/src/query/cosmos/ibc/denom-trace.ts +6 -5
- package/src/query/cosmos/staking/babylon-btc-delegation-reward.ts +7 -3
- package/src/query/cosmos/staking/delegations.ts +15 -7
- package/src/query/cosmos/staking/initia-delegations.ts +22 -10
- package/src/query/cosmos/staking/initia-unbonding-delegations.ts +20 -7
- package/src/query/cosmos/staking/initia-validators.ts +13 -5
- package/src/query/cosmos/staking/pool.ts +19 -12
- package/src/query/cosmos/staking/rewards.ts +35 -24
- package/src/query/cosmos/staking/unbonding-delegations.ts +13 -4
- package/src/query/cosmos/staking/validators.ts +9 -4
- package/src/query/cosmwasm/contract-query.ts +4 -3
- package/src/query/cosmwasm/cw20-balance.ts +4 -6
- package/src/query/cosmwasm/neutron/staking-rewards.ts +11 -9
- package/src/query/index.ts +1 -0
- package/src/query/noble/swap/simulate-swap.ts +1 -1
- package/src/query/osmosis/txfees/fee-tokens/index.ts +4 -4
- package/src/query/secret-wasm/secret20-balance.ts +5 -5
- package/src/token-factory/currency-registrar.ts +5 -1
- package/tsconfig.check.json +2 -0
package/build/account/babylon.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BabylonAccountImpl = exports.BabylonAccount = void 0;
|
|
4
|
+
const chain_1 = require("../chain");
|
|
4
5
|
const unit_1 = require("@keplr-wallet/unit");
|
|
5
6
|
const tx_1 = require("@keplr-wallet/proto-types/babylon/epoching/v1/tx");
|
|
6
7
|
const cosmos_1 = require("@keplr-wallet/cosmos");
|
|
@@ -22,8 +23,9 @@ class BabylonAccountImpl {
|
|
|
22
23
|
}
|
|
23
24
|
makeDelegateTx(amount, validatorAddress) {
|
|
24
25
|
var _a;
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
const cosmosInfo = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
27
|
+
cosmos_1.Bech32Address.validate(validatorAddress, (_a = cosmosInfo.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixValAddr);
|
|
28
|
+
const currency = cosmosInfo.stakeCurrency;
|
|
27
29
|
if (!currency) {
|
|
28
30
|
throw new Error("Stake currency is null");
|
|
29
31
|
}
|
|
@@ -65,8 +67,9 @@ class BabylonAccountImpl {
|
|
|
65
67
|
}
|
|
66
68
|
makeUndelegateTx(amount, validatorAddress) {
|
|
67
69
|
var _a;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
const cosmosInfo = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
71
|
+
cosmos_1.Bech32Address.validate(validatorAddress, (_a = cosmosInfo.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixValAddr);
|
|
72
|
+
const currency = cosmosInfo.stakeCurrency;
|
|
70
73
|
if (!currency) {
|
|
71
74
|
throw new Error("Stake currency is null");
|
|
72
75
|
}
|
|
@@ -108,9 +111,10 @@ class BabylonAccountImpl {
|
|
|
108
111
|
}
|
|
109
112
|
makeBeginRedelegateTx(amount, srcValidatorAddress, dstValidatorAddress) {
|
|
110
113
|
var _a, _b;
|
|
111
|
-
|
|
112
|
-
cosmos_1.Bech32Address.validate(
|
|
113
|
-
|
|
114
|
+
const cosmosInfo = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
115
|
+
cosmos_1.Bech32Address.validate(srcValidatorAddress, (_a = cosmosInfo.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixValAddr);
|
|
116
|
+
cosmos_1.Bech32Address.validate(dstValidatorAddress, (_b = cosmosInfo.bech32Config) === null || _b === void 0 ? void 0 : _b.bech32PrefixValAddr);
|
|
117
|
+
const currency = cosmosInfo.stakeCurrency;
|
|
114
118
|
if (!currency) {
|
|
115
119
|
throw new Error("Stake currency is null");
|
|
116
120
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babylon.js","sourceRoot":"","sources":["../../src/account/babylon.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"babylon.js","sourceRoot":"","sources":["../../src/account/babylon.ts"],"names":[],"mappings":";;;AAOA,oCAA0D;AAG1D,6CAAmD;AACnD,yEAI0D;AAC1D,iDAAqD;AAOxC,QAAA,cAAc,GAAG;IAC5B,GAAG,CAAC,OAEH;QAKC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE;YACpC,OAAO;gBACL,OAAO,EAAE,IA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ACjD,mBAAmB,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,qBAAqB;4BACxD,mBAAmB,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,qBAAqB;4BACxD,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM;yBAC7B;qBACF,CAAC,CAAC,MAAM,EAAE;iBACZ;aACF;SACF,EACD,CAAC,EAAE,EAAE,EAAE;YACL,IAAI,EAAE,CAAC,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,EAAE;gBACpC,sEAAsE;gBACtE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC;aAC5D;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED,IAAc,OAAO;QAGnB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AA1MD,gDA0MC"}
|
package/build/account/base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppCurrency, Keplr, SupportedPaymentType } from "@keplr-wallet/types";
|
|
1
|
+
import { AppCurrency, ChainInfo, Keplr, SupportedPaymentType } from "@keplr-wallet/types";
|
|
2
2
|
import { ChainGetter } from "../chain";
|
|
3
3
|
import { MakeTxResponse } from "./types";
|
|
4
4
|
import { AccountSharedContext } from "./context";
|
|
@@ -15,7 +15,7 @@ export interface MsgOpt {
|
|
|
15
15
|
}
|
|
16
16
|
export interface AccountSetOpts {
|
|
17
17
|
readonly suggestChain: boolean;
|
|
18
|
-
readonly suggestChainFn?: (keplr: Keplr, chainInfo:
|
|
18
|
+
readonly suggestChainFn?: (keplr: Keplr, chainInfo: ChainInfo) => Promise<void>;
|
|
19
19
|
readonly autoInit: boolean;
|
|
20
20
|
}
|
|
21
21
|
export declare class AccountSetBase {
|
package/build/account/base.js
CHANGED
|
@@ -17,6 +17,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.AccountSetBaseSuper = exports.AccountSetBase = exports.WalletStatus = void 0;
|
|
19
19
|
const mobx_1 = require("mobx");
|
|
20
|
+
const types_1 = require("@keplr-wallet/types");
|
|
21
|
+
const chain_1 = require("../chain");
|
|
20
22
|
const common_1 = require("@keplr-wallet/common");
|
|
21
23
|
var WalletStatus;
|
|
22
24
|
(function (WalletStatus) {
|
|
@@ -61,21 +63,21 @@ class AccountSetBase {
|
|
|
61
63
|
}
|
|
62
64
|
enable(chainId) {
|
|
63
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const
|
|
65
|
-
if ("cosmos"
|
|
66
|
+
const mcInfo2 = this.chainGetter.getModularChain(chainId);
|
|
67
|
+
if (mcInfo2.type === "cosmos" || mcInfo2.type === "ethermint") {
|
|
66
68
|
if (this.opts.suggestChain) {
|
|
67
69
|
const keplr = yield this.sharedContext.getKeplr();
|
|
68
70
|
if (this.opts.suggestChainFn) {
|
|
69
71
|
yield this.sharedContext.suggestChain(() => __awaiter(this, void 0, void 0, function* () {
|
|
70
72
|
if (keplr && this.opts.suggestChainFn) {
|
|
71
|
-
yield this.opts.suggestChainFn(keplr, this.chainGetter.
|
|
73
|
+
yield this.opts.suggestChainFn(keplr, (0, chain_1.modularChainInfoToChainInfo)(this.chainGetter.getModularChain(chainId).embedded));
|
|
72
74
|
}
|
|
73
75
|
}));
|
|
74
76
|
}
|
|
75
77
|
else {
|
|
76
78
|
yield this.sharedContext.suggestChain(() => __awaiter(this, void 0, void 0, function* () {
|
|
77
79
|
if (keplr) {
|
|
78
|
-
yield keplr.experimentalSuggestChain(this.chainGetter.
|
|
80
|
+
yield keplr.experimentalSuggestChain((0, chain_1.modularChainInfoToChainInfo)(this.chainGetter.getModularChain(chainId).embedded));
|
|
79
81
|
}
|
|
80
82
|
}));
|
|
81
83
|
}
|
|
@@ -112,8 +114,8 @@ class AccountSetBase {
|
|
|
112
114
|
this._rejectionReason = e;
|
|
113
115
|
return;
|
|
114
116
|
}
|
|
115
|
-
const isStarknet =
|
|
116
|
-
const isBitcoin =
|
|
117
|
+
const isStarknet = this.chainGetter.getModularChain(this.chainId).type === "starknet";
|
|
118
|
+
const isBitcoin = this.chainGetter.getModularChain(this.chainId).type === "bitcoin";
|
|
117
119
|
yield this.sharedContext.getKeyMixed(this.chainId, isStarknet, isBitcoin, (res) => {
|
|
118
120
|
if (res.status === "fulfilled") {
|
|
119
121
|
const key = res.value;
|
|
@@ -246,12 +248,8 @@ class AccountSetBase {
|
|
|
246
248
|
return this.txTypeInProgress;
|
|
247
249
|
}
|
|
248
250
|
get hasEthereumHexAddress() {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
return (chainInfo.evm != null ||
|
|
252
|
-
chainInfo.bip44.coinType === 60 ||
|
|
253
|
-
!!((_a = chainInfo.features) === null || _a === void 0 ? void 0 : _a.includes("eth-address-gen")) ||
|
|
254
|
-
!!((_b = chainInfo.features) === null || _b === void 0 ? void 0 : _b.includes("eth-key-sign")));
|
|
251
|
+
const mcInfo2 = this.chainGetter.getModularChain(this.chainId);
|
|
252
|
+
return (0, types_1.isEthSignChain)(mcInfo2.unwrapped);
|
|
255
253
|
}
|
|
256
254
|
get ethereumHexAddress() {
|
|
257
255
|
return this._ethereumHexAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/account/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA0E;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/account/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA0E;AAC1E,+CAM6B;AAC7B,oCAAoE;AACpE,iDAAgE;AAIhE,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB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;IADT,iBAAU;2DACgC;AAEjC;IADT,iBAAU;2DACgC;AAEjC;IADT,iBAAU;uDAQe;AAEhB;IADT,iBAAU;qDAC8B;AAE/B;IADT,iBAAU;mDAC4B;AAG7B;IADT,iBAAU;yDAC8B;AAiFjC;IADP,WAAI;0CA2GJ;AAGM;IADN,aAAM;gDAgBN;AAOD;IADC,eAAQ;qDAKR;AAMD;IADC,eAAQ;uDAKR;AApQH,wCA2VC;AAED,MAAa,mBAAoB,SAAQ,cAAc;IACrD,YAAY,GAAG,MAAoD;QACjE,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;QAEjB,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAGD,mBAAmB,CAAC,IAAY;QAC9B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAChC,CAAC;CACF;AAHC;IADC,aAAM;8DAGN;AAVH,kDAWC"}
|
package/build/account/cosmos.js
CHANGED
|
@@ -25,6 +25,7 @@ const tx_4 = require("@keplr-wallet/proto-types/cosmos/staking/v1beta1/tx");
|
|
|
25
25
|
const tx_5 = require("@keplr-wallet/proto-types/cosmos/distribution/v1beta1/tx");
|
|
26
26
|
const cosmos_1 = require("@keplr-wallet/cosmos");
|
|
27
27
|
const types_1 = require("../query/cosmos/staking/types");
|
|
28
|
+
const chain_1 = require("../chain");
|
|
28
29
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
29
30
|
const buffer_1 = require("buffer/");
|
|
30
31
|
const utils_1 = require("./utils");
|
|
@@ -108,7 +109,8 @@ class CosmosAccountImpl {
|
|
|
108
109
|
dec = dec.mul(unit_1.DecUtils.getPrecisionDec(currency.coinDecimals));
|
|
109
110
|
return dec.truncate().toString();
|
|
110
111
|
})();
|
|
111
|
-
cosmos_1.Bech32Address.validate(recipient, (_a = this.chainGetter.
|
|
112
|
+
cosmos_1.Bech32Address.validate(recipient, (_a = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId))
|
|
113
|
+
.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixAccAddr);
|
|
112
114
|
const isThorchain = this.chainId.startsWith("thorchain-");
|
|
113
115
|
const msg = {
|
|
114
116
|
type: this.msgOpts.send.native.type,
|
|
@@ -213,7 +215,7 @@ class CosmosAccountImpl {
|
|
|
213
215
|
if (onBroadcasted) {
|
|
214
216
|
onBroadcasted(txHash);
|
|
215
217
|
}
|
|
216
|
-
const txTracer = new cosmos_1.TendermintTxTracer(this.chainGetter.
|
|
218
|
+
const txTracer = new cosmos_1.TendermintTxTracer((0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId)).rpc, "/websocket", {
|
|
217
219
|
wsObject: this.txOpts.wsObject,
|
|
218
220
|
});
|
|
219
221
|
txTracer.traceTx(txHash).then((tx) => {
|
|
@@ -275,10 +277,9 @@ class CosmosAccountImpl {
|
|
|
275
277
|
throw new Error("The length of aminoMsgs and protoMsgs are different");
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
.features) === null || _a === void 0 ? void 0 : _a.includes("eth-key-sign")) === true;
|
|
280
|
+
const cosmosInfo = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
281
|
+
const account = yield cosmos_1.BaseAccount.fetchFromRest(cosmosInfo.rest, this.base.bech32Address, true);
|
|
282
|
+
const useEthereumSign = ((_a = cosmosInfo.features) === null || _a === void 0 ? void 0 : _a.includes("eth-key-sign")) === true;
|
|
282
283
|
const eip712Signing = useEthereumSign && this.base.isNanoLedger;
|
|
283
284
|
if (eip712Signing && !msgs.rlpTypes) {
|
|
284
285
|
throw new Error("RLP types information is needed for signing tx for ethermint chain with ledger");
|
|
@@ -301,12 +302,11 @@ class CosmosAccountImpl {
|
|
|
301
302
|
msgs: aminoMsgs,
|
|
302
303
|
memo: (0, common_1.escapeHTML)(memo),
|
|
303
304
|
};
|
|
304
|
-
const chainInfo = this.chainGetter.getChain(this.chainId);
|
|
305
305
|
const chainIsInjective = this.chainId.startsWith("injective");
|
|
306
306
|
const chainIsStratos = this.chainId.startsWith("stratos");
|
|
307
307
|
const chainIsCysic = this.chainId.startsWith("cysic");
|
|
308
|
-
const ethSignPlainJson =
|
|
309
|
-
|
|
308
|
+
const ethSignPlainJson = cosmosInfo.features != null &&
|
|
309
|
+
cosmosInfo.features.includes("evm-ledger-sign-plain-json");
|
|
310
310
|
if (eip712Signing) {
|
|
311
311
|
if (chainIsInjective) {
|
|
312
312
|
// Due to injective's problem, it should exist if injective with ledger.
|
|
@@ -344,7 +344,10 @@ class CosmosAccountImpl {
|
|
|
344
344
|
if (!eip712Signing) {
|
|
345
345
|
return yield signAmino(this.chainId, this.base.bech32Address, signDoc, signOptions);
|
|
346
346
|
}
|
|
347
|
-
return yield experimentalSignEIP712CosmosTx_v0(this.chainId, this.base.bech32Address, (0, utils_1.getEip712TypedDataBasedOnChainInfo)(
|
|
347
|
+
return yield experimentalSignEIP712CosmosTx_v0(this.chainId, this.base.bech32Address, (0, utils_1.getEip712TypedDataBasedOnChainInfo)({
|
|
348
|
+
chainId: this.chainId,
|
|
349
|
+
features: (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId)).features,
|
|
350
|
+
}, msgs), signDoc, signOptions);
|
|
348
351
|
}))();
|
|
349
352
|
return {
|
|
350
353
|
tx: tx_1.TxRaw.encode({
|
|
@@ -370,6 +373,7 @@ class CosmosAccountImpl {
|
|
|
370
373
|
{
|
|
371
374
|
publicKey: {
|
|
372
375
|
typeUrl: (() => {
|
|
376
|
+
var _a, _b;
|
|
373
377
|
if (!useEthereumSign) {
|
|
374
378
|
return "/cosmos.crypto.secp256k1.PubKey";
|
|
375
379
|
}
|
|
@@ -379,10 +383,10 @@ class CosmosAccountImpl {
|
|
|
379
383
|
if (chainIsStratos) {
|
|
380
384
|
return "/stratos.crypto.v1.ethsecp256k1.PubKey";
|
|
381
385
|
}
|
|
382
|
-
if (
|
|
386
|
+
if ((_a = cosmosInfo.features) === null || _a === void 0 ? void 0 : _a.includes("eth-secp256k1-cosmos")) {
|
|
383
387
|
return "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey";
|
|
384
388
|
}
|
|
385
|
-
if (
|
|
389
|
+
if ((_b = cosmosInfo.features) === null || _b === void 0 ? void 0 : _b.includes("eth-secp256k1-initia")) {
|
|
386
390
|
return "/initia.crypto.v1beta1.ethsecp256k1.PubKey";
|
|
387
391
|
}
|
|
388
392
|
if (chainIsCysic) {
|
|
@@ -440,9 +444,8 @@ class CosmosAccountImpl {
|
|
|
440
444
|
createSignedTxWithDirectSign(keplr, account, protoMsgs, fee, memo, signOptions) {
|
|
441
445
|
var _a;
|
|
442
446
|
return __awaiter(this, void 0, void 0, function* () {
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
.features) === null || _a === void 0 ? void 0 : _a.includes("eth-key-sign")) === true;
|
|
447
|
+
const cosmosInfoForSign = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
448
|
+
const useEthereumSign = ((_a = cosmosInfoForSign.features) === null || _a === void 0 ? void 0 : _a.includes("eth-key-sign")) === true;
|
|
446
449
|
const chainIsInjective = this.chainId.startsWith("injective");
|
|
447
450
|
const chainIsStratos = this.chainId.startsWith("stratos");
|
|
448
451
|
const chainIsCysic = this.chainId.startsWith("cysic");
|
|
@@ -461,6 +464,7 @@ class CosmosAccountImpl {
|
|
|
461
464
|
{
|
|
462
465
|
publicKey: {
|
|
463
466
|
typeUrl: (() => {
|
|
467
|
+
var _a, _b;
|
|
464
468
|
if (!useEthereumSign) {
|
|
465
469
|
return "/cosmos.crypto.secp256k1.PubKey";
|
|
466
470
|
}
|
|
@@ -470,14 +474,10 @@ class CosmosAccountImpl {
|
|
|
470
474
|
if (chainIsStratos) {
|
|
471
475
|
return "/stratos.crypto.v1.ethsecp256k1.PubKey";
|
|
472
476
|
}
|
|
473
|
-
if (
|
|
474
|
-
.getChain(this.chainId)
|
|
475
|
-
.hasFeature("eth-secp256k1-cosmos")) {
|
|
477
|
+
if ((_a = cosmosInfoForSign.features) === null || _a === void 0 ? void 0 : _a.includes("eth-secp256k1-cosmos")) {
|
|
476
478
|
return "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey";
|
|
477
479
|
}
|
|
478
|
-
if (
|
|
479
|
-
.getChain(this.chainId)
|
|
480
|
-
.hasFeature("eth-secp256k1-initia")) {
|
|
480
|
+
if ((_b = cosmosInfoForSign.features) === null || _b === void 0 ? void 0 : _b.includes("eth-secp256k1-initia")) {
|
|
481
481
|
return "/initia.crypto.v1beta1.ethsecp256k1.PubKey";
|
|
482
482
|
}
|
|
483
483
|
if (chainIsCysic) {
|
|
@@ -540,7 +540,8 @@ class CosmosAccountImpl {
|
|
|
540
540
|
*/
|
|
541
541
|
simulateTx(msgs, fee, memo = "") {
|
|
542
542
|
return __awaiter(this, void 0, void 0, function* () {
|
|
543
|
-
const
|
|
543
|
+
const cosmosInfoForSim = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
544
|
+
const account = yield cosmos_1.BaseAccount.fetchFromRest(cosmosInfoForSim.rest, this.base.bech32Address, true);
|
|
544
545
|
const unsignedTx = tx_1.TxRaw.encode({
|
|
545
546
|
bodyBytes: tx_1.TxBody.encode(tx_1.TxBody.fromPartial({
|
|
546
547
|
messages: msgs,
|
|
@@ -572,7 +573,7 @@ class CosmosAccountImpl {
|
|
|
572
573
|
signatures: [new Uint8Array(64)],
|
|
573
574
|
}).finish();
|
|
574
575
|
// TODO: Add response type
|
|
575
|
-
const result = yield (0, simple_fetch_1.simpleFetch)(
|
|
576
|
+
const result = yield (0, simple_fetch_1.simpleFetch)(cosmosInfoForSim.rest, "/cosmos/tx/v1beta1/simulate", {
|
|
576
577
|
method: "POST",
|
|
577
578
|
headers: {
|
|
578
579
|
"content-type": "application/json",
|
|
@@ -668,23 +669,23 @@ class CosmosAccountImpl {
|
|
|
668
669
|
throw new Error("No channels");
|
|
669
670
|
}
|
|
670
671
|
const destinationChainId = channels[channels.length - 1].counterpartyChainId;
|
|
671
|
-
const
|
|
672
|
-
cosmos_1.Bech32Address.validate(recipient, (_a =
|
|
673
|
-
const counterpartyChainBech32Config = this.chainGetter.
|
|
672
|
+
const destinationCosmosInfo = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(destinationChainId));
|
|
673
|
+
cosmos_1.Bech32Address.validate(recipient, (_a = destinationCosmosInfo.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixAccAddr);
|
|
674
|
+
const counterpartyChainBech32Config = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(channels[0].counterpartyChainId)).bech32Config;
|
|
674
675
|
if (counterpartyChainBech32Config == null) {
|
|
675
676
|
throw new Error("Counterparty chain bech32 config is not set");
|
|
676
677
|
}
|
|
677
678
|
return this.makeIBCTransferTxWithAsyncMemoConstructor(channels[0], amount, currency, () => __awaiter(this, void 0, void 0, function* () {
|
|
678
679
|
if (channels.length === 1) {
|
|
679
|
-
const
|
|
680
|
-
if (!
|
|
680
|
+
const counterpartyCosmosInfo = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(channels[0].counterpartyChainId));
|
|
681
|
+
if (!counterpartyCosmosInfo.bech32Config) {
|
|
681
682
|
throw new Error("Bech32 config is not set");
|
|
682
683
|
}
|
|
683
|
-
return cosmos_1.Bech32Address.fromBech32(recipient).toBech32(
|
|
684
|
+
return cosmos_1.Bech32Address.fromBech32(recipient).toBech32(counterpartyCosmosInfo.bech32Config.bech32PrefixAccAddr);
|
|
684
685
|
}
|
|
685
686
|
const channel = channels[0];
|
|
686
|
-
const
|
|
687
|
-
const account = accountStore.getAccount(
|
|
687
|
+
const destMcInfo2 = this.chainGetter.getModularChain(channel.counterpartyChainId);
|
|
688
|
+
const account = accountStore.getAccount(destMcInfo2.chainId);
|
|
688
689
|
if (account.walletStatus !== base_1.WalletStatus.Loaded) {
|
|
689
690
|
account.init();
|
|
690
691
|
}
|
|
@@ -704,7 +705,7 @@ class CosmosAccountImpl {
|
|
|
704
705
|
})();
|
|
705
706
|
}
|
|
706
707
|
if (account.walletStatus !== base_1.WalletStatus.Loaded) {
|
|
707
|
-
throw new Error(`The account of ${
|
|
708
|
+
throw new Error(`The account of ${destMcInfo2.chainId} is not loaded: ${account.walletStatus}`);
|
|
708
709
|
}
|
|
709
710
|
return account.bech32Address;
|
|
710
711
|
}), () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -715,11 +716,11 @@ class CosmosAccountImpl {
|
|
|
715
716
|
for (let i = 0; i < loopChannels.length; i++) {
|
|
716
717
|
const channel = loopChannels[i];
|
|
717
718
|
if (i === loopChannels.length - 1) {
|
|
718
|
-
const
|
|
719
|
-
if (!
|
|
719
|
+
const loopCosmosInfo = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(channel.counterpartyChainId));
|
|
720
|
+
if (!loopCosmosInfo.bech32Config) {
|
|
720
721
|
throw new Error("Bech32 config is not set");
|
|
721
722
|
}
|
|
722
|
-
cosmos_1.Bech32Address.validate(recipient,
|
|
723
|
+
cosmos_1.Bech32Address.validate(recipient, loopCosmosInfo.bech32Config.bech32PrefixAccAddr);
|
|
723
724
|
const forward = {
|
|
724
725
|
receiver: recipient,
|
|
725
726
|
port: channel.portId,
|
|
@@ -737,8 +738,8 @@ class CosmosAccountImpl {
|
|
|
737
738
|
lastForward = forward;
|
|
738
739
|
}
|
|
739
740
|
else {
|
|
740
|
-
const
|
|
741
|
-
const account = accountStore.getAccount(
|
|
741
|
+
const loopDestMcInfo2 = this.chainGetter.getModularChain(channel.counterpartyChainId);
|
|
742
|
+
const account = accountStore.getAccount(loopDestMcInfo2.chainId);
|
|
742
743
|
if (account.walletStatus !== base_1.WalletStatus.Loaded) {
|
|
743
744
|
account.init();
|
|
744
745
|
}
|
|
@@ -758,7 +759,7 @@ class CosmosAccountImpl {
|
|
|
758
759
|
})();
|
|
759
760
|
}
|
|
760
761
|
if (account.walletStatus !== base_1.WalletStatus.Loaded) {
|
|
761
|
-
throw new Error(`The account of ${
|
|
762
|
+
throw new Error(`The account of ${loopDestMcInfo2.chainId} is not loaded: ${account.walletStatus}`);
|
|
762
763
|
}
|
|
763
764
|
const forward = {
|
|
764
765
|
receiver: account.bech32Address,
|
|
@@ -819,9 +820,8 @@ class CosmosAccountImpl {
|
|
|
819
820
|
destinationInfo.latestBlockHeight.equals(new unit_1.Int("0"))) {
|
|
820
821
|
throw new Error(`Failed to fetch the latest block of ${channel.counterpartyChainId}`);
|
|
821
822
|
}
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
.features) === null || _a === void 0 ? void 0 : _a.includes("eth-key-sign")) === true;
|
|
823
|
+
const ibcCosmosInfo = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
824
|
+
const useEthereumSign = ((_a = ibcCosmosInfo.features) === null || _a === void 0 ? void 0 : _a.includes("eth-key-sign")) === true;
|
|
825
825
|
const eip712Signing = useEthereumSign && this.base.isNanoLedger;
|
|
826
826
|
const chainIsInjective = this.chainId.startsWith("injective");
|
|
827
827
|
let memo = yield memoConstructor();
|
|
@@ -869,12 +869,11 @@ class CosmosAccountImpl {
|
|
|
869
869
|
delete msg.value.memo;
|
|
870
870
|
}
|
|
871
871
|
const forceDirectSign = (() => {
|
|
872
|
+
var _a;
|
|
872
873
|
if (!this.base.isNanoLedger) {
|
|
873
874
|
if (this.chainId.startsWith("injective") ||
|
|
874
875
|
this.chainId.startsWith("stride") ||
|
|
875
|
-
|
|
876
|
-
.getChain(this.chainId)
|
|
877
|
-
.hasFeature("ibc-go-v7-hot-fix")) {
|
|
876
|
+
((_a = ibcCosmosInfo.features) === null || _a === void 0 ? void 0 : _a.includes("ibc-go-v7-hot-fix"))) {
|
|
878
877
|
return true;
|
|
879
878
|
}
|
|
880
879
|
}
|
|
@@ -1037,11 +1036,12 @@ class CosmosAccountImpl {
|
|
|
1037
1036
|
});
|
|
1038
1037
|
}
|
|
1039
1038
|
makeRevokeMsg(grantee, messageType) {
|
|
1040
|
-
var _a;
|
|
1041
|
-
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
|
|
1039
|
+
var _a, _b;
|
|
1040
|
+
const mcInfo2ForRevoke = this.chainGetter.getModularChain(this.chainId);
|
|
1041
|
+
const cosmosInfoForRevoke = (0, chain_1.requireCosmosInfo)(mcInfo2ForRevoke);
|
|
1042
|
+
cosmos_1.Bech32Address.validate(grantee, (_a = cosmosInfoForRevoke.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixAccAddr);
|
|
1043
|
+
const msg = mcInfo2ForRevoke.chainIdentifier === "osmosis" ||
|
|
1044
|
+
((_b = cosmosInfoForRevoke.features) === null || _b === void 0 ? void 0 : _b.includes("authz-msg-revoke-fixed"))
|
|
1045
1045
|
? {
|
|
1046
1046
|
type: "cosmos-sdk/MsgRevoke",
|
|
1047
1047
|
value: {
|
|
@@ -1077,8 +1077,9 @@ class CosmosAccountImpl {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
makeDelegateTx(amount, validatorAddress) {
|
|
1079
1079
|
var _a;
|
|
1080
|
-
|
|
1081
|
-
|
|
1080
|
+
const cosmosInfoForDelegate = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
1081
|
+
cosmos_1.Bech32Address.validate(validatorAddress, (_a = cosmosInfoForDelegate.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixValAddr);
|
|
1082
|
+
const currency = cosmosInfoForDelegate.stakeCurrency;
|
|
1082
1083
|
if (!currency) {
|
|
1083
1084
|
throw new Error("Stake currency is null");
|
|
1084
1085
|
}
|
|
@@ -1167,7 +1168,7 @@ class CosmosAccountImpl {
|
|
|
1167
1168
|
sendDelegateMsg(amount, validatorAddress, memo = "", stdFee = {}, signOptions, onTxEvents) {
|
|
1168
1169
|
var _a, _b;
|
|
1169
1170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1170
|
-
const currency = this.chainGetter.
|
|
1171
|
+
const currency = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId)).stakeCurrency;
|
|
1171
1172
|
if (!currency) {
|
|
1172
1173
|
throw new Error("Stake currency is null");
|
|
1173
1174
|
}
|
|
@@ -1217,8 +1218,9 @@ class CosmosAccountImpl {
|
|
|
1217
1218
|
}
|
|
1218
1219
|
makeUndelegateTx(amount, validatorAddress) {
|
|
1219
1220
|
var _a;
|
|
1220
|
-
|
|
1221
|
-
|
|
1221
|
+
const cosmosInfoForUndelegate = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
1222
|
+
cosmos_1.Bech32Address.validate(validatorAddress, (_a = cosmosInfoForUndelegate.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixValAddr);
|
|
1223
|
+
const currency = cosmosInfoForUndelegate.stakeCurrency;
|
|
1222
1224
|
if (!currency) {
|
|
1223
1225
|
throw new Error("Stake currency is null");
|
|
1224
1226
|
}
|
|
@@ -1344,9 +1346,10 @@ class CosmosAccountImpl {
|
|
|
1344
1346
|
}
|
|
1345
1347
|
makeBeginRedelegateTx(amount, srcValidatorAddress, dstValidatorAddress) {
|
|
1346
1348
|
var _a, _b;
|
|
1347
|
-
|
|
1348
|
-
cosmos_1.Bech32Address.validate(
|
|
1349
|
-
|
|
1349
|
+
const cosmosInfoForRedelegate = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
1350
|
+
cosmos_1.Bech32Address.validate(srcValidatorAddress, (_a = cosmosInfoForRedelegate.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixValAddr);
|
|
1351
|
+
cosmos_1.Bech32Address.validate(dstValidatorAddress, (_b = cosmosInfoForRedelegate.bech32Config) === null || _b === void 0 ? void 0 : _b.bech32PrefixValAddr);
|
|
1352
|
+
const currency = cosmosInfoForRedelegate.stakeCurrency;
|
|
1350
1353
|
if (!currency) {
|
|
1351
1354
|
throw new Error("Stake currency is null");
|
|
1352
1355
|
}
|
|
@@ -1469,8 +1472,9 @@ class CosmosAccountImpl {
|
|
|
1469
1472
|
}
|
|
1470
1473
|
makeWithdrawDelegationRewardTx(validatorAddresses) {
|
|
1471
1474
|
var _a;
|
|
1475
|
+
const cosmosInfoForWithdraw = (0, chain_1.requireCosmosInfo)(this.chainGetter.getModularChain(this.chainId));
|
|
1472
1476
|
for (const validatorAddress of validatorAddresses) {
|
|
1473
|
-
cosmos_1.Bech32Address.validate(validatorAddress, (_a =
|
|
1477
|
+
cosmos_1.Bech32Address.validate(validatorAddress, (_a = cosmosInfoForWithdraw.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixValAddr);
|
|
1474
1478
|
}
|
|
1475
1479
|
return this.makeTx("withdrawRewards", () => __awaiter(this, void 0, void 0, function* () {
|
|
1476
1480
|
let msgs = validatorAddresses.map((validatorAddress) => {
|