@firmachain/firma-js 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -1
- package/dist/sdk/FirmaAuthzService.d.ts +8 -7
- package/dist/sdk/FirmaAuthzService.js +12 -22
- package/dist/sdk/FirmaBankService.js +2 -2
- package/dist/sdk/FirmaChainService.js +1 -1
- package/dist/sdk/FirmaContractService.d.ts +1 -1
- package/dist/sdk/FirmaContractService.js +6 -6
- package/dist/sdk/FirmaCosmWasmCw20.d.ts +2 -2
- package/dist/sdk/FirmaCosmWasmCw20.js +8 -8
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +2 -2
- package/dist/sdk/FirmaCosmWasmCw721.js +12 -12
- package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +1 -1
- package/dist/sdk/FirmaCosmWasmCwBridge.js +8 -8
- package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +1 -1
- package/dist/sdk/FirmaCosmWasmCwMarketplace.js +5 -5
- package/dist/sdk/FirmaCosmWasmService.d.ts +1 -1
- package/dist/sdk/FirmaCosmWasmService.js +13 -13
- package/dist/sdk/FirmaDistributionService.d.ts +1 -1
- package/dist/sdk/FirmaDistributionService.js +6 -6
- package/dist/sdk/FirmaFeeGrantService.d.ts +7 -6
- package/dist/sdk/FirmaFeeGrantService.js +9 -26
- package/dist/sdk/FirmaGovService.d.ts +1 -1
- package/dist/sdk/FirmaGovService.js +14 -14
- package/dist/sdk/FirmaIbcService.d.ts +3 -3
- package/dist/sdk/FirmaIbcService.js +11 -8
- package/dist/sdk/FirmaIpfsService.js +1 -1
- package/dist/sdk/FirmaMintService.js +1 -1
- package/dist/sdk/FirmaNftService.d.ts +1 -1
- package/dist/sdk/FirmaNftService.js +6 -6
- package/dist/sdk/FirmaSlashingService.js +1 -1
- package/dist/sdk/FirmaStakingService.d.ts +3 -3
- package/dist/sdk/FirmaStakingService.js +6 -6
- package/dist/sdk/FirmaTokenService.d.ts +1 -1
- package/dist/sdk/FirmaTokenService.js +5 -5
- package/dist/sdk/FirmaUtil.d.ts +25 -24
- package/dist/sdk/FirmaUtil.js +200 -145
- package/dist/sdk/FirmaWalletService.d.ts +6 -7
- package/dist/sdk/FirmaWalletService.js +78 -36
- package/dist/sdk/firmachain/authz/AuthzQueryClient.js +4 -4
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +8 -11
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +6 -10
- package/dist/sdk/firmachain/authz/index.js +5 -1
- package/dist/sdk/firmachain/bank/BankQueryClient.js +5 -5
- package/dist/sdk/firmachain/bank/index.js +5 -1
- package/dist/sdk/firmachain/common/ITxClient.d.ts +2 -4
- package/dist/sdk/firmachain/common/ITxClient.js +20 -92
- package/dist/sdk/firmachain/common/LedgerWallet.d.ts +19 -3
- package/dist/sdk/firmachain/common/LedgerWallet.js +138 -68
- package/dist/sdk/firmachain/common/TendermintQueryClient.js +1 -1
- package/dist/sdk/firmachain/common/TxCommon.d.ts +13 -29
- package/dist/sdk/firmachain/common/accounts.d.ts +1 -1
- package/dist/sdk/firmachain/common/accounts.js +7 -7
- package/dist/sdk/firmachain/{amino → common}/coins.d.ts +2 -14
- package/dist/sdk/firmachain/{amino → common}/coins.js +4 -25
- package/dist/sdk/firmachain/common/index.d.ts +0 -1
- package/dist/sdk/firmachain/common/index.js +5 -4
- package/dist/sdk/firmachain/{amino → common}/wallet.js +15 -11
- package/dist/sdk/firmachain/contract/ContractQueryClient.js +3 -3
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +6 -6
- package/dist/sdk/firmachain/contract/index.js +5 -1
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +9 -9
- package/dist/sdk/firmachain/cosmwasm/index.js +5 -1
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +6 -6
- package/dist/sdk/firmachain/distribution/index.js +5 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +3 -3
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +4 -45
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +3 -82
- package/dist/sdk/firmachain/feegrant/index.js +5 -1
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -3
- package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +29 -29
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -3
- package/dist/sdk/firmachain/gov/GovQueryClient.js +3 -3
- package/dist/sdk/firmachain/gov/index.js +5 -1
- package/dist/sdk/firmachain/ibc/IbcQueryClient.js +2 -2
- package/dist/sdk/firmachain/ibc/index.js +5 -1
- package/dist/sdk/firmachain/mint/MintQueryClient.js +1 -1
- package/dist/sdk/firmachain/mint/index.js +5 -1
- package/dist/sdk/firmachain/nft/NftQueryClient.js +1 -1
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +8 -8
- package/dist/sdk/firmachain/nft/index.js +5 -1
- package/dist/sdk/firmachain/slashing/SlashingQueryClient.js +1 -1
- package/dist/sdk/firmachain/slashing/index.js +5 -1
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +2 -2
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +10 -9
- package/dist/sdk/firmachain/staking/index.js +5 -1
- package/dist/sdk/firmachain/token/TokenQueryClient.js +1 -1
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +11 -11
- package/dist/sdk/firmachain/token/TokenTxTypes.js +1 -1
- package/dist/sdk/firmachain/token/index.js +5 -1
- package/dist/test/00.wallet.test.js +4 -4
- package/dist/test/01.contract_tx.test.js +5 -5
- package/dist/test/02.contract_query.test.js +15 -15
- package/dist/test/03.contract_scenario.test.js +28 -28
- package/dist/test/04.bank_tx.test.js +4 -4
- package/dist/test/05.bank_query.test.js +9 -9
- package/dist/test/06.feegrant_tx.test.js +59 -35
- package/dist/test/07.feegrant_query.test.js +18 -15
- package/dist/test/08.gas_estimate.test.js +110 -70
- package/dist/test/09.ipfs.test.js +4 -4
- package/dist/test/10.nft_tx.test.js +7 -7
- package/dist/test/11.nft_query.test.js +9 -9
- package/dist/test/12.staking_tx.test.js +27 -15
- package/dist/test/13.staking_query.test.js +20 -20
- package/dist/test/14.distribution_tx.test.js +8 -8
- package/dist/test/15.distribution_query.test.js +15 -15
- package/dist/test/16.gov_tx.test.js +17 -17
- package/dist/test/17.gov_query.test.js +19 -19
- package/dist/test/18.util.test.js +105 -63
- package/dist/test/19.chain.test.js +38 -38
- package/dist/test/20.slashing_query.test.js +25 -25
- package/dist/test/21.token_tx.test.js +6 -6
- package/dist/test/22.token_query.test.js +4 -4
- package/dist/test/23.authz_tx.test.js +77 -47
- package/dist/test/24.authz_query.test.js +66 -67
- package/dist/test/25.cosmwasm_tx.test.js +7 -7
- package/dist/test/26.cosmwasm_query.test.js +127 -59
- package/dist/test/{27.arbitary_sign.test.js → 27.arbitrary_sign.test.js} +34 -62
- package/dist/test/28.ibc_tx.test.js +8 -8
- package/dist/test/29.mint_query.test.js +2 -2
- package/dist/test/30.cw20_tx.test.js +20 -20
- package/dist/test/31.cw20_query.test.js +24 -24
- package/dist/test/32.cw721_tx.test.js +19 -19
- package/dist/test/33.cw721_query.test.js +32 -32
- package/dist/test/34.cw_bridge_tx.test.js +19 -19
- package/dist/test/35.cw_bridge_tx_low.test.js +13 -13
- package/dist/test/36.cw_bridge_query.test.js +20 -20
- package/dist/test/37.cw_marketplace_tx.test.js +32 -32
- package/dist/test/38.cw_marketplace_query.test.js +2 -2
- package/dist/test/config_test.d.ts +1 -1
- package/dist/test/config_test.js +2 -2
- package/package.json +9 -10
- package/dist/sdk/firmachain/amino/addresses.d.ts +0 -5
- package/dist/sdk/firmachain/amino/addresses.js +0 -46
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +0 -291
- package/dist/sdk/firmachain/amino/aminomsgs.js +0 -81
- package/dist/sdk/firmachain/amino/aminotypes.d.ts +0 -22
- package/dist/sdk/firmachain/amino/aminotypes.js +0 -538
- package/dist/sdk/firmachain/amino/encoding.d.ts +0 -33
- package/dist/sdk/firmachain/amino/encoding.js +0 -252
- package/dist/sdk/firmachain/amino/multisig.d.ts +0 -10
- package/dist/sdk/firmachain/amino/multisig.js +0 -42
- package/dist/sdk/firmachain/amino/pubkeys.d.ts +0 -47
- package/dist/sdk/firmachain/amino/pubkeys.js +0 -29
- package/dist/sdk/firmachain/amino/signature.d.ts +0 -16
- package/dist/sdk/firmachain/amino/signature.js +0 -36
- package/dist/sdk/firmachain/amino/signdoc.d.ts +0 -44
- package/dist/sdk/firmachain/amino/signdoc.js +0 -68
- package/dist/sdk/firmachain/amino/signer.d.ts +0 -33
- package/dist/sdk/firmachain/amino/signer.js +0 -2
- package/dist/sdk/firmachain/amino/stdtx.d.ts +0 -15
- package/dist/sdk/firmachain/amino/stdtx.js +0 -17
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +0 -22
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +0 -170
- package/dist/sdk/firmachain/common/aminotypes.d.ts +0 -19
- package/dist/sdk/firmachain/common/aminotypes.js +0 -74
- package/dist/sdk/firmachain/common/events.d.ts +0 -32
- package/dist/sdk/firmachain/common/events.js +0 -18
- package/dist/sdk/firmachain/common/fee.d.ts +0 -26
- package/dist/sdk/firmachain/common/fee.js +0 -83
- package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +0 -15
- package/dist/sdk/firmachain/common/modules/auth/queries.js +0 -64
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +0 -15
- package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/authz/messages.js +0 -9
- package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +0 -10
- package/dist/sdk/firmachain/common/modules/authz/queries.js +0 -88
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +0 -35
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +0 -85
- package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +0 -8
- package/dist/sdk/firmachain/common/modules/bank/messages.js +0 -12
- package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +0 -15
- package/dist/sdk/firmachain/common/modules/bank/queries.js +0 -128
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +0 -14
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +0 -11
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +0 -44
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +0 -113
- package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +0 -8
- package/dist/sdk/firmachain/common/modules/distribution/messages.js +0 -15
- package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +0 -16
- package/dist/sdk/firmachain/common/modules/distribution/queries.js +0 -171
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +0 -18
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +0 -11
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +0 -14
- package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/feegrant/messages.js +0 -8
- package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +0 -9
- package/dist/sdk/firmachain/common/modules/feegrant/queries.js +0 -81
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +0 -79
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +0 -152
- package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +0 -29
- package/dist/sdk/firmachain/common/modules/gov/messages.js +0 -39
- package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +0 -19
- package/dist/sdk/firmachain/common/modules/gov/queries.js +0 -160
- package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/group/aminomessages.js +0 -8
- package/dist/sdk/firmachain/common/modules/group/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/group/messages.js +0 -28
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +0 -38
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +0 -55
- package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +0 -8
- package/dist/sdk/firmachain/common/modules/ibc/messages.js +0 -32
- package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +0 -58
- package/dist/sdk/firmachain/common/modules/ibc/queries.js +0 -576
- package/dist/sdk/firmachain/common/modules/index.d.ts +0 -32
- package/dist/sdk/firmachain/common/modules/index.js +0 -101
- package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +0 -21
- package/dist/sdk/firmachain/common/modules/mint/queries.js +0 -95
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +0 -12
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +0 -11
- package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +0 -10
- package/dist/sdk/firmachain/common/modules/slashing/queries.js +0 -88
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +0 -112
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +0 -234
- package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +0 -33
- package/dist/sdk/firmachain/common/modules/staking/messages.js +0 -37
- package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +0 -23
- package/dist/sdk/firmachain/common/modules/staking/queries.js +0 -242
- package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +0 -11
- package/dist/sdk/firmachain/common/modules/tx/queries.js +0 -103
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +0 -16
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +0 -56
- package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/vesting/messages.js +0 -7
- package/dist/sdk/firmachain/common/queryclient/index.d.ts +0 -2
- package/dist/sdk/firmachain/common/queryclient/index.js +0 -10
- package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +0 -75
- package/dist/sdk/firmachain/common/queryclient/queryclient.js +0 -157
- package/dist/sdk/firmachain/common/queryclient/utils.d.ts +0 -33
- package/dist/sdk/firmachain/common/queryclient/utils.js +0 -101
- package/dist/sdk/firmachain/common/search.d.ts +0 -10
- package/dist/sdk/firmachain/common/search.js +0 -7
- package/dist/sdk/firmachain/common/signing.d.ts +0 -15
- package/dist/sdk/firmachain/common/signing.js +0 -87
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +0 -121
- package/dist/sdk/firmachain/common/signingstargateclient.js +0 -674
- package/dist/sdk/firmachain/common/stargateclient.d.ts +0 -210
- package/dist/sdk/firmachain/common/stargateclient.js +0 -527
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +0 -110
- package/dist/sdk/firmachain/google/protobuf/timestamp.js +0 -108
- /package/dist/sdk/firmachain/{amino → common}/paths.d.ts +0 -0
- /package/dist/sdk/firmachain/{amino → common}/paths.js +0 -0
- /package/dist/sdk/firmachain/{amino → common}/wallet.d.ts +0 -0
- /package/dist/test/{27.arbitary_sign.test.d.ts → 27.arbitrary_sign.test.d.ts} +0 -0
|
@@ -1,527 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
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
|
-
};
|
|
74
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
-
exports.StargateClient = exports.BroadcastTxError = exports.assertIsDeliverTxFailure = exports.assertIsDeliverTxSuccess = exports.isDeliverTxSuccess = exports.isDeliverTxFailure = exports.TimeoutError = void 0;
|
|
76
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
77
|
-
var amino_1 = require("@cosmjs/amino");
|
|
78
|
-
var encoding_1 = require("@cosmjs/encoding");
|
|
79
|
-
var math_1 = require("@cosmjs/math");
|
|
80
|
-
var tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
|
|
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");
|
|
88
|
-
var TimeoutError = /** @class */ (function (_super) {
|
|
89
|
-
__extends(TimeoutError, _super);
|
|
90
|
-
function TimeoutError(message, txId) {
|
|
91
|
-
var _this = _super.call(this, message) || this;
|
|
92
|
-
_this.txId = txId;
|
|
93
|
-
return _this;
|
|
94
|
-
}
|
|
95
|
-
return TimeoutError;
|
|
96
|
-
}(Error));
|
|
97
|
-
exports.TimeoutError = TimeoutError;
|
|
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
|
-
}
|
|
113
|
-
}
|
|
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
|
-
}
|
|
122
|
-
}
|
|
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;
|
|
141
|
-
var StargateClient = /** @class */ (function () {
|
|
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);
|
|
146
|
-
}
|
|
147
|
-
var _a = options.accountParser, accountParser = _a === void 0 ? accounts_1.accountFromAny : _a;
|
|
148
|
-
this.accountParser = accountParser;
|
|
149
|
-
}
|
|
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 = {}; }
|
|
158
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
159
|
-
var cometClient;
|
|
160
|
-
return __generator(this, function (_a) {
|
|
161
|
-
switch (_a.label) {
|
|
162
|
-
case 0: return [4 /*yield*/, tendermint_rpc_1.connectComet(endpoint)];
|
|
163
|
-
case 1:
|
|
164
|
-
cometClient = _a.sent();
|
|
165
|
-
return [2 /*return*/, StargateClient.create(cometClient, options)];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
};
|
|
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;
|
|
184
|
-
};
|
|
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.");
|
|
188
|
-
}
|
|
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
|
-
});
|
|
354
|
-
};
|
|
355
|
-
StargateClient.prototype.getTx = function (id) {
|
|
356
|
-
var _a;
|
|
357
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
358
|
-
var results;
|
|
359
|
-
return __generator(this, function (_b) {
|
|
360
|
-
switch (_b.label) {
|
|
361
|
-
case 0: return [4 /*yield*/, this.txsQuery("tx.hash='" + id + "'")];
|
|
362
|
-
case 1:
|
|
363
|
-
results = _b.sent();
|
|
364
|
-
return [2 /*return*/, (_a = results[0]) !== null && _a !== void 0 ? _a : null];
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
});
|
|
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
|
-
};
|
|
394
|
-
StargateClient.prototype.disconnect = function () {
|
|
395
|
-
if (this.cometClient)
|
|
396
|
-
this.cometClient.disconnect();
|
|
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
|
-
*/
|
|
409
|
-
StargateClient.prototype.broadcastTx = function (tx, timeoutMs, pollIntervalMs) {
|
|
410
|
-
if (timeoutMs === void 0) { timeoutMs = 60000; }
|
|
411
|
-
if (pollIntervalMs === void 0) { pollIntervalMs = 3000; }
|
|
412
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
413
|
-
var timedOut, txPollTimeout, pollForTx, transactionId;
|
|
414
|
-
var _this = this;
|
|
415
|
-
return __generator(this, function (_a) {
|
|
416
|
-
switch (_a.label) {
|
|
417
|
-
case 0:
|
|
418
|
-
timedOut = false;
|
|
419
|
-
txPollTimeout = setTimeout(function () {
|
|
420
|
-
timedOut = true;
|
|
421
|
-
}, timeoutMs);
|
|
422
|
-
pollForTx = function (txId) { return __awaiter(_this, void 0, void 0, function () {
|
|
423
|
-
var result;
|
|
424
|
-
return __generator(this, function (_a) {
|
|
425
|
-
switch (_a.label) {
|
|
426
|
-
case 0:
|
|
427
|
-
if (timedOut) {
|
|
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);
|
|
429
|
-
}
|
|
430
|
-
return [4 /*yield*/, utils_1.sleep(pollIntervalMs)];
|
|
431
|
-
case 1:
|
|
432
|
-
_a.sent();
|
|
433
|
-
return [4 /*yield*/, this.getTx(txId)];
|
|
434
|
-
case 2:
|
|
435
|
-
result = _a.sent();
|
|
436
|
-
return [2 /*return*/, result
|
|
437
|
-
? {
|
|
438
|
-
code: result.code,
|
|
439
|
-
height: result.height,
|
|
440
|
-
txIndex: result.txIndex,
|
|
441
|
-
events: result.events,
|
|
442
|
-
rawLog: result.rawLog,
|
|
443
|
-
transactionHash: txId,
|
|
444
|
-
msgResponses: result.msgResponses,
|
|
445
|
-
gasUsed: result.gasUsed,
|
|
446
|
-
gasWanted: result.gasWanted,
|
|
447
|
-
}
|
|
448
|
-
: pollForTx(txId)];
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
}); };
|
|
452
|
-
return [4 /*yield*/, this.broadcastTxSync(tx)];
|
|
453
|
-
case 1:
|
|
454
|
-
transactionId = _a.sent();
|
|
455
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
456
|
-
return pollForTx(transactionId).then(function (value) {
|
|
457
|
-
clearTimeout(txPollTimeout);
|
|
458
|
-
resolve(value);
|
|
459
|
-
}, function (error) {
|
|
460
|
-
clearTimeout(txPollTimeout);
|
|
461
|
-
reject(error);
|
|
462
|
-
});
|
|
463
|
-
})];
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
});
|
|
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
|
-
};
|
|
497
|
-
StargateClient.prototype.txsQuery = function (query) {
|
|
498
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
499
|
-
var results;
|
|
500
|
-
return __generator(this, function (_a) {
|
|
501
|
-
switch (_a.label) {
|
|
502
|
-
case 0: return [4 /*yield*/, this.forceGetCometClient().txSearchAll({ query: query })];
|
|
503
|
-
case 1:
|
|
504
|
-
results = _a.sent();
|
|
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());
|
|
508
|
-
return {
|
|
509
|
-
height: tx.height,
|
|
510
|
-
txIndex: tx.index,
|
|
511
|
-
hash: encoding_1.toHex(tx.hash).toUpperCase(),
|
|
512
|
-
code: tx.result.code,
|
|
513
|
-
events: tx.result.events.map(events_1.fromTendermintEvent),
|
|
514
|
-
rawLog: tx.result.log || "",
|
|
515
|
-
tx: tx.tx,
|
|
516
|
-
msgResponses: txMsgData.msgResponses,
|
|
517
|
-
gasUsed: tx.result.gasUsed,
|
|
518
|
-
gasWanted: tx.result.gasWanted,
|
|
519
|
-
};
|
|
520
|
-
})];
|
|
521
|
-
}
|
|
522
|
-
});
|
|
523
|
-
});
|
|
524
|
-
};
|
|
525
|
-
return StargateClient;
|
|
526
|
-
}());
|
|
527
|
-
exports.StargateClient = StargateClient;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Reader } from "protobufjs/minimal";
|
|
2
|
-
import { BinaryWriter } from "cosmjs-types/binary";
|
|
3
|
-
export declare const protobufPackage = "google.protobuf";
|
|
4
|
-
/**
|
|
5
|
-
* A Timestamp represents a point in time independent of any time zone
|
|
6
|
-
* or calendar, represented as seconds and fractions of seconds at
|
|
7
|
-
* nanosecond resolution in UTC Epoch time. It is encoded using the
|
|
8
|
-
* Proleptic Gregorian Calendar which extends the Gregorian calendar
|
|
9
|
-
* backwards to year one. It is encoded assuming all minutes are 60
|
|
10
|
-
* seconds long, i.e. leap seconds are "smeared" so that no leap second
|
|
11
|
-
* table is needed for interpretation. Range is from
|
|
12
|
-
* 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
|
13
|
-
* By restricting to that range, we ensure that we can convert to
|
|
14
|
-
* and from RFC 3339 date strings.
|
|
15
|
-
* See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
|
|
16
|
-
*
|
|
17
|
-
* # Examples
|
|
18
|
-
*
|
|
19
|
-
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
20
|
-
*
|
|
21
|
-
* Timestamp timestamp;
|
|
22
|
-
* timestamp.set_seconds(time(NULL));
|
|
23
|
-
* timestamp.set_nanos(0);
|
|
24
|
-
*
|
|
25
|
-
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
26
|
-
*
|
|
27
|
-
* struct timeval tv;
|
|
28
|
-
* gettimeofday(&tv, NULL);
|
|
29
|
-
*
|
|
30
|
-
* Timestamp timestamp;
|
|
31
|
-
* timestamp.set_seconds(tv.tv_sec);
|
|
32
|
-
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
33
|
-
*
|
|
34
|
-
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
35
|
-
*
|
|
36
|
-
* FILETIME ft;
|
|
37
|
-
* GetSystemTimeAsFileTime(&ft);
|
|
38
|
-
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
39
|
-
*
|
|
40
|
-
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
41
|
-
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
42
|
-
* Timestamp timestamp;
|
|
43
|
-
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
44
|
-
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
45
|
-
*
|
|
46
|
-
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
47
|
-
*
|
|
48
|
-
* long millis = System.currentTimeMillis();
|
|
49
|
-
*
|
|
50
|
-
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
51
|
-
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* Example 5: Compute Timestamp from current time in Python.
|
|
55
|
-
*
|
|
56
|
-
* timestamp = Timestamp()
|
|
57
|
-
* timestamp.GetCurrentTime()
|
|
58
|
-
*
|
|
59
|
-
* # JSON Mapping
|
|
60
|
-
*
|
|
61
|
-
* In JSON format, the Timestamp type is encoded as a string in the
|
|
62
|
-
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
63
|
-
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
64
|
-
* where {year} is always expressed using four digits while {month}, {day},
|
|
65
|
-
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
66
|
-
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
67
|
-
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
68
|
-
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
69
|
-
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
70
|
-
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
71
|
-
*
|
|
72
|
-
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
73
|
-
* 01:30 UTC on January 15, 2017.
|
|
74
|
-
*
|
|
75
|
-
* In JavaScript, one can convert a Date object to this format using the
|
|
76
|
-
* standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
|
|
77
|
-
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
78
|
-
* to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
|
79
|
-
* with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
|
80
|
-
* can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
81
|
-
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
|
|
82
|
-
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
83
|
-
*/
|
|
84
|
-
export interface Timestamp {
|
|
85
|
-
/**
|
|
86
|
-
* Represents seconds of UTC time since Unix epoch
|
|
87
|
-
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
88
|
-
* 9999-12-31T23:59:59Z inclusive.
|
|
89
|
-
*/
|
|
90
|
-
seconds: number;
|
|
91
|
-
/**
|
|
92
|
-
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
93
|
-
* second values with fractions must still have non-negative nanos values
|
|
94
|
-
* that count forward in time. Must be from 0 to 999,999,999
|
|
95
|
-
* inclusive.
|
|
96
|
-
*/
|
|
97
|
-
nanos: number;
|
|
98
|
-
}
|
|
99
|
-
export declare const Timestamp: {
|
|
100
|
-
encode(message: Timestamp, writer?: BinaryWriter): BinaryWriter;
|
|
101
|
-
decode(input: Reader | Uint8Array, length?: number | undefined): Timestamp;
|
|
102
|
-
fromJSON(object: any): Timestamp;
|
|
103
|
-
toJSON(message: Timestamp): unknown;
|
|
104
|
-
fromPartial(object: DeepPartial<Timestamp>): Timestamp;
|
|
105
|
-
};
|
|
106
|
-
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
107
|
-
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 {} ? {
|
|
108
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
109
|
-
} : Partial<T>;
|
|
110
|
-
export {};
|