@firmachain/firma-js 0.2.31 → 0.2.34
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 +13 -4
- package/dist/sdk/FirmaAuthzService.js +29 -26
- package/dist/sdk/FirmaBankService.js +2 -2
- package/dist/sdk/FirmaContractService.js +14 -16
- package/dist/sdk/FirmaCosmWasmService.js +27 -29
- package/dist/sdk/FirmaDistributionService.js +10 -10
- package/dist/sdk/FirmaFeeGrantService.js +6 -6
- package/dist/sdk/FirmaGovService.js +26 -26
- package/dist/sdk/FirmaIbcService.d.ts +15 -0
- package/dist/sdk/FirmaIbcService.js +144 -0
- package/dist/sdk/FirmaIpfsService.js +1 -1
- package/dist/sdk/FirmaNftService.js +9 -9
- package/dist/sdk/FirmaSDK.d.ts +3 -1
- package/dist/sdk/FirmaSDK.js +4 -1
- package/dist/sdk/FirmaStakingService.d.ts +17 -5
- package/dist/sdk/FirmaStakingService.js +22 -18
- package/dist/sdk/FirmaTokenService.js +16 -16
- package/dist/sdk/FirmaUtil.d.ts +19 -1
- package/dist/sdk/FirmaUtil.js +198 -3
- package/dist/sdk/FirmaWalletService.d.ts +3 -0
- package/dist/sdk/FirmaWalletService.js +21 -13
- package/dist/sdk/firmachain/amino/addresses.js +11 -11
- package/dist/sdk/firmachain/amino/aminotypes.js +36 -32
- package/dist/sdk/firmachain/amino/encoding.js +30 -26
- package/dist/sdk/firmachain/amino/multisig.js +5 -5
- package/dist/sdk/firmachain/amino/signature.js +4 -4
- package/dist/sdk/firmachain/amino/signdoc.js +1 -1
- package/dist/sdk/firmachain/amino/signer.d.ts +1 -2
- package/dist/sdk/firmachain/amino/wallet.js +14 -10
- package/dist/sdk/firmachain/authz/AuthzQueryClient.d.ts +13 -3
- package/dist/sdk/firmachain/authz/AuthzQueryClient.js +42 -15
- package/dist/sdk/firmachain/authz/AuthzTxClient.d.ts +5 -4
- package/dist/sdk/firmachain/authz/AuthzTxClient.js +6 -3
- package/dist/sdk/firmachain/authz/index.js +5 -1
- package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
- package/dist/sdk/firmachain/bank/BankTxClient.d.ts +4 -3
- package/dist/sdk/firmachain/bank/BankTxClient.js +5 -2
- package/dist/sdk/firmachain/bank/index.js +5 -1
- package/dist/sdk/firmachain/common/CommonTxClient.d.ts +7 -0
- package/dist/sdk/firmachain/common/CommonTxClient.js +79 -0
- package/dist/sdk/firmachain/common/ITxClient.d.ts +3 -3
- package/dist/sdk/firmachain/common/ITxClient.js +14 -8
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +2 -2
- package/dist/sdk/firmachain/common/LedgerWallet.js +14 -10
- package/dist/sdk/firmachain/common/accounts.js +2 -2
- package/dist/sdk/firmachain/common/index.js +5 -1
- package/dist/sdk/firmachain/common/signing.js +9 -5
- package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +50 -0
- package/dist/sdk/firmachain/common/signingaminostargateclient.js +267 -0
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +15 -8
- package/dist/sdk/firmachain/common/signingstargateclient.js +82 -19
- package/dist/sdk/firmachain/common/stargateclient.js +6 -6
- package/dist/sdk/firmachain/contract/ContractQueryClient.js +2 -2
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +4 -3
- package/dist/sdk/firmachain/contract/ContractTxClient.js +5 -2
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +4 -4
- package/dist/sdk/firmachain/contract/index.js +5 -1
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +7 -7
- package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.d.ts +8 -7
- package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.js +9 -6
- package/dist/sdk/firmachain/cosmwasm/index.js +5 -1
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +5 -5
- package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +6 -5
- package/dist/sdk/firmachain/distribution/DistributionTxClient.js +7 -4
- package/dist/sdk/firmachain/distribution/index.js +5 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +2 -2
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +4 -3
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +5 -2
- package/dist/sdk/firmachain/feegrant/index.js +5 -1
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +1 -1
- package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +27 -27
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +1 -1
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +1 -1
- package/dist/sdk/firmachain/gov/GovQueryClient.js +2 -2
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +5 -4
- package/dist/sdk/firmachain/gov/GovTxClient.js +6 -3
- package/dist/sdk/firmachain/gov/index.js +5 -1
- package/dist/sdk/firmachain/ibc/IbcQueryClient.d.ts +34 -0
- package/dist/sdk/firmachain/ibc/IbcQueryClient.js +71 -0
- package/dist/sdk/firmachain/ibc/IbcTxClient.d.ts +13 -0
- package/dist/sdk/firmachain/ibc/IbcTxClient.js +39 -0
- package/dist/sdk/firmachain/ibc/index.d.ts +3 -0
- package/dist/sdk/firmachain/ibc/index.js +19 -0
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +5 -4
- package/dist/sdk/firmachain/nft/NftTxClient.js +6 -3
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +6 -6
- package/dist/sdk/firmachain/nft/index.js +5 -1
- package/dist/sdk/firmachain/slashing/index.js +5 -1
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +17 -4
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +44 -24
- package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +7 -6
- package/dist/sdk/firmachain/staking/StakingTxClient.js +8 -5
- package/dist/sdk/firmachain/staking/index.js +5 -1
- package/dist/sdk/firmachain/token/TokenTxClient.d.ts +6 -5
- package/dist/sdk/firmachain/token/TokenTxClient.js +7 -4
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +8 -8
- package/dist/sdk/firmachain/token/index.js +5 -1
- package/package.json +2 -3
- package/dist/sdk/firmachain/amino/secp256k1hdwallet.d.ts +0 -94
- package/dist/sdk/firmachain/amino/secp256k1hdwallet.js +0 -437
- package/dist/sdk/firmachain/amino/secp256k1wallet.d.ts +0 -23
- package/dist/sdk/firmachain/amino/secp256k1wallet.js +0 -141
|
@@ -52,40 +52,59 @@ var AuthzQueryClient = /** @class */ (function () {
|
|
|
52
52
|
timeout: 15000,
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
AuthzQueryClient.prototype.getSendGrantData = function (granterAddress, granteeAddress) {
|
|
55
|
+
AuthzQueryClient.prototype.getSendGrantData = function (granterAddress, granteeAddress, paginationKey) {
|
|
56
|
+
if (paginationKey === void 0) { paginationKey = ""; }
|
|
56
57
|
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var msgType, path, result;
|
|
58
|
+
var msgType, path, result, convertPagination;
|
|
58
59
|
return __generator(this, function (_a) {
|
|
59
60
|
switch (_a.label) {
|
|
60
61
|
case 0:
|
|
61
62
|
msgType = "/cosmos.bank.v1beta1.MsgSend";
|
|
62
|
-
path = "/cosmos/authz/v1beta1/grants?granter="
|
|
63
|
-
return [4 /*yield*/, this.axios.get(path)];
|
|
63
|
+
path = "/cosmos/authz/v1beta1/grants?granter=".concat(granterAddress, "&grantee=").concat(granteeAddress, "&msg_type_url=").concat(msgType);
|
|
64
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
64
65
|
case 1:
|
|
65
66
|
result = _a.sent();
|
|
66
|
-
|
|
67
|
+
convertPagination = {
|
|
68
|
+
next_key: "",
|
|
69
|
+
total: result.data.grants.length
|
|
70
|
+
};
|
|
71
|
+
if (result.data.pagination != null) {
|
|
72
|
+
convertPagination.next_key = result.data.pagination.next_key;
|
|
73
|
+
convertPagination.total = Number.parseInt(result.data.pagination.total);
|
|
74
|
+
}
|
|
75
|
+
return [2 /*return*/, { dataList: result.data.grants, pagination: convertPagination }];
|
|
67
76
|
}
|
|
68
77
|
});
|
|
69
78
|
});
|
|
70
79
|
};
|
|
71
|
-
AuthzQueryClient.prototype.getGenericGrantData = function (granterAddress, granteeAddress, msgType) {
|
|
80
|
+
AuthzQueryClient.prototype.getGenericGrantData = function (granterAddress, granteeAddress, msgType, paginationKey) {
|
|
81
|
+
if (paginationKey === void 0) { paginationKey = ""; }
|
|
72
82
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var path, result;
|
|
83
|
+
var path, result, convertPagination;
|
|
74
84
|
return __generator(this, function (_a) {
|
|
75
85
|
switch (_a.label) {
|
|
76
86
|
case 0:
|
|
77
|
-
path = "/cosmos/authz/v1beta1/grants?granter="
|
|
78
|
-
return [4 /*yield*/, this.axios.get(path)];
|
|
87
|
+
path = "/cosmos/authz/v1beta1/grants?granter=".concat(granterAddress, "&grantee=").concat(granteeAddress, "&msg_type_url=").concat(msgType);
|
|
88
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
79
89
|
case 1:
|
|
80
90
|
result = _a.sent();
|
|
81
|
-
|
|
91
|
+
convertPagination = {
|
|
92
|
+
next_key: "",
|
|
93
|
+
total: result.data.grants.length
|
|
94
|
+
};
|
|
95
|
+
if (result.data.pagination != null) {
|
|
96
|
+
convertPagination.next_key = result.data.pagination.next_key;
|
|
97
|
+
convertPagination.total = Number.parseInt(result.data.pagination.total);
|
|
98
|
+
}
|
|
99
|
+
return [2 /*return*/, { dataList: result.data.grants, pagination: convertPagination }];
|
|
82
100
|
}
|
|
83
101
|
});
|
|
84
102
|
});
|
|
85
103
|
};
|
|
86
|
-
AuthzQueryClient.prototype.getStakingGrantData = function (granterAddress, granteeAddress, type) {
|
|
104
|
+
AuthzQueryClient.prototype.getStakingGrantData = function (granterAddress, granteeAddress, type, paginationKey) {
|
|
105
|
+
if (paginationKey === void 0) { paginationKey = ""; }
|
|
87
106
|
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
-
var msgType, path, result;
|
|
107
|
+
var msgType, path, result, convertPagination;
|
|
89
108
|
return __generator(this, function (_a) {
|
|
90
109
|
switch (_a.label) {
|
|
91
110
|
case 0:
|
|
@@ -101,11 +120,19 @@ var AuthzQueryClient = /** @class */ (function () {
|
|
|
101
120
|
msgType = "/cosmos.staking.v1beta1.MsgBeginRedelegate";
|
|
102
121
|
break;
|
|
103
122
|
}
|
|
104
|
-
path = "/cosmos/authz/v1beta1/grants?granter="
|
|
105
|
-
return [4 /*yield*/, this.axios.get(path)];
|
|
123
|
+
path = "/cosmos/authz/v1beta1/grants?granter=".concat(granterAddress, "&grantee=").concat(granteeAddress, "&msg_type_url=").concat(msgType);
|
|
124
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
106
125
|
case 1:
|
|
107
126
|
result = _a.sent();
|
|
108
|
-
|
|
127
|
+
convertPagination = {
|
|
128
|
+
next_key: "",
|
|
129
|
+
total: result.data.grants.length
|
|
130
|
+
};
|
|
131
|
+
if (result.data.pagination != null) {
|
|
132
|
+
convertPagination.next_key = result.data.pagination.next_key;
|
|
133
|
+
convertPagination.total = Number.parseInt(result.data.pagination.total);
|
|
134
|
+
}
|
|
135
|
+
return [2 /*return*/, { dataList: result.data.grants, pagination: convertPagination }];
|
|
109
136
|
}
|
|
110
137
|
});
|
|
111
138
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EncodeObject } from "@cosmjs/proto-signing";
|
|
1
|
+
import { Registry, EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgExec, MsgGrant, MsgRevoke } from "./AuthzTxTypes";
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
4
|
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
@@ -16,7 +16,8 @@ export interface MsgRevokeAllowanceEncodeObject extends EncodeObject {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class AuthzTxClient extends ITxClient {
|
|
18
18
|
constructor(wallet: FirmaWalletService, serverUrl: string);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
static getRegistry(): Registry;
|
|
20
|
+
static msgExecAllowance(data: MsgExec): MsgExecAllowanceEncodeObject;
|
|
21
|
+
static msgGrantAllowance(data: MsgGrant): MsgGrantAllowanceEncodeObject;
|
|
22
|
+
static msgRevokeAllowance(data: MsgRevoke): MsgRevokeAllowanceEncodeObject;
|
|
22
23
|
}
|
|
@@ -30,13 +30,16 @@ var AuthzTxClient = /** @class */ (function (_super) {
|
|
|
30
30
|
function AuthzTxClient(wallet, serverUrl) {
|
|
31
31
|
return _super.call(this, wallet, serverUrl, registry) || this;
|
|
32
32
|
}
|
|
33
|
-
AuthzTxClient.
|
|
33
|
+
AuthzTxClient.getRegistry = function () {
|
|
34
|
+
return registry;
|
|
35
|
+
};
|
|
36
|
+
AuthzTxClient.msgExecAllowance = function (data) {
|
|
34
37
|
return { typeUrl: "/cosmos.authz.v1beta1.MsgExec", value: data };
|
|
35
38
|
};
|
|
36
|
-
AuthzTxClient.
|
|
39
|
+
AuthzTxClient.msgGrantAllowance = function (data) {
|
|
37
40
|
return { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", value: data };
|
|
38
41
|
};
|
|
39
|
-
AuthzTxClient.
|
|
42
|
+
AuthzTxClient.msgRevokeAllowance = function (data) {
|
|
40
43
|
return { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: data };
|
|
41
44
|
};
|
|
42
45
|
return AuthzTxClient;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -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/"
|
|
60
|
+
path = "/cosmos/bank/v1beta1/supply/".concat(denom);
|
|
61
61
|
return [4 /*yield*/, this.axios.get(path)];
|
|
62
62
|
case 1:
|
|
63
63
|
result = _a.sent();
|
|
@@ -72,7 +72,7 @@ var BankQueryClient = /** @class */ (function () {
|
|
|
72
72
|
return __generator(this, function (_a) {
|
|
73
73
|
switch (_a.label) {
|
|
74
74
|
case 0:
|
|
75
|
-
path = "/cosmos/bank/v1beta1/balances/"
|
|
75
|
+
path = "/cosmos/bank/v1beta1/balances/".concat(address, "/by_denom?denom=").concat(denom);
|
|
76
76
|
return [4 /*yield*/, this.axios.get(path)];
|
|
77
77
|
case 1:
|
|
78
78
|
result = _a.sent();
|
|
@@ -87,7 +87,7 @@ var BankQueryClient = /** @class */ (function () {
|
|
|
87
87
|
return __generator(this, function (_a) {
|
|
88
88
|
switch (_a.label) {
|
|
89
89
|
case 0:
|
|
90
|
-
path = "/cosmos/bank/v1beta1/balances/"
|
|
90
|
+
path = "/cosmos/bank/v1beta1/balances/".concat(address);
|
|
91
91
|
return [4 /*yield*/, this.axios.get(path)];
|
|
92
92
|
case 1:
|
|
93
93
|
result = _a.sent();
|
|
@@ -102,7 +102,7 @@ var BankQueryClient = /** @class */ (function () {
|
|
|
102
102
|
return __generator(this, function (_a) {
|
|
103
103
|
switch (_a.label) {
|
|
104
104
|
case 0:
|
|
105
|
-
path = "/cosmos/bank/v1beta1/balances/"
|
|
105
|
+
path = "/cosmos/bank/v1beta1/balances/".concat(address, "/by_denom?denom=").concat(denom);
|
|
106
106
|
return [4 /*yield*/, this.axios.get(path)];
|
|
107
107
|
case 1:
|
|
108
108
|
result = _a.sent();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EncodeObject } from "@cosmjs/proto-signing";
|
|
1
|
+
import { Registry, EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgSend, MsgMultiSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
|
|
3
3
|
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
4
4
|
import { ITxClient } from "../common/ITxClient";
|
|
@@ -12,6 +12,7 @@ export interface MsgMultiSendEncodeObject extends EncodeObject {
|
|
|
12
12
|
}
|
|
13
13
|
export declare class BankTxClient extends ITxClient {
|
|
14
14
|
constructor(wallet: FirmaWalletService, address: string);
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
static getRegistry(): Registry;
|
|
16
|
+
static msgSend(data: MsgSend): MsgSendEncodeObject;
|
|
17
|
+
static msgMultiSend(data: MsgMultiSend): MsgMultiSendEncodeObject;
|
|
17
18
|
}
|
|
@@ -29,10 +29,13 @@ var BankTxClient = /** @class */ (function (_super) {
|
|
|
29
29
|
function BankTxClient(wallet, address) {
|
|
30
30
|
return _super.call(this, wallet, address, registry) || this;
|
|
31
31
|
}
|
|
32
|
-
BankTxClient.
|
|
32
|
+
BankTxClient.getRegistry = function () {
|
|
33
|
+
return registry;
|
|
34
|
+
};
|
|
35
|
+
BankTxClient.msgSend = function (data) {
|
|
33
36
|
return { typeUrl: "/cosmos.bank.v1beta1.MsgSend", value: data };
|
|
34
37
|
};
|
|
35
|
-
BankTxClient.
|
|
38
|
+
BankTxClient.msgMultiSend = function (data) {
|
|
36
39
|
return { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: data };
|
|
37
40
|
};
|
|
38
41
|
return BankTxClient;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Registry } from "@cosmjs/proto-signing";
|
|
2
|
+
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
3
|
+
import { ITxClient } from "./ITxClient";
|
|
4
|
+
export declare class CommonTxClient extends ITxClient {
|
|
5
|
+
constructor(wallet: FirmaWalletService, address: string);
|
|
6
|
+
static getRegistry(): Registry;
|
|
7
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.CommonTxClient = void 0;
|
|
19
|
+
var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
20
|
+
var tx_1 = require("cosmjs-types/cosmos/bank/v1beta1/tx");
|
|
21
|
+
var tx_2 = require("cosmjs-types/cosmos/distribution/v1beta1/tx");
|
|
22
|
+
var tx_3 = require("cosmjs-types/cosmos/gov/v1beta1/tx");
|
|
23
|
+
var tx_4 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
|
|
24
|
+
var tx_5 = require("cosmjs-types/cosmwasm/wasm/v1/tx");
|
|
25
|
+
var AuthzTxTypes_1 = require("../authz/AuthzTxTypes");
|
|
26
|
+
var ContractTxTypes_1 = require("../contract/ContractTxTypes");
|
|
27
|
+
var FeeGrantTxTypes_1 = require("../feegrant/FeeGrantTxTypes");
|
|
28
|
+
var NftTxTypes_1 = require("../nft/NftTxTypes");
|
|
29
|
+
var TokenTxTypes_1 = require("../token/TokenTxTypes");
|
|
30
|
+
var ITxClient_1 = require("./ITxClient");
|
|
31
|
+
var types = [
|
|
32
|
+
["/cosmos.authz.v1beta1.MsgExec", AuthzTxTypes_1.MsgExec],
|
|
33
|
+
["/cosmos.authz.v1beta1.MsgGrant", AuthzTxTypes_1.MsgGrant],
|
|
34
|
+
["/cosmos.authz.v1beta1.MsgRevoke", AuthzTxTypes_1.MsgRevoke],
|
|
35
|
+
["/cosmos.bank.v1beta1.MsgSend", tx_1.MsgSend],
|
|
36
|
+
["/cosmos.bank.v1beta1.MsgMultiSend", tx_1.MsgMultiSend],
|
|
37
|
+
["/firmachain.firmachain.contract.MsgCreateContractFile", ContractTxTypes_1.MsgCreateContractFile],
|
|
38
|
+
["/firmachain.firmachain.contract.MsgAddContractLog", ContractTxTypes_1.MsgAddContractLog],
|
|
39
|
+
["/cosmwasm.wasm.v1.MsgStoreCode", tx_5.MsgStoreCode],
|
|
40
|
+
["/cosmwasm.wasm.v1.MsgInstantiateContract", tx_5.MsgInstantiateContract],
|
|
41
|
+
["/cosmwasm.wasm.v1.MsgExecuteContract", tx_5.MsgExecuteContract],
|
|
42
|
+
["/cosmwasm.wasm.v1.MsgUpdateAdmin", tx_5.MsgUpdateAdmin],
|
|
43
|
+
["/cosmwasm.wasm.v1.MsgClearAdmin", tx_5.MsgClearAdmin],
|
|
44
|
+
["/cosmwasm.wasm.v1.MsgMigrateContract", tx_5.MsgMigrateContract],
|
|
45
|
+
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", tx_2.MsgFundCommunityPool],
|
|
46
|
+
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", tx_2.MsgSetWithdrawAddress],
|
|
47
|
+
["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", tx_2.MsgWithdrawDelegatorReward],
|
|
48
|
+
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", tx_2.MsgWithdrawValidatorCommission],
|
|
49
|
+
["/cosmos.feegrant.v1beta1.MsgGrantAllowance", FeeGrantTxTypes_1.MsgGrantAllowance],
|
|
50
|
+
["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", FeeGrantTxTypes_1.MsgRevokeAllowance],
|
|
51
|
+
["/cosmos.gov.v1beta1.MsgDeposit", tx_3.MsgDeposit],
|
|
52
|
+
["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_3.MsgSubmitProposal],
|
|
53
|
+
["/cosmos.gov.v1beta1.MsgVote", tx_3.MsgVote],
|
|
54
|
+
["/ibc.applications.transfer.v1.MsgTransfer", NftTxTypes_1.MsgTransfer],
|
|
55
|
+
["/firmachain.firmachain.nft.MsgTransfer", NftTxTypes_1.MsgTransfer],
|
|
56
|
+
["/firmachain.firmachain.nft.MsgMint", NftTxTypes_1.MsgMint],
|
|
57
|
+
["/firmachain.firmachain.nft.MsgBurn", NftTxTypes_1.MsgBurn],
|
|
58
|
+
["/cosmos.staking.v1beta1.MsgDelegate", tx_4.MsgDelegate],
|
|
59
|
+
["/cosmos.staking.v1beta1.MsgUndelegate", tx_4.MsgUndelegate],
|
|
60
|
+
["/cosmos.staking.v1beta1.MsgBeginRedelegate", tx_4.MsgBeginRedelegate],
|
|
61
|
+
["/cosmos.staking.v1beta1.MsgEditValidator", tx_4.MsgEditValidator],
|
|
62
|
+
["/cosmos.staking.v1beta1.MsgCreateValidator", tx_4.MsgCreateValidator],
|
|
63
|
+
["/firmachain.firmachain.token.MsgCreateToken", TokenTxTypes_1.MsgCreateToken],
|
|
64
|
+
["/firmachain.firmachain.token.MsgUpdateTokenURI", TokenTxTypes_1.MsgUpdateTokenURI],
|
|
65
|
+
["/firmachain.firmachain.token.MsgMint", NftTxTypes_1.MsgMint],
|
|
66
|
+
["/firmachain.firmachain.token.MsgBurn", NftTxTypes_1.MsgBurn]
|
|
67
|
+
];
|
|
68
|
+
var registry = new proto_signing_1.Registry(types);
|
|
69
|
+
var CommonTxClient = /** @class */ (function (_super) {
|
|
70
|
+
__extends(CommonTxClient, _super);
|
|
71
|
+
function CommonTxClient(wallet, address) {
|
|
72
|
+
return _super.call(this, wallet, address, registry) || this;
|
|
73
|
+
}
|
|
74
|
+
CommonTxClient.getRegistry = function () {
|
|
75
|
+
return registry;
|
|
76
|
+
};
|
|
77
|
+
return CommonTxClient;
|
|
78
|
+
}(ITxClient_1.ITxClient));
|
|
79
|
+
exports.CommonTxClient = CommonTxClient;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Registry, EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { SignAndBroadcastOptions } from ".";
|
|
3
|
-
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
|
|
3
|
+
import { SignDoc, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
|
|
4
|
+
import { TxRawExt } from "./signingstargateclient";
|
|
4
5
|
import { BroadcastTxResponse } from "./stargateclient";
|
|
5
6
|
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
6
|
-
import { Any } from "cosmjs-types/google/protobuf/any";
|
|
7
7
|
export declare class ITxClient {
|
|
8
8
|
private readonly wallet;
|
|
9
9
|
private readonly serverUrl;
|
|
10
10
|
private readonly registry;
|
|
11
11
|
private rawWallet;
|
|
12
12
|
constructor(wallet: FirmaWalletService, serverUrl: string, registry: Registry);
|
|
13
|
-
getAnyData(message: EncodeObject): Any;
|
|
14
13
|
getRegistry(): Registry;
|
|
15
14
|
sign(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<TxRaw>;
|
|
16
15
|
broadcast(txRaw: TxRaw): Promise<BroadcastTxResponse>;
|
|
17
16
|
signAndBroadcast(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<BroadcastTxResponse>;
|
|
17
|
+
signDirectForSignDoc(signerAddress: string, signDoc: SignDoc): Promise<TxRawExt>;
|
|
18
18
|
}
|
|
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.ITxClient = void 0;
|
|
40
40
|
var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
|
|
41
41
|
var signingstargateclient_1 = require("./signingstargateclient");
|
|
42
|
-
var any_1 = require("cosmjs-types/google/protobuf/any");
|
|
43
42
|
var ITxClient = /** @class */ (function () {
|
|
44
43
|
function ITxClient(wallet, serverUrl, registry) {
|
|
45
44
|
this.wallet = wallet;
|
|
@@ -47,13 +46,6 @@ var ITxClient = /** @class */ (function () {
|
|
|
47
46
|
this.registry = registry;
|
|
48
47
|
this.rawWallet = wallet.getRawWallet();
|
|
49
48
|
}
|
|
50
|
-
ITxClient.prototype.getAnyData = function (message) {
|
|
51
|
-
var anyData = any_1.Any.fromPartial({
|
|
52
|
-
typeUrl: message.typeUrl,
|
|
53
|
-
value: this.getRegistry().encode(message)
|
|
54
|
-
});
|
|
55
|
-
return anyData;
|
|
56
|
-
};
|
|
57
49
|
ITxClient.prototype.getRegistry = function () { return this.registry; };
|
|
58
50
|
ITxClient.prototype.sign = function (msgs, _a) {
|
|
59
51
|
var fee = _a.fee, memo = _a.memo;
|
|
@@ -106,6 +98,20 @@ var ITxClient = /** @class */ (function () {
|
|
|
106
98
|
});
|
|
107
99
|
});
|
|
108
100
|
};
|
|
101
|
+
ITxClient.prototype.signDirectForSignDoc = function (signerAddress, signDoc) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
+
var client;
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0: return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.connectWithSigner(this.serverUrl, this.rawWallet, this.registry)];
|
|
107
|
+
case 1:
|
|
108
|
+
client = _a.sent();
|
|
109
|
+
return [4 /*yield*/, client.signDirectForSignDoc(signerAddress, signDoc)];
|
|
110
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
109
115
|
return ITxClient;
|
|
110
116
|
}());
|
|
111
117
|
exports.ITxClient = ITxClient;
|
|
@@ -135,7 +135,7 @@ var LedgerSigningStargateClient = /** @class */ (function (_super) {
|
|
|
135
135
|
case 0:
|
|
136
136
|
_a.trys.push([0, 2, , 3]);
|
|
137
137
|
accAddress = this.toAccAddress(address);
|
|
138
|
-
hexAccAddress = "0x01"
|
|
138
|
+
hexAccAddress = "0x01".concat(Buffer.from(accAddress).toString("hex"));
|
|
139
139
|
axios = axios_1.default.create({
|
|
140
140
|
baseURL: LedgerSigningStargateClient._endpoint,
|
|
141
141
|
headers: {
|
|
@@ -149,7 +149,7 @@ var LedgerSigningStargateClient = /** @class */ (function (_super) {
|
|
|
149
149
|
result = _a.sent();
|
|
150
150
|
finalData = result.data.result.response.value;
|
|
151
151
|
account = any_1.Any.decode(Buffer.from(finalData, "base64"));
|
|
152
|
-
finalAccount = accounts_1.accountFromAny(account);
|
|
152
|
+
finalAccount = (0, accounts_1.accountFromAny)(account);
|
|
153
153
|
return [2 /*return*/, finalAccount];
|
|
154
154
|
case 2:
|
|
155
155
|
error_1 = _a.sent();
|
|
@@ -51,10 +51,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
51
51
|
}
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
55
|
-
for (var i = 0,
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
55
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
56
|
+
if (ar || !(i in from)) {
|
|
57
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
58
|
+
ar[i] = from[i];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
58
62
|
};
|
|
59
63
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
60
64
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -91,7 +95,7 @@ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
|
|
|
91
95
|
var authInfo = {
|
|
92
96
|
signerInfos: makeSignerInfos(signers, signMode),
|
|
93
97
|
fee: {
|
|
94
|
-
amount: __spreadArray([], __read(feeAmount)),
|
|
98
|
+
amount: __spreadArray([], __read(feeAmount), false),
|
|
95
99
|
gasLimit: long_1.default.fromNumber(gasLimit),
|
|
96
100
|
granter: granter,
|
|
97
101
|
},
|
|
@@ -109,7 +113,7 @@ function signFromLedger(ledger, messages, option, registry) {
|
|
|
109
113
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.getSignerDataForLedger(address)];
|
|
110
114
|
case 2:
|
|
111
115
|
signerData = _b.sent();
|
|
112
|
-
pubkey = proto_signing_1.encodePubkey(encoding_2.encodeSecp256k1Pubkey(publicKey));
|
|
116
|
+
pubkey = (0, proto_signing_1.encodePubkey)((0, encoding_2.encodeSecp256k1Pubkey)(publicKey));
|
|
113
117
|
aminoTypes = new aminotypes_1.AminoTypes({});
|
|
114
118
|
msgs = messages.map(function (msg) { return aminoTypes.toAmino(msg); });
|
|
115
119
|
chainId = signerData.chain_id;
|
|
@@ -117,9 +121,9 @@ function signFromLedger(ledger, messages, option, registry) {
|
|
|
117
121
|
sequence = Number.parseInt(signerData.sequence);
|
|
118
122
|
memo = option.memo;
|
|
119
123
|
fee = { amount: option.fee.amount, gas: option.fee.gas };
|
|
120
|
-
signDoc = signdoc_2.makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
|
|
121
|
-
signMessage = signdoc_1.serializeSignDoc(signDoc);
|
|
122
|
-
return [4 /*yield*/, ledger.sign(encoding_3.fromUtf8(signMessage))];
|
|
124
|
+
signDoc = (0, signdoc_2.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence);
|
|
125
|
+
signMessage = (0, signdoc_1.serializeSignDoc)(signDoc);
|
|
126
|
+
return [4 /*yield*/, ledger.sign((0, encoding_3.fromUtf8)(signMessage))];
|
|
123
127
|
case 3:
|
|
124
128
|
ledgerSignature = _b.sent();
|
|
125
129
|
;
|
|
@@ -137,7 +141,7 @@ function signFromLedger(ledger, messages, option, registry) {
|
|
|
137
141
|
txRaw = tx_2.TxRaw.fromPartial({
|
|
138
142
|
bodyBytes: signedTxBodyBytes,
|
|
139
143
|
authInfoBytes: signedAuthInfoBytes,
|
|
140
|
-
signatures: [encoding_1.fromBase64(Buffer.from(ledgerSignature).toString('base64'))],
|
|
144
|
+
signatures: [(0, encoding_1.fromBase64)(Buffer.from(ledgerSignature).toString('base64'))],
|
|
141
145
|
});
|
|
142
146
|
return [2 /*return*/, txRaw];
|
|
143
147
|
}
|
|
@@ -10,7 +10,7 @@ function uint64FromProto(input) {
|
|
|
10
10
|
}
|
|
11
11
|
function accountFromBaseAccount(input) {
|
|
12
12
|
var address = input.address, pubKey = input.pubKey, accountNumber = input.accountNumber, sequence = input.sequence;
|
|
13
|
-
var pubkey = proto_signing_1.decodePubkey(pubKey);
|
|
13
|
+
var pubkey = (0, proto_signing_1.decodePubkey)(pubKey);
|
|
14
14
|
return {
|
|
15
15
|
address: address,
|
|
16
16
|
pubkey: pubkey,
|
|
@@ -58,7 +58,7 @@ function accountFromAny(input) {
|
|
|
58
58
|
return accountFromBaseAccount(baseAccount);
|
|
59
59
|
}
|
|
60
60
|
default:
|
|
61
|
-
throw new Error("Unsupported type: '"
|
|
61
|
+
throw new Error("Unsupported type: '".concat(typeUrl, "'"));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
exports.accountFromAny = accountFromAny;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -15,10 +15,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
15
15
|
}
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
19
|
-
for (var i = 0,
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
+
if (ar || !(i in from)) {
|
|
21
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
+
ar[i] = from[i];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
22
26
|
};
|
|
23
27
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
28
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -45,7 +49,7 @@ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
|
|
|
45
49
|
var authInfo = {
|
|
46
50
|
signerInfos: makeSignerInfos(signers, signMode),
|
|
47
51
|
fee: {
|
|
48
|
-
amount: __spreadArray([], __read(feeAmount)),
|
|
52
|
+
amount: __spreadArray([], __read(feeAmount), false),
|
|
49
53
|
gasLimit: long_1.default.fromNumber(gasLimit),
|
|
50
54
|
granter: granter,
|
|
51
55
|
},
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Registry } from "@cosmjs/proto-signing";
|
|
2
|
+
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
|
|
3
|
+
import { Account } from "./accounts";
|
|
4
|
+
import { StargateClient } from "./stargateclient";
|
|
5
|
+
import { AminoMsg } from "@cosmjs/amino";
|
|
6
|
+
import { OfflineAminoSigner } from "../amino/signer";
|
|
7
|
+
export interface SignerData {
|
|
8
|
+
readonly accountNumber: number;
|
|
9
|
+
readonly sequence: number;
|
|
10
|
+
readonly chainId: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SequenceResponse {
|
|
13
|
+
readonly accountNumber: number;
|
|
14
|
+
readonly sequence: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ArbitraryVerifyData {
|
|
17
|
+
type: string;
|
|
18
|
+
signer: string;
|
|
19
|
+
data: string;
|
|
20
|
+
pubkey: string;
|
|
21
|
+
signature: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* See ADR-036
|
|
25
|
+
*/
|
|
26
|
+
export interface MsgSignData extends AminoMsg {
|
|
27
|
+
readonly type: "sign/MsgSignData";
|
|
28
|
+
readonly value: {
|
|
29
|
+
/** Bech32 account address */
|
|
30
|
+
signer: string;
|
|
31
|
+
/** Base64 encoded data */
|
|
32
|
+
data: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare function isMsgSignData(msg: AminoMsg): msg is MsgSignData;
|
|
36
|
+
export declare class SigningAminoStargateClient extends StargateClient {
|
|
37
|
+
private readonly signer;
|
|
38
|
+
private static _endpoint;
|
|
39
|
+
static connectWithSigner(endpoint: string, signer: OfflineAminoSigner, registry: Registry): Promise<SigningAminoStargateClient>;
|
|
40
|
+
protected constructor(tmClient: Tendermint34Client | undefined, signer: OfflineAminoSigner);
|
|
41
|
+
experimentalAdr36Sign(signerAddress: string, data: Uint8Array | Uint8Array[]): Promise<ArbitraryVerifyData>;
|
|
42
|
+
static experimentalAdr36Verify(data: ArbitraryVerifyData, checkMsg: string): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Takes a bech32 encoded address and returns the data part. The prefix is ignored and discarded.
|
|
45
|
+
* This is called AccAddress in Cosmos SDK, which is basically an alias for raw binary data.
|
|
46
|
+
* The result is typically 20 bytes long but not restricted to that.
|
|
47
|
+
*/
|
|
48
|
+
private toAccAddress;
|
|
49
|
+
getAccount(address: string): Promise<Account | undefined>;
|
|
50
|
+
}
|