@pioneer-platform/ripple-network 8.3.3 → 8.3.4
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 +35 -12
- package/package.json +9 -3
package/lib/index.js
CHANGED
|
@@ -209,16 +209,37 @@ 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, response, output, e_3;
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
var tag, NOWNODES_API_KEY, serverInfoResponse, currentLedgerIndex, response, output, e_3;
|
|
213
|
+
var _a, _b;
|
|
214
|
+
return __generator(this, function (_c) {
|
|
215
|
+
switch (_c.label) {
|
|
215
216
|
case 0:
|
|
216
217
|
tag = TAG + " | get_account_info | ";
|
|
217
|
-
|
|
218
|
+
_c.label = 1;
|
|
218
219
|
case 1:
|
|
219
|
-
|
|
220
|
+
_c.trys.push([1, 4, , 5]);
|
|
220
221
|
log.debug(tag, "Getting account info for:", address);
|
|
221
222
|
NOWNODES_API_KEY = process.env['NOW_NODES_API'];
|
|
223
|
+
return [4 /*yield*/, axios({
|
|
224
|
+
url: URL_NODE,
|
|
225
|
+
method: 'POST',
|
|
226
|
+
data: {
|
|
227
|
+
"method": "server_info",
|
|
228
|
+
"params": []
|
|
229
|
+
},
|
|
230
|
+
headers: {
|
|
231
|
+
'Content-Type': 'application/json',
|
|
232
|
+
'api-key': NOWNODES_API_KEY
|
|
233
|
+
}
|
|
234
|
+
})];
|
|
235
|
+
case 2:
|
|
236
|
+
serverInfoResponse = _c.sent();
|
|
237
|
+
currentLedgerIndex = undefined;
|
|
238
|
+
if (serverInfoResponse.data && serverInfoResponse.data.result && serverInfoResponse.data.result.info) {
|
|
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
|
+
}
|
|
222
243
|
return [4 /*yield*/, axios({
|
|
223
244
|
url: URL_NODE,
|
|
224
245
|
method: 'POST',
|
|
@@ -234,23 +255,25 @@ var get_account_info = function (address) {
|
|
|
234
255
|
'api-key': NOWNODES_API_KEY
|
|
235
256
|
}
|
|
236
257
|
})];
|
|
237
|
-
case
|
|
238
|
-
response =
|
|
258
|
+
case 3:
|
|
259
|
+
response = _c.sent();
|
|
239
260
|
if (response.data && response.data.result && response.data.result.account_data) {
|
|
240
261
|
output = response.data.result.account_data;
|
|
241
|
-
|
|
262
|
+
// Set the current ledger index from server_info
|
|
263
|
+
output.ledger_index_current = currentLedgerIndex ? parseInt(currentLedgerIndex) : undefined;
|
|
242
264
|
log.debug(tag, "Account info retrieved successfully");
|
|
265
|
+
log.debug(tag, "ledger_index_current set to:", output.ledger_index_current);
|
|
243
266
|
return [2 /*return*/, output];
|
|
244
267
|
}
|
|
245
268
|
else {
|
|
246
269
|
throw new Error("Invalid response from NowNodes API");
|
|
247
270
|
}
|
|
248
|
-
return [3 /*break*/,
|
|
249
|
-
case
|
|
250
|
-
e_3 =
|
|
271
|
+
return [3 /*break*/, 5];
|
|
272
|
+
case 4:
|
|
273
|
+
e_3 = _c.sent();
|
|
251
274
|
log.error(tag, "Error getting account info: ", e_3.message);
|
|
252
275
|
throw e_3;
|
|
253
|
-
case
|
|
276
|
+
case 5: return [2 /*return*/];
|
|
254
277
|
}
|
|
255
278
|
});
|
|
256
279
|
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/ripple-network",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.4",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"description": "Pioneer Platform Ripple Network module with NowNodes integration",
|
|
7
|
-
"keywords": [
|
|
7
|
+
"keywords": [
|
|
8
|
+
"ripple",
|
|
9
|
+
"xrp",
|
|
10
|
+
"blockchain",
|
|
11
|
+
"nownodes",
|
|
12
|
+
"pioneer"
|
|
13
|
+
],
|
|
8
14
|
"scripts": {
|
|
9
15
|
"create": "pnpm run build && pnpm run test",
|
|
10
16
|
"build": "tsc -p .",
|
|
@@ -21,4 +27,4 @@
|
|
|
21
27
|
"typescript": "^5.0.4"
|
|
22
28
|
},
|
|
23
29
|
"gitHead": "aeae28273014ab69b42f22abec159c6693a56c40"
|
|
24
|
-
}
|
|
30
|
+
}
|