@firmachain/firma-js 0.2.64 → 0.3.1
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/README.md +1 -1
- package/dist/sdk/FirmaAuthzService.d.ts +8 -8
- package/dist/sdk/FirmaAuthzService.js +12 -6
- package/dist/sdk/FirmaBankService.d.ts +4 -4
- package/dist/sdk/FirmaContractService.d.ts +4 -4
- package/dist/sdk/FirmaCosmWasmCw20.d.ts +14 -14
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +14 -14
- package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +9 -9
- package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.js +2 -3
- package/dist/sdk/FirmaDistributionService.d.ts +6 -6
- package/dist/sdk/FirmaFeeGrantService.d.ts +4 -4
- package/dist/sdk/FirmaGovService.d.ts +27 -16
- package/dist/sdk/FirmaGovService.js +305 -195
- package/dist/sdk/FirmaIbcService.d.ts +3 -4
- package/dist/sdk/FirmaIbcService.js +5 -2
- package/dist/sdk/FirmaNftService.d.ts +5 -5
- package/dist/sdk/FirmaStakingService.d.ts +6 -6
- package/dist/sdk/FirmaTokenService.d.ts +5 -5
- package/dist/sdk/FirmaUtil.d.ts +1 -1
- package/dist/sdk/FirmaUtil.js +12 -14
- package/dist/sdk/firmachain/amino/addresses.js +1 -1
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +10 -0
- package/dist/sdk/firmachain/amino/aminomsgs.js +5 -1
- package/dist/sdk/firmachain/amino/aminotypes.js +27 -10
- package/dist/sdk/firmachain/amino/coins.d.ts +14 -2
- package/dist/sdk/firmachain/amino/coins.js +26 -5
- package/dist/sdk/firmachain/amino/encoding.d.ts +10 -1
- package/dist/sdk/firmachain/amino/encoding.js +21 -3
- package/dist/sdk/firmachain/amino/signdoc.d.ts +21 -3
- package/dist/sdk/firmachain/amino/signdoc.js +37 -11
- package/dist/sdk/firmachain/amino/signer.d.ts +2 -1
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +7 -6
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +7 -6
- package/dist/sdk/firmachain/bank/BankQueryClient.js +1 -1
- package/dist/sdk/firmachain/common/CommonTxClient.js +11 -9
- package/dist/sdk/firmachain/common/ITxClient.d.ts +6 -6
- package/dist/sdk/firmachain/common/ITxClient.js +82 -24
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +4 -9
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +37 -32
- package/dist/sdk/firmachain/common/LedgerWallet.js +4 -8
- package/dist/sdk/firmachain/common/TxCommon.d.ts +1 -2
- package/dist/sdk/firmachain/common/accounts.d.ts +7 -3
- package/dist/sdk/firmachain/common/accounts.js +28 -33
- package/dist/sdk/firmachain/common/aminotypes.d.ts +19 -0
- package/dist/sdk/firmachain/common/aminotypes.js +74 -0
- package/dist/sdk/firmachain/common/events.d.ts +32 -0
- package/dist/sdk/firmachain/common/events.js +18 -0
- package/dist/sdk/firmachain/common/fee.d.ts +26 -0
- package/dist/sdk/firmachain/common/fee.js +83 -0
- package/dist/sdk/firmachain/common/index.d.ts +1 -0
- package/dist/sdk/firmachain/common/index.js +3 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.js +64 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +15 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.js +9 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +35 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +85 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.js +12 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.js +128 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +14 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +44 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +113 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.js +15 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.js +171 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +18 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +14 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.js +8 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +9 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.js +81 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +79 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +152 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +29 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.js +38 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +19 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.js +160 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.js +8 -0
- package/dist/sdk/firmachain/common/modules/group/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/messages.js +28 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +38 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +55 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.js +32 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +58 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.js +576 -0
- package/dist/sdk/firmachain/common/modules/index.d.ts +32 -0
- package/dist/sdk/firmachain/common/modules/index.js +101 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +21 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.js +95 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +12 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +112 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +234 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +33 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.js +37 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +23 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.js +242 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +11 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.js +103 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +56 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.js +7 -0
- package/dist/sdk/firmachain/common/queryclient/index.d.ts +2 -0
- package/dist/sdk/firmachain/common/queryclient/index.js +10 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +75 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.js +157 -0
- package/dist/sdk/firmachain/common/queryclient/utils.d.ts +33 -0
- package/dist/sdk/firmachain/common/queryclient/utils.js +101 -0
- package/dist/sdk/firmachain/common/search.d.ts +10 -0
- package/dist/sdk/firmachain/common/search.js +7 -0
- package/dist/sdk/firmachain/common/signing.d.ts +8 -3
- package/dist/sdk/firmachain/common/signing.js +24 -12
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +107 -30
- package/dist/sdk/firmachain/common/signingstargateclient.js +445 -128
- package/dist/sdk/firmachain/common/stargateclient.d.ts +184 -20
- package/dist/sdk/firmachain/common/stargateclient.js +351 -35
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +2 -2
- package/dist/sdk/firmachain/contract/ContractTxClient.js +4 -4
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +3 -3
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +1 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +5 -5
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +10 -8
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/any.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/duration.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/timestamp.js +2 -1
- package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +13 -1
- package/dist/sdk/firmachain/gov/GovQueryClient.js +9 -2
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +12 -0
- package/dist/sdk/firmachain/gov/GovTxClient.js +11 -1
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -3
- package/dist/sdk/firmachain/nft/NftTxClient.js +6 -6
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/nft/NftTxTypes.js +4 -4
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +1 -0
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -1
- package/dist/sdk/firmachain/token/TokenTxClient.d.ts +4 -4
- package/dist/sdk/firmachain/token/TokenTxClient.js +8 -8
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/token/TokenTxTypes.js +5 -5
- package/dist/test/00.wallet.test.js +15 -9
- package/dist/test/01.contract_tx.test.js +53 -45
- package/dist/test/02.contract_query.test.js +54 -31
- package/dist/test/03.contract_scenario.test.js +170 -326
- package/dist/test/04.bank_tx.test.js +58 -59
- package/dist/test/05.bank_query.test.js +51 -56
- package/dist/test/06.feegrant_tx.test.js +74 -89
- package/dist/test/07.feegrant_query.test.js +69 -27
- package/dist/test/08.gas_estimate.test.js +422 -392
- package/dist/test/09.ipfs.test.js +3 -3
- package/dist/test/10.nft_tx.test.js +108 -76
- package/dist/test/11.nft_query.test.js +41 -46
- package/dist/test/12.staking_tx.test.js +81 -98
- package/dist/test/13.staking_query.test.js +66 -12
- package/dist/test/14.distribution_tx.test.js +69 -78
- package/dist/test/15.distribution_query.test.js +81 -57
- package/dist/test/16.gov_tx.test.js +247 -107
- package/dist/test/17.gov_query.test.js +48 -9
- package/dist/test/18.util.test.js +6 -1
- package/dist/test/19.chain.test.js +50 -4
- package/dist/test/20.slashing_query.test.js +31 -1
- package/dist/test/21.token_tx.test.js +48 -56
- package/dist/test/22.token_query.test.js +24 -20
- package/dist/test/23.authz_tx.test.js +119 -240
- package/dist/test/24.authz_query.test.js +116 -56
- package/dist/test/25.cosmwasm_tx.test.js +95 -57
- package/dist/test/26.cosmwasm_query.test.js +66 -26
- package/dist/test/27.arbitary_sign.test.js +59 -67
- package/dist/test/28.ibc_tx.test.js +29 -17
- package/dist/test/29.mint_query.test.js +2 -0
- package/dist/test/30.cw20_tx.test.js +161 -226
- package/dist/test/31.cw20_query.test.js +183 -37
- package/dist/test/32.cw721_tx.test.js +147 -149
- package/dist/test/33.cw721_query.test.js +188 -36
- package/dist/test/34.cw_bridge_tx.test.js +266 -155
- package/dist/test/35.cw_bridge_tx_low.test.js +221 -81
- package/dist/test/36.cw_bridge_query.test.js +157 -21
- package/dist/test/37.cw_marketplace_tx.test.js +22 -22
- package/dist/test/38.cw_marketplace_query.test.js +9 -9
- package/dist/test/config_test.d.ts +10 -4
- package/dist/test/config_test.js +16 -9
- package/dist/test/config_test.sample.d.ts +11 -0
- package/dist/test/config_test.sample.js +14 -0
- package/package.json +9 -7
- package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +0 -50
- package/dist/sdk/firmachain/common/signingaminostargateclient.js +0 -267
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.accountFromAny = void 0;
|
|
4
4
|
var math_1 = require("@cosmjs/math");
|
|
5
5
|
var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
6
|
+
var utils_1 = require("@cosmjs/utils");
|
|
6
7
|
var auth_1 = require("cosmjs-types/cosmos/auth/v1beta1/auth");
|
|
7
8
|
var vesting_1 = require("cosmjs-types/cosmos/vesting/v1beta1/vesting");
|
|
8
9
|
function uint64FromProto(input) {
|
|
@@ -10,7 +11,7 @@ function uint64FromProto(input) {
|
|
|
10
11
|
}
|
|
11
12
|
function accountFromBaseAccount(input) {
|
|
12
13
|
var address = input.address, pubKey = input.pubKey, accountNumber = input.accountNumber, sequence = input.sequence;
|
|
13
|
-
var pubkey = proto_signing_1.
|
|
14
|
+
var pubkey = proto_signing_1.decodeOptionalPubkey(pubKey);
|
|
14
15
|
return {
|
|
15
16
|
address: address,
|
|
16
17
|
pubkey: pubkey,
|
|
@@ -19,8 +20,7 @@ function accountFromBaseAccount(input) {
|
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
-
* `Account` information from it. This is supposed to support the most relevant
|
|
23
|
+
* Basic implementation of AccountParser. This is supposed to support the most relevant
|
|
24
24
|
* common Cosmos SDK account types. If you need support for exotic account types,
|
|
25
25
|
* you'll need to write your own account decoder.
|
|
26
26
|
*/
|
|
@@ -31,37 +31,32 @@ function accountFromAny(input) {
|
|
|
31
31
|
// auth
|
|
32
32
|
case "/cosmos.auth.v1beta1.BaseAccount":
|
|
33
33
|
return accountFromBaseAccount(auth_1.BaseAccount.decode(value));
|
|
34
|
-
case "/cosmos.auth.v1beta1.ModuleAccount":
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
case "/cosmos.auth.v1beta1.ModuleAccount": {
|
|
35
|
+
var baseAccount = auth_1.ModuleAccount.decode(value).baseAccount;
|
|
36
|
+
utils_1.assert(baseAccount);
|
|
37
|
+
return accountFromBaseAccount(baseAccount);
|
|
38
|
+
}
|
|
39
39
|
// vesting
|
|
40
|
-
case "/cosmos.vesting.v1beta1.BaseVestingAccount":
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
case "/cosmos.vesting.v1beta1.ContinuousVestingAccount":
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
case "/cosmos.vesting.v1beta1.DelayedVestingAccount":
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
case "/cosmos.vesting.v1beta1.PeriodicVestingAccount":
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
case "/ethermint.types.v1.EthAccount":
|
|
61
|
-
{
|
|
62
|
-
var baseAccount = auth_1.ModuleAccount.decode(value).baseAccount;
|
|
63
|
-
return accountFromBaseAccount(baseAccount);
|
|
64
|
-
}
|
|
40
|
+
case "/cosmos.vesting.v1beta1.BaseVestingAccount": {
|
|
41
|
+
var baseAccount = (_a = vesting_1.BaseVestingAccount.decode(value)) === null || _a === void 0 ? void 0 : _a.baseAccount;
|
|
42
|
+
utils_1.assert(baseAccount);
|
|
43
|
+
return accountFromBaseAccount(baseAccount);
|
|
44
|
+
}
|
|
45
|
+
case "/cosmos.vesting.v1beta1.ContinuousVestingAccount": {
|
|
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);
|
|
48
|
+
return accountFromBaseAccount(baseAccount);
|
|
49
|
+
}
|
|
50
|
+
case "/cosmos.vesting.v1beta1.DelayedVestingAccount": {
|
|
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);
|
|
53
|
+
return accountFromBaseAccount(baseAccount);
|
|
54
|
+
}
|
|
55
|
+
case "/cosmos.vesting.v1beta1.PeriodicVestingAccount": {
|
|
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);
|
|
58
|
+
return accountFromBaseAccount(baseAccount);
|
|
59
|
+
}
|
|
65
60
|
default:
|
|
66
61
|
throw new Error("Unsupported type: '" + typeUrl + "'");
|
|
67
62
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AminoMsg } from "@cosmjs/amino";
|
|
2
|
+
import { EncodeObject } from "@cosmjs/proto-signing";
|
|
3
|
+
export interface AminoConverter {
|
|
4
|
+
readonly aminoType: string;
|
|
5
|
+
readonly toAmino: (value: any) => any;
|
|
6
|
+
readonly fromAmino: (value: any) => any;
|
|
7
|
+
}
|
|
8
|
+
/** A map from protobuf type URL to the AminoConverter implementation if supported on chain */
|
|
9
|
+
export declare type AminoConverters = Record<string, AminoConverter>;
|
|
10
|
+
/**
|
|
11
|
+
* A map from Stargate message types as used in the messages's `Any` type
|
|
12
|
+
* to Amino types.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AminoTypes {
|
|
15
|
+
private readonly register;
|
|
16
|
+
constructor(types: AminoConverters);
|
|
17
|
+
toAmino({ typeUrl, value }: EncodeObject): AminoMsg;
|
|
18
|
+
fromAmino({ type, value }: AminoMsg): EncodeObject;
|
|
19
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.AminoTypes = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* A map from Stargate message types as used in the messages's `Any` type
|
|
22
|
+
* to Amino types.
|
|
23
|
+
*/
|
|
24
|
+
var AminoTypes = /** @class */ (function () {
|
|
25
|
+
function AminoTypes(types) {
|
|
26
|
+
this.register = types;
|
|
27
|
+
}
|
|
28
|
+
AminoTypes.prototype.toAmino = function (_a) {
|
|
29
|
+
var typeUrl = _a.typeUrl, value = _a.value;
|
|
30
|
+
var converter = this.register[typeUrl];
|
|
31
|
+
if (!converter) {
|
|
32
|
+
throw new Error("Type URL '" + typeUrl + "' does not exist in the Amino message type register. " +
|
|
33
|
+
"If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " +
|
|
34
|
+
"If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues.");
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
type: converter.aminoType,
|
|
38
|
+
value: converter.toAmino(value),
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
AminoTypes.prototype.fromAmino = function (_a) {
|
|
42
|
+
var type = _a.type, value = _a.value;
|
|
43
|
+
var matches = Object.entries(this.register).filter(function (_a) {
|
|
44
|
+
var _b = __read(_a, 2), _typeUrl = _b[0], aminoType = _b[1].aminoType;
|
|
45
|
+
return aminoType === type;
|
|
46
|
+
});
|
|
47
|
+
switch (matches.length) {
|
|
48
|
+
case 0: {
|
|
49
|
+
throw new Error("Amino type identifier '" + type + "' does not exist in the Amino message type register. " +
|
|
50
|
+
"If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " +
|
|
51
|
+
"If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues.");
|
|
52
|
+
}
|
|
53
|
+
case 1: {
|
|
54
|
+
var _b = __read(matches[0], 2), typeUrl = _b[0], converter = _b[1];
|
|
55
|
+
return {
|
|
56
|
+
typeUrl: typeUrl,
|
|
57
|
+
value: converter.fromAmino(value),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
default:
|
|
61
|
+
throw new Error("Multiple types are registered with Amino type identifier '" + type + "': '" +
|
|
62
|
+
matches
|
|
63
|
+
.map(function (_a) {
|
|
64
|
+
var _b = __read(_a, 2), key = _b[0], _value = _b[1];
|
|
65
|
+
return key;
|
|
66
|
+
})
|
|
67
|
+
.sort()
|
|
68
|
+
.join("', '") +
|
|
69
|
+
"'. Thus fromAmino cannot be performed.");
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return AminoTypes;
|
|
73
|
+
}());
|
|
74
|
+
exports.AminoTypes = AminoTypes;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { tendermint34, tendermint37 } from "@cosmjs/tendermint-rpc";
|
|
2
|
+
/**
|
|
3
|
+
* An event attribute.
|
|
4
|
+
*
|
|
5
|
+
* This is the same attribute type as tendermint34.Attribute and tendermint35.EventAttribute
|
|
6
|
+
* but `key` and `value` are unified to strings. The conversion
|
|
7
|
+
* from bytes to string in the Tendermint 0.34 case should be done by performing
|
|
8
|
+
* [lossy] UTF-8 decoding.
|
|
9
|
+
*
|
|
10
|
+
* [lossy]: https://doc.rust-lang.org/stable/std/string/struct.String.html#method.from_utf8_lossy
|
|
11
|
+
*/
|
|
12
|
+
export interface Attribute {
|
|
13
|
+
readonly key: string;
|
|
14
|
+
readonly value: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The same event type as tendermint34.Event and tendermint35.Event
|
|
18
|
+
* but attribute keys and values are unified to strings. The conversion
|
|
19
|
+
* from bytes to string in the Tendermint 0.34 case should be done by performing
|
|
20
|
+
* [lossy] UTF-8 decoding.
|
|
21
|
+
*
|
|
22
|
+
* [lossy]: https://doc.rust-lang.org/stable/std/string/struct.String.html#method.from_utf8_lossy
|
|
23
|
+
*/
|
|
24
|
+
export interface Event {
|
|
25
|
+
readonly type: string;
|
|
26
|
+
readonly attributes: readonly Attribute[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Takes a Tendermint 0.34 or 0.37 event with binary encoded key and value
|
|
30
|
+
* and converts it into an `Event` with string attributes.
|
|
31
|
+
*/
|
|
32
|
+
export declare function fromTendermintEvent(event: tendermint34.Event | tendermint37.Event): Event;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fromTendermintEvent = void 0;
|
|
4
|
+
var encoding_1 = require("@cosmjs/encoding");
|
|
5
|
+
/**
|
|
6
|
+
* Takes a Tendermint 0.34 or 0.37 event with binary encoded key and value
|
|
7
|
+
* and converts it into an `Event` with string attributes.
|
|
8
|
+
*/
|
|
9
|
+
function fromTendermintEvent(event) {
|
|
10
|
+
return {
|
|
11
|
+
type: event.type,
|
|
12
|
+
attributes: event.attributes.map(function (attr) { return ({
|
|
13
|
+
key: typeof attr.key == "string" ? attr.key : encoding_1.fromUtf8(attr.key, true),
|
|
14
|
+
value: typeof attr.value == "string" ? attr.value : encoding_1.fromUtf8(attr.value, true),
|
|
15
|
+
}); }),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.fromTendermintEvent = fromTendermintEvent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StdFee } from "@cosmjs/amino";
|
|
2
|
+
import { Decimal } from "@cosmjs/math";
|
|
3
|
+
/**
|
|
4
|
+
* A gas price, i.e. the price of a single unit of gas. This is typically a fraction of
|
|
5
|
+
* the smallest fee token unit, such as 0.012utoken.
|
|
6
|
+
*/
|
|
7
|
+
export declare class GasPrice {
|
|
8
|
+
readonly amount: Decimal;
|
|
9
|
+
readonly denom: string;
|
|
10
|
+
constructor(amount: Decimal, denom: string);
|
|
11
|
+
/**
|
|
12
|
+
* Parses a gas price formatted as `<amount><denom>`, e.g. `GasPrice.fromString("0.012utoken")`.
|
|
13
|
+
*
|
|
14
|
+
* The denom must match the Cosmos SDK 0.42 pattern (https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/types/coin.go#L599-L601).
|
|
15
|
+
* See `GasPrice` in @cosmjs/stargate for a more generic matcher.
|
|
16
|
+
*
|
|
17
|
+
* Separators are not yet supported.
|
|
18
|
+
*/
|
|
19
|
+
static fromString(gasPrice: string): GasPrice;
|
|
20
|
+
/**
|
|
21
|
+
* Returns a string representation of this gas price, e.g. "0.025uatom".
|
|
22
|
+
* This can be used as an input to `GasPrice.fromString`.
|
|
23
|
+
*/
|
|
24
|
+
toString(): string;
|
|
25
|
+
}
|
|
26
|
+
export declare function calculateFee(gasLimit: number, gasPrice: GasPrice | string): StdFee;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.calculateFee = exports.GasPrice = void 0;
|
|
20
|
+
var math_1 = require("@cosmjs/math");
|
|
21
|
+
var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
22
|
+
/**
|
|
23
|
+
* Denom checker for the Cosmos SDK 0.42 denom pattern
|
|
24
|
+
* (https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/types/coin.go#L599-L601).
|
|
25
|
+
*
|
|
26
|
+
* This is like a regexp but with helpful error messages.
|
|
27
|
+
*/
|
|
28
|
+
function checkDenom(denom) {
|
|
29
|
+
if (denom.length < 3 || denom.length > 128) {
|
|
30
|
+
throw new Error("Denom must be between 3 and 128 characters");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A gas price, i.e. the price of a single unit of gas. This is typically a fraction of
|
|
35
|
+
* the smallest fee token unit, such as 0.012utoken.
|
|
36
|
+
*/
|
|
37
|
+
var GasPrice = /** @class */ (function () {
|
|
38
|
+
function GasPrice(amount, denom) {
|
|
39
|
+
this.amount = amount;
|
|
40
|
+
this.denom = denom;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Parses a gas price formatted as `<amount><denom>`, e.g. `GasPrice.fromString("0.012utoken")`.
|
|
44
|
+
*
|
|
45
|
+
* The denom must match the Cosmos SDK 0.42 pattern (https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/types/coin.go#L599-L601).
|
|
46
|
+
* See `GasPrice` in @cosmjs/stargate for a more generic matcher.
|
|
47
|
+
*
|
|
48
|
+
* Separators are not yet supported.
|
|
49
|
+
*/
|
|
50
|
+
GasPrice.fromString = function (gasPrice) {
|
|
51
|
+
// Use Decimal.fromUserInput and checkDenom for detailed checks and helpful error messages
|
|
52
|
+
var matchResult = gasPrice.match(/^([0-9.]+)([a-zA-Z][a-zA-Z0-9/:._-]*)$/);
|
|
53
|
+
if (!matchResult) {
|
|
54
|
+
throw new Error("Invalid gas price string");
|
|
55
|
+
}
|
|
56
|
+
var _a = __read(matchResult, 3), _ = _a[0], amount = _a[1], denom = _a[2];
|
|
57
|
+
checkDenom(denom);
|
|
58
|
+
var fractionalDigits = 18;
|
|
59
|
+
var decimalAmount = math_1.Decimal.fromUserInput(amount, fractionalDigits);
|
|
60
|
+
return new GasPrice(decimalAmount, denom);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Returns a string representation of this gas price, e.g. "0.025uatom".
|
|
64
|
+
* This can be used as an input to `GasPrice.fromString`.
|
|
65
|
+
*/
|
|
66
|
+
GasPrice.prototype.toString = function () {
|
|
67
|
+
return this.amount.toString() + this.denom;
|
|
68
|
+
};
|
|
69
|
+
return GasPrice;
|
|
70
|
+
}());
|
|
71
|
+
exports.GasPrice = GasPrice;
|
|
72
|
+
function calculateFee(gasLimit, gasPrice) {
|
|
73
|
+
var processedGasPrice = typeof gasPrice === "string" ? GasPrice.fromString(gasPrice) : gasPrice;
|
|
74
|
+
var denom = processedGasPrice.denom, gasPriceAmount = processedGasPrice.amount;
|
|
75
|
+
// Note: Amount can exceed the safe integer range (https://github.com/cosmos/cosmjs/issues/1134),
|
|
76
|
+
// which we handle by converting from Decimal to string without going through number.
|
|
77
|
+
var amount = gasPriceAmount.multiply(new math_1.Uint53(gasLimit)).ceil().toString();
|
|
78
|
+
return {
|
|
79
|
+
amount: proto_signing_1.coins(amount, denom),
|
|
80
|
+
gas: gasLimit.toString(),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
exports.calculateFee = calculateFee;
|
|
@@ -10,5 +10,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.AminoTypes = void 0;
|
|
13
14
|
__exportStar(require("./TxCommon"), exports);
|
|
14
15
|
__exportStar(require("./QueryCommon"), exports);
|
|
16
|
+
var aminotypes_1 = require("./aminotypes");
|
|
17
|
+
Object.defineProperty(exports, "AminoTypes", { enumerable: true, get: function () { return aminotypes_1.AminoTypes; } });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Any } from "cosmjs-types/google/protobuf/any";
|
|
2
|
+
import { QueryClient } from "../../queryclient";
|
|
3
|
+
export interface AuthExtension {
|
|
4
|
+
readonly auth: {
|
|
5
|
+
/**
|
|
6
|
+
* Returns an account if it exists and `null` otherwise.
|
|
7
|
+
*
|
|
8
|
+
* The account is a protobuf Any in order to be able to support many different
|
|
9
|
+
* account types in one API. The caller needs to switch over the expected and supported
|
|
10
|
+
* `typeUrl` and decode the `value` using its own type decoder.
|
|
11
|
+
*/
|
|
12
|
+
readonly account: (address: string) => Promise<Any | null>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function setupAuthExtension(base: QueryClient): AuthExtension;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
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
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.setupAuthExtension = void 0;
|
|
40
|
+
var query_1 = require("cosmjs-types/cosmos/auth/v1beta1/query");
|
|
41
|
+
var queryclient_1 = require("../../queryclient");
|
|
42
|
+
function setupAuthExtension(base) {
|
|
43
|
+
var _this = this;
|
|
44
|
+
var rpc = queryclient_1.createProtobufRpcClient(base);
|
|
45
|
+
// Use this service to get easy typed access to query methods
|
|
46
|
+
// This cannot be used for proof verification
|
|
47
|
+
var queryService = new query_1.QueryClientImpl(rpc);
|
|
48
|
+
return {
|
|
49
|
+
auth: {
|
|
50
|
+
account: function (address) { return __awaiter(_this, void 0, void 0, function () {
|
|
51
|
+
var account;
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0: return [4 /*yield*/, queryService.Account({ address: address })];
|
|
55
|
+
case 1:
|
|
56
|
+
account = (_a.sent()).account;
|
|
57
|
+
return [2 /*return*/, account !== null && account !== void 0 ? account : null];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}); },
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
exports.setupAuthExtension = setupAuthExtension;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAuthzAminoConverters = void 0;
|
|
4
|
+
function createAuthzAminoConverters() {
|
|
5
|
+
return {
|
|
6
|
+
// For Cosmos SDK < 0.46 the Amino JSON codec was broken on chain and thus inaccessible.
|
|
7
|
+
// Now this can be implemented for 0.46+ chains, see
|
|
8
|
+
// https://github.com/cosmos/cosmjs/issues/1092
|
|
9
|
+
//
|
|
10
|
+
// "/cosmos.authz.v1beta1.MsgGrant": IMPLEMENT ME,
|
|
11
|
+
// "/cosmos.authz.v1beta1.MsgExec": IMPLEMENT ME,
|
|
12
|
+
// "/cosmos.authz.v1beta1.MsgRevoke": IMPLEMENT ME,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.createAuthzAminoConverters = createAuthzAminoConverters;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authzTypes = void 0;
|
|
4
|
+
var tx_1 = require("cosmjs-types/cosmos/authz/v1beta1/tx");
|
|
5
|
+
exports.authzTypes = [
|
|
6
|
+
["/cosmos.authz.v1beta1.MsgExec", tx_1.MsgExec],
|
|
7
|
+
["/cosmos.authz.v1beta1.MsgGrant", tx_1.MsgGrant],
|
|
8
|
+
["/cosmos.authz.v1beta1.MsgRevoke", tx_1.MsgRevoke],
|
|
9
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { QueryGranteeGrantsResponse, QueryGranterGrantsResponse, QueryGrantsResponse } from "cosmjs-types/cosmos/authz/v1beta1/query";
|
|
2
|
+
import { QueryClient } from "../../queryclient";
|
|
3
|
+
export interface AuthzExtension {
|
|
4
|
+
readonly authz: {
|
|
5
|
+
readonly grants: (granter: string, grantee: string, msgTypeUrl: string, paginationKey?: Uint8Array) => Promise<QueryGrantsResponse>;
|
|
6
|
+
readonly granteeGrants: (grantee: string, paginationKey?: Uint8Array) => Promise<QueryGranteeGrantsResponse>;
|
|
7
|
+
readonly granterGrants: (granter: string, paginationKey?: Uint8Array) => Promise<QueryGranterGrantsResponse>;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare function setupAuthzExtension(base: QueryClient): AuthzExtension;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
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
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.setupAuthzExtension = void 0;
|
|
40
|
+
var query_1 = require("cosmjs-types/cosmos/authz/v1beta1/query");
|
|
41
|
+
var queryclient_1 = require("../../queryclient");
|
|
42
|
+
function setupAuthzExtension(base) {
|
|
43
|
+
var _this = this;
|
|
44
|
+
// Use this service to get easy typed access to query methods
|
|
45
|
+
// This cannot be used for proof verification
|
|
46
|
+
var rpc = queryclient_1.createProtobufRpcClient(base);
|
|
47
|
+
var queryService = new query_1.QueryClientImpl(rpc);
|
|
48
|
+
return {
|
|
49
|
+
authz: {
|
|
50
|
+
grants: function (granter, grantee, msgTypeUrl, paginationKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, queryService.Grants({
|
|
54
|
+
granter: granter,
|
|
55
|
+
grantee: grantee,
|
|
56
|
+
msgTypeUrl: msgTypeUrl,
|
|
57
|
+
pagination: queryclient_1.createPagination(paginationKey),
|
|
58
|
+
})];
|
|
59
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}); },
|
|
63
|
+
granteeGrants: function (grantee, paginationKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
switch (_a.label) {
|
|
66
|
+
case 0: return [4 /*yield*/, queryService.GranteeGrants({
|
|
67
|
+
grantee: grantee,
|
|
68
|
+
pagination: queryclient_1.createPagination(paginationKey),
|
|
69
|
+
})];
|
|
70
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); },
|
|
74
|
+
granterGrants: function (granter, paginationKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0: return [4 /*yield*/, queryService.GranterGrants({
|
|
78
|
+
granter: granter,
|
|
79
|
+
pagination: queryclient_1.createPagination(paginationKey),
|
|
80
|
+
})];
|
|
81
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}); },
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
exports.setupAuthzExtension = setupAuthzExtension;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AminoMsg, Coin } from "@cosmjs/amino";
|
|
2
|
+
import { AminoConverters } from "../../aminotypes";
|
|
3
|
+
/** A high level transaction of the coin module */
|
|
4
|
+
export interface AminoMsgSend extends AminoMsg {
|
|
5
|
+
readonly type: "cosmos-sdk/MsgSend";
|
|
6
|
+
readonly value: {
|
|
7
|
+
/** Bech32 account address */
|
|
8
|
+
readonly from_address: string;
|
|
9
|
+
/** Bech32 account address */
|
|
10
|
+
readonly to_address: string;
|
|
11
|
+
readonly amount: readonly Coin[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare function isAminoMsgSend(msg: AminoMsg): msg is AminoMsgSend;
|
|
15
|
+
interface Input {
|
|
16
|
+
/** Bech32 account address */
|
|
17
|
+
readonly address: string;
|
|
18
|
+
readonly coins: readonly Coin[];
|
|
19
|
+
}
|
|
20
|
+
interface Output {
|
|
21
|
+
/** Bech32 account address */
|
|
22
|
+
readonly address: string;
|
|
23
|
+
readonly coins: readonly Coin[];
|
|
24
|
+
}
|
|
25
|
+
/** A high level transaction of the coin module */
|
|
26
|
+
export interface AminoMsgMultiSend extends AminoMsg {
|
|
27
|
+
readonly type: "cosmos-sdk/MsgMultiSend";
|
|
28
|
+
readonly value: {
|
|
29
|
+
readonly inputs: readonly Input[];
|
|
30
|
+
readonly outputs: readonly Output[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export declare function isAminoMsgMultiSend(msg: AminoMsg): msg is AminoMsgMultiSend;
|
|
34
|
+
export declare function createBankAminoConverters(): AminoConverters;
|
|
35
|
+
export {};
|