@firmachain/firma-js 0.2.40 → 0.2.43
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.d.ts +1 -0
- package/dist/sdk/FirmaBankService.js +39 -16
- package/dist/sdk/FirmaUtil.d.ts +4 -4
- package/dist/sdk/FirmaUtil.js +7 -6
- package/dist/sdk/FirmaWalletService.d.ts +1 -0
- package/dist/sdk/FirmaWalletService.js +56 -32
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +1 -1
- package/dist/sdk/firmachain/common/signingstargateclient.js +2 -2
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ export declare class FirmaBankService {
|
|
|
10
10
|
getGasEstimationSendToken(wallet: FirmaWalletService, targetAddress: string, tokenID: string, amount: number, decimal: number, txMisc?: TxMisc): Promise<number>;
|
|
11
11
|
sendToken(wallet: FirmaWalletService, targetAddress: string, tokenID: string, amount: number, decimal: number, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
12
12
|
send(wallet: FirmaWalletService, targetAddress: string, amount: number, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
13
|
+
send_raw(wallet: FirmaWalletService, targetAddress: string, ufctAmount: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
13
14
|
getTokenBalanceList(address: string): Promise<Token[]>;
|
|
14
15
|
getTokenBalance(address: string, tokenID: string): Promise<string>;
|
|
15
16
|
getBalance(address: string): Promise<string>;
|
|
@@ -136,9 +136,32 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
138
|
};
|
|
139
|
+
FirmaBankService.prototype.send_raw = function (wallet, targetAddress, ufctAmount, txMisc) {
|
|
140
|
+
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
141
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
142
|
+
var txRaw, bankTxClient, error_5;
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
switch (_a.label) {
|
|
145
|
+
case 0:
|
|
146
|
+
_a.trys.push([0, 3, , 4]);
|
|
147
|
+
return [4 /*yield*/, this.getSignedTxSend(wallet, targetAddress, this.config.denom, ufctAmount, txMisc)];
|
|
148
|
+
case 1:
|
|
149
|
+
txRaw = _a.sent();
|
|
150
|
+
bankTxClient = new bank_1.BankTxClient(wallet, this.config.rpcAddress);
|
|
151
|
+
return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
|
|
152
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
153
|
+
case 3:
|
|
154
|
+
error_5 = _a.sent();
|
|
155
|
+
FirmaUtil_1.FirmaUtil.printLog(error_5);
|
|
156
|
+
throw error_5;
|
|
157
|
+
case 4: return [2 /*return*/];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
};
|
|
139
162
|
FirmaBankService.prototype.getTokenBalanceList = function (address) {
|
|
140
163
|
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
-
var bankQueryClient, result, tokenList, i,
|
|
164
|
+
var bankQueryClient, result, tokenList, i, error_6;
|
|
142
165
|
return __generator(this, function (_a) {
|
|
143
166
|
switch (_a.label) {
|
|
144
167
|
case 0:
|
|
@@ -156,9 +179,9 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
156
179
|
}
|
|
157
180
|
return [2 /*return*/, tokenList];
|
|
158
181
|
case 2:
|
|
159
|
-
|
|
160
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
161
|
-
throw
|
|
182
|
+
error_6 = _a.sent();
|
|
183
|
+
FirmaUtil_1.FirmaUtil.printLog(error_6);
|
|
184
|
+
throw error_6;
|
|
162
185
|
case 3: return [2 /*return*/];
|
|
163
186
|
}
|
|
164
187
|
});
|
|
@@ -166,7 +189,7 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
166
189
|
};
|
|
167
190
|
FirmaBankService.prototype.getTokenBalance = function (address, tokenID) {
|
|
168
191
|
return __awaiter(this, void 0, void 0, function () {
|
|
169
|
-
var bankQueryClient, result,
|
|
192
|
+
var bankQueryClient, result, error_7;
|
|
170
193
|
return __generator(this, function (_a) {
|
|
171
194
|
switch (_a.label) {
|
|
172
195
|
case 0:
|
|
@@ -177,9 +200,9 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
177
200
|
result = _a.sent();
|
|
178
201
|
return [2 /*return*/, result.amount];
|
|
179
202
|
case 2:
|
|
180
|
-
|
|
181
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
182
|
-
throw
|
|
203
|
+
error_7 = _a.sent();
|
|
204
|
+
FirmaUtil_1.FirmaUtil.printLog(error_7);
|
|
205
|
+
throw error_7;
|
|
183
206
|
case 3: return [2 /*return*/];
|
|
184
207
|
}
|
|
185
208
|
});
|
|
@@ -187,7 +210,7 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
187
210
|
};
|
|
188
211
|
FirmaBankService.prototype.getBalance = function (address) {
|
|
189
212
|
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
-
var bankQueryClient, result,
|
|
213
|
+
var bankQueryClient, result, error_8;
|
|
191
214
|
return __generator(this, function (_a) {
|
|
192
215
|
switch (_a.label) {
|
|
193
216
|
case 0:
|
|
@@ -198,9 +221,9 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
198
221
|
result = _a.sent();
|
|
199
222
|
return [2 /*return*/, result.amount];
|
|
200
223
|
case 2:
|
|
201
|
-
|
|
202
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
203
|
-
throw
|
|
224
|
+
error_8 = _a.sent();
|
|
225
|
+
FirmaUtil_1.FirmaUtil.printLog(error_8);
|
|
226
|
+
throw error_8;
|
|
204
227
|
case 3: return [2 /*return*/];
|
|
205
228
|
}
|
|
206
229
|
});
|
|
@@ -209,7 +232,7 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
209
232
|
FirmaBankService.prototype.getSignedTxSend = function (wallet, targetAddress, denom, amount, txMisc) {
|
|
210
233
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
211
234
|
return __awaiter(this, void 0, void 0, function () {
|
|
212
|
-
var bankTxClient, address, sendAmount, message,
|
|
235
|
+
var bankTxClient, address, sendAmount, message, error_9;
|
|
213
236
|
return __generator(this, function (_a) {
|
|
214
237
|
switch (_a.label) {
|
|
215
238
|
case 0:
|
|
@@ -223,9 +246,9 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
223
246
|
return [4 /*yield*/, bankTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
224
247
|
case 2: return [2 /*return*/, _a.sent()];
|
|
225
248
|
case 3:
|
|
226
|
-
|
|
227
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
228
|
-
throw
|
|
249
|
+
error_9 = _a.sent();
|
|
250
|
+
FirmaUtil_1.FirmaUtil.printLog(error_9);
|
|
251
|
+
throw error_9;
|
|
229
252
|
case 4: return [2 /*return*/];
|
|
230
253
|
}
|
|
231
254
|
});
|
package/dist/sdk/FirmaUtil.d.ts
CHANGED
|
@@ -40,10 +40,10 @@ export declare class FirmaUtil {
|
|
|
40
40
|
private static recoverSigningAddress;
|
|
41
41
|
private static verifySignature;
|
|
42
42
|
static verifyDirectSignature(address: string, signature: string, signDoc: SignDoc): Promise<boolean>;
|
|
43
|
-
static parseSignDocValues(signDocString:
|
|
44
|
-
static stringifySignDocValues(signDoc: any):
|
|
45
|
-
static makeSignDoc(signerAddress: string, messages: readonly EncodeObject[], txMisc?: TxMisc): Promise<SignDoc>;
|
|
46
|
-
static makeSignDocWithStringify(signerAddress: string, messages: readonly EncodeObject[], txMisc?: TxMisc): Promise<
|
|
43
|
+
static parseSignDocValues(signDocString: string): any;
|
|
44
|
+
static stringifySignDocValues(signDoc: any): string;
|
|
45
|
+
static makeSignDoc(signerAddress: string, pubkey: string, messages: readonly EncodeObject[], txMisc?: TxMisc): Promise<SignDoc>;
|
|
46
|
+
static makeSignDocWithStringify(signerAddress: string, pubkey: string, messages: readonly EncodeObject[], txMisc?: TxMisc): Promise<string>;
|
|
47
47
|
static getAnyData(registry: Registry, message: EncodeObject): Any;
|
|
48
48
|
static getCommonTxClient(aliceWallet: FirmaWalletService): CommonTxClient;
|
|
49
49
|
}
|
package/dist/sdk/FirmaUtil.js
CHANGED
|
@@ -375,12 +375,13 @@ var FirmaUtil = /** @class */ (function () {
|
|
|
375
375
|
};
|
|
376
376
|
;
|
|
377
377
|
FirmaUtil.parseSignDocValues = function (signDocString) {
|
|
378
|
-
|
|
378
|
+
var signDoc = JSON.parse(signDocString);
|
|
379
|
+
return __assign(__assign({}, signDoc), { bodyBytes: (0, encoding_2.fromHex)(signDoc.bodyBytes), authInfoBytes: (0, encoding_2.fromHex)(signDoc.authInfoBytes), accountNumber: long_1.default.fromString(signDoc.accountNumber) });
|
|
379
380
|
};
|
|
380
381
|
FirmaUtil.stringifySignDocValues = function (signDoc) {
|
|
381
|
-
return __assign(__assign({}, signDoc), { bodyBytes: (0, encoding_2.toHex)(signDoc.bodyBytes), authInfoBytes: (0, encoding_2.toHex)(signDoc.authInfoBytes), accountNumber: signDoc.accountNumber.toString(
|
|
382
|
+
return JSON.stringify(__assign(__assign({}, signDoc), { bodyBytes: (0, encoding_2.toHex)(signDoc.bodyBytes), authInfoBytes: (0, encoding_2.toHex)(signDoc.authInfoBytes), accountNumber: signDoc.accountNumber.toString() }));
|
|
382
383
|
};
|
|
383
|
-
FirmaUtil.makeSignDoc = function (signerAddress, messages, txMisc) {
|
|
384
|
+
FirmaUtil.makeSignDoc = function (signerAddress, pubkey, messages, txMisc) {
|
|
384
385
|
if (txMisc === void 0) { txMisc = exports.DefaultTxMisc; }
|
|
385
386
|
return __awaiter(this, void 0, void 0, function () {
|
|
386
387
|
var result, chainID, serverUrl, registry;
|
|
@@ -391,19 +392,19 @@ var FirmaUtil = /** @class */ (function () {
|
|
|
391
392
|
chainID = FirmaUtil.config.chainID;
|
|
392
393
|
serverUrl = FirmaUtil.config.rpcAddress;
|
|
393
394
|
registry = CommonTxClient_1.CommonTxClient.getRegistry();
|
|
394
|
-
return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.makeSignDocForSend(signerAddress, messages, result.fee, result.memo, serverUrl, chainID, registry)];
|
|
395
|
+
return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.makeSignDocForSend(signerAddress, pubkey, messages, result.fee, result.memo, serverUrl, chainID, registry)];
|
|
395
396
|
case 1: return [2 /*return*/, _a.sent()];
|
|
396
397
|
}
|
|
397
398
|
});
|
|
398
399
|
});
|
|
399
400
|
};
|
|
400
|
-
FirmaUtil.makeSignDocWithStringify = function (signerAddress, messages, txMisc) {
|
|
401
|
+
FirmaUtil.makeSignDocWithStringify = function (signerAddress, pubkey, messages, txMisc) {
|
|
401
402
|
if (txMisc === void 0) { txMisc = exports.DefaultTxMisc; }
|
|
402
403
|
return __awaiter(this, void 0, void 0, function () {
|
|
403
404
|
var signDoc, stringSignDoc;
|
|
404
405
|
return __generator(this, function (_a) {
|
|
405
406
|
switch (_a.label) {
|
|
406
|
-
case 0: return [4 /*yield*/, this.makeSignDoc(signerAddress, messages, txMisc)];
|
|
407
|
+
case 0: return [4 /*yield*/, this.makeSignDoc(signerAddress, pubkey, messages, txMisc)];
|
|
407
408
|
case 1:
|
|
408
409
|
signDoc = _a.sent();
|
|
409
410
|
stringSignDoc = this.stringifySignDocValues(signDoc);
|
|
@@ -22,6 +22,7 @@ export declare class FirmaWalletService {
|
|
|
22
22
|
isLedger(): boolean;
|
|
23
23
|
initFromLedger(ledger: LedgerWalletInterface): Promise<FirmaWalletService>;
|
|
24
24
|
signLedger(messages: EncodeObject[], option: SignAndBroadcastOptions, registry: Registry): Promise<TxRaw>;
|
|
25
|
+
getPubKey(): Promise<string>;
|
|
25
26
|
getAddress(): Promise<string>;
|
|
26
27
|
constructor(config: FirmaConfig);
|
|
27
28
|
private static getHdPath;
|
|
@@ -98,9 +98,33 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
|
+
FirmaWalletService.prototype.getPubKey = function () {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
+
var _a, _b, accounts, error_1;
|
|
104
|
+
return __generator(this, function (_c) {
|
|
105
|
+
switch (_c.label) {
|
|
106
|
+
case 0:
|
|
107
|
+
_c.trys.push([0, 4, , 5]);
|
|
108
|
+
if (!(this.ledger != null)) return [3 /*break*/, 2];
|
|
109
|
+
_b = (_a = FirmaUtil_1.FirmaUtil).arrayBufferToBase64;
|
|
110
|
+
return [4 /*yield*/, this.ledger.getPublicKey()];
|
|
111
|
+
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
|
|
112
|
+
case 2: return [4 /*yield*/, this.wallet.getAccounts()];
|
|
113
|
+
case 3:
|
|
114
|
+
accounts = _c.sent();
|
|
115
|
+
return [2 /*return*/, FirmaUtil_1.FirmaUtil.arrayBufferToBase64(accounts[0].pubkey)];
|
|
116
|
+
case 4:
|
|
117
|
+
error_1 = _c.sent();
|
|
118
|
+
FirmaUtil_1.FirmaUtil.printLog(error_1);
|
|
119
|
+
throw error_1;
|
|
120
|
+
case 5: return [2 /*return*/];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
};
|
|
101
125
|
FirmaWalletService.prototype.getAddress = function () {
|
|
102
126
|
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
-
var accounts,
|
|
127
|
+
var accounts, error_2;
|
|
104
128
|
return __generator(this, function (_a) {
|
|
105
129
|
switch (_a.label) {
|
|
106
130
|
case 0:
|
|
@@ -113,9 +137,9 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
113
137
|
accounts = _a.sent();
|
|
114
138
|
return [2 /*return*/, accounts[0].address];
|
|
115
139
|
case 4:
|
|
116
|
-
|
|
117
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
118
|
-
throw
|
|
140
|
+
error_2 = _a.sent();
|
|
141
|
+
FirmaUtil_1.FirmaUtil.printLog(error_2);
|
|
142
|
+
throw error_2;
|
|
119
143
|
case 5: return [2 /*return*/];
|
|
120
144
|
}
|
|
121
145
|
});
|
|
@@ -133,7 +157,7 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
133
157
|
FirmaWalletService.prototype.initFromMnemonic = function (mnemonic, accountIndex) {
|
|
134
158
|
if (accountIndex === void 0) { accountIndex = 0; }
|
|
135
159
|
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
-
var privateKey,
|
|
160
|
+
var privateKey, error_3;
|
|
137
161
|
return __generator(this, function (_a) {
|
|
138
162
|
switch (_a.label) {
|
|
139
163
|
case 0:
|
|
@@ -148,9 +172,9 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
148
172
|
_a.sent();
|
|
149
173
|
return [2 /*return*/, { success: true }];
|
|
150
174
|
case 3:
|
|
151
|
-
|
|
152
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
153
|
-
throw
|
|
175
|
+
error_3 = _a.sent();
|
|
176
|
+
FirmaUtil_1.FirmaUtil.printLog(error_3);
|
|
177
|
+
throw error_3;
|
|
154
178
|
case 4: return [2 /*return*/];
|
|
155
179
|
}
|
|
156
180
|
});
|
|
@@ -158,7 +182,7 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
158
182
|
};
|
|
159
183
|
FirmaWalletService.prototype.getPrivateKeyInternal = function (mnemonic, accountIndex) {
|
|
160
184
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
-
var mnemonicChecked, seed, hdpath, privkey, privateKey,
|
|
185
|
+
var mnemonicChecked, seed, hdpath, privkey, privateKey, error_4;
|
|
162
186
|
return __generator(this, function (_a) {
|
|
163
187
|
switch (_a.label) {
|
|
164
188
|
case 0:
|
|
@@ -172,9 +196,9 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
172
196
|
privateKey = "0x".concat(Buffer.from(privkey).toString("hex"));
|
|
173
197
|
return [2 /*return*/, privateKey];
|
|
174
198
|
case 2:
|
|
175
|
-
|
|
176
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
177
|
-
throw
|
|
199
|
+
error_4 = _a.sent();
|
|
200
|
+
FirmaUtil_1.FirmaUtil.printLog(error_4);
|
|
201
|
+
throw error_4;
|
|
178
202
|
case 3: return [2 /*return*/];
|
|
179
203
|
}
|
|
180
204
|
});
|
|
@@ -182,7 +206,7 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
182
206
|
};
|
|
183
207
|
FirmaWalletService.prototype.initFromPrivateKey = function (privateKey) {
|
|
184
208
|
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
-
var tempPrivateKey, _a, _b,
|
|
209
|
+
var tempPrivateKey, _a, _b, error_5;
|
|
186
210
|
return __generator(this, function (_c) {
|
|
187
211
|
switch (_c.label) {
|
|
188
212
|
case 0:
|
|
@@ -199,9 +223,9 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
199
223
|
this.privateKey = privateKey;
|
|
200
224
|
return [3 /*break*/, 4];
|
|
201
225
|
case 3:
|
|
202
|
-
|
|
203
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
204
|
-
throw
|
|
226
|
+
error_5 = _c.sent();
|
|
227
|
+
FirmaUtil_1.FirmaUtil.printLog(error_5);
|
|
228
|
+
throw error_5;
|
|
205
229
|
case 4: return [2 /*return*/];
|
|
206
230
|
}
|
|
207
231
|
});
|
|
@@ -228,7 +252,7 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
228
252
|
};
|
|
229
253
|
FirmaWalletService.prototype.newWallet = function () {
|
|
230
254
|
return __awaiter(this, void 0, void 0, function () {
|
|
231
|
-
var mnemonic, wallet,
|
|
255
|
+
var mnemonic, wallet, error_6;
|
|
232
256
|
return __generator(this, function (_a) {
|
|
233
257
|
switch (_a.label) {
|
|
234
258
|
case 0:
|
|
@@ -241,9 +265,9 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
241
265
|
wallet = _a.sent();
|
|
242
266
|
return [2 /*return*/, wallet];
|
|
243
267
|
case 3:
|
|
244
|
-
|
|
245
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
246
|
-
throw
|
|
268
|
+
error_6 = _a.sent();
|
|
269
|
+
FirmaUtil_1.FirmaUtil.printLog(error_6);
|
|
270
|
+
throw error_6;
|
|
247
271
|
case 4: return [2 /*return*/];
|
|
248
272
|
}
|
|
249
273
|
});
|
|
@@ -252,7 +276,7 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
252
276
|
FirmaWalletService.prototype.fromMnemonic = function (mnemonic, accountIndex) {
|
|
253
277
|
if (accountIndex === void 0) { accountIndex = 0; }
|
|
254
278
|
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
-
var wallet,
|
|
279
|
+
var wallet, error_7;
|
|
256
280
|
return __generator(this, function (_a) {
|
|
257
281
|
switch (_a.label) {
|
|
258
282
|
case 0:
|
|
@@ -263,9 +287,9 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
263
287
|
_a.sent();
|
|
264
288
|
return [2 /*return*/, wallet];
|
|
265
289
|
case 2:
|
|
266
|
-
|
|
267
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
268
|
-
throw
|
|
290
|
+
error_7 = _a.sent();
|
|
291
|
+
FirmaUtil_1.FirmaUtil.printLog(error_7);
|
|
292
|
+
throw error_7;
|
|
269
293
|
case 3: return [2 /*return*/];
|
|
270
294
|
}
|
|
271
295
|
});
|
|
@@ -273,7 +297,7 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
273
297
|
};
|
|
274
298
|
FirmaWalletService.prototype.fromPrivateKey = function (privateKey) {
|
|
275
299
|
return __awaiter(this, void 0, void 0, function () {
|
|
276
|
-
var wallet,
|
|
300
|
+
var wallet, error_8;
|
|
277
301
|
return __generator(this, function (_a) {
|
|
278
302
|
switch (_a.label) {
|
|
279
303
|
case 0:
|
|
@@ -284,9 +308,9 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
284
308
|
_a.sent();
|
|
285
309
|
return [2 /*return*/, wallet];
|
|
286
310
|
case 2:
|
|
287
|
-
|
|
288
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
289
|
-
throw
|
|
311
|
+
error_8 = _a.sent();
|
|
312
|
+
FirmaUtil_1.FirmaUtil.printLog(error_8);
|
|
313
|
+
throw error_8;
|
|
290
314
|
case 3: return [2 /*return*/];
|
|
291
315
|
}
|
|
292
316
|
});
|
|
@@ -294,7 +318,7 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
294
318
|
};
|
|
295
319
|
FirmaWalletService.prototype.generateMnemonic = function () {
|
|
296
320
|
return __awaiter(this, void 0, void 0, function () {
|
|
297
|
-
var wallet,
|
|
321
|
+
var wallet, error_9;
|
|
298
322
|
return __generator(this, function (_a) {
|
|
299
323
|
switch (_a.label) {
|
|
300
324
|
case 0:
|
|
@@ -304,9 +328,9 @@ var FirmaWalletService = /** @class */ (function () {
|
|
|
304
328
|
wallet = _a.sent();
|
|
305
329
|
return [2 /*return*/, wallet.mnemonic];
|
|
306
330
|
case 2:
|
|
307
|
-
|
|
308
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
309
|
-
throw
|
|
331
|
+
error_9 = _a.sent();
|
|
332
|
+
FirmaUtil_1.FirmaUtil.printLog(error_9);
|
|
333
|
+
throw error_9;
|
|
310
334
|
case 3: return [2 /*return*/];
|
|
311
335
|
}
|
|
312
336
|
});
|
|
@@ -26,7 +26,7 @@ export declare class SigningStargateClient extends StargateClient {
|
|
|
26
26
|
static connectWithSigner(endpoint: string, signer: OfflineDirectSigner | undefined, registry: Registry): Promise<SigningStargateClient>;
|
|
27
27
|
protected constructor(tmClient: Tendermint34Client | undefined, signer: OfflineDirectSigner | undefined, registry: Registry);
|
|
28
28
|
signAndBroadcast(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo?: string): Promise<BroadcastTxResponse>;
|
|
29
|
-
static makeSignDocForSend(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, serverUrl: string, chainId: string, registry: Registry): Promise<SignDoc>;
|
|
29
|
+
static makeSignDocForSend(signerAddress: string, pubkeyStr: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, serverUrl: string, chainId: string, registry: Registry): Promise<SignDoc>;
|
|
30
30
|
sign(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, explicitSignerData?: SignerData): Promise<TxRaw>;
|
|
31
31
|
getChainId(): Promise<string>;
|
|
32
32
|
/**
|
|
@@ -134,7 +134,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
|
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
136
|
};
|
|
137
|
-
SigningStargateClient.makeSignDocForSend = function (signerAddress, messages, fee, memo, serverUrl, chainId, registry) {
|
|
137
|
+
SigningStargateClient.makeSignDocForSend = function (signerAddress, pubkeyStr, messages, fee, memo, serverUrl, chainId, registry) {
|
|
138
138
|
return __awaiter(this, void 0, void 0, function () {
|
|
139
139
|
var _a, accountNumber, sequence, account, rawSecp256k1Pubkey, pubkey, txBodyEncodeObject, txBodyBytes, gasLimit, authInfoBytes;
|
|
140
140
|
return __generator(this, function (_b) {
|
|
@@ -149,7 +149,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
|
|
|
149
149
|
account = _b.sent();
|
|
150
150
|
if (account == null)
|
|
151
151
|
throw new Error("Failed to retrieve account from signer");
|
|
152
|
-
rawSecp256k1Pubkey = (0, encoding_1.fromBase64)(
|
|
152
|
+
rawSecp256k1Pubkey = (0, encoding_1.fromBase64)(pubkeyStr);
|
|
153
153
|
pubkey = (0, proto_signing_1.encodePubkey)((0, encoding_3.encodeSecp256k1Pubkey)(rawSecp256k1Pubkey));
|
|
154
154
|
txBodyEncodeObject = {
|
|
155
155
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|