@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 CHANGED
@@ -22,4 +22,5 @@ declare let client: {
22
22
  /**********************************
23
23
  // Lib
24
24
  //**********************************/
25
+ declare let get_account_info: (address: string) => Promise<any>;
25
26
  declare let get_balance: (address: string) => Promise<any>;
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
- // getAccount:function (address:string) {
112
- // return get_account_info(address);
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
- // let get_account_info = async function(address:string){
268
- // let tag = TAG + " | get_account_info | "
269
- // try{
270
- // //
271
- // console.log("URL ",URL_THORNODE+'/auth/accounts/'+address)
272
- // let txInfo = await axios({method:'GET',url: URL_THORNODE+'/auth/accounts/'+address})
273
- // log.debug(tag,"txInfo: ",txInfo.data)
274
- //
275
- // return txInfo.data
276
- // }catch(e){
277
- // log.error(tag,"e: ",e)
278
- // throw e
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, e_1;
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
- e_1 = _a.sent();
439
- log.error(tag, "e: ", e_1);
440
- throw e_1;
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/ripple-network",
3
- "version": "8.1.42",
3
+ "version": "8.1.44",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "scripts": {