@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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AminoMsg } from "@cosmjs/amino";
|
|
2
|
+
import { AminoConverters } from "../../aminotypes";
|
|
3
|
+
interface Any {
|
|
4
|
+
readonly type_url: string;
|
|
5
|
+
readonly value: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
/** Supports submitting arbitrary evidence */
|
|
8
|
+
export interface AminoMsgSubmitEvidence extends AminoMsg {
|
|
9
|
+
readonly type: "cosmos-sdk/MsgSubmitEvidence";
|
|
10
|
+
readonly value: {
|
|
11
|
+
/** Bech32 account address */
|
|
12
|
+
readonly submitter: string;
|
|
13
|
+
readonly evidence: Any;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function isAminoMsgSubmitEvidence(msg: AminoMsg): msg is AminoMsgSubmitEvidence;
|
|
17
|
+
export declare function createEvidenceAminoConverters(): AminoConverters;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEvidenceAminoConverters = exports.isAminoMsgSubmitEvidence = void 0;
|
|
4
|
+
function isAminoMsgSubmitEvidence(msg) {
|
|
5
|
+
return msg.type === "cosmos-sdk/MsgSubmitEvidence";
|
|
6
|
+
}
|
|
7
|
+
exports.isAminoMsgSubmitEvidence = isAminoMsgSubmitEvidence;
|
|
8
|
+
function createEvidenceAminoConverters() {
|
|
9
|
+
throw new Error("Not implemented");
|
|
10
|
+
}
|
|
11
|
+
exports.createEvidenceAminoConverters = createEvidenceAminoConverters;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFeegrantAminoConverters = void 0;
|
|
4
|
+
function createFeegrantAminoConverters() {
|
|
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.feegrant.v1beta1.MsgGrantAllowance": IMPLEMENT_ME,
|
|
11
|
+
// "/cosmos.feegrant.v1beta1.MsgRevokeAllowance": IMPLEMENT_ME,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.createFeegrantAminoConverters = createFeegrantAminoConverters;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.feegrantTypes = void 0;
|
|
4
|
+
var tx_1 = require("cosmjs-types/cosmos/feegrant/v1beta1/tx");
|
|
5
|
+
exports.feegrantTypes = [
|
|
6
|
+
["/cosmos.feegrant.v1beta1.MsgGrantAllowance", tx_1.MsgGrantAllowance],
|
|
7
|
+
["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", tx_1.MsgRevokeAllowance],
|
|
8
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QueryAllowanceResponse, QueryAllowancesResponse } from "cosmjs-types/cosmos/feegrant/v1beta1/query";
|
|
2
|
+
import { QueryClient } from "../../queryclient";
|
|
3
|
+
export interface FeegrantExtension {
|
|
4
|
+
readonly feegrant: {
|
|
5
|
+
readonly allowance: (granter: string, grantee: string) => Promise<QueryAllowanceResponse>;
|
|
6
|
+
readonly allowances: (grantee: string, paginationKey?: Uint8Array) => Promise<QueryAllowancesResponse>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare function setupFeegrantExtension(base: QueryClient): FeegrantExtension;
|
|
@@ -0,0 +1,81 @@
|
|
|
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.setupFeegrantExtension = void 0;
|
|
40
|
+
var query_1 = require("cosmjs-types/cosmos/feegrant/v1beta1/query");
|
|
41
|
+
var queryclient_1 = require("../../queryclient");
|
|
42
|
+
function setupFeegrantExtension(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
|
+
feegrant: {
|
|
50
|
+
allowance: function (granter, grantee) { return __awaiter(_this, void 0, void 0, function () {
|
|
51
|
+
var response;
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0: return [4 /*yield*/, queryService.Allowance({
|
|
55
|
+
granter: granter,
|
|
56
|
+
grantee: grantee,
|
|
57
|
+
})];
|
|
58
|
+
case 1:
|
|
59
|
+
response = _a.sent();
|
|
60
|
+
return [2 /*return*/, response];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}); },
|
|
64
|
+
allowances: function (grantee, paginationKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
65
|
+
var response;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0: return [4 /*yield*/, queryService.Allowances({
|
|
69
|
+
grantee: grantee,
|
|
70
|
+
pagination: queryclient_1.createPagination(paginationKey),
|
|
71
|
+
})];
|
|
72
|
+
case 1:
|
|
73
|
+
response = _a.sent();
|
|
74
|
+
return [2 /*return*/, response];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); },
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
exports.setupFeegrantExtension = setupFeegrantExtension;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AminoMsg, Coin } from "@cosmjs/amino";
|
|
2
|
+
import { AminoConverters } from "../../aminotypes";
|
|
3
|
+
/** Supports submitting arbitrary proposal content. */
|
|
4
|
+
export interface AminoMsgSubmitProposal extends AminoMsg {
|
|
5
|
+
readonly type: "cosmos-sdk/MsgSubmitProposal";
|
|
6
|
+
readonly value: {
|
|
7
|
+
/**
|
|
8
|
+
* A proposal structure, e.g.
|
|
9
|
+
*
|
|
10
|
+
* ```
|
|
11
|
+
* {
|
|
12
|
+
* type: 'cosmos-sdk/TextProposal',
|
|
13
|
+
* value: {
|
|
14
|
+
* description: 'This proposal proposes to test whether this proposal passes',
|
|
15
|
+
* title: 'Test Proposal'
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
readonly content: {
|
|
21
|
+
readonly type: string;
|
|
22
|
+
readonly value: any;
|
|
23
|
+
};
|
|
24
|
+
readonly initial_deposit: readonly Coin[];
|
|
25
|
+
/** Bech32 account address */
|
|
26
|
+
readonly proposer: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare function isAminoMsgSubmitProposal(msg: AminoMsg): msg is AminoMsgSubmitProposal;
|
|
30
|
+
/** Casts a vote */
|
|
31
|
+
export interface AminoMsgVote extends AminoMsg {
|
|
32
|
+
readonly type: "cosmos-sdk/MsgVote";
|
|
33
|
+
readonly value: {
|
|
34
|
+
readonly proposal_id: string;
|
|
35
|
+
/** Bech32 account address */
|
|
36
|
+
readonly voter: string;
|
|
37
|
+
/**
|
|
38
|
+
* VoteOption as integer from 0 to 4 🤷
|
|
39
|
+
*
|
|
40
|
+
* @see https://github.com/cosmos/cosmos-sdk/blob/v0.42.9/x/gov/types/gov.pb.go#L38-L49
|
|
41
|
+
*/
|
|
42
|
+
readonly option: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare function isAminoMsgVote(msg: AminoMsg): msg is AminoMsgVote;
|
|
46
|
+
/**
|
|
47
|
+
* @see https://github.com/cosmos/cosmos-sdk/blob/v0.44.5/x/gov/types/tx.pb.go#L196-L203
|
|
48
|
+
* @see https://github.com/cosmos/cosmos-sdk/blob/v0.44.5/x/gov/types/gov.pb.go#L124-L130
|
|
49
|
+
*/
|
|
50
|
+
export interface AminoMsgVoteWeighted extends AminoMsg {
|
|
51
|
+
readonly type: "cosmos-sdk/MsgVoteWeighted";
|
|
52
|
+
readonly value: {
|
|
53
|
+
readonly proposal_id: string;
|
|
54
|
+
/** Bech32 account address */
|
|
55
|
+
readonly voter: string;
|
|
56
|
+
readonly options: Array<{
|
|
57
|
+
/**
|
|
58
|
+
* VoteOption as integer from 0 to 4 🤷
|
|
59
|
+
*
|
|
60
|
+
* @see https://github.com/cosmos/cosmos-sdk/blob/v0.44.5/x/gov/types/gov.pb.go#L35-L49
|
|
61
|
+
*/
|
|
62
|
+
readonly option: number;
|
|
63
|
+
readonly weight: string;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export declare function isAminoMsgVoteWeighted(msg: AminoMsg): msg is AminoMsgVoteWeighted;
|
|
68
|
+
/** Submits a deposit to an existing proposal */
|
|
69
|
+
export interface AminoMsgDeposit extends AminoMsg {
|
|
70
|
+
readonly type: "cosmos-sdk/MsgDeposit";
|
|
71
|
+
readonly value: {
|
|
72
|
+
readonly proposal_id: string;
|
|
73
|
+
/** Bech32 account address */
|
|
74
|
+
readonly depositor: string;
|
|
75
|
+
readonly amount: readonly Coin[];
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export declare function isAminoMsgDeposit(msg: AminoMsg): msg is AminoMsgDeposit;
|
|
79
|
+
export declare function createGovAminoConverters(): AminoConverters;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createGovAminoConverters = exports.isAminoMsgDeposit = exports.isAminoMsgVoteWeighted = exports.isAminoMsgVote = exports.isAminoMsgSubmitProposal = void 0;
|
|
4
|
+
var math_1 = require("@cosmjs/math");
|
|
5
|
+
var utils_1 = require("@cosmjs/utils");
|
|
6
|
+
var gov_1 = require("cosmjs-types/cosmos/gov/v1beta1/gov");
|
|
7
|
+
var any_1 = require("cosmjs-types/google/protobuf/any");
|
|
8
|
+
var queryclient_1 = require("../../queryclient");
|
|
9
|
+
function isAminoMsgSubmitProposal(msg) {
|
|
10
|
+
return msg.type === "cosmos-sdk/MsgSubmitProposal";
|
|
11
|
+
}
|
|
12
|
+
exports.isAminoMsgSubmitProposal = isAminoMsgSubmitProposal;
|
|
13
|
+
function isAminoMsgVote(msg) {
|
|
14
|
+
return msg.type === "cosmos-sdk/MsgVote";
|
|
15
|
+
}
|
|
16
|
+
exports.isAminoMsgVote = isAminoMsgVote;
|
|
17
|
+
function isAminoMsgVoteWeighted(msg) {
|
|
18
|
+
return msg.type === "cosmos-sdk/MsgVoteWeighted";
|
|
19
|
+
}
|
|
20
|
+
exports.isAminoMsgVoteWeighted = isAminoMsgVoteWeighted;
|
|
21
|
+
function isAminoMsgDeposit(msg) {
|
|
22
|
+
return msg.type === "cosmos-sdk/MsgDeposit";
|
|
23
|
+
}
|
|
24
|
+
exports.isAminoMsgDeposit = isAminoMsgDeposit;
|
|
25
|
+
function createGovAminoConverters() {
|
|
26
|
+
// Gov v1 types missing, see
|
|
27
|
+
// https://github.com/cosmos/cosmjs/issues/1442
|
|
28
|
+
return {
|
|
29
|
+
"/cosmos.gov.v1beta1.MsgDeposit": {
|
|
30
|
+
aminoType: "cosmos-sdk/MsgDeposit",
|
|
31
|
+
toAmino: function (_a) {
|
|
32
|
+
var amount = _a.amount, depositor = _a.depositor, proposalId = _a.proposalId;
|
|
33
|
+
return {
|
|
34
|
+
amount: amount,
|
|
35
|
+
depositor: depositor,
|
|
36
|
+
proposal_id: proposalId.toString(),
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
fromAmino: function (_a) {
|
|
40
|
+
var amount = _a.amount, depositor = _a.depositor, proposal_id = _a.proposal_id;
|
|
41
|
+
return {
|
|
42
|
+
amount: Array.from(amount),
|
|
43
|
+
depositor: depositor,
|
|
44
|
+
proposalId: BigInt(proposal_id),
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
"/cosmos.gov.v1beta1.MsgVote": {
|
|
49
|
+
aminoType: "cosmos-sdk/MsgVote",
|
|
50
|
+
toAmino: function (_a) {
|
|
51
|
+
var option = _a.option, proposalId = _a.proposalId, voter = _a.voter;
|
|
52
|
+
return {
|
|
53
|
+
option: option,
|
|
54
|
+
proposal_id: proposalId.toString(),
|
|
55
|
+
voter: voter,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
fromAmino: function (_a) {
|
|
59
|
+
var option = _a.option, proposal_id = _a.proposal_id, voter = _a.voter;
|
|
60
|
+
return {
|
|
61
|
+
option: gov_1.voteOptionFromJSON(option),
|
|
62
|
+
proposalId: BigInt(proposal_id),
|
|
63
|
+
voter: voter,
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
"/cosmos.gov.v1beta1.MsgVoteWeighted": {
|
|
68
|
+
aminoType: "cosmos-sdk/MsgVoteWeighted",
|
|
69
|
+
toAmino: function (_a) {
|
|
70
|
+
var options = _a.options, proposalId = _a.proposalId, voter = _a.voter;
|
|
71
|
+
return {
|
|
72
|
+
options: options.map(function (o) { return ({
|
|
73
|
+
option: o.option,
|
|
74
|
+
// Weight is between 0 and 1, so we always have 20 characters when printing all trailing
|
|
75
|
+
// zeros (e.g. "0.700000000000000000" or "1.000000000000000000")
|
|
76
|
+
weight: queryclient_1.decodeCosmosSdkDecFromProto(o.weight).toString().padEnd(20, "0"),
|
|
77
|
+
}); }),
|
|
78
|
+
proposal_id: proposalId.toString(),
|
|
79
|
+
voter: voter,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
fromAmino: function (_a) {
|
|
83
|
+
var options = _a.options, proposal_id = _a.proposal_id, voter = _a.voter;
|
|
84
|
+
return {
|
|
85
|
+
proposalId: BigInt(proposal_id),
|
|
86
|
+
voter: voter,
|
|
87
|
+
options: options.map(function (o) { return ({
|
|
88
|
+
option: gov_1.voteOptionFromJSON(o.option),
|
|
89
|
+
weight: math_1.Decimal.fromUserInput(o.weight, 18).atomics,
|
|
90
|
+
}); }),
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
"/cosmos.gov.v1beta1.MsgSubmitProposal": {
|
|
95
|
+
aminoType: "cosmos-sdk/MsgSubmitProposal",
|
|
96
|
+
toAmino: function (_a) {
|
|
97
|
+
var initialDeposit = _a.initialDeposit, proposer = _a.proposer, content = _a.content;
|
|
98
|
+
utils_1.assertDefinedAndNotNull(content);
|
|
99
|
+
var proposal;
|
|
100
|
+
switch (content.typeUrl) {
|
|
101
|
+
case "/cosmos.gov.v1beta1.TextProposal": {
|
|
102
|
+
var textProposal = gov_1.TextProposal.decode(content.value);
|
|
103
|
+
proposal = {
|
|
104
|
+
type: "cosmos-sdk/TextProposal",
|
|
105
|
+
value: {
|
|
106
|
+
description: textProposal.description,
|
|
107
|
+
title: textProposal.title,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
default:
|
|
113
|
+
throw new Error("Unsupported proposal type: '" + content.typeUrl + "'");
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
initial_deposit: initialDeposit,
|
|
117
|
+
proposer: proposer,
|
|
118
|
+
content: proposal,
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
fromAmino: function (_a) {
|
|
122
|
+
var initial_deposit = _a.initial_deposit, proposer = _a.proposer, content = _a.content;
|
|
123
|
+
var any_content;
|
|
124
|
+
switch (content.type) {
|
|
125
|
+
case "cosmos-sdk/TextProposal": {
|
|
126
|
+
var value = content.value;
|
|
127
|
+
utils_1.assert(utils_1.isNonNullObject(value));
|
|
128
|
+
var _b = value, title = _b.title, description = _b.description;
|
|
129
|
+
utils_1.assert(typeof title === "string");
|
|
130
|
+
utils_1.assert(typeof description === "string");
|
|
131
|
+
any_content = any_1.Any.fromPartial({
|
|
132
|
+
typeUrl: "/cosmos.gov.v1beta1.TextProposal",
|
|
133
|
+
value: gov_1.TextProposal.encode(gov_1.TextProposal.fromPartial({
|
|
134
|
+
title: title,
|
|
135
|
+
description: description,
|
|
136
|
+
})).finish(),
|
|
137
|
+
});
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
default:
|
|
141
|
+
throw new Error("Unsupported proposal type: '" + content.type + "'");
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
initialDeposit: Array.from(initial_deposit),
|
|
145
|
+
proposer: proposer,
|
|
146
|
+
content: any_content,
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
exports.createGovAminoConverters = createGovAminoConverters;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EncodeObject, GeneratedType } from "@cosmjs/proto-signing";
|
|
2
|
+
import { MsgDeposit, MsgSubmitProposal, MsgVote, MsgVoteWeighted } from "cosmjs-types/cosmos/gov/v1beta1/tx";
|
|
3
|
+
import { MsgCancelProposal } from "@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx";
|
|
4
|
+
export declare const govTypes: ReadonlyArray<[string, GeneratedType]>;
|
|
5
|
+
export interface MsgDepositEncodeObject extends EncodeObject {
|
|
6
|
+
readonly typeUrl: "/cosmos.gov.v1beta1.MsgDeposit";
|
|
7
|
+
readonly value: Partial<MsgDeposit>;
|
|
8
|
+
}
|
|
9
|
+
export declare function isMsgDepositEncodeObject(object: EncodeObject): object is MsgSubmitProposalEncodeObject;
|
|
10
|
+
export interface MsgSubmitProposalEncodeObject extends EncodeObject {
|
|
11
|
+
readonly typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal";
|
|
12
|
+
readonly value: Partial<MsgSubmitProposal>;
|
|
13
|
+
}
|
|
14
|
+
export declare function isMsgSubmitProposalEncodeObject(object: EncodeObject): object is MsgSubmitProposalEncodeObject;
|
|
15
|
+
export interface MsgVoteEncodeObject extends EncodeObject {
|
|
16
|
+
readonly typeUrl: "/cosmos.gov.v1beta1.MsgVote";
|
|
17
|
+
readonly value: Partial<MsgVote>;
|
|
18
|
+
}
|
|
19
|
+
export declare function isMsgVoteEncodeObject(object: EncodeObject): object is MsgVoteEncodeObject;
|
|
20
|
+
export interface MsgVoteWeightedEncodeObject extends EncodeObject {
|
|
21
|
+
readonly typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted";
|
|
22
|
+
readonly value: Partial<MsgVoteWeighted>;
|
|
23
|
+
}
|
|
24
|
+
export declare function isMsgVoteWeightedEncodeObject(object: EncodeObject): object is MsgVoteWeightedEncodeObject;
|
|
25
|
+
export interface MsgCancelProposalEncodeObject extends EncodeObject {
|
|
26
|
+
readonly typeUrl: "/cosmos.gov.v1.MsgCancelProposal";
|
|
27
|
+
readonly value: Partial<MsgCancelProposal>;
|
|
28
|
+
}
|
|
29
|
+
export declare function isMsgCancelProposalEncodeObject(object: EncodeObject): object is MsgCancelProposalEncodeObject;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMsgCancelProposalEncodeObject = exports.isMsgVoteWeightedEncodeObject = exports.isMsgVoteEncodeObject = exports.isMsgSubmitProposalEncodeObject = exports.isMsgDepositEncodeObject = exports.govTypes = void 0;
|
|
4
|
+
var tx_1 = require("cosmjs-types/cosmos/gov/v1/tx");
|
|
5
|
+
var tx_2 = require("cosmjs-types/cosmos/gov/v1beta1/tx");
|
|
6
|
+
var tx_3 = require("@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx");
|
|
7
|
+
exports.govTypes = [
|
|
8
|
+
["/cosmos.gov.v1.MsgDeposit", tx_1.MsgDeposit],
|
|
9
|
+
["/cosmos.gov.v1.MsgSubmitProposal", tx_1.MsgSubmitProposal],
|
|
10
|
+
["/cosmos.gov.v1.MsgUpdateParams", tx_1.MsgUpdateParams],
|
|
11
|
+
["/cosmos.gov.v1.MsgVote", tx_1.MsgVote],
|
|
12
|
+
["/cosmos.gov.v1.MsgVoteWeighted", tx_1.MsgVoteWeighted],
|
|
13
|
+
["/cosmos.gov.v1beta1.MsgDeposit", tx_2.MsgDeposit],
|
|
14
|
+
["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_2.MsgSubmitProposal],
|
|
15
|
+
["/cosmos.gov.v1beta1.MsgVote", tx_2.MsgVote],
|
|
16
|
+
["/cosmos.gov.v1beta1.MsgVoteWeighted", tx_2.MsgVoteWeighted],
|
|
17
|
+
["/cosmos.gov.v1.MsgCancelProposal", tx_3.MsgCancelProposal], // Temporary type casting
|
|
18
|
+
];
|
|
19
|
+
function isMsgDepositEncodeObject(object) {
|
|
20
|
+
return object.typeUrl === "/cosmos.gov.v1beta1.MsgDeposit";
|
|
21
|
+
}
|
|
22
|
+
exports.isMsgDepositEncodeObject = isMsgDepositEncodeObject;
|
|
23
|
+
function isMsgSubmitProposalEncodeObject(object) {
|
|
24
|
+
return object.typeUrl === "/cosmos.gov.v1beta1.MsgSubmitProposal";
|
|
25
|
+
}
|
|
26
|
+
exports.isMsgSubmitProposalEncodeObject = isMsgSubmitProposalEncodeObject;
|
|
27
|
+
function isMsgVoteEncodeObject(object) {
|
|
28
|
+
return object.typeUrl === "/cosmos.gov.v1beta1.MsgVote";
|
|
29
|
+
}
|
|
30
|
+
exports.isMsgVoteEncodeObject = isMsgVoteEncodeObject;
|
|
31
|
+
function isMsgVoteWeightedEncodeObject(object) {
|
|
32
|
+
return object.typeUrl === "/cosmos.gov.v1beta1.MsgVoteWeighted";
|
|
33
|
+
}
|
|
34
|
+
exports.isMsgVoteWeightedEncodeObject = isMsgVoteWeightedEncodeObject;
|
|
35
|
+
function isMsgCancelProposalEncodeObject(object) {
|
|
36
|
+
return object.typeUrl === "/cosmos.gov.v1.MsgCancelProposal";
|
|
37
|
+
}
|
|
38
|
+
exports.isMsgCancelProposalEncodeObject = isMsgCancelProposalEncodeObject;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Uint64 } from "@cosmjs/math";
|
|
2
|
+
import { ProposalStatus } from "cosmjs-types/cosmos/gov/v1beta1/gov";
|
|
3
|
+
import { QueryDepositResponse, QueryDepositsResponse, QueryParamsResponse, QueryProposalResponse, QueryProposalsResponse, QueryTallyResultResponse, QueryVoteResponse, QueryVotesResponse } from "cosmjs-types/cosmos/gov/v1beta1/query";
|
|
4
|
+
import { QueryClient } from "../../queryclient";
|
|
5
|
+
export declare type GovParamsType = "deposit" | "tallying" | "voting";
|
|
6
|
+
export declare type GovProposalId = string | number | Uint64;
|
|
7
|
+
export interface GovExtension {
|
|
8
|
+
readonly gov: {
|
|
9
|
+
readonly params: (parametersType: GovParamsType) => Promise<QueryParamsResponse>;
|
|
10
|
+
readonly proposals: (proposalStatus: ProposalStatus, depositor: string, voter: string, paginationKey?: Uint8Array) => Promise<QueryProposalsResponse>;
|
|
11
|
+
readonly proposal: (proposalId: GovProposalId) => Promise<QueryProposalResponse>;
|
|
12
|
+
readonly deposits: (proposalId: GovProposalId, paginationKey?: Uint8Array) => Promise<QueryDepositsResponse>;
|
|
13
|
+
readonly deposit: (proposalId: GovProposalId, depositorAddress: string) => Promise<QueryDepositResponse>;
|
|
14
|
+
readonly tally: (proposalId: GovProposalId) => Promise<QueryTallyResultResponse>;
|
|
15
|
+
readonly votes: (proposalId: GovProposalId, paginationKey?: Uint8Array) => Promise<QueryVotesResponse>;
|
|
16
|
+
readonly vote: (proposalId: GovProposalId, voterAddress: string) => Promise<QueryVoteResponse>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare function setupGovExtension(base: QueryClient): GovExtension;
|
|
@@ -0,0 +1,160 @@
|
|
|
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.setupGovExtension = void 0;
|
|
40
|
+
var query_1 = require("cosmjs-types/cosmos/gov/v1beta1/query");
|
|
41
|
+
var queryclient_1 = require("../../queryclient");
|
|
42
|
+
function setupGovExtension(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
|
+
gov: {
|
|
50
|
+
params: function (parametersType) { return __awaiter(_this, void 0, void 0, function () {
|
|
51
|
+
var response;
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0: return [4 /*yield*/, queryService.Params({ paramsType: parametersType })];
|
|
55
|
+
case 1:
|
|
56
|
+
response = _a.sent();
|
|
57
|
+
return [2 /*return*/, response];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}); },
|
|
61
|
+
proposals: function (proposalStatus, depositorAddress, voterAddress, paginationKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
62
|
+
var response;
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
switch (_a.label) {
|
|
65
|
+
case 0: return [4 /*yield*/, queryService.Proposals({
|
|
66
|
+
proposalStatus: proposalStatus,
|
|
67
|
+
depositor: depositorAddress,
|
|
68
|
+
voter: voterAddress,
|
|
69
|
+
pagination: queryclient_1.createPagination(paginationKey),
|
|
70
|
+
})];
|
|
71
|
+
case 1:
|
|
72
|
+
response = _a.sent();
|
|
73
|
+
return [2 /*return*/, response];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}); },
|
|
77
|
+
proposal: function (proposalId) { return __awaiter(_this, void 0, void 0, function () {
|
|
78
|
+
var response;
|
|
79
|
+
return __generator(this, function (_a) {
|
|
80
|
+
switch (_a.label) {
|
|
81
|
+
case 0: return [4 /*yield*/, queryService.Proposal({ proposalId: queryclient_1.longify(proposalId) })];
|
|
82
|
+
case 1:
|
|
83
|
+
response = _a.sent();
|
|
84
|
+
return [2 /*return*/, response];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}); },
|
|
88
|
+
deposits: function (proposalId, paginationKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
89
|
+
var response;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0: return [4 /*yield*/, queryService.Deposits({
|
|
93
|
+
proposalId: queryclient_1.longify(proposalId),
|
|
94
|
+
pagination: queryclient_1.createPagination(paginationKey),
|
|
95
|
+
})];
|
|
96
|
+
case 1:
|
|
97
|
+
response = _a.sent();
|
|
98
|
+
return [2 /*return*/, response];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}); },
|
|
102
|
+
deposit: function (proposalId, depositorAddress) { return __awaiter(_this, void 0, void 0, function () {
|
|
103
|
+
var response;
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0: return [4 /*yield*/, queryService.Deposit({
|
|
107
|
+
proposalId: queryclient_1.longify(proposalId),
|
|
108
|
+
depositor: depositorAddress,
|
|
109
|
+
})];
|
|
110
|
+
case 1:
|
|
111
|
+
response = _a.sent();
|
|
112
|
+
return [2 /*return*/, response];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}); },
|
|
116
|
+
tally: function (proposalId) { return __awaiter(_this, void 0, void 0, function () {
|
|
117
|
+
var response;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0: return [4 /*yield*/, queryService.TallyResult({
|
|
121
|
+
proposalId: queryclient_1.longify(proposalId),
|
|
122
|
+
})];
|
|
123
|
+
case 1:
|
|
124
|
+
response = _a.sent();
|
|
125
|
+
return [2 /*return*/, response];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}); },
|
|
129
|
+
votes: function (proposalId, paginationKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
130
|
+
var response;
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
switch (_a.label) {
|
|
133
|
+
case 0: return [4 /*yield*/, queryService.Votes({
|
|
134
|
+
proposalId: queryclient_1.longify(proposalId),
|
|
135
|
+
pagination: queryclient_1.createPagination(paginationKey),
|
|
136
|
+
})];
|
|
137
|
+
case 1:
|
|
138
|
+
response = _a.sent();
|
|
139
|
+
return [2 /*return*/, response];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}); },
|
|
143
|
+
vote: function (proposalId, voterAddress) { return __awaiter(_this, void 0, void 0, function () {
|
|
144
|
+
var response;
|
|
145
|
+
return __generator(this, function (_a) {
|
|
146
|
+
switch (_a.label) {
|
|
147
|
+
case 0: return [4 /*yield*/, queryService.Vote({
|
|
148
|
+
proposalId: queryclient_1.longify(proposalId),
|
|
149
|
+
voter: voterAddress,
|
|
150
|
+
})];
|
|
151
|
+
case 1:
|
|
152
|
+
response = _a.sent();
|
|
153
|
+
return [2 /*return*/, response];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}); },
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
exports.setupGovExtension = setupGovExtension;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createGroupAminoConverters = void 0;
|
|
4
|
+
function createGroupAminoConverters() {
|
|
5
|
+
// Missing, see https://github.com/cosmos/cosmjs/issues/1441
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
exports.createGroupAminoConverters = createGroupAminoConverters;
|