@pioneer-platform/ripple-network 8.3.4 → 8.3.5
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/lib/index.js +19 -30
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -209,23 +209,22 @@ var broadcast_transaction = function (tx) {
|
|
|
209
209
|
};
|
|
210
210
|
var get_account_info = function (address) {
|
|
211
211
|
return __awaiter(this, void 0, void 0, function () {
|
|
212
|
-
var tag, NOWNODES_API_KEY,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
switch (_c.label) {
|
|
212
|
+
var tag, NOWNODES_API_KEY, ledgerCurrentResponse, currentLedgerIndex, response, output, e_3;
|
|
213
|
+
return __generator(this, function (_a) {
|
|
214
|
+
switch (_a.label) {
|
|
216
215
|
case 0:
|
|
217
216
|
tag = TAG + " | get_account_info | ";
|
|
218
|
-
|
|
217
|
+
_a.label = 1;
|
|
219
218
|
case 1:
|
|
220
|
-
|
|
219
|
+
_a.trys.push([1, 4, , 5]);
|
|
221
220
|
log.debug(tag, "Getting account info for:", address);
|
|
222
221
|
NOWNODES_API_KEY = process.env['NOW_NODES_API'];
|
|
223
222
|
return [4 /*yield*/, axios({
|
|
224
223
|
url: URL_NODE,
|
|
225
224
|
method: 'POST',
|
|
226
225
|
data: {
|
|
227
|
-
"method": "
|
|
228
|
-
"params": []
|
|
226
|
+
"method": "ledger_current",
|
|
227
|
+
"params": [{}]
|
|
229
228
|
},
|
|
230
229
|
headers: {
|
|
231
230
|
'Content-Type': 'application/json',
|
|
@@ -233,13 +232,9 @@ var get_account_info = function (address) {
|
|
|
233
232
|
}
|
|
234
233
|
})];
|
|
235
234
|
case 2:
|
|
236
|
-
|
|
237
|
-
currentLedgerIndex =
|
|
238
|
-
|
|
239
|
-
currentLedgerIndex = ((_a = serverInfoResponse.data.result.info.validated_ledger) === null || _a === void 0 ? void 0 : _a.seq) ||
|
|
240
|
-
((_b = serverInfoResponse.data.result.info.complete_ledgers) === null || _b === void 0 ? void 0 : _b.split('-').pop());
|
|
241
|
-
log.debug(tag, "Current ledger index from server_info:", currentLedgerIndex);
|
|
242
|
-
}
|
|
235
|
+
ledgerCurrentResponse = _a.sent();
|
|
236
|
+
currentLedgerIndex = ledgerCurrentResponse.data.result.ledger_current_index;
|
|
237
|
+
log.debug(tag, "Current ledger index:", currentLedgerIndex);
|
|
243
238
|
return [4 /*yield*/, axios({
|
|
244
239
|
url: URL_NODE,
|
|
245
240
|
method: 'POST',
|
|
@@ -256,22 +251,16 @@ var get_account_info = function (address) {
|
|
|
256
251
|
}
|
|
257
252
|
})];
|
|
258
253
|
case 3:
|
|
259
|
-
response =
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return [2 /*return*/, output];
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
throw new Error("Invalid response from NowNodes API");
|
|
270
|
-
}
|
|
271
|
-
return [3 /*break*/, 5];
|
|
254
|
+
response = _a.sent();
|
|
255
|
+
log.debug(tag, "Account info response:", response.data);
|
|
256
|
+
output = response.data.result.account_data;
|
|
257
|
+
// Add the current ledger index to the account info
|
|
258
|
+
output.ledger_index_current = currentLedgerIndex;
|
|
259
|
+
log.debug(tag, "Final account info with ledger index:", output);
|
|
260
|
+
return [2 /*return*/, output];
|
|
272
261
|
case 4:
|
|
273
|
-
e_3 =
|
|
274
|
-
log.error(tag, "Error getting account info:
|
|
262
|
+
e_3 = _a.sent();
|
|
263
|
+
log.error(tag, "Error getting account info:", e_3);
|
|
275
264
|
throw e_3;
|
|
276
265
|
case 5: return [2 /*return*/];
|
|
277
266
|
}
|