@firmachain/firma-js 0.2.16 → 0.2.20
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/sdk/FirmaBankService.js +3 -3
- package/dist/sdk/FirmaContractService.js +8 -8
- package/dist/sdk/FirmaDistributionService.js +10 -10
- package/dist/sdk/FirmaFeeGrantService.js +6 -6
- package/dist/sdk/FirmaGovService.js +15 -15
- package/dist/sdk/FirmaNftService.js +6 -6
- package/dist/sdk/FirmaStakingService.js +10 -10
- package/dist/sdk/FirmaTokenService.js +8 -8
- package/dist/sdk/FirmaUtil.d.ts +4 -0
- package/dist/sdk/FirmaUtil.js +65 -6
- package/dist/sdk/FirmaWalletService.d.ts +9 -1
- package/dist/sdk/FirmaWalletService.js +39 -5
- package/dist/sdk/firmachain/amino/addresses.d.ts +5 -0
- package/dist/sdk/firmachain/amino/addresses.js +46 -0
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +281 -0
- package/dist/sdk/firmachain/amino/aminomsgs.js +77 -0
- package/dist/sdk/firmachain/amino/aminotypes.d.ts +22 -0
- package/dist/sdk/firmachain/amino/aminotypes.js +521 -0
- package/dist/sdk/firmachain/amino/coins.d.ts +30 -0
- package/dist/sdk/firmachain/amino/coins.js +69 -0
- package/dist/sdk/firmachain/amino/encoding.d.ts +24 -0
- package/dist/sdk/firmachain/amino/encoding.js +234 -0
- package/dist/sdk/firmachain/amino/multisig.d.ts +10 -0
- package/dist/sdk/firmachain/amino/multisig.js +42 -0
- package/dist/sdk/firmachain/amino/paths.d.ts +6 -0
- package/dist/sdk/firmachain/amino/paths.js +18 -0
- package/dist/sdk/firmachain/amino/pubkeys.d.ts +47 -0
- package/dist/sdk/firmachain/amino/pubkeys.js +29 -0
- package/dist/sdk/firmachain/amino/secp256k1hdwallet.d.ts +94 -0
- package/dist/sdk/firmachain/amino/secp256k1hdwallet.js +437 -0
- package/dist/sdk/firmachain/amino/secp256k1wallet.d.ts +23 -0
- package/dist/sdk/firmachain/amino/secp256k1wallet.js +141 -0
- package/dist/sdk/firmachain/amino/signature.d.ts +16 -0
- package/dist/sdk/firmachain/amino/signature.js +36 -0
- package/dist/sdk/firmachain/amino/signdoc.d.ts +26 -0
- package/dist/sdk/firmachain/amino/signdoc.js +42 -0
- package/dist/sdk/firmachain/amino/signer.d.ts +33 -0
- package/dist/sdk/firmachain/amino/signer.js +2 -0
- package/dist/sdk/firmachain/amino/stdtx.d.ts +15 -0
- package/dist/sdk/firmachain/amino/stdtx.js +17 -0
- package/dist/sdk/firmachain/amino/wallet.d.ts +32 -0
- package/dist/sdk/firmachain/amino/wallet.js +132 -0
- package/dist/sdk/firmachain/bank/BankTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/common/ITxClient.d.ts +4 -2
- package/dist/sdk/firmachain/common/ITxClient.js +10 -6
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +27 -0
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +165 -0
- package/dist/sdk/firmachain/common/LedgerWallet.d.ts +14 -0
- package/dist/sdk/firmachain/common/LedgerWallet.js +147 -0
- package/dist/sdk/firmachain/common/signing.js +17 -1
- package/dist/sdk/firmachain/common/signingstargateclient.js +19 -3
- package/dist/sdk/firmachain/common/stargateclient.js +5 -2
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +50 -9
- package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/distribution/index.js +0 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +63 -13
- package/dist/sdk/firmachain/google/protobuf/any.js +3 -2
- package/dist/sdk/firmachain/google/protobuf/descriptor.js +1364 -324
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/gov/index.js +0 -1
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/token/TokenTxClient.d.ts +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
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
|
+
};
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
55
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
56
|
+
to[j] = from[i];
|
|
57
|
+
return to;
|
|
58
|
+
};
|
|
59
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
60
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
61
|
+
};
|
|
62
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
+
exports.signFromLedger = void 0;
|
|
64
|
+
var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
65
|
+
var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
|
|
66
|
+
var long_1 = __importDefault(require("long"));
|
|
67
|
+
var math_1 = require("@cosmjs/math");
|
|
68
|
+
var encoding_1 = require("@cosmjs/encoding");
|
|
69
|
+
var aminotypes_1 = require("../amino/aminotypes");
|
|
70
|
+
var signdoc_1 = require("../amino/signdoc");
|
|
71
|
+
var encoding_2 = require("../amino/encoding");
|
|
72
|
+
var signdoc_2 = require("../amino/signdoc");
|
|
73
|
+
var encoding_3 = require("@cosmjs/encoding");
|
|
74
|
+
var signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
|
|
75
|
+
var tx_2 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
|
|
76
|
+
var FirmaUtil_1 = require("../../FirmaUtil");
|
|
77
|
+
function makeSignerInfos(signers, signMode) {
|
|
78
|
+
return signers.map(function (_a) {
|
|
79
|
+
var pubkey = _a.pubkey, sequence = _a.sequence;
|
|
80
|
+
return ({
|
|
81
|
+
publicKey: pubkey,
|
|
82
|
+
modeInfo: {
|
|
83
|
+
single: { mode: signMode },
|
|
84
|
+
},
|
|
85
|
+
sequence: long_1.default.fromNumber(sequence),
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
|
|
90
|
+
if (signMode === void 0) { signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON; }
|
|
91
|
+
var authInfo = {
|
|
92
|
+
signerInfos: makeSignerInfos(signers, signMode),
|
|
93
|
+
fee: {
|
|
94
|
+
amount: __spreadArray([], __read(feeAmount)),
|
|
95
|
+
gasLimit: long_1.default.fromNumber(gasLimit),
|
|
96
|
+
granter: granter,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
return tx_1.AuthInfo.encode(tx_1.AuthInfo.fromPartial(authInfo)).finish();
|
|
100
|
+
}
|
|
101
|
+
function signFromLedger(ledger, messages, option, registry) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
+
var _a, address, publicKey, signerData, pubkey, aminoTypes, msgs, chainId, accountNumber, sequence, memo, fee, signDoc, signMessage, ledgerSignature, signedTxBody, signedTxBodyEncodeObject, signedTxBodyBytes, signedGasLimit, signedAuthInfoBytes, txRaw;
|
|
104
|
+
return __generator(this, function (_b) {
|
|
105
|
+
switch (_b.label) {
|
|
106
|
+
case 0: return [4 /*yield*/, ledger.getAddressAndPublicKey()];
|
|
107
|
+
case 1:
|
|
108
|
+
_a = _b.sent(), address = _a.address, publicKey = _a.publicKey;
|
|
109
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.getSignerDataForLedger(address)];
|
|
110
|
+
case 2:
|
|
111
|
+
signerData = _b.sent();
|
|
112
|
+
pubkey = proto_signing_1.encodePubkey(encoding_2.encodeSecp256k1Pubkey(publicKey));
|
|
113
|
+
aminoTypes = new aminotypes_1.AminoTypes({});
|
|
114
|
+
msgs = messages.map(function (msg) { return aminoTypes.toAmino(msg); });
|
|
115
|
+
chainId = signerData.chain_id;
|
|
116
|
+
accountNumber = Number.parseInt(signerData.account_number);
|
|
117
|
+
sequence = Number.parseInt(signerData.sequence);
|
|
118
|
+
memo = option.memo;
|
|
119
|
+
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))];
|
|
123
|
+
case 3:
|
|
124
|
+
ledgerSignature = _b.sent();
|
|
125
|
+
;
|
|
126
|
+
signedTxBody = {
|
|
127
|
+
messages: signDoc.msgs.map(function (msg) { return aminoTypes.fromAmino(msg); }),
|
|
128
|
+
memo: memo,
|
|
129
|
+
};
|
|
130
|
+
signedTxBodyEncodeObject = {
|
|
131
|
+
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
132
|
+
value: signedTxBody,
|
|
133
|
+
};
|
|
134
|
+
signedTxBodyBytes = registry.encode(signedTxBodyEncodeObject);
|
|
135
|
+
signedGasLimit = math_1.Int53.fromString(option.fee.gas).toNumber();
|
|
136
|
+
signedAuthInfoBytes = makeAuthInfoBytes([{ pubkey: pubkey, sequence: sequence }], option.fee.amount, signedGasLimit, option.fee.granter, signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON);
|
|
137
|
+
txRaw = tx_2.TxRaw.fromPartial({
|
|
138
|
+
bodyBytes: signedTxBodyBytes,
|
|
139
|
+
authInfoBytes: signedAuthInfoBytes,
|
|
140
|
+
signatures: [encoding_1.fromBase64(Buffer.from(ledgerSignature).toString('base64'))],
|
|
141
|
+
});
|
|
142
|
+
return [2 /*return*/, txRaw];
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
exports.signFromLedger = signFromLedger;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
2
18
|
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
3
19
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
4
20
|
to[j] = from[i];
|
|
@@ -29,7 +45,7 @@ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
|
|
|
29
45
|
var authInfo = {
|
|
30
46
|
signerInfos: makeSignerInfos(signers, signMode),
|
|
31
47
|
fee: {
|
|
32
|
-
amount: __spreadArray([], feeAmount),
|
|
48
|
+
amount: __spreadArray([], __read(feeAmount)),
|
|
33
49
|
gasLimit: long_1.default.fromNumber(gasLimit),
|
|
34
50
|
granter: granter,
|
|
35
51
|
},
|
|
@@ -50,6 +50,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
54
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
55
|
+
if (!m) return o;
|
|
56
|
+
var i = m.call(o), r, ar = [], e;
|
|
57
|
+
try {
|
|
58
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
59
|
+
}
|
|
60
|
+
catch (error) { e = { error: error }; }
|
|
61
|
+
finally {
|
|
62
|
+
try {
|
|
63
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
64
|
+
}
|
|
65
|
+
finally { if (e) throw e.error; }
|
|
66
|
+
}
|
|
67
|
+
return ar;
|
|
68
|
+
};
|
|
53
69
|
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
54
70
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
55
71
|
to[j] = from[i];
|
|
@@ -60,7 +76,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
60
76
|
};
|
|
61
77
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
78
|
exports.SigningStargateClient = void 0;
|
|
63
|
-
var amino_1 = require("@cosmjs/amino");
|
|
64
79
|
var encoding_1 = require("@cosmjs/encoding");
|
|
65
80
|
var encoding_2 = require("@cosmjs/encoding");
|
|
66
81
|
var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
@@ -73,6 +88,7 @@ var axios_1 = __importDefault(require("axios"));
|
|
|
73
88
|
var math_1 = require("@cosmjs/math");
|
|
74
89
|
var any_1 = require("../google/protobuf/any");
|
|
75
90
|
var long_1 = __importDefault(require("long"));
|
|
91
|
+
var encoding_3 = require("../amino/encoding");
|
|
76
92
|
var SigningStargateClient = /** @class */ (function (_super) {
|
|
77
93
|
__extends(SigningStargateClient, _super);
|
|
78
94
|
function SigningStargateClient(tmClient, signer, registry) {
|
|
@@ -233,7 +249,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
|
|
|
233
249
|
var authInfo = {
|
|
234
250
|
signerInfos: this.makeSignerInfos(signers, signMode),
|
|
235
251
|
fee: {
|
|
236
|
-
amount: __spreadArray([], feeAmount),
|
|
252
|
+
amount: __spreadArray([], __read(feeAmount)),
|
|
237
253
|
gasLimit: long_1.default.fromNumber(gasLimit),
|
|
238
254
|
granter: granter,
|
|
239
255
|
},
|
|
@@ -252,7 +268,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
|
|
|
252
268
|
if (!accountFromSigner) {
|
|
253
269
|
throw new Error("Failed to retrieve account from signer");
|
|
254
270
|
}
|
|
255
|
-
pubkey = proto_signing_1.encodePubkey(
|
|
271
|
+
pubkey = proto_signing_1.encodePubkey(encoding_3.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
|
|
256
272
|
txBodyEncodeObject = {
|
|
257
273
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
258
274
|
value: {
|
|
@@ -124,7 +124,7 @@ var StargateClient = /** @class */ (function () {
|
|
|
124
124
|
if (timeoutMs === void 0) { timeoutMs = 60000; }
|
|
125
125
|
if (pollIntervalMs === void 0) { pollIntervalMs = 3000; }
|
|
126
126
|
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
-
var timedOut, txPollTimeout, pollForTx, broadcasted, transactionId;
|
|
127
|
+
var timedOut, txPollTimeout, pollForTx, test, broadcasted, transactionId;
|
|
128
128
|
var _this = this;
|
|
129
129
|
return __generator(this, function (_a) {
|
|
130
130
|
switch (_a.label) {
|
|
@@ -160,8 +160,11 @@ var StargateClient = /** @class */ (function () {
|
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
}); };
|
|
163
|
-
return [4 /*yield*/, this.forceGetTmClient().
|
|
163
|
+
return [4 /*yield*/, this.forceGetTmClient().status()];
|
|
164
164
|
case 1:
|
|
165
|
+
test = _a.sent();
|
|
166
|
+
return [4 /*yield*/, this.forceGetTmClient().broadcastTxSync({ tx: tx })];
|
|
167
|
+
case 2:
|
|
165
168
|
broadcasted = _a.sent();
|
|
166
169
|
if (broadcasted.code) {
|
|
167
170
|
throw new Error("Broadcasting transaction failed with code " + broadcasted.code + " (codespace: " + broadcasted.codeSpace + "). Log: " + broadcasted.log);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { EncodeObject
|
|
1
|
+
import { EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgCreateContractFile, MsgAddContractLog } from "./ContractTxTypes";
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
|
+
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
4
5
|
export interface MsgAddContractLogEncodeObject extends EncodeObject {
|
|
5
6
|
readonly typeUrl: "/firmachain.firmachain.contract.MsgAddContractLog";
|
|
6
7
|
readonly value: Partial<MsgAddContractLog>;
|
|
@@ -10,7 +11,7 @@ export interface MsgCreateContractFileEncodeObject extends EncodeObject {
|
|
|
10
11
|
readonly value: Partial<MsgCreateContractFile>;
|
|
11
12
|
}
|
|
12
13
|
export declare class ContractTxClient extends ITxClient {
|
|
13
|
-
constructor(wallet:
|
|
14
|
+
constructor(wallet: FirmaWalletService, serverUrl: string);
|
|
14
15
|
msgAddContractLog(data: MsgAddContractLog): MsgAddContractLogEncodeObject;
|
|
15
16
|
msgCreateContractFile(data: MsgCreateContractFile): MsgCreateContractFileEncodeObject;
|
|
16
17
|
}
|
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __values = (this && this.__values) || function(o) {
|
|
14
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
+
if (m) return m.call(o);
|
|
16
|
+
if (o && typeof o.length === "number") return {
|
|
17
|
+
next: function () {
|
|
18
|
+
if (o && i >= o.length) o = void 0;
|
|
19
|
+
return { value: o && o[i++], done: !o };
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
+
};
|
|
13
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
25
|
exports.MsgClientImpl = exports.MsgAddContractLogResponse = exports.MsgAddContractLog = exports.MsgCreateContractFileResponse = exports.MsgCreateContractFile = exports.protobufPackage = void 0;
|
|
15
26
|
/* eslint-disable */
|
|
@@ -24,6 +35,7 @@ var baseMsgCreateContractFile = {
|
|
|
24
35
|
};
|
|
25
36
|
exports.MsgCreateContractFile = {
|
|
26
37
|
encode: function (message, writer) {
|
|
38
|
+
var e_1, _a;
|
|
27
39
|
if (writer === void 0) { writer = minimal_1.Writer.create(); }
|
|
28
40
|
if (message.creator !== "") {
|
|
29
41
|
writer.uint32(10).string(message.creator);
|
|
@@ -34,9 +46,18 @@ exports.MsgCreateContractFile = {
|
|
|
34
46
|
if (message.timeStamp !== 0) {
|
|
35
47
|
writer.uint32(24).uint64(message.timeStamp);
|
|
36
48
|
}
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
49
|
+
try {
|
|
50
|
+
for (var _b = __values(message.ownerList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
51
|
+
var v = _c.value;
|
|
52
|
+
writer.uint32(34).string(v);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
56
|
+
finally {
|
|
57
|
+
try {
|
|
58
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
59
|
+
}
|
|
60
|
+
finally { if (e_1) throw e_1.error; }
|
|
40
61
|
}
|
|
41
62
|
if (message.metaDataJsonString !== "") {
|
|
42
63
|
writer.uint32(42).string(message.metaDataJsonString);
|
|
@@ -74,6 +95,7 @@ exports.MsgCreateContractFile = {
|
|
|
74
95
|
return message;
|
|
75
96
|
},
|
|
76
97
|
fromJSON: function (object) {
|
|
98
|
+
var e_2, _a;
|
|
77
99
|
var message = __assign({}, baseMsgCreateContractFile);
|
|
78
100
|
message.ownerList = [];
|
|
79
101
|
if (object.creator !== undefined && object.creator !== null) {
|
|
@@ -95,9 +117,18 @@ exports.MsgCreateContractFile = {
|
|
|
95
117
|
message.timeStamp = 0;
|
|
96
118
|
}
|
|
97
119
|
if (object.ownerList !== undefined && object.ownerList !== null) {
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
|
|
120
|
+
try {
|
|
121
|
+
for (var _b = __values(object.ownerList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
122
|
+
var e = _c.value;
|
|
123
|
+
message.ownerList.push(String(e));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
127
|
+
finally {
|
|
128
|
+
try {
|
|
129
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
130
|
+
}
|
|
131
|
+
finally { if (e_2) throw e_2.error; }
|
|
101
132
|
}
|
|
102
133
|
}
|
|
103
134
|
if (object.metaDataJsonString !== undefined &&
|
|
@@ -125,6 +156,7 @@ exports.MsgCreateContractFile = {
|
|
|
125
156
|
return obj;
|
|
126
157
|
},
|
|
127
158
|
fromPartial: function (object) {
|
|
159
|
+
var e_3, _a;
|
|
128
160
|
var message = __assign({}, baseMsgCreateContractFile);
|
|
129
161
|
message.ownerList = [];
|
|
130
162
|
if (object.creator !== undefined && object.creator !== null) {
|
|
@@ -146,9 +178,18 @@ exports.MsgCreateContractFile = {
|
|
|
146
178
|
message.timeStamp = 0;
|
|
147
179
|
}
|
|
148
180
|
if (object.ownerList !== undefined && object.ownerList !== null) {
|
|
149
|
-
|
|
150
|
-
var
|
|
151
|
-
|
|
181
|
+
try {
|
|
182
|
+
for (var _b = __values(object.ownerList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
183
|
+
var e = _c.value;
|
|
184
|
+
message.ownerList.push(e);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
188
|
+
finally {
|
|
189
|
+
try {
|
|
190
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
191
|
+
}
|
|
192
|
+
finally { if (e_3) throw e_3.error; }
|
|
152
193
|
}
|
|
153
194
|
}
|
|
154
195
|
if (object.metaDataJsonString !== undefined &&
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EncodeObject
|
|
1
|
+
import { EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgFundCommunityPool, MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission } from "cosmjs-types/cosmos/distribution/v1beta1/tx";
|
|
3
|
+
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
3
4
|
import { ITxClient } from "../common/ITxClient";
|
|
4
5
|
export interface MsgFundCommunityPoolEncodeObject extends EncodeObject {
|
|
5
6
|
readonly typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool";
|
|
@@ -18,7 +19,7 @@ export interface MsgWithdrawValidatorCommissionEncodeObject extends EncodeObject
|
|
|
18
19
|
readonly value: Partial<MsgWithdrawValidatorCommission>;
|
|
19
20
|
}
|
|
20
21
|
export declare class DistributionTxClient extends ITxClient {
|
|
21
|
-
constructor(wallet:
|
|
22
|
+
constructor(wallet: FirmaWalletService, serverUrl: string);
|
|
22
23
|
msgFundCommunityPool(data: MsgFundCommunityPool): MsgFundCommunityPoolEncodeObject;
|
|
23
24
|
msgSetWithdrawAddress(data: MsgSetWithdrawAddress): MsgSetWithdrawAddressEncodeObject;
|
|
24
25
|
msgWithdrawDelegatorReward(data: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardEncodeObject;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgGrantAllowance, MsgRevokeAllowance } from "./FeeGrantTxTypes";
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
|
+
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
4
5
|
export interface MsgGrantAllowanceEncodeObject extends EncodeObject {
|
|
5
6
|
readonly typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance";
|
|
6
7
|
readonly value: Partial<MsgGrantAllowance>;
|
|
@@ -10,7 +11,7 @@ export interface MsgRevokeAllowanceEncodeObject extends EncodeObject {
|
|
|
10
11
|
readonly value: Partial<MsgRevokeAllowance>;
|
|
11
12
|
}
|
|
12
13
|
export declare class FeeGrantTxClient extends ITxClient {
|
|
13
|
-
constructor(wallet:
|
|
14
|
+
constructor(wallet: FirmaWalletService, serverUrl: string);
|
|
14
15
|
msgGrantAllowance(data: MsgGrantAllowance): MsgGrantAllowanceEncodeObject;
|
|
15
16
|
msgRevokeAllowance(data: MsgRevokeAllowance): MsgRevokeAllowanceEncodeObject;
|
|
16
17
|
}
|
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __values = (this && this.__values) || function(o) {
|
|
14
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
+
if (m) return m.call(o);
|
|
16
|
+
if (o && typeof o.length === "number") return {
|
|
17
|
+
next: function () {
|
|
18
|
+
if (o && i >= o.length) o = void 0;
|
|
19
|
+
return { value: o && o[i++], done: !o };
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
+
};
|
|
13
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
26
|
};
|
|
@@ -90,19 +101,30 @@ exports.MsgRevokeAllowance = {
|
|
|
90
101
|
};
|
|
91
102
|
exports.AllowedMsgAllowance = {
|
|
92
103
|
encode: function (message, writer) {
|
|
104
|
+
var e_1, _a;
|
|
93
105
|
if (writer === void 0) { writer = minimal_2.Writer.create(); }
|
|
94
106
|
if (message.allowance !== undefined) {
|
|
95
107
|
any_1.Any.encode(message.allowance, writer.uint32(10).fork()).ldelim();
|
|
96
108
|
}
|
|
97
|
-
|
|
98
|
-
var
|
|
99
|
-
|
|
109
|
+
try {
|
|
110
|
+
for (var _b = __values(message.allowedMessages), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
111
|
+
var v = _c.value;
|
|
112
|
+
writer.uint32(18).string(v);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
116
|
+
finally {
|
|
117
|
+
try {
|
|
118
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
119
|
+
}
|
|
120
|
+
finally { if (e_1) throw e_1.error; }
|
|
100
121
|
}
|
|
101
122
|
return writer;
|
|
102
123
|
},
|
|
103
124
|
};
|
|
104
125
|
exports.PeriodicAllowance = {
|
|
105
126
|
encode: function (message, writer) {
|
|
127
|
+
var e_2, _a, e_3, _b;
|
|
106
128
|
if (writer === void 0) { writer = minimal_2.Writer.create(); }
|
|
107
129
|
if (message.basic !== undefined) {
|
|
108
130
|
exports.BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim();
|
|
@@ -110,13 +132,31 @@ exports.PeriodicAllowance = {
|
|
|
110
132
|
if (message.period !== undefined) {
|
|
111
133
|
duration_1.Duration.encode(message.period, writer.uint32(18).fork()).ldelim();
|
|
112
134
|
}
|
|
113
|
-
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
135
|
+
try {
|
|
136
|
+
for (var _c = __values(message.periodSpendLimit), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
137
|
+
var v = _d.value;
|
|
138
|
+
coin_1.Coin.encode(v, writer.uint32(26).fork()).ldelim();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
142
|
+
finally {
|
|
143
|
+
try {
|
|
144
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
145
|
+
}
|
|
146
|
+
finally { if (e_2) throw e_2.error; }
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
for (var _e = __values(message.periodCanSpend), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
150
|
+
var v = _f.value;
|
|
151
|
+
coin_1.Coin.encode(v, writer.uint32(34).fork()).ldelim();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
155
|
+
finally {
|
|
156
|
+
try {
|
|
157
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
158
|
+
}
|
|
159
|
+
finally { if (e_3) throw e_3.error; }
|
|
120
160
|
}
|
|
121
161
|
if (message.periodReset !== undefined) {
|
|
122
162
|
timestamp_1.Timestamp.encode(toTimestamp(message.periodReset), writer.uint32(42).fork()).ldelim();
|
|
@@ -126,10 +166,20 @@ exports.PeriodicAllowance = {
|
|
|
126
166
|
};
|
|
127
167
|
exports.BasicAllowance = {
|
|
128
168
|
encode: function (message, writer) {
|
|
169
|
+
var e_4, _a;
|
|
129
170
|
if (writer === void 0) { writer = minimal_2.Writer.create(); }
|
|
130
|
-
|
|
131
|
-
var
|
|
132
|
-
|
|
171
|
+
try {
|
|
172
|
+
for (var _b = __values(message.spendLimit), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
173
|
+
var v = _c.value;
|
|
174
|
+
coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
178
|
+
finally {
|
|
179
|
+
try {
|
|
180
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
181
|
+
}
|
|
182
|
+
finally { if (e_4) throw e_4.error; }
|
|
133
183
|
}
|
|
134
184
|
if (message.expiration !== undefined) {
|
|
135
185
|
timestamp_1.Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim();
|
|
@@ -58,7 +58,7 @@ exports.Any = {
|
|
|
58
58
|
message.typeUrl = "";
|
|
59
59
|
}
|
|
60
60
|
if (object.value !== undefined && object.value !== null) {
|
|
61
|
-
message.value = bytesFromBase64(object.value);
|
|
61
|
+
message.value = object.value; //bytesFromBase64(object.value);
|
|
62
62
|
}
|
|
63
63
|
return message;
|
|
64
64
|
},
|
|
@@ -94,7 +94,8 @@ var globalThis = (function () {
|
|
|
94
94
|
// globalThis.atob ||
|
|
95
95
|
// ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
96
96
|
function bytesFromBase64(b64) {
|
|
97
|
-
|
|
97
|
+
//const bin = globalThis.Buffer.from(b64, "base64").toString("binary");
|
|
98
|
+
var bin = atob(b64);
|
|
98
99
|
var arr = new Uint8Array(bin.length);
|
|
99
100
|
for (var i = 0; i < bin.length; ++i) {
|
|
100
101
|
arr[i] = bin.charCodeAt(i);
|