@firmachain/firma-js 0.3.3 → 0.3.5
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/dist/index.js +5 -1
- package/dist/sdk/FirmaAuthzService.d.ts +8 -7
- package/dist/sdk/FirmaAuthzService.js +12 -22
- package/dist/sdk/FirmaBankService.js +2 -2
- package/dist/sdk/FirmaChainService.js +1 -1
- package/dist/sdk/FirmaContractService.d.ts +1 -1
- package/dist/sdk/FirmaContractService.js +6 -6
- package/dist/sdk/FirmaCosmWasmCw20.d.ts +2 -2
- package/dist/sdk/FirmaCosmWasmCw20.js +8 -8
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +2 -2
- package/dist/sdk/FirmaCosmWasmCw721.js +12 -12
- package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +1 -1
- package/dist/sdk/FirmaCosmWasmCwBridge.js +8 -8
- package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +1 -1
- package/dist/sdk/FirmaCosmWasmCwMarketplace.js +5 -5
- package/dist/sdk/FirmaCosmWasmService.d.ts +1 -1
- package/dist/sdk/FirmaCosmWasmService.js +13 -13
- package/dist/sdk/FirmaDistributionService.d.ts +1 -1
- package/dist/sdk/FirmaDistributionService.js +6 -6
- package/dist/sdk/FirmaFeeGrantService.d.ts +7 -6
- package/dist/sdk/FirmaFeeGrantService.js +9 -26
- package/dist/sdk/FirmaGovService.d.ts +1 -1
- package/dist/sdk/FirmaGovService.js +14 -14
- package/dist/sdk/FirmaIbcService.d.ts +3 -3
- package/dist/sdk/FirmaIbcService.js +11 -8
- package/dist/sdk/FirmaIpfsService.js +1 -1
- package/dist/sdk/FirmaMintService.js +1 -1
- package/dist/sdk/FirmaNftService.d.ts +1 -1
- package/dist/sdk/FirmaNftService.js +6 -6
- package/dist/sdk/FirmaSlashingService.js +1 -1
- package/dist/sdk/FirmaStakingService.d.ts +3 -3
- package/dist/sdk/FirmaStakingService.js +6 -6
- package/dist/sdk/FirmaTokenService.d.ts +1 -1
- package/dist/sdk/FirmaTokenService.js +5 -5
- package/dist/sdk/FirmaUtil.d.ts +25 -24
- package/dist/sdk/FirmaUtil.js +200 -145
- package/dist/sdk/FirmaWalletService.d.ts +6 -7
- package/dist/sdk/FirmaWalletService.js +78 -36
- package/dist/sdk/firmachain/authz/AuthzQueryClient.js +4 -4
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +8 -11
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +6 -10
- package/dist/sdk/firmachain/authz/index.js +5 -1
- package/dist/sdk/firmachain/bank/BankQueryClient.js +5 -5
- package/dist/sdk/firmachain/bank/index.js +5 -1
- package/dist/sdk/firmachain/common/ITxClient.d.ts +2 -4
- package/dist/sdk/firmachain/common/ITxClient.js +20 -92
- package/dist/sdk/firmachain/common/LedgerWallet.d.ts +19 -3
- package/dist/sdk/firmachain/common/LedgerWallet.js +138 -68
- package/dist/sdk/firmachain/common/TendermintQueryClient.js +1 -1
- package/dist/sdk/firmachain/common/TxCommon.d.ts +13 -29
- package/dist/sdk/firmachain/common/accounts.d.ts +1 -1
- package/dist/sdk/firmachain/common/accounts.js +7 -7
- package/dist/sdk/firmachain/{amino → common}/coins.d.ts +2 -14
- package/dist/sdk/firmachain/{amino → common}/coins.js +4 -25
- package/dist/sdk/firmachain/common/index.d.ts +0 -1
- package/dist/sdk/firmachain/common/index.js +5 -4
- package/dist/sdk/firmachain/{amino → common}/wallet.js +15 -11
- package/dist/sdk/firmachain/contract/ContractQueryClient.js +3 -3
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +6 -6
- package/dist/sdk/firmachain/contract/index.js +5 -1
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +9 -9
- package/dist/sdk/firmachain/cosmwasm/index.js +5 -1
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +6 -6
- package/dist/sdk/firmachain/distribution/index.js +5 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +3 -3
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +4 -45
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +3 -82
- package/dist/sdk/firmachain/feegrant/index.js +5 -1
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -3
- package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +29 -29
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -3
- package/dist/sdk/firmachain/gov/GovQueryClient.js +3 -3
- package/dist/sdk/firmachain/gov/index.js +5 -1
- package/dist/sdk/firmachain/ibc/IbcQueryClient.js +2 -2
- package/dist/sdk/firmachain/ibc/index.js +5 -1
- package/dist/sdk/firmachain/mint/MintQueryClient.js +1 -1
- package/dist/sdk/firmachain/mint/index.js +5 -1
- package/dist/sdk/firmachain/nft/NftQueryClient.js +1 -1
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +8 -8
- package/dist/sdk/firmachain/nft/index.js +5 -1
- package/dist/sdk/firmachain/slashing/SlashingQueryClient.js +1 -1
- package/dist/sdk/firmachain/slashing/index.js +5 -1
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +2 -2
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +10 -9
- package/dist/sdk/firmachain/staking/index.js +5 -1
- package/dist/sdk/firmachain/token/TokenQueryClient.js +1 -1
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +11 -11
- package/dist/sdk/firmachain/token/TokenTxTypes.js +1 -1
- package/dist/sdk/firmachain/token/index.js +5 -1
- package/dist/test/00.wallet.test.js +4 -4
- package/dist/test/01.contract_tx.test.js +5 -5
- package/dist/test/02.contract_query.test.js +15 -15
- package/dist/test/03.contract_scenario.test.js +28 -28
- package/dist/test/04.bank_tx.test.js +4 -4
- package/dist/test/05.bank_query.test.js +9 -9
- package/dist/test/06.feegrant_tx.test.js +59 -35
- package/dist/test/07.feegrant_query.test.js +18 -15
- package/dist/test/08.gas_estimate.test.js +110 -70
- package/dist/test/09.ipfs.test.js +4 -4
- package/dist/test/10.nft_tx.test.js +7 -7
- package/dist/test/11.nft_query.test.js +9 -9
- package/dist/test/12.staking_tx.test.js +27 -15
- package/dist/test/13.staking_query.test.js +20 -20
- package/dist/test/14.distribution_tx.test.js +8 -8
- package/dist/test/15.distribution_query.test.js +15 -15
- package/dist/test/16.gov_tx.test.js +17 -17
- package/dist/test/17.gov_query.test.js +19 -19
- package/dist/test/18.util.test.js +105 -63
- package/dist/test/19.chain.test.js +38 -38
- package/dist/test/20.slashing_query.test.js +25 -25
- package/dist/test/21.token_tx.test.js +6 -6
- package/dist/test/22.token_query.test.js +4 -4
- package/dist/test/23.authz_tx.test.js +77 -47
- package/dist/test/24.authz_query.test.js +66 -67
- package/dist/test/25.cosmwasm_tx.test.js +7 -7
- package/dist/test/26.cosmwasm_query.test.js +127 -59
- package/dist/test/{27.arbitary_sign.test.js → 27.arbitrary_sign.test.js} +34 -62
- package/dist/test/28.ibc_tx.test.js +8 -8
- package/dist/test/29.mint_query.test.js +2 -2
- package/dist/test/30.cw20_tx.test.js +20 -20
- package/dist/test/31.cw20_query.test.js +24 -24
- package/dist/test/32.cw721_tx.test.js +19 -19
- package/dist/test/33.cw721_query.test.js +32 -32
- package/dist/test/34.cw_bridge_tx.test.js +19 -19
- package/dist/test/35.cw_bridge_tx_low.test.js +13 -13
- package/dist/test/36.cw_bridge_query.test.js +20 -20
- package/dist/test/37.cw_marketplace_tx.test.js +32 -32
- package/dist/test/38.cw_marketplace_query.test.js +2 -2
- package/dist/test/config_test.d.ts +1 -1
- package/dist/test/config_test.js +2 -2
- package/package.json +9 -10
- package/dist/sdk/firmachain/amino/addresses.d.ts +0 -5
- package/dist/sdk/firmachain/amino/addresses.js +0 -46
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +0 -291
- package/dist/sdk/firmachain/amino/aminomsgs.js +0 -81
- package/dist/sdk/firmachain/amino/aminotypes.d.ts +0 -22
- package/dist/sdk/firmachain/amino/aminotypes.js +0 -538
- package/dist/sdk/firmachain/amino/encoding.d.ts +0 -33
- package/dist/sdk/firmachain/amino/encoding.js +0 -252
- package/dist/sdk/firmachain/amino/multisig.d.ts +0 -10
- package/dist/sdk/firmachain/amino/multisig.js +0 -42
- package/dist/sdk/firmachain/amino/pubkeys.d.ts +0 -47
- package/dist/sdk/firmachain/amino/pubkeys.js +0 -29
- package/dist/sdk/firmachain/amino/signature.d.ts +0 -16
- package/dist/sdk/firmachain/amino/signature.js +0 -36
- package/dist/sdk/firmachain/amino/signdoc.d.ts +0 -44
- package/dist/sdk/firmachain/amino/signdoc.js +0 -68
- package/dist/sdk/firmachain/amino/signer.d.ts +0 -33
- package/dist/sdk/firmachain/amino/signer.js +0 -2
- package/dist/sdk/firmachain/amino/stdtx.d.ts +0 -15
- package/dist/sdk/firmachain/amino/stdtx.js +0 -17
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +0 -22
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +0 -170
- package/dist/sdk/firmachain/common/aminotypes.d.ts +0 -19
- package/dist/sdk/firmachain/common/aminotypes.js +0 -74
- package/dist/sdk/firmachain/common/events.d.ts +0 -32
- package/dist/sdk/firmachain/common/events.js +0 -18
- package/dist/sdk/firmachain/common/fee.d.ts +0 -26
- package/dist/sdk/firmachain/common/fee.js +0 -83
- package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +0 -15
- package/dist/sdk/firmachain/common/modules/auth/queries.js +0 -64
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +0 -15
- package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/authz/messages.js +0 -9
- package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +0 -10
- package/dist/sdk/firmachain/common/modules/authz/queries.js +0 -88
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +0 -35
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +0 -85
- package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +0 -8
- package/dist/sdk/firmachain/common/modules/bank/messages.js +0 -12
- package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +0 -15
- package/dist/sdk/firmachain/common/modules/bank/queries.js +0 -128
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +0 -14
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +0 -11
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +0 -44
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +0 -113
- package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +0 -8
- package/dist/sdk/firmachain/common/modules/distribution/messages.js +0 -15
- package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +0 -16
- package/dist/sdk/firmachain/common/modules/distribution/queries.js +0 -171
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +0 -18
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +0 -11
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +0 -14
- package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/feegrant/messages.js +0 -8
- package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +0 -9
- package/dist/sdk/firmachain/common/modules/feegrant/queries.js +0 -81
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +0 -79
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +0 -152
- package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +0 -29
- package/dist/sdk/firmachain/common/modules/gov/messages.js +0 -39
- package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +0 -19
- package/dist/sdk/firmachain/common/modules/gov/queries.js +0 -160
- package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/group/aminomessages.js +0 -8
- package/dist/sdk/firmachain/common/modules/group/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/group/messages.js +0 -28
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +0 -38
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +0 -55
- package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +0 -8
- package/dist/sdk/firmachain/common/modules/ibc/messages.js +0 -32
- package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +0 -58
- package/dist/sdk/firmachain/common/modules/ibc/queries.js +0 -576
- package/dist/sdk/firmachain/common/modules/index.d.ts +0 -32
- package/dist/sdk/firmachain/common/modules/index.js +0 -101
- package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +0 -21
- package/dist/sdk/firmachain/common/modules/mint/queries.js +0 -95
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +0 -12
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +0 -11
- package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +0 -10
- package/dist/sdk/firmachain/common/modules/slashing/queries.js +0 -88
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +0 -112
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +0 -234
- package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +0 -33
- package/dist/sdk/firmachain/common/modules/staking/messages.js +0 -37
- package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +0 -23
- package/dist/sdk/firmachain/common/modules/staking/queries.js +0 -242
- package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +0 -11
- package/dist/sdk/firmachain/common/modules/tx/queries.js +0 -103
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +0 -16
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +0 -56
- package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/vesting/messages.js +0 -7
- package/dist/sdk/firmachain/common/queryclient/index.d.ts +0 -2
- package/dist/sdk/firmachain/common/queryclient/index.js +0 -10
- package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +0 -75
- package/dist/sdk/firmachain/common/queryclient/queryclient.js +0 -157
- package/dist/sdk/firmachain/common/queryclient/utils.d.ts +0 -33
- package/dist/sdk/firmachain/common/queryclient/utils.js +0 -101
- package/dist/sdk/firmachain/common/search.d.ts +0 -10
- package/dist/sdk/firmachain/common/search.js +0 -7
- package/dist/sdk/firmachain/common/signing.d.ts +0 -15
- package/dist/sdk/firmachain/common/signing.js +0 -87
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +0 -121
- package/dist/sdk/firmachain/common/signingstargateclient.js +0 -674
- package/dist/sdk/firmachain/common/stargateclient.d.ts +0 -210
- package/dist/sdk/firmachain/common/stargateclient.js +0 -527
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +0 -110
- package/dist/sdk/firmachain/google/protobuf/timestamp.js +0 -108
- /package/dist/sdk/firmachain/{amino → common}/paths.d.ts +0 -0
- /package/dist/sdk/firmachain/{amino → common}/paths.js +0 -0
- /package/dist/sdk/firmachain/{amino → common}/wallet.d.ts +0 -0
- /package/dist/test/{27.arbitary_sign.test.d.ts → 27.arbitrary_sign.test.d.ts} +0 -0
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -51,93 +51,163 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
51
51
|
}
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
55
|
-
for (var i = 0,
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
55
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
56
|
+
if (ar || !(i in from)) {
|
|
57
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
58
|
+
ar[i] = from[i];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
62
|
+
};
|
|
63
|
+
var __values = (this && this.__values) || function(o) {
|
|
64
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
65
|
+
if (m) return m.call(o);
|
|
66
|
+
if (o && typeof o.length === "number") return {
|
|
67
|
+
next: function () {
|
|
68
|
+
if (o && i >= o.length) o = void 0;
|
|
69
|
+
return { value: o && o[i++], done: !o };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
58
73
|
};
|
|
59
74
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
exports.
|
|
61
|
-
var
|
|
75
|
+
exports.signWithSignerProtobuf = void 0;
|
|
76
|
+
var signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
|
|
62
77
|
var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
|
|
63
|
-
var math_1 = require("@cosmjs/math");
|
|
64
78
|
var encoding_1 = require("@cosmjs/encoding");
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var pubkey = _a.pubkey, sequence = _a.sequence;
|
|
76
|
-
return ({
|
|
77
|
-
publicKey: pubkey,
|
|
78
|
-
modeInfo: {
|
|
79
|
-
single: { mode: signMode },
|
|
80
|
-
},
|
|
81
|
-
sequence: BigInt(sequence),
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
|
|
86
|
-
if (signMode === void 0) { signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON; }
|
|
79
|
+
var keys_1 = require("cosmjs-types/cosmos/crypto/secp256k1/keys");
|
|
80
|
+
// Creates AuthInfoBytes for "SIGN_MODE_DIRECT"
|
|
81
|
+
function makeAuthInfoBytesDirect(pubkey, feeAmount, gasLimit, sequence) {
|
|
82
|
+
var signerInfo = {
|
|
83
|
+
publicKey: pubkey,
|
|
84
|
+
modeInfo: {
|
|
85
|
+
single: { mode: signing_1.SignMode.SIGN_MODE_DIRECT },
|
|
86
|
+
},
|
|
87
|
+
sequence: BigInt(sequence),
|
|
88
|
+
};
|
|
87
89
|
var authInfo = {
|
|
88
|
-
signerInfos:
|
|
90
|
+
signerInfos: [signerInfo],
|
|
89
91
|
fee: {
|
|
90
|
-
amount: __spreadArray([], __read(feeAmount)),
|
|
92
|
+
amount: __spreadArray([], __read(feeAmount), false),
|
|
91
93
|
gasLimit: BigInt(gasLimit),
|
|
92
|
-
granter: granter,
|
|
93
94
|
},
|
|
94
95
|
};
|
|
95
96
|
return tx_1.AuthInfo.encode(tx_1.AuthInfo.fromPartial(authInfo)).finish();
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Signs a protobuf-based Cosmos transaction using a general Signer
|
|
100
|
+
* compatible with SIGN_MODE_DIRECT (e.g. Ledger, Keplr, etc.)
|
|
101
|
+
*
|
|
102
|
+
* @param signer - SignerInterface instance
|
|
103
|
+
* @param messages - Cosmos transaction messages
|
|
104
|
+
* @param signerData - Chain ID, account number, sequence
|
|
105
|
+
* @param option - Fee, memo, granter info
|
|
106
|
+
* @param registry - Protobuf registry for message encoding
|
|
107
|
+
* @returns TxRaw - fully signed transaction
|
|
108
|
+
*/
|
|
109
|
+
function signWithSignerProtobuf(signer, messages, signerData, option, registry) {
|
|
98
110
|
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
-
var
|
|
111
|
+
var anyMsgs, txBody, bodyBytes, pubkey, pubkeyProto, feeAmount, authInfoBytes, signDoc, signDocBytes, base64SignBytes, signature, lastError, protobufAttempts, protobufAttempts_1, protobufAttempts_1_1, attempt, signError_1, e_1_1, errorMsg, txRaw;
|
|
112
|
+
var e_1, _a;
|
|
100
113
|
return __generator(this, function (_b) {
|
|
101
114
|
switch (_b.label) {
|
|
102
|
-
case 0:
|
|
115
|
+
case 0:
|
|
116
|
+
anyMsgs = messages.map(function (msg) { return registry.encodeAsAny(msg); });
|
|
117
|
+
txBody = tx_1.TxBody.fromPartial({
|
|
118
|
+
messages: anyMsgs,
|
|
119
|
+
memo: option.memo || "",
|
|
120
|
+
});
|
|
121
|
+
bodyBytes = tx_1.TxBody.encode(txBody).finish();
|
|
122
|
+
return [4 /*yield*/, signer.getPublicKey()];
|
|
103
123
|
case 1:
|
|
104
|
-
|
|
105
|
-
|
|
124
|
+
pubkey = _b.sent();
|
|
125
|
+
pubkeyProto = {
|
|
126
|
+
typeUrl: "/cosmos.crypto.secp256k1.PubKey",
|
|
127
|
+
value: keys_1.PubKey.encode({ key: pubkey }).finish(),
|
|
128
|
+
};
|
|
129
|
+
feeAmount = option.fee.amount.map(function (a) { return ({
|
|
130
|
+
denom: a.denom,
|
|
131
|
+
amount: a.amount,
|
|
132
|
+
}); });
|
|
133
|
+
authInfoBytes = makeAuthInfoBytesDirect(pubkeyProto, feeAmount, parseInt(option.fee.gas), signerData.sequence);
|
|
134
|
+
signDoc = tx_1.SignDoc.fromPartial({
|
|
135
|
+
bodyBytes: bodyBytes,
|
|
136
|
+
authInfoBytes: authInfoBytes,
|
|
137
|
+
chainId: signerData.chain_id,
|
|
138
|
+
accountNumber: BigInt(signerData.account_number),
|
|
139
|
+
});
|
|
140
|
+
// Verify SignDoc has all required fields
|
|
141
|
+
if (!signDoc.chainId) {
|
|
142
|
+
throw new Error("SignDoc chainId is missing: ".concat(signDoc.chainId));
|
|
143
|
+
}
|
|
144
|
+
if (!signDoc.accountNumber) {
|
|
145
|
+
throw new Error("SignDoc accountNumber is missing: ".concat(signDoc.accountNumber));
|
|
146
|
+
}
|
|
147
|
+
signDocBytes = tx_1.SignDoc.encode(signDoc).finish();
|
|
148
|
+
base64SignBytes = (0, encoding_1.toBase64)(signDocBytes);
|
|
149
|
+
protobufAttempts = [
|
|
150
|
+
{ name: "SignDoc Base64", data: base64SignBytes },
|
|
151
|
+
{ name: "SignDoc Hex", data: Buffer.from(signDocBytes).toString('hex') },
|
|
152
|
+
{ name: "SignDoc Hex with 0x", data: '0x' + Buffer.from(signDocBytes).toString('hex') },
|
|
153
|
+
];
|
|
154
|
+
_b.label = 2;
|
|
106
155
|
case 2:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
msgs = messages.map(function (msg) { return aminoTypes.toAmino(msg); });
|
|
111
|
-
chainId = signerData.chain_id;
|
|
112
|
-
accountNumber = Number.parseInt(signerData.account_number);
|
|
113
|
-
sequence = Number.parseInt(signerData.sequence);
|
|
114
|
-
memo = option.memo;
|
|
115
|
-
fee = { amount: option.fee.amount, gas: option.fee.gas };
|
|
116
|
-
signDoc = signdoc_2.makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
|
|
117
|
-
signMessage = signdoc_1.serializeSignDoc(signDoc);
|
|
118
|
-
return [4 /*yield*/, ledger.sign(encoding_3.fromUtf8(signMessage))];
|
|
156
|
+
_b.trys.push([2, 9, 10, 11]);
|
|
157
|
+
protobufAttempts_1 = __values(protobufAttempts), protobufAttempts_1_1 = protobufAttempts_1.next();
|
|
158
|
+
_b.label = 3;
|
|
119
159
|
case 3:
|
|
120
|
-
|
|
121
|
-
;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
160
|
+
if (!!protobufAttempts_1_1.done) return [3 /*break*/, 8];
|
|
161
|
+
attempt = protobufAttempts_1_1.value;
|
|
162
|
+
_b.label = 4;
|
|
163
|
+
case 4:
|
|
164
|
+
_b.trys.push([4, 6, , 7]);
|
|
165
|
+
return [4 /*yield*/, signer.sign(attempt.data)];
|
|
166
|
+
case 5:
|
|
167
|
+
signature = _b.sent();
|
|
168
|
+
if (signature && signature.length > 0) {
|
|
169
|
+
return [3 /*break*/, 8]; // Success! Exit loop
|
|
170
|
+
}
|
|
171
|
+
return [3 /*break*/, 7];
|
|
172
|
+
case 6:
|
|
173
|
+
signError_1 = _b.sent();
|
|
174
|
+
lastError = signError_1;
|
|
175
|
+
return [3 /*break*/, 7]; // Try next format
|
|
176
|
+
case 7:
|
|
177
|
+
protobufAttempts_1_1 = protobufAttempts_1.next();
|
|
178
|
+
return [3 /*break*/, 3];
|
|
179
|
+
case 8: return [3 /*break*/, 11];
|
|
180
|
+
case 9:
|
|
181
|
+
e_1_1 = _b.sent();
|
|
182
|
+
e_1 = { error: e_1_1 };
|
|
183
|
+
return [3 /*break*/, 11];
|
|
184
|
+
case 10:
|
|
185
|
+
try {
|
|
186
|
+
if (protobufAttempts_1_1 && !protobufAttempts_1_1.done && (_a = protobufAttempts_1.return)) _a.call(protobufAttempts_1);
|
|
187
|
+
}
|
|
188
|
+
finally { if (e_1) throw e_1.error; }
|
|
189
|
+
return [7 /*endfinally*/];
|
|
190
|
+
case 11:
|
|
191
|
+
// If all Protobuf attempts failed, provide guidance
|
|
192
|
+
if (!signature || signature.length === 0) {
|
|
193
|
+
errorMsg = lastError instanceof Error ? lastError.message : String(lastError);
|
|
194
|
+
throw new Error("FirmaChain Ledger app signing failed: ".concat(errorMsg, ". Please ensure FirmaChain app is properly installed and up to date."));
|
|
195
|
+
}
|
|
196
|
+
// Signature validation
|
|
197
|
+
if (!signature || signature.length === 0) {
|
|
198
|
+
throw new Error("Signature is empty. Please confirm that the transaction was approved on Ledger or check Ledger connection.");
|
|
199
|
+
}
|
|
200
|
+
if (signature.length !== 64) {
|
|
201
|
+
throw new Error("Unexpected signature length: ".concat(signature.length, " bytes (expected: 64 bytes)"));
|
|
202
|
+
}
|
|
203
|
+
txRaw = tx_1.TxRaw.fromPartial({
|
|
204
|
+
bodyBytes: bodyBytes,
|
|
205
|
+
authInfoBytes: authInfoBytes,
|
|
206
|
+
signatures: [signature],
|
|
137
207
|
});
|
|
138
208
|
return [2 /*return*/, txRaw];
|
|
139
209
|
}
|
|
140
210
|
});
|
|
141
211
|
});
|
|
142
212
|
}
|
|
143
|
-
exports.
|
|
213
|
+
exports.signWithSignerProtobuf = signWithSignerProtobuf;
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Any } from "../google/protobuf/any";
|
|
3
|
-
export interface StdFee {
|
|
4
|
-
amount: Coin[];
|
|
5
|
-
gas: string;
|
|
6
|
-
granter: string;
|
|
7
|
-
}
|
|
8
|
-
export interface BasicFeeGrantOption {
|
|
9
|
-
spendLimit?: number;
|
|
10
|
-
expiration?: Date;
|
|
11
|
-
}
|
|
12
|
-
export interface PeriodicFeeGrantOption {
|
|
13
|
-
basicSpendLimit?: number;
|
|
14
|
-
basicExpiration?: Date;
|
|
15
|
-
periodSeconds: number;
|
|
16
|
-
periodSpendLimit: number;
|
|
17
|
-
periodCanSpend: number;
|
|
18
|
-
periodReset: Date;
|
|
19
|
-
}
|
|
1
|
+
import { StdFee } from "@cosmjs/stargate";
|
|
20
2
|
export declare const DefaultBasicFeeGrantOption: {
|
|
21
3
|
spendLimit: undefined;
|
|
22
4
|
expiration: undefined;
|
|
@@ -72,15 +54,17 @@ export declare enum VotingOption {
|
|
|
72
54
|
VOTE_OPTION_NO_WITH_VETO = 4,
|
|
73
55
|
UNRECOGNIZED = -1
|
|
74
56
|
}
|
|
75
|
-
export interface
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
export interface ArbitraryVerifyData {
|
|
58
|
+
chainId: string;
|
|
59
|
+
accountNumber: string;
|
|
60
|
+
sequence: string;
|
|
61
|
+
bodyBytes: string;
|
|
62
|
+
authInfoBytes: string;
|
|
63
|
+
signerAddress: string;
|
|
64
|
+
pubkey: string;
|
|
65
|
+
signature: string;
|
|
79
66
|
}
|
|
80
|
-
export interface
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
height?: bigint;
|
|
84
|
-
info?: string;
|
|
85
|
-
upgradedClientState?: Any;
|
|
67
|
+
export interface MsgSignArbitraryData {
|
|
68
|
+
signer: string;
|
|
69
|
+
data: Uint8Array;
|
|
86
70
|
}
|
|
@@ -11,7 +11,7 @@ export interface Account {
|
|
|
11
11
|
* Represents a generic function that takes an `Any` encoded account from the chain
|
|
12
12
|
* and extracts some common `Account` information from it.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export type AccountParser = (any: Any) => Account;
|
|
15
15
|
/**
|
|
16
16
|
* Basic implementation of AccountParser. This is supposed to support the most relevant
|
|
17
17
|
* common Cosmos SDK account types. If you need support for exotic account types,
|
|
@@ -11,7 +11,7 @@ function uint64FromProto(input) {
|
|
|
11
11
|
}
|
|
12
12
|
function accountFromBaseAccount(input) {
|
|
13
13
|
var address = input.address, pubKey = input.pubKey, accountNumber = input.accountNumber, sequence = input.sequence;
|
|
14
|
-
var pubkey = proto_signing_1.decodeOptionalPubkey(pubKey);
|
|
14
|
+
var pubkey = (0, proto_signing_1.decodeOptionalPubkey)(pubKey);
|
|
15
15
|
return {
|
|
16
16
|
address: address,
|
|
17
17
|
pubkey: pubkey,
|
|
@@ -33,32 +33,32 @@ function accountFromAny(input) {
|
|
|
33
33
|
return accountFromBaseAccount(auth_1.BaseAccount.decode(value));
|
|
34
34
|
case "/cosmos.auth.v1beta1.ModuleAccount": {
|
|
35
35
|
var baseAccount = auth_1.ModuleAccount.decode(value).baseAccount;
|
|
36
|
-
utils_1.assert(baseAccount);
|
|
36
|
+
(0, utils_1.assert)(baseAccount);
|
|
37
37
|
return accountFromBaseAccount(baseAccount);
|
|
38
38
|
}
|
|
39
39
|
// vesting
|
|
40
40
|
case "/cosmos.vesting.v1beta1.BaseVestingAccount": {
|
|
41
41
|
var baseAccount = (_a = vesting_1.BaseVestingAccount.decode(value)) === null || _a === void 0 ? void 0 : _a.baseAccount;
|
|
42
|
-
utils_1.assert(baseAccount);
|
|
42
|
+
(0, utils_1.assert)(baseAccount);
|
|
43
43
|
return accountFromBaseAccount(baseAccount);
|
|
44
44
|
}
|
|
45
45
|
case "/cosmos.vesting.v1beta1.ContinuousVestingAccount": {
|
|
46
46
|
var baseAccount = (_c = (_b = vesting_1.ContinuousVestingAccount.decode(value)) === null || _b === void 0 ? void 0 : _b.baseVestingAccount) === null || _c === void 0 ? void 0 : _c.baseAccount;
|
|
47
|
-
utils_1.assert(baseAccount);
|
|
47
|
+
(0, utils_1.assert)(baseAccount);
|
|
48
48
|
return accountFromBaseAccount(baseAccount);
|
|
49
49
|
}
|
|
50
50
|
case "/cosmos.vesting.v1beta1.DelayedVestingAccount": {
|
|
51
51
|
var baseAccount = (_e = (_d = vesting_1.DelayedVestingAccount.decode(value)) === null || _d === void 0 ? void 0 : _d.baseVestingAccount) === null || _e === void 0 ? void 0 : _e.baseAccount;
|
|
52
|
-
utils_1.assert(baseAccount);
|
|
52
|
+
(0, utils_1.assert)(baseAccount);
|
|
53
53
|
return accountFromBaseAccount(baseAccount);
|
|
54
54
|
}
|
|
55
55
|
case "/cosmos.vesting.v1beta1.PeriodicVestingAccount": {
|
|
56
56
|
var baseAccount = (_g = (_f = vesting_1.PeriodicVestingAccount.decode(value)) === null || _f === void 0 ? void 0 : _f.baseVestingAccount) === null || _g === void 0 ? void 0 : _g.baseAccount;
|
|
57
|
-
utils_1.assert(baseAccount);
|
|
57
|
+
(0, utils_1.assert)(baseAccount);
|
|
58
58
|
return accountFromBaseAccount(baseAccount);
|
|
59
59
|
}
|
|
60
60
|
default:
|
|
61
|
-
throw new Error("Unsupported type: '"
|
|
61
|
+
throw new Error("Unsupported type: '".concat(typeUrl, "'"));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
exports.accountFromAny = accountFromAny;
|
|
@@ -19,24 +19,12 @@ export declare function coins(amount: number | string, denom: string): Coin[];
|
|
|
19
19
|
/**
|
|
20
20
|
* Takes a coins list like "819966000ucosm,700000000ustake" and parses it.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
* a variety of denom types such as IBC denoms or tokenfactory. If you need to
|
|
24
|
-
* restrict the denom to something very minimal, this needs to be implemented
|
|
25
|
-
* separately in the caller.
|
|
22
|
+
* A Stargate-ready variant of this function is available via:
|
|
26
23
|
*
|
|
27
24
|
* ```
|
|
28
25
|
* import { parseCoins } from "@cosmjs/proto-signing";
|
|
29
|
-
* //
|
|
26
|
+
* // or
|
|
30
27
|
* import { parseCoins } from "@cosmjs/stargate";
|
|
31
|
-
* // equals
|
|
32
|
-
* import { parseCoins } from "@cosmjs/amino";
|
|
33
28
|
* ```
|
|
34
|
-
*
|
|
35
|
-
* This function is not made for supporting decimal amounts and does not support
|
|
36
|
-
* parsing gas prices.
|
|
37
29
|
*/
|
|
38
30
|
export declare function parseCoins(input: string): Coin[];
|
|
39
|
-
/**
|
|
40
|
-
* Function to sum up coins with type Coin
|
|
41
|
-
*/
|
|
42
|
-
export declare function addCoins(lhs: Coin, rhs: Coin): Coin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseCoins = exports.coins = exports.coin = void 0;
|
|
4
4
|
var math_1 = require("@cosmjs/math");
|
|
5
5
|
/**
|
|
6
6
|
* Creates a coin.
|
|
@@ -43,21 +43,13 @@ exports.coins = coins;
|
|
|
43
43
|
/**
|
|
44
44
|
* Takes a coins list like "819966000ucosm,700000000ustake" and parses it.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
47
|
-
* a variety of denom types such as IBC denoms or tokenfactory. If you need to
|
|
48
|
-
* restrict the denom to something very minimal, this needs to be implemented
|
|
49
|
-
* separately in the caller.
|
|
46
|
+
* A Stargate-ready variant of this function is available via:
|
|
50
47
|
*
|
|
51
48
|
* ```
|
|
52
49
|
* import { parseCoins } from "@cosmjs/proto-signing";
|
|
53
|
-
* //
|
|
50
|
+
* // or
|
|
54
51
|
* import { parseCoins } from "@cosmjs/stargate";
|
|
55
|
-
* // equals
|
|
56
|
-
* import { parseCoins } from "@cosmjs/amino";
|
|
57
52
|
* ```
|
|
58
|
-
*
|
|
59
|
-
* This function is not made for supporting decimal amounts and does not support
|
|
60
|
-
* parsing gas prices.
|
|
61
53
|
*/
|
|
62
54
|
function parseCoins(input) {
|
|
63
55
|
return input
|
|
@@ -65,26 +57,13 @@ function parseCoins(input) {
|
|
|
65
57
|
.split(",")
|
|
66
58
|
.filter(Boolean)
|
|
67
59
|
.map(function (part) {
|
|
68
|
-
// Denom regex from Stargate (https://github.com/cosmos/cosmos-sdk/blob/v0.42.7/types/coin.go#L599-L601)
|
|
69
60
|
var match = part.match(/^([0-9]+)([a-zA-Z][a-zA-Z0-9/]{2,127})$/);
|
|
70
61
|
if (!match)
|
|
71
62
|
throw new Error("Got an invalid coin string");
|
|
72
63
|
return {
|
|
73
|
-
amount: match[1].
|
|
64
|
+
amount: math_1.Uint64.fromString(match[1]).toString(),
|
|
74
65
|
denom: match[2],
|
|
75
66
|
};
|
|
76
67
|
});
|
|
77
68
|
}
|
|
78
69
|
exports.parseCoins = parseCoins;
|
|
79
|
-
/**
|
|
80
|
-
* Function to sum up coins with type Coin
|
|
81
|
-
*/
|
|
82
|
-
function addCoins(lhs, rhs) {
|
|
83
|
-
if (lhs.denom !== rhs.denom)
|
|
84
|
-
throw new Error("Trying to add two coins with different denoms");
|
|
85
|
-
return {
|
|
86
|
-
amount: math_1.Decimal.fromAtomics(lhs.amount, 0).plus(math_1.Decimal.fromAtomics(rhs.amount, 0)).atomics,
|
|
87
|
-
denom: lhs.denom,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
exports.addCoins = addCoins;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -10,8 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.AminoTypes = void 0;
|
|
14
17
|
__exportStar(require("./TxCommon"), exports);
|
|
15
18
|
__exportStar(require("./QueryCommon"), exports);
|
|
16
|
-
var aminotypes_1 = require("./aminotypes");
|
|
17
|
-
Object.defineProperty(exports, "AminoTypes", { enumerable: true, get: function () { return aminotypes_1.AminoTypes; } });
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -51,10 +51,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
51
51
|
}
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
55
|
-
for (var i = 0,
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
55
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
56
|
+
if (ar || !(i in from)) {
|
|
57
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
58
|
+
ar[i] = from[i];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
58
62
|
};
|
|
59
63
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
64
|
exports.decrypt = exports.encrypt = exports.supportedAlgorithms = exports.executeKdf = exports.cosmjsSalt = void 0;
|
|
@@ -65,7 +69,7 @@ var encoding_1 = require("@cosmjs/encoding");
|
|
|
65
69
|
* This reduces the scope of a potential rainbow attack to all CosmJS users.
|
|
66
70
|
* Must be 16 bytes due to implementation limitations.
|
|
67
71
|
*/
|
|
68
|
-
exports.cosmjsSalt = encoding_1.toAscii("The CosmJS salt.");
|
|
72
|
+
exports.cosmjsSalt = (0, encoding_1.toAscii)("The CosmJS salt.");
|
|
69
73
|
function executeKdf(password, configuration) {
|
|
70
74
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
75
|
var options;
|
|
@@ -73,7 +77,7 @@ function executeKdf(password, configuration) {
|
|
|
73
77
|
switch (configuration.algorithm) {
|
|
74
78
|
case "argon2id": {
|
|
75
79
|
options = configuration.params;
|
|
76
|
-
if (!crypto_1.isArgon2idOptions(options))
|
|
80
|
+
if (!(0, crypto_1.isArgon2idOptions)(options))
|
|
77
81
|
throw new Error("Invalid format of argon2id params");
|
|
78
82
|
return [2 /*return*/, crypto_1.Argon2id.execute(password, exports.cosmjsSalt, options)];
|
|
79
83
|
}
|
|
@@ -102,12 +106,12 @@ function encrypt(plaintext, encryptionKey, config) {
|
|
|
102
106
|
case 1:
|
|
103
107
|
nonce = crypto_1.Random.getBytes(crypto_1.xchacha20NonceLength);
|
|
104
108
|
_b = Uint8Array.bind;
|
|
105
|
-
_c = [__spreadArray([], __read(nonce))];
|
|
109
|
+
_c = [__spreadArray([], __read(nonce), false)];
|
|
106
110
|
return [4 /*yield*/, crypto_1.Xchacha20poly1305Ietf.encrypt(plaintext, encryptionKey, nonce)];
|
|
107
111
|
case 2:
|
|
108
112
|
// Prepend fixed-length nonce to ciphertext as suggested in the example from https://github.com/jedisct1/libsodium.js#api
|
|
109
|
-
return [2 /*return*/, new (_b.apply(Uint8Array, [void 0, __spreadArray.apply(void 0, _c.concat([__read.apply(void 0, [(_d.sent())])]))]))()];
|
|
110
|
-
case 3: throw new Error("Unsupported encryption algorithm: '"
|
|
113
|
+
return [2 /*return*/, new (_b.apply(Uint8Array, [void 0, __spreadArray.apply(void 0, _c.concat([__read.apply(void 0, [(_d.sent())]), false]))]))()];
|
|
114
|
+
case 3: throw new Error("Unsupported encryption algorithm: '".concat(config.algorithm, "'"));
|
|
111
115
|
}
|
|
112
116
|
});
|
|
113
117
|
});
|
|
@@ -123,7 +127,7 @@ function decrypt(ciphertext, encryptionKey, config) {
|
|
|
123
127
|
return [2 /*return*/, crypto_1.Xchacha20poly1305Ietf.decrypt(ciphertext.slice(crypto_1.xchacha20NonceLength), encryptionKey, nonce)];
|
|
124
128
|
}
|
|
125
129
|
default:
|
|
126
|
-
throw new Error("Unsupported encryption algorithm: '"
|
|
130
|
+
throw new Error("Unsupported encryption algorithm: '".concat(config.algorithm, "'"));
|
|
127
131
|
}
|
|
128
132
|
return [2 /*return*/];
|
|
129
133
|
});
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -87,7 +87,7 @@ var ContractQueryClient = /** @class */ (function () {
|
|
|
87
87
|
return __generator(this, function (_a) {
|
|
88
88
|
switch (_a.label) {
|
|
89
89
|
case 0:
|
|
90
|
-
path = "/firmachain/firmachain/contract/contractFile/"
|
|
90
|
+
path = "/firmachain/firmachain/contract/contractFile/".concat(fileHash);
|
|
91
91
|
return [4 /*yield*/, this.axios.get(path)];
|
|
92
92
|
case 1:
|
|
93
93
|
result = _a.sent();
|
|
@@ -122,7 +122,7 @@ var ContractQueryClient = /** @class */ (function () {
|
|
|
122
122
|
return __generator(this, function (_a) {
|
|
123
123
|
switch (_a.label) {
|
|
124
124
|
case 0:
|
|
125
|
-
path = "/firmachain/firmachain/contract/contractLog/"
|
|
125
|
+
path = "/firmachain/firmachain/contract/contractLog/".concat(logId);
|
|
126
126
|
return [4 /*yield*/, this.axios.get(path)];
|
|
127
127
|
case 1:
|
|
128
128
|
result = _a.sent();
|
|
@@ -22,28 +22,28 @@ export interface MsgAddContractLogResponse {
|
|
|
22
22
|
}
|
|
23
23
|
export declare const MsgCreateContractFile: {
|
|
24
24
|
encode(message: MsgCreateContractFile, writer?: Writer): Writer;
|
|
25
|
-
decode(input: Reader | Uint8Array, length?: number
|
|
25
|
+
decode(input: Reader | Uint8Array, length?: number): MsgCreateContractFile;
|
|
26
26
|
fromJSON(object: any): MsgCreateContractFile;
|
|
27
27
|
toJSON(message: MsgCreateContractFile): unknown;
|
|
28
28
|
fromPartial(object: DeepPartial<MsgCreateContractFile>): MsgCreateContractFile;
|
|
29
29
|
};
|
|
30
30
|
export declare const MsgCreateContractFileResponse: {
|
|
31
31
|
encode(_: MsgCreateContractFileResponse, writer?: Writer): Writer;
|
|
32
|
-
decode(input: Reader | Uint8Array, length?: number
|
|
32
|
+
decode(input: Reader | Uint8Array, length?: number): MsgCreateContractFileResponse;
|
|
33
33
|
fromJSON(_: any): MsgCreateContractFileResponse;
|
|
34
34
|
toJSON(_: MsgCreateContractFileResponse): unknown;
|
|
35
35
|
fromPartial(_: DeepPartial<MsgCreateContractFileResponse>): MsgCreateContractFileResponse;
|
|
36
36
|
};
|
|
37
37
|
export declare const MsgAddContractLog: {
|
|
38
38
|
encode(message: MsgAddContractLog, writer?: Writer): Writer;
|
|
39
|
-
decode(input: Reader | Uint8Array, length?: number
|
|
39
|
+
decode(input: Reader | Uint8Array, length?: number): MsgAddContractLog;
|
|
40
40
|
fromJSON(object: any): MsgAddContractLog;
|
|
41
41
|
toJSON(message: MsgAddContractLog): unknown;
|
|
42
42
|
fromPartial(object: DeepPartial<MsgAddContractLog>): MsgAddContractLog;
|
|
43
43
|
};
|
|
44
44
|
export declare const MsgAddContractLogResponse: {
|
|
45
45
|
encode(message: MsgAddContractLogResponse, writer?: Writer): Writer;
|
|
46
|
-
decode(input: Reader | Uint8Array, length?: number
|
|
46
|
+
decode(input: Reader | Uint8Array, length?: number): MsgAddContractLogResponse;
|
|
47
47
|
fromJSON(object: any): MsgAddContractLogResponse;
|
|
48
48
|
toJSON(message: MsgAddContractLogResponse): unknown;
|
|
49
49
|
fromPartial(object: DeepPartial<MsgAddContractLogResponse>): MsgAddContractLogResponse;
|
|
@@ -62,8 +62,8 @@ export declare class MsgClientImpl implements Msg {
|
|
|
62
62
|
interface Rpc {
|
|
63
63
|
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
export
|
|
65
|
+
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
66
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
67
67
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
68
68
|
} : Partial<T>;
|
|
69
69
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|