@pioneer-platform/ripple-network 8.1.42 → 8.1.44
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.d.ts +1 -0
- package/lib/index.js +48 -30
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -108,9 +108,9 @@ module.exports = {
|
|
|
108
108
|
getBalance: function (address) {
|
|
109
109
|
return get_balance(address);
|
|
110
110
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
getAccount: function (address) {
|
|
112
|
+
return get_account_info(address);
|
|
113
|
+
},
|
|
114
114
|
// getLastBlock:function () {
|
|
115
115
|
// return get_last_block();
|
|
116
116
|
// },
|
|
@@ -263,22 +263,33 @@ module.exports = {
|
|
|
263
263
|
//
|
|
264
264
|
// }
|
|
265
265
|
// }
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
266
|
+
var get_account_info = function (address) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
268
|
+
var tag, response, e_1;
|
|
269
|
+
return __generator(this, function (_a) {
|
|
270
|
+
switch (_a.label) {
|
|
271
|
+
case 0:
|
|
272
|
+
tag = TAG + " | get_account_info | ";
|
|
273
|
+
_a.label = 1;
|
|
274
|
+
case 1:
|
|
275
|
+
_a.trys.push([1, 3, , 4]);
|
|
276
|
+
return [4 /*yield*/, client.request({
|
|
277
|
+
"command": "account_info",
|
|
278
|
+
"account": address,
|
|
279
|
+
"ledger_index": "validated"
|
|
280
|
+
})];
|
|
281
|
+
case 2:
|
|
282
|
+
response = _a.sent();
|
|
283
|
+
return [2 /*return*/, response.result.account_data];
|
|
284
|
+
case 3:
|
|
285
|
+
e_1 = _a.sent();
|
|
286
|
+
log.error(tag, "e: ", e_1);
|
|
287
|
+
throw e_1;
|
|
288
|
+
case 4: return [2 /*return*/];
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
};
|
|
282
293
|
// let normalize_tx = function(tx:any,address?:string){
|
|
283
294
|
// let tag = TAG + " | normalize_tx | "
|
|
284
295
|
// try{
|
|
@@ -410,7 +421,7 @@ module.exports = {
|
|
|
410
421
|
// }
|
|
411
422
|
var get_balance = function (address) {
|
|
412
423
|
return __awaiter(this, void 0, void 0, function () {
|
|
413
|
-
var tag, output, response,
|
|
424
|
+
var tag, output, response, e_2;
|
|
414
425
|
return __generator(this, function (_a) {
|
|
415
426
|
switch (_a.label) {
|
|
416
427
|
case 0:
|
|
@@ -423,21 +434,28 @@ var get_balance = function (address) {
|
|
|
423
434
|
"command": "account_info",
|
|
424
435
|
"account": address,
|
|
425
436
|
"ledger_index": "validated"
|
|
426
|
-
})
|
|
437
|
+
})
|
|
438
|
+
// console.log(response)
|
|
439
|
+
// console.log(response.result)
|
|
440
|
+
// console.log(response.result.account_data)
|
|
441
|
+
// console.log(response.result.account_data.Account)
|
|
442
|
+
// console.log(response.result.account_data.Balance)
|
|
443
|
+
// console.log(response.result.account_data.Balance / 1000000)
|
|
444
|
+
];
|
|
427
445
|
case 2:
|
|
428
446
|
response = _a.sent();
|
|
429
|
-
console.log(response)
|
|
430
|
-
console.log(response.result)
|
|
431
|
-
console.log(response.result.account_data)
|
|
432
|
-
console.log(response.result.account_data.Account)
|
|
433
|
-
console.log(response.result.account_data.Balance)
|
|
434
|
-
console.log(response.result.account_data.Balance / 1000000)
|
|
447
|
+
// console.log(response)
|
|
448
|
+
// console.log(response.result)
|
|
449
|
+
// console.log(response.result.account_data)
|
|
450
|
+
// console.log(response.result.account_data.Account)
|
|
451
|
+
// console.log(response.result.account_data.Balance)
|
|
452
|
+
// console.log(response.result.account_data.Balance / 1000000)
|
|
435
453
|
response.result.account_data.Balance = parseFloat(response.result.account_data.Balance) / 1000000;
|
|
436
454
|
return [2 /*return*/, response.result.account_data.Balance];
|
|
437
455
|
case 3:
|
|
438
|
-
|
|
439
|
-
log.error(tag, "e: ",
|
|
440
|
-
throw
|
|
456
|
+
e_2 = _a.sent();
|
|
457
|
+
log.error(tag, "e: ", e_2);
|
|
458
|
+
throw e_2;
|
|
441
459
|
case 4: return [2 /*return*/];
|
|
442
460
|
}
|
|
443
461
|
});
|