@firmachain/firma-js 0.2.42 → 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.
|
@@ -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
|
});
|