@pioneer-platform/ripple-network 8.3.3 → 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.
Files changed (2) hide show
  1. package/lib/index.js +28 -16
  2. package/package.json +9 -3
package/lib/index.js CHANGED
@@ -209,16 +209,32 @@ 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;
212
+ var tag, NOWNODES_API_KEY, ledgerCurrentResponse, currentLedgerIndex, response, output, e_3;
213
213
  return __generator(this, function (_a) {
214
214
  switch (_a.label) {
215
215
  case 0:
216
216
  tag = TAG + " | get_account_info | ";
217
217
  _a.label = 1;
218
218
  case 1:
219
- _a.trys.push([1, 3, , 4]);
219
+ _a.trys.push([1, 4, , 5]);
220
220
  log.debug(tag, "Getting account info for:", address);
221
221
  NOWNODES_API_KEY = process.env['NOW_NODES_API'];
222
+ return [4 /*yield*/, axios({
223
+ url: URL_NODE,
224
+ method: 'POST',
225
+ data: {
226
+ "method": "ledger_current",
227
+ "params": [{}]
228
+ },
229
+ headers: {
230
+ 'Content-Type': 'application/json',
231
+ 'api-key': NOWNODES_API_KEY
232
+ }
233
+ })];
234
+ case 2:
235
+ ledgerCurrentResponse = _a.sent();
236
+ currentLedgerIndex = ledgerCurrentResponse.data.result.ledger_current_index;
237
+ log.debug(tag, "Current ledger index:", currentLedgerIndex);
222
238
  return [4 /*yield*/, axios({
223
239
  url: URL_NODE,
224
240
  method: 'POST',
@@ -234,23 +250,19 @@ var get_account_info = function (address) {
234
250
  'api-key': NOWNODES_API_KEY
235
251
  }
236
252
  })];
237
- case 2:
238
- response = _a.sent();
239
- if (response.data && response.data.result && response.data.result.account_data) {
240
- output = response.data.result.account_data;
241
- output.ledger_index_current = response.data.result.ledger_current_index;
242
- log.debug(tag, "Account info retrieved successfully");
243
- return [2 /*return*/, output];
244
- }
245
- else {
246
- throw new Error("Invalid response from NowNodes API");
247
- }
248
- return [3 /*break*/, 4];
249
253
  case 3:
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];
261
+ case 4:
250
262
  e_3 = _a.sent();
251
- log.error(tag, "Error getting account info: ", e_3.message);
263
+ log.error(tag, "Error getting account info:", e_3);
252
264
  throw e_3;
253
- case 4: return [2 /*return*/];
265
+ case 5: return [2 /*return*/];
254
266
  }
255
267
  });
256
268
  });
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@pioneer-platform/ripple-network",
3
- "version": "8.3.3",
3
+ "version": "8.3.5",
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": ["ripple", "xrp", "blockchain", "nownodes", "pioneer"],
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
+ }