@firmachain/firma-js 0.2.64 → 0.3.0-beta1
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 +4 -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 +12 -9
- package/dist/sdk/FirmaGovService.js +162 -97
- 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/GovTxClient.d.ts +6 -0
- package/dist/sdk/firmachain/gov/GovTxClient.js +6 -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.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 +351 -379
- 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 +149 -78
- 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 +18 -9
- package/dist/test/config_test.sample.d.ts +5 -0
- package/dist/test/config_test.sample.js +8 -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
|
@@ -50,12 +50,41 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
54
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
55
|
+
if (!m) return o;
|
|
56
|
+
var i = m.call(o), r, ar = [], e;
|
|
57
|
+
try {
|
|
58
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
59
|
+
}
|
|
60
|
+
catch (error) { e = { error: error }; }
|
|
61
|
+
finally {
|
|
62
|
+
try {
|
|
63
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
64
|
+
}
|
|
65
|
+
finally { if (e) throw e.error; }
|
|
66
|
+
}
|
|
67
|
+
return ar;
|
|
68
|
+
};
|
|
69
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
70
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
71
|
+
to[j] = from[i];
|
|
72
|
+
return to;
|
|
73
|
+
};
|
|
53
74
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.StargateClient = exports.
|
|
75
|
+
exports.StargateClient = exports.BroadcastTxError = exports.assertIsDeliverTxFailure = exports.assertIsDeliverTxSuccess = exports.isDeliverTxSuccess = exports.isDeliverTxFailure = exports.TimeoutError = void 0;
|
|
55
76
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
77
|
+
var amino_1 = require("@cosmjs/amino");
|
|
56
78
|
var encoding_1 = require("@cosmjs/encoding");
|
|
79
|
+
var math_1 = require("@cosmjs/math");
|
|
57
80
|
var tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
|
|
58
81
|
var utils_1 = require("@cosmjs/utils");
|
|
82
|
+
var abci_1 = require("cosmjs-types/cosmos/base/abci/v1beta1/abci");
|
|
83
|
+
var accounts_1 = require("./accounts");
|
|
84
|
+
var events_1 = require("./events");
|
|
85
|
+
var modules_1 = require("./modules");
|
|
86
|
+
var queryclient_1 = require("./queryclient");
|
|
87
|
+
var search_1 = require("./search");
|
|
59
88
|
var TimeoutError = /** @class */ (function (_super) {
|
|
60
89
|
__extends(TimeoutError, _super);
|
|
61
90
|
function TimeoutError(message, txId) {
|
|
@@ -66,41 +95,262 @@ var TimeoutError = /** @class */ (function (_super) {
|
|
|
66
95
|
return TimeoutError;
|
|
67
96
|
}(Error));
|
|
68
97
|
exports.TimeoutError = TimeoutError;
|
|
69
|
-
function
|
|
70
|
-
return result.code
|
|
98
|
+
function isDeliverTxFailure(result) {
|
|
99
|
+
return !!result.code;
|
|
100
|
+
}
|
|
101
|
+
exports.isDeliverTxFailure = isDeliverTxFailure;
|
|
102
|
+
function isDeliverTxSuccess(result) {
|
|
103
|
+
return !isDeliverTxFailure(result);
|
|
104
|
+
}
|
|
105
|
+
exports.isDeliverTxSuccess = isDeliverTxSuccess;
|
|
106
|
+
/**
|
|
107
|
+
* Ensures the given result is a success. Throws a detailed error message otherwise.
|
|
108
|
+
*/
|
|
109
|
+
function assertIsDeliverTxSuccess(result) {
|
|
110
|
+
if (isDeliverTxFailure(result)) {
|
|
111
|
+
throw new Error("Error when broadcasting tx " + result.transactionHash + " at height " + result.height + ". Code: " + result.code + "; Raw log: " + result.rawLog);
|
|
112
|
+
}
|
|
71
113
|
}
|
|
72
|
-
exports.
|
|
73
|
-
|
|
74
|
-
|
|
114
|
+
exports.assertIsDeliverTxSuccess = assertIsDeliverTxSuccess;
|
|
115
|
+
/**
|
|
116
|
+
* Ensures the given result is a failure. Throws a detailed error message otherwise.
|
|
117
|
+
*/
|
|
118
|
+
function assertIsDeliverTxFailure(result) {
|
|
119
|
+
if (isDeliverTxSuccess(result)) {
|
|
120
|
+
throw new Error("Transaction " + result.transactionHash + " did not fail at height " + result.height + ". Code: " + result.code + "; Raw log: " + result.rawLog);
|
|
121
|
+
}
|
|
75
122
|
}
|
|
76
|
-
exports.
|
|
123
|
+
exports.assertIsDeliverTxFailure = assertIsDeliverTxFailure;
|
|
124
|
+
/**
|
|
125
|
+
* An error when broadcasting the transaction. This contains the CheckTx errors
|
|
126
|
+
* from the blockchain. Once a transaction is included in a block no BroadcastTxError
|
|
127
|
+
* is thrown, even if the execution fails (DeliverTx errors).
|
|
128
|
+
*/
|
|
129
|
+
var BroadcastTxError = /** @class */ (function (_super) {
|
|
130
|
+
__extends(BroadcastTxError, _super);
|
|
131
|
+
function BroadcastTxError(code, codespace, log) {
|
|
132
|
+
var _this = _super.call(this, "Broadcasting transaction failed with code " + code + " (codespace: " + codespace + "). Log: " + log) || this;
|
|
133
|
+
_this.code = code;
|
|
134
|
+
_this.codespace = codespace;
|
|
135
|
+
_this.log = log;
|
|
136
|
+
return _this;
|
|
137
|
+
}
|
|
138
|
+
return BroadcastTxError;
|
|
139
|
+
}(Error));
|
|
140
|
+
exports.BroadcastTxError = BroadcastTxError;
|
|
77
141
|
var StargateClient = /** @class */ (function () {
|
|
78
|
-
function StargateClient(
|
|
79
|
-
if (
|
|
80
|
-
this.
|
|
142
|
+
function StargateClient(cometClient, options) {
|
|
143
|
+
if (cometClient) {
|
|
144
|
+
this.cometClient = cometClient;
|
|
145
|
+
this.queryClient = queryclient_1.QueryClient.withExtensions(cometClient, modules_1.setupAuthExtension, modules_1.setupBankExtension, modules_1.setupStakingExtension, modules_1.setupTxExtension);
|
|
81
146
|
}
|
|
147
|
+
var _a = options.accountParser, accountParser = _a === void 0 ? accounts_1.accountFromAny : _a;
|
|
148
|
+
this.accountParser = accountParser;
|
|
82
149
|
}
|
|
83
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Creates an instance by connecting to the given CometBFT RPC endpoint.
|
|
152
|
+
*
|
|
153
|
+
* This uses auto-detection to decide between a CometBFT 0.38, Tendermint 0.37 and 0.34 client.
|
|
154
|
+
* To set the Comet client explicitly, use `create`.
|
|
155
|
+
*/
|
|
156
|
+
StargateClient.connect = function (endpoint, options) {
|
|
157
|
+
if (options === void 0) { options = {}; }
|
|
84
158
|
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
-
var
|
|
159
|
+
var cometClient;
|
|
86
160
|
return __generator(this, function (_a) {
|
|
87
161
|
switch (_a.label) {
|
|
88
|
-
case 0: return [4 /*yield*/, tendermint_rpc_1.
|
|
162
|
+
case 0: return [4 /*yield*/, tendermint_rpc_1.connectComet(endpoint)];
|
|
89
163
|
case 1:
|
|
90
|
-
|
|
91
|
-
return [2 /*return*/,
|
|
164
|
+
cometClient = _a.sent();
|
|
165
|
+
return [2 /*return*/, StargateClient.create(cometClient, options)];
|
|
92
166
|
}
|
|
93
167
|
});
|
|
94
168
|
});
|
|
95
169
|
};
|
|
96
|
-
|
|
97
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Creates an instance from a manually created Comet client.
|
|
172
|
+
* Use this to use `Comet38Client` or `Tendermint37Client` instead of `Tendermint34Client`.
|
|
173
|
+
*/
|
|
174
|
+
StargateClient.create = function (cometClient, options) {
|
|
175
|
+
if (options === void 0) { options = {}; }
|
|
176
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
+
return __generator(this, function (_a) {
|
|
178
|
+
return [2 /*return*/, new StargateClient(cometClient, options)];
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
StargateClient.prototype.getCometClient = function () {
|
|
183
|
+
return this.cometClient;
|
|
98
184
|
};
|
|
99
|
-
StargateClient.prototype.
|
|
100
|
-
if (!this.
|
|
101
|
-
throw new Error("
|
|
185
|
+
StargateClient.prototype.forceGetCometClient = function () {
|
|
186
|
+
if (!this.cometClient) {
|
|
187
|
+
throw new Error("Comet client not available. You cannot use online functionality in offline mode.");
|
|
102
188
|
}
|
|
103
|
-
return this.
|
|
189
|
+
return this.cometClient;
|
|
190
|
+
};
|
|
191
|
+
StargateClient.prototype.getQueryClient = function () {
|
|
192
|
+
return this.queryClient;
|
|
193
|
+
};
|
|
194
|
+
StargateClient.prototype.forceGetQueryClient = function () {
|
|
195
|
+
if (!this.queryClient) {
|
|
196
|
+
throw new Error("Query client not available. You cannot use online functionality in offline mode.");
|
|
197
|
+
}
|
|
198
|
+
return this.queryClient;
|
|
199
|
+
};
|
|
200
|
+
StargateClient.prototype.getHeight = function () {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
202
|
+
var status;
|
|
203
|
+
return __generator(this, function (_a) {
|
|
204
|
+
switch (_a.label) {
|
|
205
|
+
case 0: return [4 /*yield*/, this.forceGetCometClient().status()];
|
|
206
|
+
case 1:
|
|
207
|
+
status = _a.sent();
|
|
208
|
+
return [2 /*return*/, status.syncInfo.latestBlockHeight];
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
StargateClient.prototype.getAccount = function (searchAddress) {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
215
|
+
var account, error_1;
|
|
216
|
+
return __generator(this, function (_a) {
|
|
217
|
+
switch (_a.label) {
|
|
218
|
+
case 0:
|
|
219
|
+
_a.trys.push([0, 2, , 3]);
|
|
220
|
+
return [4 /*yield*/, this.forceGetQueryClient().auth.account(searchAddress)];
|
|
221
|
+
case 1:
|
|
222
|
+
account = _a.sent();
|
|
223
|
+
return [2 /*return*/, account ? this.accountParser(account) : null];
|
|
224
|
+
case 2:
|
|
225
|
+
error_1 = _a.sent();
|
|
226
|
+
if (/rpc error: code = NotFound/i.test(error_1.toString())) {
|
|
227
|
+
return [2 /*return*/, null];
|
|
228
|
+
}
|
|
229
|
+
throw error_1;
|
|
230
|
+
case 3: return [2 /*return*/];
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
StargateClient.prototype.getSequence = function (address) {
|
|
236
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
237
|
+
var account;
|
|
238
|
+
return __generator(this, function (_a) {
|
|
239
|
+
switch (_a.label) {
|
|
240
|
+
case 0: return [4 /*yield*/, this.getAccount(address)];
|
|
241
|
+
case 1:
|
|
242
|
+
account = _a.sent();
|
|
243
|
+
if (!account) {
|
|
244
|
+
throw new Error("Account '" + address + "' does not exist on chain. Send some tokens there before trying to query sequence.");
|
|
245
|
+
}
|
|
246
|
+
return [2 /*return*/, {
|
|
247
|
+
accountNumber: account.accountNumber,
|
|
248
|
+
sequence: account.sequence,
|
|
249
|
+
}];
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
StargateClient.prototype.getBlock = function (height) {
|
|
255
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
256
|
+
var response;
|
|
257
|
+
return __generator(this, function (_a) {
|
|
258
|
+
switch (_a.label) {
|
|
259
|
+
case 0: return [4 /*yield*/, this.forceGetCometClient().block(height)];
|
|
260
|
+
case 1:
|
|
261
|
+
response = _a.sent();
|
|
262
|
+
return [2 /*return*/, {
|
|
263
|
+
id: encoding_1.toHex(response.blockId.hash).toUpperCase(),
|
|
264
|
+
header: {
|
|
265
|
+
version: {
|
|
266
|
+
block: new math_1.Uint53(response.block.header.version.block).toString(),
|
|
267
|
+
app: new math_1.Uint53(response.block.header.version.app).toString(),
|
|
268
|
+
},
|
|
269
|
+
height: response.block.header.height,
|
|
270
|
+
chainId: response.block.header.chainId,
|
|
271
|
+
time: tendermint_rpc_1.toRfc3339WithNanoseconds(response.block.header.time),
|
|
272
|
+
},
|
|
273
|
+
txs: response.block.txs,
|
|
274
|
+
}];
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
StargateClient.prototype.getBalance = function (address, searchDenom) {
|
|
280
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
281
|
+
return __generator(this, function (_a) {
|
|
282
|
+
return [2 /*return*/, this.forceGetQueryClient().bank.balance(address, searchDenom)];
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Queries all balances for all denoms that belong to this address.
|
|
288
|
+
*
|
|
289
|
+
* Uses the grpc queries (which iterates over the store internally), and we cannot get
|
|
290
|
+
* proofs from such a method.
|
|
291
|
+
*/
|
|
292
|
+
StargateClient.prototype.getAllBalances = function (address) {
|
|
293
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
294
|
+
return __generator(this, function (_a) {
|
|
295
|
+
return [2 /*return*/, this.forceGetQueryClient().bank.allBalances(address)];
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
StargateClient.prototype.getBalanceStaked = function (address) {
|
|
300
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
301
|
+
var allDelegations, startAtKey, _a, delegationResponses, pagination, loadedDelegations, sumValues;
|
|
302
|
+
return __generator(this, function (_b) {
|
|
303
|
+
switch (_b.label) {
|
|
304
|
+
case 0:
|
|
305
|
+
allDelegations = [];
|
|
306
|
+
startAtKey = undefined;
|
|
307
|
+
_b.label = 1;
|
|
308
|
+
case 1: return [4 /*yield*/, this.forceGetQueryClient().staking.delegatorDelegations(address, startAtKey)];
|
|
309
|
+
case 2:
|
|
310
|
+
_a = _b.sent(), delegationResponses = _a.delegationResponses, pagination = _a.pagination;
|
|
311
|
+
loadedDelegations = delegationResponses || [];
|
|
312
|
+
allDelegations.push.apply(allDelegations, __spreadArray([], __read(loadedDelegations)));
|
|
313
|
+
startAtKey = pagination === null || pagination === void 0 ? void 0 : pagination.nextKey;
|
|
314
|
+
_b.label = 3;
|
|
315
|
+
case 3:
|
|
316
|
+
if (startAtKey !== undefined && startAtKey.length !== 0) return [3 /*break*/, 1];
|
|
317
|
+
_b.label = 4;
|
|
318
|
+
case 4:
|
|
319
|
+
sumValues = allDelegations.reduce(function (previousValue, currentValue) {
|
|
320
|
+
// Safe because field is set to non-nullable (https://github.com/cosmos/cosmos-sdk/blob/v0.45.3/proto/cosmos/staking/v1beta1/staking.proto#L295)
|
|
321
|
+
utils_1.assert(currentValue.balance);
|
|
322
|
+
return previousValue !== null ? amino_1.addCoins(previousValue, currentValue.balance) : currentValue.balance;
|
|
323
|
+
}, null);
|
|
324
|
+
return [2 /*return*/, sumValues];
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
StargateClient.prototype.getDelegation = function (delegatorAddress, validatorAddress) {
|
|
330
|
+
var _a;
|
|
331
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
332
|
+
var delegatedAmount, e_1;
|
|
333
|
+
return __generator(this, function (_b) {
|
|
334
|
+
switch (_b.label) {
|
|
335
|
+
case 0:
|
|
336
|
+
_b.trys.push([0, 2, , 3]);
|
|
337
|
+
return [4 /*yield*/, this.forceGetQueryClient().staking.delegation(delegatorAddress, validatorAddress)];
|
|
338
|
+
case 1:
|
|
339
|
+
delegatedAmount = (_a = (_b.sent()).delegationResponse) === null || _a === void 0 ? void 0 : _a.balance;
|
|
340
|
+
return [3 /*break*/, 3];
|
|
341
|
+
case 2:
|
|
342
|
+
e_1 = _b.sent();
|
|
343
|
+
if (e_1.toString().includes("key not found")) {
|
|
344
|
+
// ignore, `delegatedAmount` remains undefined
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
throw e_1;
|
|
348
|
+
}
|
|
349
|
+
return [3 /*break*/, 3];
|
|
350
|
+
case 3: return [2 /*return*/, delegatedAmount || null];
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
});
|
|
104
354
|
};
|
|
105
355
|
StargateClient.prototype.getTx = function (id) {
|
|
106
356
|
var _a;
|
|
@@ -116,15 +366,51 @@ var StargateClient = /** @class */ (function () {
|
|
|
116
366
|
});
|
|
117
367
|
});
|
|
118
368
|
};
|
|
369
|
+
StargateClient.prototype.searchTx = function (query) {
|
|
370
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
371
|
+
var rawQuery;
|
|
372
|
+
return __generator(this, function (_a) {
|
|
373
|
+
if (typeof query === "string") {
|
|
374
|
+
rawQuery = query;
|
|
375
|
+
}
|
|
376
|
+
else if (search_1.isSearchTxQueryArray(query)) {
|
|
377
|
+
rawQuery = query
|
|
378
|
+
.map(function (t) {
|
|
379
|
+
// numeric values must not have quotes https://github.com/cosmos/cosmjs/issues/1462
|
|
380
|
+
if (typeof t.value === "string")
|
|
381
|
+
return t.key + "='" + t.value + "'";
|
|
382
|
+
else
|
|
383
|
+
return t.key + "=" + t.value;
|
|
384
|
+
})
|
|
385
|
+
.join(" AND ");
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
throw new Error("Got unsupported query type. See CosmJS 0.31 CHANGELOG for API breaking changes here.");
|
|
389
|
+
}
|
|
390
|
+
return [2 /*return*/, this.txsQuery(rawQuery)];
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
};
|
|
119
394
|
StargateClient.prototype.disconnect = function () {
|
|
120
|
-
if (this.
|
|
121
|
-
this.
|
|
395
|
+
if (this.cometClient)
|
|
396
|
+
this.cometClient.disconnect();
|
|
122
397
|
};
|
|
398
|
+
/**
|
|
399
|
+
* Broadcasts a signed transaction to the network and monitors its inclusion in a block.
|
|
400
|
+
*
|
|
401
|
+
* If broadcasting is rejected by the node for some reason (e.g. because of a CheckTx failure),
|
|
402
|
+
* an error is thrown.
|
|
403
|
+
*
|
|
404
|
+
* If the transaction is not included in a block before the provided timeout, this errors with a `TimeoutError`.
|
|
405
|
+
*
|
|
406
|
+
* If the transaction is included in a block, a `DeliverTxResponse` is returned. The caller then
|
|
407
|
+
* usually needs to check for execution success or failure.
|
|
408
|
+
*/
|
|
123
409
|
StargateClient.prototype.broadcastTx = function (tx, timeoutMs, pollIntervalMs) {
|
|
124
410
|
if (timeoutMs === void 0) { timeoutMs = 60000; }
|
|
125
411
|
if (pollIntervalMs === void 0) { pollIntervalMs = 3000; }
|
|
126
412
|
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
-
var timedOut, txPollTimeout, pollForTx,
|
|
413
|
+
var timedOut, txPollTimeout, pollForTx, transactionId;
|
|
128
414
|
var _this = this;
|
|
129
415
|
return __generator(this, function (_a) {
|
|
130
416
|
switch (_a.label) {
|
|
@@ -139,7 +425,7 @@ var StargateClient = /** @class */ (function () {
|
|
|
139
425
|
switch (_a.label) {
|
|
140
426
|
case 0:
|
|
141
427
|
if (timedOut) {
|
|
142
|
-
throw new TimeoutError("Transaction with ID " + txId + " was submitted but was not yet found on the chain. You might want to check later.", txId);
|
|
428
|
+
throw new TimeoutError("Transaction with ID " + txId + " was submitted but was not yet found on the chain. You might want to check later. There was a wait of " + timeoutMs / 1000 + " seconds.", txId);
|
|
143
429
|
}
|
|
144
430
|
return [4 /*yield*/, utils_1.sleep(pollIntervalMs)];
|
|
145
431
|
case 1:
|
|
@@ -151,8 +437,11 @@ var StargateClient = /** @class */ (function () {
|
|
|
151
437
|
? {
|
|
152
438
|
code: result.code,
|
|
153
439
|
height: result.height,
|
|
440
|
+
txIndex: result.txIndex,
|
|
441
|
+
events: result.events,
|
|
154
442
|
rawLog: result.rawLog,
|
|
155
443
|
transactionHash: txId,
|
|
444
|
+
msgResponses: result.msgResponses,
|
|
156
445
|
gasUsed: result.gasUsed,
|
|
157
446
|
gasWanted: result.gasWanted,
|
|
158
447
|
}
|
|
@@ -160,16 +449,9 @@ var StargateClient = /** @class */ (function () {
|
|
|
160
449
|
}
|
|
161
450
|
});
|
|
162
451
|
}); };
|
|
163
|
-
return [4 /*yield*/, this.
|
|
452
|
+
return [4 /*yield*/, this.broadcastTxSync(tx)];
|
|
164
453
|
case 1:
|
|
165
|
-
|
|
166
|
-
return [4 /*yield*/, this.forceGetTmClient().broadcastTxSync({ tx: tx })];
|
|
167
|
-
case 2:
|
|
168
|
-
broadcasted = _a.sent();
|
|
169
|
-
if (broadcasted.code) {
|
|
170
|
-
throw new Error("Broadcasting transaction failed with code " + broadcasted.code + " (codespace: " + broadcasted.codeSpace + "). Log: " + broadcasted.log);
|
|
171
|
-
}
|
|
172
|
-
transactionId = encoding_1.toHex(broadcasted.hash).toUpperCase();
|
|
454
|
+
transactionId = _a.sent();
|
|
173
455
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
174
456
|
return pollForTx(transactionId).then(function (value) {
|
|
175
457
|
clearTimeout(txPollTimeout);
|
|
@@ -183,21 +465,55 @@ var StargateClient = /** @class */ (function () {
|
|
|
183
465
|
});
|
|
184
466
|
});
|
|
185
467
|
};
|
|
468
|
+
/**
|
|
469
|
+
* Broadcasts a signed transaction to the network without monitoring it.
|
|
470
|
+
*
|
|
471
|
+
* If broadcasting is rejected by the node for some reason (e.g. because of a CheckTx failure),
|
|
472
|
+
* an error is thrown.
|
|
473
|
+
*
|
|
474
|
+
* If the transaction is broadcasted, a `string` containing the hash of the transaction is returned. The caller then
|
|
475
|
+
* usually needs to check if the transaction was included in a block and was successful.
|
|
476
|
+
*
|
|
477
|
+
* @returns Returns the hash of the transaction
|
|
478
|
+
*/
|
|
479
|
+
StargateClient.prototype.broadcastTxSync = function (tx) {
|
|
480
|
+
var _a;
|
|
481
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
482
|
+
var broadcasted, transactionId;
|
|
483
|
+
return __generator(this, function (_b) {
|
|
484
|
+
switch (_b.label) {
|
|
485
|
+
case 0: return [4 /*yield*/, this.forceGetCometClient().broadcastTxSync({ tx: tx })];
|
|
486
|
+
case 1:
|
|
487
|
+
broadcasted = _b.sent();
|
|
488
|
+
if (broadcasted.code) {
|
|
489
|
+
return [2 /*return*/, Promise.reject(new BroadcastTxError(broadcasted.code, (_a = broadcasted.codespace) !== null && _a !== void 0 ? _a : "", broadcasted.log))];
|
|
490
|
+
}
|
|
491
|
+
transactionId = encoding_1.toHex(broadcasted.hash).toUpperCase();
|
|
492
|
+
return [2 /*return*/, transactionId];
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
};
|
|
186
497
|
StargateClient.prototype.txsQuery = function (query) {
|
|
187
498
|
return __awaiter(this, void 0, void 0, function () {
|
|
188
499
|
var results;
|
|
189
500
|
return __generator(this, function (_a) {
|
|
190
501
|
switch (_a.label) {
|
|
191
|
-
case 0: return [4 /*yield*/, this.
|
|
502
|
+
case 0: return [4 /*yield*/, this.forceGetCometClient().txSearchAll({ query: query })];
|
|
192
503
|
case 1:
|
|
193
504
|
results = _a.sent();
|
|
194
505
|
return [2 /*return*/, results.txs.map(function (tx) {
|
|
506
|
+
var _a;
|
|
507
|
+
var txMsgData = abci_1.TxMsgData.decode((_a = tx.result.data) !== null && _a !== void 0 ? _a : new Uint8Array());
|
|
195
508
|
return {
|
|
196
509
|
height: tx.height,
|
|
510
|
+
txIndex: tx.index,
|
|
197
511
|
hash: encoding_1.toHex(tx.hash).toUpperCase(),
|
|
198
512
|
code: tx.result.code,
|
|
513
|
+
events: tx.result.events.map(events_1.fromTendermintEvent),
|
|
199
514
|
rawLog: tx.result.log || "",
|
|
200
515
|
tx: tx.tx,
|
|
516
|
+
msgResponses: txMsgData.msgResponses,
|
|
201
517
|
gasUsed: tx.result.gasUsed,
|
|
202
518
|
gasWanted: tx.result.gasWanted,
|
|
203
519
|
};
|
|
@@ -3,11 +3,11 @@ import { MsgCreateContractFile, MsgAddContractLog } from "./ContractTxTypes";
|
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
4
|
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
5
5
|
export interface MsgAddContractLogEncodeObject extends EncodeObject {
|
|
6
|
-
readonly typeUrl: "/firmachain.
|
|
6
|
+
readonly typeUrl: "/firmachain.contract.MsgAddContractLog";
|
|
7
7
|
readonly value: Partial<MsgAddContractLog>;
|
|
8
8
|
}
|
|
9
9
|
export interface MsgCreateContractFileEncodeObject extends EncodeObject {
|
|
10
|
-
readonly typeUrl: "/firmachain.
|
|
10
|
+
readonly typeUrl: "/firmachain.contract.MsgCreateContractFile";
|
|
11
11
|
readonly value: Partial<MsgCreateContractFile>;
|
|
12
12
|
}
|
|
13
13
|
export declare class ContractTxClient extends ITxClient {
|
|
@@ -20,8 +20,8 @@ var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
|
20
20
|
var ContractTxTypes_1 = require("./ContractTxTypes");
|
|
21
21
|
var ITxClient_1 = require("../common/ITxClient");
|
|
22
22
|
var types = [
|
|
23
|
-
["/firmachain.
|
|
24
|
-
["/firmachain.
|
|
23
|
+
["/firmachain.contract.MsgCreateContractFile", ContractTxTypes_1.MsgCreateContractFile],
|
|
24
|
+
["/firmachain.contract.MsgAddContractLog", ContractTxTypes_1.MsgAddContractLog]
|
|
25
25
|
];
|
|
26
26
|
var registry = new proto_signing_1.Registry(types);
|
|
27
27
|
var ContractTxClient = /** @class */ (function (_super) {
|
|
@@ -33,10 +33,10 @@ var ContractTxClient = /** @class */ (function (_super) {
|
|
|
33
33
|
return registry;
|
|
34
34
|
};
|
|
35
35
|
ContractTxClient.msgAddContractLog = function (data) {
|
|
36
|
-
return { typeUrl: "/firmachain.
|
|
36
|
+
return { typeUrl: "/firmachain.contract.MsgAddContractLog", value: data };
|
|
37
37
|
};
|
|
38
38
|
ContractTxClient.msgCreateContractFile = function (data) {
|
|
39
|
-
return { typeUrl: "/firmachain.
|
|
39
|
+
return { typeUrl: "/firmachain.contract.MsgCreateContractFile", value: data };
|
|
40
40
|
};
|
|
41
41
|
return ContractTxClient;
|
|
42
42
|
}(ITxClient_1.ITxClient));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Reader, Writer } from "protobufjs/minimal";
|
|
2
|
-
export declare const protobufPackage = "firmachain.
|
|
2
|
+
export declare const protobufPackage = "firmachain.contract";
|
|
3
3
|
export interface MsgCreateContractFile {
|
|
4
4
|
creator: string;
|
|
5
5
|
fileHash: string;
|
|
@@ -25,7 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.MsgClientImpl = exports.MsgAddContractLogResponse = exports.MsgAddContractLog = exports.MsgCreateContractFileResponse = exports.MsgCreateContractFile = exports.protobufPackage = void 0;
|
|
26
26
|
/* eslint-disable */
|
|
27
27
|
var minimal_1 = require("protobufjs/minimal");
|
|
28
|
-
exports.protobufPackage = "firmachain.
|
|
28
|
+
exports.protobufPackage = "firmachain.contract";
|
|
29
29
|
var baseMsgCreateContractFile = {
|
|
30
30
|
creator: "",
|
|
31
31
|
fileHash: "",
|
|
@@ -449,14 +449,14 @@ var MsgClientImpl = /** @class */ (function () {
|
|
|
449
449
|
}
|
|
450
450
|
MsgClientImpl.prototype.CreateContractFile = function (request) {
|
|
451
451
|
var data = exports.MsgCreateContractFile.encode(request).finish();
|
|
452
|
-
var promise = this.rpc.request("firmachain.
|
|
452
|
+
var promise = this.rpc.request("firmachain.contract.Msg", "CreateContractFile", data);
|
|
453
453
|
return promise.then(function (data) {
|
|
454
454
|
return exports.MsgCreateContractFileResponse.decode(new minimal_1.Reader(data));
|
|
455
455
|
});
|
|
456
456
|
};
|
|
457
457
|
MsgClientImpl.prototype.AddContractLog = function (request) {
|
|
458
458
|
var data = exports.MsgAddContractLog.encode(request).finish();
|
|
459
|
-
var promise = this.rpc.request("firmachain.
|
|
459
|
+
var promise = this.rpc.request("firmachain.contract.Msg", "AddContractLog", data);
|
|
460
460
|
return promise.then(function (data) {
|
|
461
461
|
return exports.MsgAddContractLogResponse.decode(new minimal_1.Reader(data));
|
|
462
462
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="long" />
|
|
2
2
|
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
|
|
3
3
|
import _m0 from "protobufjs/minimal";
|
|
4
|
-
import {
|
|
4
|
+
import { BinaryWriter } from "cosmjs-types/binary";
|
|
5
5
|
import { Any } from "../google/protobuf/any";
|
|
6
6
|
import { Duration } from "../google/protobuf/duration";
|
|
7
7
|
export interface MsgGrantAllowance {
|
|
@@ -14,7 +14,7 @@ export interface MsgRevokeAllowance {
|
|
|
14
14
|
grantee: string;
|
|
15
15
|
}
|
|
16
16
|
export declare const MsgGrantAllowance: {
|
|
17
|
-
encode(message: MsgGrantAllowance, writer?:
|
|
17
|
+
encode(message: MsgGrantAllowance, writer?: BinaryWriter): BinaryWriter;
|
|
18
18
|
fromPartial(object: DeepPartial<MsgGrantAllowance>): MsgGrantAllowance;
|
|
19
19
|
};
|
|
20
20
|
export declare const MsgRevokeAllowance: {
|
|
@@ -61,13 +61,13 @@ export interface AllowedMsgAllowance {
|
|
|
61
61
|
allowedMessages: string[];
|
|
62
62
|
}
|
|
63
63
|
export declare const AllowedMsgAllowance: {
|
|
64
|
-
encode(message: AllowedMsgAllowance, writer?:
|
|
64
|
+
encode(message: AllowedMsgAllowance, writer?: BinaryWriter): BinaryWriter;
|
|
65
65
|
};
|
|
66
66
|
export declare const PeriodicAllowance: {
|
|
67
|
-
encode(message: PeriodicAllowance, writer?:
|
|
67
|
+
encode(message: PeriodicAllowance, writer?: BinaryWriter): BinaryWriter;
|
|
68
68
|
};
|
|
69
69
|
export declare const BasicAllowance: {
|
|
70
|
-
encode(message: BasicAllowance, writer?:
|
|
70
|
+
encode(message: BasicAllowance, writer?: BinaryWriter): BinaryWriter;
|
|
71
71
|
};
|
|
72
72
|
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long;
|
|
73
73
|
export declare 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 {} ? {
|
|
@@ -28,7 +28,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
28
28
|
exports.BasicAllowance = exports.PeriodicAllowance = exports.AllowedMsgAllowance = exports.MsgRevokeAllowance = exports.MsgGrantAllowance = void 0;
|
|
29
29
|
var coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin");
|
|
30
30
|
var minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
31
|
-
var
|
|
31
|
+
var binary_1 = require("cosmjs-types/binary");
|
|
32
32
|
var timestamp_1 = require("../google/protobuf/timestamp");
|
|
33
33
|
var any_1 = require("../google/protobuf/any");
|
|
34
34
|
var duration_1 = require("../google/protobuf/duration");
|
|
@@ -36,7 +36,7 @@ var baseMsgGrantAllowance = { granter: "", grantee: "" };
|
|
|
36
36
|
var baseMsgRevokeAllowance = { granter: "", grantee: "" };
|
|
37
37
|
exports.MsgGrantAllowance = {
|
|
38
38
|
encode: function (message, writer) {
|
|
39
|
-
if (writer === void 0) { writer =
|
|
39
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
40
40
|
if (message.granter !== "") {
|
|
41
41
|
writer.uint32(10).string(message.granter);
|
|
42
42
|
}
|
|
@@ -102,7 +102,7 @@ exports.MsgRevokeAllowance = {
|
|
|
102
102
|
exports.AllowedMsgAllowance = {
|
|
103
103
|
encode: function (message, writer) {
|
|
104
104
|
var e_1, _a;
|
|
105
|
-
if (writer === void 0) { writer =
|
|
105
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
106
106
|
if (message.allowance !== undefined) {
|
|
107
107
|
any_1.Any.encode(message.allowance, writer.uint32(10).fork()).ldelim();
|
|
108
108
|
}
|
|
@@ -125,7 +125,7 @@ exports.AllowedMsgAllowance = {
|
|
|
125
125
|
exports.PeriodicAllowance = {
|
|
126
126
|
encode: function (message, writer) {
|
|
127
127
|
var e_2, _a, e_3, _b;
|
|
128
|
-
if (writer === void 0) { writer =
|
|
128
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
129
129
|
if (message.basic !== undefined) {
|
|
130
130
|
exports.BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim();
|
|
131
131
|
}
|
|
@@ -167,7 +167,7 @@ exports.PeriodicAllowance = {
|
|
|
167
167
|
exports.BasicAllowance = {
|
|
168
168
|
encode: function (message, writer) {
|
|
169
169
|
var e_4, _a;
|
|
170
|
-
if (writer === void 0) { writer =
|
|
170
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
171
171
|
try {
|
|
172
172
|
for (var _b = __values(message.spendLimit), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
173
173
|
var v = _c.value;
|
|
@@ -188,7 +188,9 @@ exports.BasicAllowance = {
|
|
|
188
188
|
},
|
|
189
189
|
};
|
|
190
190
|
function toTimestamp(date) {
|
|
191
|
-
var
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
var millis = date.getTime();
|
|
192
|
+
return {
|
|
193
|
+
seconds: Math.floor(millis / 1000),
|
|
194
|
+
nanos: (millis % 1000) * 1000000,
|
|
195
|
+
};
|
|
194
196
|
}
|