@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
|
@@ -4,6 +4,7 @@ import _m0 from "protobufjs/minimal";
|
|
|
4
4
|
import { Writer } from "protobufjs/minimal";
|
|
5
5
|
import { Timestamp } from "../google/protobuf/timestamp";
|
|
6
6
|
import { Any } from "../google/protobuf/any";
|
|
7
|
+
import { BinaryWriter } from "cosmjs-types/binary";
|
|
7
8
|
export interface GenericAuthorization {
|
|
8
9
|
/** Msg, identified by it's type URL, to grant unrestricted permissions to execute */
|
|
9
10
|
msg: string;
|
|
@@ -51,7 +52,7 @@ export interface MsgRevoke {
|
|
|
51
52
|
export interface MsgRevokeResponse {
|
|
52
53
|
}
|
|
53
54
|
export declare const MsgGrant: {
|
|
54
|
-
encode(message: MsgGrant, writer?:
|
|
55
|
+
encode(message: MsgGrant, writer?: BinaryWriter): BinaryWriter;
|
|
55
56
|
fromPartial(object: DeepPartial<MsgGrant>): MsgGrant;
|
|
56
57
|
};
|
|
57
58
|
export declare const MsgExecResponse: {
|
|
@@ -59,7 +60,7 @@ export declare const MsgExecResponse: {
|
|
|
59
60
|
fromPartial(object: DeepPartial<MsgExecResponse>): MsgExecResponse;
|
|
60
61
|
};
|
|
61
62
|
export declare const MsgExec: {
|
|
62
|
-
encode(message: MsgExec, writer?:
|
|
63
|
+
encode(message: MsgExec, writer?: BinaryWriter): BinaryWriter;
|
|
63
64
|
fromPartial(object: DeepPartial<MsgExec>): MsgExec;
|
|
64
65
|
};
|
|
65
66
|
export declare const MsgGrantResponse: {
|
|
@@ -75,7 +76,7 @@ export declare const MsgRevokeResponse: {
|
|
|
75
76
|
fromPartial(object: DeepPartial<MsgRevokeResponse>): MsgRevokeResponse;
|
|
76
77
|
};
|
|
77
78
|
export declare const Grant: {
|
|
78
|
-
encode(message: Grant, writer?:
|
|
79
|
+
encode(message: Grant, writer?: BinaryWriter): BinaryWriter;
|
|
79
80
|
fromPartial(object: DeepPartial<Grant>): Grant;
|
|
80
81
|
};
|
|
81
82
|
export declare const GenericAuthorization: {
|
|
@@ -126,18 +127,18 @@ export interface StakeAuthorization_Validators {
|
|
|
126
127
|
address: string[];
|
|
127
128
|
}
|
|
128
129
|
export declare const StakeAuthorization: {
|
|
129
|
-
encode(message: StakeAuthorization, writer?:
|
|
130
|
+
encode(message: StakeAuthorization, writer?: BinaryWriter): BinaryWriter;
|
|
130
131
|
fromPartial(object: DeepPartial<StakeAuthorization>): StakeAuthorization;
|
|
131
132
|
};
|
|
132
133
|
export declare const StakeAuthorization_Validators: {
|
|
133
|
-
encode(message: StakeAuthorization_Validators, writer?:
|
|
134
|
+
encode(message: StakeAuthorization_Validators, writer?: BinaryWriter): BinaryWriter;
|
|
134
135
|
fromPartial(object: DeepPartial<StakeAuthorization_Validators>): StakeAuthorization_Validators;
|
|
135
136
|
};
|
|
136
137
|
export interface SendAuthorization {
|
|
137
138
|
spendLimit: Coin[];
|
|
138
139
|
}
|
|
139
140
|
export declare const SendAuthorization: {
|
|
140
|
-
encode(message: SendAuthorization, writer?:
|
|
141
|
+
encode(message: SendAuthorization, writer?: BinaryWriter): BinaryWriter;
|
|
141
142
|
fromPartial(object: DeepPartial<SendAuthorization>): SendAuthorization;
|
|
142
143
|
};
|
|
143
144
|
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long;
|
|
@@ -19,12 +19,13 @@ var coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin");
|
|
|
19
19
|
var minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
20
20
|
var timestamp_1 = require("../google/protobuf/timestamp");
|
|
21
21
|
var any_1 = require("../google/protobuf/any");
|
|
22
|
+
var binary_1 = require("cosmjs-types/binary");
|
|
22
23
|
function createBaseMsgGrant() {
|
|
23
24
|
return { granter: "", grantee: "", grant: undefined };
|
|
24
25
|
}
|
|
25
26
|
exports.MsgGrant = {
|
|
26
27
|
encode: function (message, writer) {
|
|
27
|
-
if (writer === void 0) { writer =
|
|
28
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
28
29
|
if (message.granter !== "") {
|
|
29
30
|
writer.uint32(10).string(message.granter);
|
|
30
31
|
}
|
|
@@ -81,7 +82,7 @@ function createBaseMsgExec() {
|
|
|
81
82
|
exports.MsgExec = {
|
|
82
83
|
encode: function (message, writer) {
|
|
83
84
|
var e_2, _a;
|
|
84
|
-
if (writer === void 0) { writer =
|
|
85
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
85
86
|
if (message.grantee !== "") {
|
|
86
87
|
writer.uint32(10).string(message.grantee);
|
|
87
88
|
}
|
|
@@ -166,7 +167,7 @@ function createBaseGrant() {
|
|
|
166
167
|
}
|
|
167
168
|
exports.Grant = {
|
|
168
169
|
encode: function (message, writer) {
|
|
169
|
-
if (writer === void 0) { writer =
|
|
170
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
170
171
|
if (message.authorization !== undefined) {
|
|
171
172
|
any_1.Any.encode(message.authorization, writer.uint32(10).fork()).ldelim();
|
|
172
173
|
}
|
|
@@ -264,7 +265,7 @@ function createBaseStakeAuthorization() {
|
|
|
264
265
|
}
|
|
265
266
|
exports.StakeAuthorization = {
|
|
266
267
|
encode: function (message, writer) {
|
|
267
|
-
if (writer === void 0) { writer =
|
|
268
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
268
269
|
if (message.maxTokens !== undefined) {
|
|
269
270
|
coin_1.Coin.encode(message.maxTokens, writer.uint32(10).fork()).ldelim();
|
|
270
271
|
}
|
|
@@ -304,7 +305,7 @@ function createBaseStakeAuthorization_Validators() {
|
|
|
304
305
|
exports.StakeAuthorization_Validators = {
|
|
305
306
|
encode: function (message, writer) {
|
|
306
307
|
var e_3, _a;
|
|
307
|
-
if (writer === void 0) { writer =
|
|
308
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
308
309
|
try {
|
|
309
310
|
for (var _b = __values(message.address), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
310
311
|
var v = _c.value;
|
|
@@ -333,7 +334,7 @@ function createBaseSendAuthorization() {
|
|
|
333
334
|
exports.SendAuthorization = {
|
|
334
335
|
encode: function (message, writer) {
|
|
335
336
|
var e_4, _a;
|
|
336
|
-
if (writer === void 0) { writer =
|
|
337
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
337
338
|
try {
|
|
338
339
|
for (var _b = __values(message.spendLimit), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
339
340
|
var v = _c.value;
|
|
@@ -57,7 +57,7 @@ var BankQueryClient = /** @class */ (function () {
|
|
|
57
57
|
return __generator(this, function (_a) {
|
|
58
58
|
switch (_a.label) {
|
|
59
59
|
case 0:
|
|
60
|
-
path = "/cosmos/bank/v1beta1/supply/" + denom;
|
|
60
|
+
path = "/cosmos/bank/v1beta1/supply/by_denom?denom=" + denom;
|
|
61
61
|
return [4 /*yield*/, this.axios.get(path)];
|
|
62
62
|
case 1:
|
|
63
63
|
result = _a.sent();
|
|
@@ -22,6 +22,7 @@ var tx_2 = require("cosmjs-types/cosmos/distribution/v1beta1/tx");
|
|
|
22
22
|
var tx_3 = require("cosmjs-types/cosmos/gov/v1beta1/tx");
|
|
23
23
|
var tx_4 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
|
|
24
24
|
var tx_5 = require("cosmjs-types/cosmwasm/wasm/v1/tx");
|
|
25
|
+
var tx_6 = require("@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx");
|
|
25
26
|
var AuthzTxTypes_1 = require("../authz/AuthzTxTypes");
|
|
26
27
|
var ContractTxTypes_1 = require("../contract/ContractTxTypes");
|
|
27
28
|
var FeeGrantTxTypes_1 = require("../feegrant/FeeGrantTxTypes");
|
|
@@ -34,8 +35,8 @@ var types = [
|
|
|
34
35
|
["/cosmos.authz.v1beta1.MsgRevoke", AuthzTxTypes_1.MsgRevoke],
|
|
35
36
|
["/cosmos.bank.v1beta1.MsgSend", tx_1.MsgSend],
|
|
36
37
|
["/cosmos.bank.v1beta1.MsgMultiSend", tx_1.MsgMultiSend],
|
|
37
|
-
["/firmachain.
|
|
38
|
-
["/firmachain.
|
|
38
|
+
["/firmachain.contract.MsgCreateContractFile", ContractTxTypes_1.MsgCreateContractFile],
|
|
39
|
+
["/firmachain.contract.MsgAddContractLog", ContractTxTypes_1.MsgAddContractLog],
|
|
39
40
|
["/cosmwasm.wasm.v1.MsgStoreCode", tx_5.MsgStoreCode],
|
|
40
41
|
["/cosmwasm.wasm.v1.MsgInstantiateContract", tx_5.MsgInstantiateContract],
|
|
41
42
|
["/cosmwasm.wasm.v1.MsgExecuteContract", tx_5.MsgExecuteContract],
|
|
@@ -51,19 +52,20 @@ var types = [
|
|
|
51
52
|
["/cosmos.gov.v1beta1.MsgDeposit", tx_3.MsgDeposit],
|
|
52
53
|
["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_3.MsgSubmitProposal],
|
|
53
54
|
["/cosmos.gov.v1beta1.MsgVote", tx_3.MsgVote],
|
|
55
|
+
["/cosmos.gov.v1.MsgCancelProposal", tx_6.MsgCancelProposal],
|
|
54
56
|
["/ibc.applications.transfer.v1.MsgTransfer", NftTxTypes_1.MsgTransfer],
|
|
55
|
-
["/firmachain.
|
|
56
|
-
["/firmachain.
|
|
57
|
-
["/firmachain.
|
|
57
|
+
["/firmachain.nft.MsgTransfer", NftTxTypes_1.MsgTransfer],
|
|
58
|
+
["/firmachain.nft.MsgMint", NftTxTypes_1.MsgMint],
|
|
59
|
+
["/firmachain.nft.MsgBurn", NftTxTypes_1.MsgBurn],
|
|
58
60
|
["/cosmos.staking.v1beta1.MsgDelegate", tx_4.MsgDelegate],
|
|
59
61
|
["/cosmos.staking.v1beta1.MsgUndelegate", tx_4.MsgUndelegate],
|
|
60
62
|
["/cosmos.staking.v1beta1.MsgBeginRedelegate", tx_4.MsgBeginRedelegate],
|
|
61
63
|
["/cosmos.staking.v1beta1.MsgEditValidator", tx_4.MsgEditValidator],
|
|
62
64
|
["/cosmos.staking.v1beta1.MsgCreateValidator", tx_4.MsgCreateValidator],
|
|
63
|
-
["/firmachain.
|
|
64
|
-
["/firmachain.
|
|
65
|
-
["/firmachain.
|
|
66
|
-
["/firmachain.
|
|
65
|
+
["/firmachain.token.MsgCreateToken", TokenTxTypes_1.MsgCreateToken],
|
|
66
|
+
["/firmachain.token.MsgUpdateTokenURI", TokenTxTypes_1.MsgUpdateTokenURI],
|
|
67
|
+
["/firmachain.token.MsgMint", NftTxTypes_1.MsgMint],
|
|
68
|
+
["/firmachain.token.MsgBurn", NftTxTypes_1.MsgBurn]
|
|
67
69
|
];
|
|
68
70
|
var registry = new proto_signing_1.Registry(types);
|
|
69
71
|
var CommonTxClient = /** @class */ (function (_super) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Registry, EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { SignAndBroadcastOptions } from ".";
|
|
3
3
|
import { SignDoc, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
|
|
4
|
-
import {
|
|
5
|
-
import { BroadcastTxResponse } from "./stargateclient";
|
|
4
|
+
import { DeliverTxResponse } from "@cosmjs/stargate";
|
|
6
5
|
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
7
6
|
export declare class ITxClient {
|
|
8
7
|
private readonly wallet;
|
|
@@ -12,8 +11,9 @@ export declare class ITxClient {
|
|
|
12
11
|
constructor(wallet: FirmaWalletService, serverUrl: string, registry: Registry);
|
|
13
12
|
getRegistry(): Registry;
|
|
14
13
|
sign(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<TxRaw>;
|
|
15
|
-
broadcast(txRaw: TxRaw): Promise<
|
|
16
|
-
broadcastTxBytes(txBytes: Uint8Array): Promise<
|
|
17
|
-
signAndBroadcast(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<
|
|
18
|
-
signDirectForSignDoc(signerAddress: string, signDoc: SignDoc): Promise<
|
|
14
|
+
broadcast(txRaw: TxRaw): Promise<DeliverTxResponse>;
|
|
15
|
+
broadcastTxBytes(txBytes: Uint8Array): Promise<DeliverTxResponse>;
|
|
16
|
+
signAndBroadcast(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<DeliverTxResponse>;
|
|
17
|
+
signDirectForSignDoc(signerAddress: string, signDoc: SignDoc): Promise<DeliverTxResponse>;
|
|
18
|
+
signDirectForSignDocTxRaw(signerAddress: string, signDoc: SignDoc): Promise<TxRaw>;
|
|
19
19
|
}
|
|
@@ -35,10 +35,27 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
38
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
55
|
exports.ITxClient = void 0;
|
|
56
|
+
var encoding_1 = require("@cosmjs/encoding");
|
|
40
57
|
var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
|
|
41
|
-
var
|
|
58
|
+
var stargate_1 = require("@cosmjs/stargate");
|
|
42
59
|
var ITxClient = /** @class */ (function () {
|
|
43
60
|
function ITxClient(wallet, serverUrl, registry) {
|
|
44
61
|
this.wallet = wallet;
|
|
@@ -46,24 +63,41 @@ var ITxClient = /** @class */ (function () {
|
|
|
46
63
|
this.registry = registry;
|
|
47
64
|
this.rawWallet = wallet.getRawWallet();
|
|
48
65
|
}
|
|
49
|
-
ITxClient.prototype.getRegistry = function () {
|
|
66
|
+
ITxClient.prototype.getRegistry = function () {
|
|
67
|
+
return this.registry;
|
|
68
|
+
};
|
|
50
69
|
ITxClient.prototype.sign = function (msgs, _a) {
|
|
51
70
|
var fee = _a.fee, memo = _a.memo;
|
|
52
71
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
var client,
|
|
54
|
-
return __generator(this, function (
|
|
55
|
-
switch (
|
|
72
|
+
var client, _b, account, accountData, chainId, signerData;
|
|
73
|
+
return __generator(this, function (_c) {
|
|
74
|
+
switch (_c.label) {
|
|
56
75
|
case 0:
|
|
57
76
|
if (!this.wallet.isLedger()) return [3 /*break*/, 1];
|
|
58
77
|
return [2 /*return*/, this.wallet.signLedger(msgs, { fee: fee, memo: memo }, this.registry)];
|
|
59
|
-
case 1: return [4 /*yield*/,
|
|
78
|
+
case 1: return [4 /*yield*/, stargate_1.SigningStargateClient.connectWithSigner(this.serverUrl, this.rawWallet, {
|
|
79
|
+
registry: this.registry,
|
|
80
|
+
})];
|
|
60
81
|
case 2:
|
|
61
|
-
client =
|
|
82
|
+
client = _c.sent();
|
|
62
83
|
return [4 /*yield*/, this.rawWallet.getAccounts()];
|
|
63
84
|
case 3:
|
|
64
|
-
|
|
65
|
-
return [4 /*yield*/, client.
|
|
66
|
-
case 4:
|
|
85
|
+
_b = __read.apply(void 0, [_c.sent(), 1]), account = _b[0];
|
|
86
|
+
return [4 /*yield*/, client.getAccount(account.address)];
|
|
87
|
+
case 4:
|
|
88
|
+
accountData = _c.sent();
|
|
89
|
+
return [4 /*yield*/, client.getChainId()];
|
|
90
|
+
case 5:
|
|
91
|
+
chainId = _c.sent();
|
|
92
|
+
if (!accountData)
|
|
93
|
+
throw new Error("Account data not found");
|
|
94
|
+
signerData = {
|
|
95
|
+
accountNumber: accountData.accountNumber,
|
|
96
|
+
sequence: accountData.sequence,
|
|
97
|
+
chainId: chainId,
|
|
98
|
+
};
|
|
99
|
+
return [4 /*yield*/, client.sign(account.address, msgs, fee, memo, signerData)];
|
|
100
|
+
case 6: return [2 /*return*/, _c.sent()];
|
|
67
101
|
}
|
|
68
102
|
});
|
|
69
103
|
});
|
|
@@ -73,7 +107,7 @@ var ITxClient = /** @class */ (function () {
|
|
|
73
107
|
var client, txBytes;
|
|
74
108
|
return __generator(this, function (_a) {
|
|
75
109
|
switch (_a.label) {
|
|
76
|
-
case 0: return [4 /*yield*/,
|
|
110
|
+
case 0: return [4 /*yield*/, stargate_1.StargateClient.connect(this.serverUrl)];
|
|
77
111
|
case 1:
|
|
78
112
|
client = _a.sent();
|
|
79
113
|
txBytes = tx_1.TxRaw.encode(txRaw).finish();
|
|
@@ -88,7 +122,7 @@ var ITxClient = /** @class */ (function () {
|
|
|
88
122
|
var client;
|
|
89
123
|
return __generator(this, function (_a) {
|
|
90
124
|
switch (_a.label) {
|
|
91
|
-
case 0: return [4 /*yield*/,
|
|
125
|
+
case 0: return [4 /*yield*/, stargate_1.StargateClient.connect(this.serverUrl)];
|
|
92
126
|
case 1:
|
|
93
127
|
client = _a.sent();
|
|
94
128
|
return [4 /*yield*/, client.broadcastTx(txBytes)];
|
|
@@ -97,35 +131,59 @@ var ITxClient = /** @class */ (function () {
|
|
|
97
131
|
});
|
|
98
132
|
});
|
|
99
133
|
};
|
|
134
|
+
// sign() → broadcast()
|
|
100
135
|
ITxClient.prototype.signAndBroadcast = function (msgs, _a) {
|
|
101
136
|
var fee = _a.fee, memo = _a.memo;
|
|
102
137
|
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
-
var
|
|
104
|
-
return __generator(this, function (
|
|
105
|
-
switch (
|
|
106
|
-
case 0:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
case 2: return [2 /*return*/,
|
|
138
|
+
var txRaw;
|
|
139
|
+
return __generator(this, function (_b) {
|
|
140
|
+
switch (_b.label) {
|
|
141
|
+
case 0: return [4 /*yield*/, this.sign(msgs, { fee: fee, memo: memo })];
|
|
142
|
+
case 1:
|
|
143
|
+
txRaw = _b.sent();
|
|
144
|
+
return [4 /*yield*/, this.broadcast(txRaw)];
|
|
145
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
111
146
|
}
|
|
112
147
|
});
|
|
113
148
|
});
|
|
114
149
|
};
|
|
115
150
|
ITxClient.prototype.signDirectForSignDoc = function (signerAddress, signDoc) {
|
|
116
151
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
-
var
|
|
152
|
+
var signatureResponse, txRaw;
|
|
118
153
|
return __generator(this, function (_a) {
|
|
119
154
|
switch (_a.label) {
|
|
120
|
-
case 0: return [4 /*yield*/,
|
|
155
|
+
case 0: return [4 /*yield*/, this.rawWallet.signDirect(signerAddress, signDoc)];
|
|
121
156
|
case 1:
|
|
122
|
-
|
|
123
|
-
|
|
157
|
+
signatureResponse = _a.sent();
|
|
158
|
+
txRaw = tx_1.TxRaw.fromPartial({
|
|
159
|
+
bodyBytes: signDoc.bodyBytes,
|
|
160
|
+
authInfoBytes: signDoc.authInfoBytes,
|
|
161
|
+
signatures: [encoding_1.fromBase64(signatureResponse.signature.signature)],
|
|
162
|
+
});
|
|
163
|
+
return [4 /*yield*/, this.broadcast(txRaw)];
|
|
124
164
|
case 2: return [2 /*return*/, _a.sent()];
|
|
125
165
|
}
|
|
126
166
|
});
|
|
127
167
|
});
|
|
128
168
|
};
|
|
169
|
+
ITxClient.prototype.signDirectForSignDocTxRaw = function (signerAddress, signDoc) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
+
var signatureResponse, txRaw;
|
|
172
|
+
return __generator(this, function (_a) {
|
|
173
|
+
switch (_a.label) {
|
|
174
|
+
case 0: return [4 /*yield*/, this.rawWallet.signDirect(signerAddress, signDoc)];
|
|
175
|
+
case 1:
|
|
176
|
+
signatureResponse = _a.sent();
|
|
177
|
+
txRaw = tx_1.TxRaw.fromPartial({
|
|
178
|
+
bodyBytes: signDoc.bodyBytes,
|
|
179
|
+
authInfoBytes: signDoc.authInfoBytes,
|
|
180
|
+
signatures: [encoding_1.fromBase64(signatureResponse.signature.signature)],
|
|
181
|
+
});
|
|
182
|
+
return [2 /*return*/, txRaw];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
};
|
|
129
187
|
return ITxClient;
|
|
130
188
|
}());
|
|
131
189
|
exports.ITxClient = ITxClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CometClient } from "@cosmjs/tendermint-rpc";
|
|
2
|
+
import { StargateClient, StargateClientOptions } from "./stargateclient";
|
|
2
3
|
import { Account } from "./accounts";
|
|
3
|
-
import { StargateClient } from "./stargateclient";
|
|
4
4
|
export interface SignerData {
|
|
5
5
|
readonly account_number: string;
|
|
6
6
|
readonly sequence: string;
|
|
@@ -14,14 +14,9 @@ export declare class LedgerSigningStargateClient extends StargateClient {
|
|
|
14
14
|
private chainId;
|
|
15
15
|
private static _endpoint;
|
|
16
16
|
static connectWithSigner(endpoint: string): Promise<LedgerSigningStargateClient>;
|
|
17
|
-
protected constructor(
|
|
17
|
+
protected constructor(cometClient: CometClient, options: StargateClientOptions);
|
|
18
18
|
getSignerData(address: string): Promise<SignerData>;
|
|
19
19
|
getChainId(): Promise<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Takes a bech32 encoded address and returns the data part. The prefix is ignored and discarded.
|
|
22
|
-
* This is called AccAddress in Cosmos SDK, which is basically an alias for raw binary data.
|
|
23
|
-
* The result is typically 20 bytes long but not restricted to that.
|
|
24
|
-
*/
|
|
25
20
|
private toAccAddress;
|
|
26
|
-
getAccount(address: string): Promise<Account |
|
|
21
|
+
getAccount(address: string): Promise<Account | null>;
|
|
27
22
|
}
|
|
@@ -57,26 +57,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
57
57
|
exports.LedgerSigningStargateClient = void 0;
|
|
58
58
|
var encoding_1 = require("@cosmjs/encoding");
|
|
59
59
|
var tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
|
|
60
|
-
var accounts_1 = require("./accounts");
|
|
61
60
|
var stargateclient_1 = require("./stargateclient");
|
|
61
|
+
var accounts_1 = require("./accounts");
|
|
62
62
|
var axios_1 = __importDefault(require("axios"));
|
|
63
63
|
var any_1 = require("../google/protobuf/any");
|
|
64
64
|
var LedgerSigningStargateClient = /** @class */ (function (_super) {
|
|
65
65
|
__extends(LedgerSigningStargateClient, _super);
|
|
66
|
-
function LedgerSigningStargateClient(
|
|
67
|
-
return _super.call(this,
|
|
66
|
+
function LedgerSigningStargateClient(cometClient, options) {
|
|
67
|
+
return _super.call(this, cometClient, options) || this;
|
|
68
68
|
}
|
|
69
69
|
LedgerSigningStargateClient.connectWithSigner = function (endpoint) {
|
|
70
70
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var
|
|
71
|
+
var tempCometClient;
|
|
72
72
|
return __generator(this, function (_a) {
|
|
73
73
|
switch (_a.label) {
|
|
74
74
|
case 0:
|
|
75
|
-
|
|
76
|
-
return [4 /*yield*/, tendermint_rpc_1.
|
|
75
|
+
LedgerSigningStargateClient._endpoint = endpoint;
|
|
76
|
+
return [4 /*yield*/, tendermint_rpc_1.connectComet(endpoint)];
|
|
77
77
|
case 1:
|
|
78
|
-
|
|
79
|
-
return [2 /*return*/, new LedgerSigningStargateClient(
|
|
78
|
+
tempCometClient = _a.sent();
|
|
79
|
+
return [2 /*return*/, new LedgerSigningStargateClient(tempCometClient, {})];
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
});
|
|
@@ -92,24 +92,28 @@ var LedgerSigningStargateClient = /** @class */ (function (_super) {
|
|
|
92
92
|
return [4 /*yield*/, this.getAccount(address)];
|
|
93
93
|
case 2:
|
|
94
94
|
account = _a.sent();
|
|
95
|
-
if (account
|
|
96
|
-
throw new Error("
|
|
97
|
-
return [2 /*return*/, {
|
|
95
|
+
if (!account)
|
|
96
|
+
throw new Error("Account not found");
|
|
97
|
+
return [2 /*return*/, {
|
|
98
|
+
account_number: account.accountNumber.toString(),
|
|
99
|
+
sequence: account.sequence.toString(),
|
|
100
|
+
chain_id: chainID,
|
|
101
|
+
}];
|
|
98
102
|
}
|
|
99
103
|
});
|
|
100
104
|
});
|
|
101
105
|
};
|
|
102
106
|
LedgerSigningStargateClient.prototype.getChainId = function () {
|
|
103
107
|
return __awaiter(this, void 0, void 0, function () {
|
|
104
|
-
var
|
|
108
|
+
var status_1, chainId;
|
|
105
109
|
return __generator(this, function (_a) {
|
|
106
110
|
switch (_a.label) {
|
|
107
111
|
case 0:
|
|
108
112
|
if (!!this.chainId) return [3 /*break*/, 2];
|
|
109
|
-
return [4 /*yield*/, this.
|
|
113
|
+
return [4 /*yield*/, this.forceGetCometClient().status()];
|
|
110
114
|
case 1:
|
|
111
|
-
|
|
112
|
-
chainId =
|
|
115
|
+
status_1 = _a.sent();
|
|
116
|
+
chainId = status_1.nodeInfo.network;
|
|
113
117
|
if (!chainId)
|
|
114
118
|
throw new Error("Chain ID must not be empty");
|
|
115
119
|
this.chainId = chainId;
|
|
@@ -119,17 +123,12 @@ var LedgerSigningStargateClient = /** @class */ (function (_super) {
|
|
|
119
123
|
});
|
|
120
124
|
});
|
|
121
125
|
};
|
|
122
|
-
/**
|
|
123
|
-
* Takes a bech32 encoded address and returns the data part. The prefix is ignored and discarded.
|
|
124
|
-
* This is called AccAddress in Cosmos SDK, which is basically an alias for raw binary data.
|
|
125
|
-
* The result is typically 20 bytes long but not restricted to that.
|
|
126
|
-
*/
|
|
127
126
|
LedgerSigningStargateClient.prototype.toAccAddress = function (address) {
|
|
128
|
-
return encoding_1.
|
|
127
|
+
return encoding_1.fromBech32(address).data;
|
|
129
128
|
};
|
|
130
129
|
LedgerSigningStargateClient.prototype.getAccount = function (address) {
|
|
131
130
|
return __awaiter(this, void 0, void 0, function () {
|
|
132
|
-
var accAddress, hexAccAddress, axios, path,
|
|
131
|
+
var accAddress, hexAccAddress, axios, path, params, response, base64Value, decoded, account, finalAccount, error_1;
|
|
133
132
|
return __generator(this, function (_a) {
|
|
134
133
|
switch (_a.label) {
|
|
135
134
|
case 0:
|
|
@@ -138,22 +137,28 @@ var LedgerSigningStargateClient = /** @class */ (function (_super) {
|
|
|
138
137
|
hexAccAddress = "0x01" + Buffer.from(accAddress).toString("hex");
|
|
139
138
|
axios = axios_1.default.create({
|
|
140
139
|
baseURL: LedgerSigningStargateClient._endpoint,
|
|
141
|
-
headers: {
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
timeout: 15000
|
|
140
|
+
headers: { Accept: "application/json" },
|
|
141
|
+
timeout: 15000,
|
|
145
142
|
});
|
|
146
|
-
path = "/abci_query
|
|
147
|
-
|
|
143
|
+
path = "/abci_query";
|
|
144
|
+
params = {
|
|
145
|
+
path: "/store/auth/key",
|
|
146
|
+
data: hexAccAddress,
|
|
147
|
+
};
|
|
148
|
+
return [4 /*yield*/, axios.get(path, { params: params })];
|
|
148
149
|
case 1:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
response = _a.sent();
|
|
151
|
+
base64Value = response.data.result.response.value;
|
|
152
|
+
if (!base64Value)
|
|
153
|
+
return [2 /*return*/, null];
|
|
154
|
+
decoded = Buffer.from(base64Value, "base64");
|
|
155
|
+
account = any_1.Any.decode(decoded);
|
|
152
156
|
finalAccount = accounts_1.accountFromAny(account);
|
|
153
157
|
return [2 /*return*/, finalAccount];
|
|
154
158
|
case 2:
|
|
155
159
|
error_1 = _a.sent();
|
|
156
|
-
|
|
160
|
+
console.error("getAccount error:", error_1);
|
|
161
|
+
return [2 /*return*/, null];
|
|
157
162
|
case 3: return [2 /*return*/];
|
|
158
163
|
}
|
|
159
164
|
});
|
|
@@ -56,17 +56,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
56
56
|
to[j] = from[i];
|
|
57
57
|
return to;
|
|
58
58
|
};
|
|
59
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
60
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
61
|
-
};
|
|
62
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
60
|
exports.signFromLedger = void 0;
|
|
64
61
|
var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
65
62
|
var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
|
|
66
|
-
var long_1 = __importDefault(require("long"));
|
|
67
63
|
var math_1 = require("@cosmjs/math");
|
|
68
64
|
var encoding_1 = require("@cosmjs/encoding");
|
|
69
|
-
var aminotypes_1 = require("../amino/aminotypes");
|
|
70
65
|
var signdoc_1 = require("../amino/signdoc");
|
|
71
66
|
var encoding_2 = require("../amino/encoding");
|
|
72
67
|
var signdoc_2 = require("../amino/signdoc");
|
|
@@ -74,6 +69,7 @@ var encoding_3 = require("@cosmjs/encoding");
|
|
|
74
69
|
var signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
|
|
75
70
|
var tx_2 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
|
|
76
71
|
var FirmaUtil_1 = require("../../FirmaUtil");
|
|
72
|
+
var stargate_1 = require("@cosmjs/stargate");
|
|
77
73
|
function makeSignerInfos(signers, signMode) {
|
|
78
74
|
return signers.map(function (_a) {
|
|
79
75
|
var pubkey = _a.pubkey, sequence = _a.sequence;
|
|
@@ -82,7 +78,7 @@ function makeSignerInfos(signers, signMode) {
|
|
|
82
78
|
modeInfo: {
|
|
83
79
|
single: { mode: signMode },
|
|
84
80
|
},
|
|
85
|
-
sequence:
|
|
81
|
+
sequence: BigInt(sequence),
|
|
86
82
|
});
|
|
87
83
|
});
|
|
88
84
|
}
|
|
@@ -92,7 +88,7 @@ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
|
|
|
92
88
|
signerInfos: makeSignerInfos(signers, signMode),
|
|
93
89
|
fee: {
|
|
94
90
|
amount: __spreadArray([], __read(feeAmount)),
|
|
95
|
-
gasLimit:
|
|
91
|
+
gasLimit: BigInt(gasLimit),
|
|
96
92
|
granter: granter,
|
|
97
93
|
},
|
|
98
94
|
};
|
|
@@ -110,7 +106,7 @@ function signFromLedger(ledger, messages, option, registry) {
|
|
|
110
106
|
case 2:
|
|
111
107
|
signerData = _b.sent();
|
|
112
108
|
pubkey = proto_signing_1.encodePubkey(encoding_2.encodeSecp256k1Pubkey(publicKey));
|
|
113
|
-
aminoTypes = new
|
|
109
|
+
aminoTypes = new stargate_1.AminoTypes({});
|
|
114
110
|
msgs = messages.map(function (msg) { return aminoTypes.toAmino(msg); });
|
|
115
111
|
chainId = signerData.chain_id;
|
|
116
112
|
accountNumber = Number.parseInt(signerData.account_number);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="long" />
|
|
2
1
|
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
|
|
3
2
|
import { Any } from "../google/protobuf/any";
|
|
4
3
|
export interface StdFee {
|
|
@@ -81,7 +80,7 @@ export interface ParamChangeOption {
|
|
|
81
80
|
export interface SoftwareUpgradePlan {
|
|
82
81
|
name: string;
|
|
83
82
|
time?: Date;
|
|
84
|
-
height?:
|
|
83
|
+
height?: bigint;
|
|
85
84
|
info?: string;
|
|
86
85
|
upgradedClientState?: Any;
|
|
87
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pubkey } from "@cosmjs/amino";
|
|
2
|
-
import { Any } from "
|
|
2
|
+
import { Any } from "cosmjs-types/google/protobuf/any";
|
|
3
3
|
export interface Account {
|
|
4
4
|
/** Bech32 account address */
|
|
5
5
|
readonly address: string;
|
|
@@ -8,8 +8,12 @@ export interface Account {
|
|
|
8
8
|
readonly sequence: number;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* `Account` information from it.
|
|
11
|
+
* Represents a generic function that takes an `Any` encoded account from the chain
|
|
12
|
+
* and extracts some common `Account` information from it.
|
|
13
|
+
*/
|
|
14
|
+
export declare type AccountParser = (any: Any) => Account;
|
|
15
|
+
/**
|
|
16
|
+
* Basic implementation of AccountParser. This is supposed to support the most relevant
|
|
13
17
|
* common Cosmos SDK account types. If you need support for exotic account types,
|
|
14
18
|
* you'll need to write your own account decoder.
|
|
15
19
|
*/
|