@pioneer-platform/cosmos-network 8.1.19 → 8.1.25

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 (3) hide show
  1. package/lib/index.d.ts +19 -2
  2. package/lib/index.js +461 -189
  3. package/package.json +11 -6
package/lib/index.d.ts CHANGED
@@ -5,6 +5,7 @@ declare const axios: any;
5
5
  declare const log: any;
6
6
  declare let wait: any;
7
7
  declare let sleep: any;
8
+ declare const txEncoder: any;
8
9
  declare const ASSET = "ATOM";
9
10
  declare let nodes: any;
10
11
  declare let publicNode: any;
@@ -14,7 +15,21 @@ declare let RUNTIME: any;
14
15
  declare let get_mempool: () => Promise<any>;
15
16
  declare let check_online_status: () => Promise<any>;
16
17
  declare let get_balance: (address: string) => Promise<number>;
17
- declare let get_balances: (address: string) => Promise<any>;
18
+ declare let get_voucher_info: (voucher: string) => Promise<any>;
19
+ declare let get_balances: (address: string) => Promise<({
20
+ type: string;
21
+ asset: string;
22
+ denom: string;
23
+ balance: any;
24
+ } | {
25
+ type: string;
26
+ ibc: boolean;
27
+ voucherId: any;
28
+ asset: string;
29
+ denom: any;
30
+ channel: any;
31
+ balance: number;
32
+ })[]>;
18
33
  declare let get_delegations_txs_address: (address: string) => Promise<any>;
19
34
  declare let get_rewards: (address: string) => Promise<any>;
20
35
  declare let get_delegations_by_address: (address: string) => Promise<any>;
@@ -29,12 +44,14 @@ declare let get_txs_by_height: (height: string) => Promise<any>;
29
44
  declare let get_block: (height: string) => Promise<any>;
30
45
  declare let get_account: (address: string) => Promise<any>;
31
46
  declare let get_account_remote: (address: string) => Promise<any>;
47
+ declare let encode_transaction: (tx: string) => Promise<any>;
32
48
  declare let broadcast_transaction: (tx: string) => Promise<any>;
49
+ declare let broadcast_transaction_legacy: (tx: string) => Promise<any>;
33
50
  declare let get_node_info: () => Promise<any>;
34
51
  declare let get_node_info_verbose: () => Promise<any>;
35
52
  declare let get_node_syncing: () => Promise<any>;
36
53
  declare let get_node_version: () => Promise<any>;
37
54
  declare let normalize_tx: (tx: any, type: any) => any;
38
- declare let get_txs_by_address: (address: string) => Promise<any[]>;
55
+ declare let get_txs_by_address: (address: string) => Promise<any>;
39
56
  declare let getTransaction: (txid: string) => Promise<any>;
40
57
  declare let getStakingInfo: (address: string, valAddress: string) => Promise<any>;
package/lib/index.js CHANGED
@@ -59,7 +59,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
59
59
  function verb(n) { return function (v) { return step([n, v]); }; }
60
60
  function step(op) {
61
61
  if (f) throw new TypeError("Generator is already executing.");
62
- while (_) try {
62
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
63
63
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
64
64
  if (y = 0, t) op = [op[0] & 2, t.value];
65
65
  switch (op[0]) {
@@ -111,6 +111,8 @@ var axios = Axios.create({
111
111
  var log = require('@pioneer-platform/loggerdog')();
112
112
  var wait = require('wait-promise');
113
113
  var sleep = wait.sleep;
114
+ //encoder
115
+ var txEncoder = require('@pioneer-platform/cosmos-tx-encoder');
114
116
  var ASSET = "ATOM";
115
117
  var nodes = require('@pioneer-platform/nodes');
116
118
  var publicNode = nodes.getNode('cosmos', 'gaiad');
@@ -180,9 +182,15 @@ module.exports = {
180
182
  getBlockHeightRemote: function () {
181
183
  return get_block_height_remote();
182
184
  },
185
+ encode: function (tx) {
186
+ return encode_transaction(tx);
187
+ },
183
188
  broadcast: function (tx) {
184
189
  return broadcast_transaction(tx);
185
190
  },
191
+ broadcastLegacy: function (tx) {
192
+ return broadcast_transaction_legacy(tx);
193
+ },
186
194
  getAccount: function (address) {
187
195
  return get_account(address);
188
196
  },
@@ -201,6 +209,12 @@ module.exports = {
201
209
  getValidatorsByHeight: function (height) {
202
210
  return get_validators_at_height(height);
203
211
  },
212
+ // txs: function(addr) {
213
+ // return Promise.all([
214
+ // req(`GET`, `/txs?sender=${addr}`)(),
215
+ // req(`GET`, `/txs?recipient=${addr}`)()
216
+ // ]).then(([senderTxs, recipientTxs]) => [].concat(senderTxs, recipientTxs))
217
+ // },
204
218
  };
205
219
  var get_mempool = function () {
206
220
  return __awaiter(this, void 0, void 0, function () {
@@ -277,7 +291,7 @@ var get_balance = function (address) {
277
291
  return [4 /*yield*/, axios({ method: 'GET', url: URL_GAIAD + '/bank/balances/' + address })];
278
292
  case 2:
279
293
  accountInfo = _a.sent();
280
- log.debug(tag, "accountInfo: ", accountInfo);
294
+ log.info(tag, "accountInfo: ", accountInfo.data);
281
295
  if (accountInfo && accountInfo.data && accountInfo.data.result) {
282
296
  for (i = 0; i < accountInfo.data.result.length; i++) {
283
297
  entry = accountInfo.data.result[i];
@@ -295,78 +309,169 @@ var get_balance = function (address) {
295
309
  });
296
310
  });
297
311
  };
298
- var get_balances = function (address) {
312
+ var get_voucher_info = function (voucher) {
299
313
  return __awaiter(this, void 0, void 0, function () {
300
- var tag, output, accountInfo, rewards, delegations, totalDelegated, i, delegation, e_5;
314
+ var tag, url, txInfo, e_5;
301
315
  return __generator(this, function (_a) {
302
316
  switch (_a.label) {
303
317
  case 0:
304
- tag = TAG + " | get_pioneer_status | ";
305
- output = {};
318
+ tag = TAG + " | get_voucher_info | ";
306
319
  _a.label = 1;
307
320
  case 1:
308
- _a.trys.push([1, 5, , 6]);
309
- return [4 /*yield*/, get_account(address)];
321
+ _a.trys.push([1, 3, , 4]);
322
+ url = URL_GAIAD + '/ibc/applications/transfer/v1beta1/denom_traces/' + voucher;
323
+ log.debug(tag, "url: ", url);
324
+ return [4 /*yield*/, axios({ method: 'GET', url: url })];
310
325
  case 2:
311
- accountInfo = _a.sent();
312
- log.debug(tag, "accountInfo: ", accountInfo);
313
- log.debug(tag, "accountInfo.result.value: ", accountInfo.result.value.coins[0].amount);
314
- if (accountInfo && accountInfo.result && accountInfo.result.value.coins[0]) {
315
- log.debug(tag, "accountInfo: ", accountInfo.result.value.coins[0].amount);
316
- output.available = accountInfo.result.value.coins[0].amount / ATOM_BASE;
317
- }
318
- else {
319
- output.available = 0;
320
- }
321
- return [4 /*yield*/, get_rewards(address)];
326
+ txInfo = _a.sent();
327
+ log.debug(tag, "txInfo: ", txInfo.data);
328
+ return [2 /*return*/, txInfo.data];
322
329
  case 3:
323
- rewards = _a.sent();
324
- log.debug(tag, "rewards: ", rewards);
325
- if (rewards && rewards.result && rewards.result.total[0]) {
326
- log.debug(tag, "rewards: ", rewards.result.total[0].amount);
327
- output.rewards = rewards.result.total[0].amount / ATOM_BASE;
328
- }
329
- else {
330
- output.rewards = 0;
331
- }
332
- return [4 /*yield*/, get_delegations_by_address(address)];
330
+ e_5 = _a.sent();
331
+ throw e_5;
332
+ case 4: return [2 /*return*/];
333
+ }
334
+ });
335
+ });
336
+ };
337
+ var get_balances = function (address) {
338
+ var _a;
339
+ return __awaiter(this, void 0, void 0, function () {
340
+ var tag, output, accountInfo, i, entry, balance, voucher, voucherInfo, balance, e_6, e_7;
341
+ return __generator(this, function (_b) {
342
+ switch (_b.label) {
343
+ case 0:
344
+ tag = TAG + " | get_balances | ";
345
+ _b.label = 1;
346
+ case 1:
347
+ _b.trys.push([1, 10, , 11]);
348
+ output = [];
349
+ _b.label = 2;
350
+ case 2:
351
+ _b.trys.push([2, 8, , 9]);
352
+ return [4 /*yield*/, axios({ method: 'GET', url: URL_GAIAD + '/bank/balances/' + address })];
353
+ case 3:
354
+ accountInfo = _b.sent();
355
+ log.info(tag, "accountInfo: ", accountInfo.data);
356
+ if (!((_a = accountInfo.data) === null || _a === void 0 ? void 0 : _a.result)) return [3 /*break*/, 7];
357
+ i = 0;
358
+ _b.label = 4;
333
359
  case 4:
334
- delegations = _a.sent();
335
- log.debug(tag, "delegations: ", delegations);
336
- totalDelegated = 0;
337
- for (i = 0; i < delegations.length; i++) {
338
- delegation = delegations[i];
339
- log.debug(tag, "delegation: ", delegation);
340
- totalDelegated = totalDelegated + parseFloat(delegation.balance);
360
+ if (!(i < accountInfo.data.result.length)) return [3 /*break*/, 7];
361
+ entry = accountInfo.data.result[i];
362
+ if (entry.denom === 'uosmo') {
363
+ balance = {
364
+ type: 'balance',
365
+ asset: 'OSMO',
366
+ denom: 'uosmo',
367
+ balance: entry.amount
368
+ };
369
+ output.push(balance);
341
370
  }
342
- // @ts-ignore
343
- totalDelegated = totalDelegated / ATOM_BASE;
344
- log.debug(tag, "totalDelegated: ", totalDelegated);
345
- output.delegated = totalDelegated;
346
- //TODO totalRewardsPerBlock
347
- // let totalRewardsPerBlock = 0
348
- // for(let i = 0; i < rewards.result.rewards.length; i++){
349
- // let reward = rewards.result.rewards[i]
350
- // log.debug(tag,"reward: ",reward)
351
- // //get rewards per block
352
- //
353
- // }
354
- output.totalRewardsPerBlock = 0;
355
- //output.rewardsPerBlock = rewardsPerBlock
356
- //TODO unbonding
357
- output.unbonding = 0;
358
- return [2 /*return*/, output];
371
+ if (!(entry.denom.indexOf('ibc/') >= 0)) return [3 /*break*/, 6];
372
+ voucher = entry.denom.replace('ibc/', '');
373
+ log.debug(tag, "voucher: ", voucher);
374
+ return [4 /*yield*/, get_voucher_info(voucher)];
359
375
  case 5:
360
- e_5 = _a.sent();
361
- throw e_5;
362
- case 6: return [2 /*return*/];
376
+ voucherInfo = _b.sent();
377
+ log.debug(tag, "voucherInfo: ", voucherInfo);
378
+ if (voucherInfo.denom_trace.base_denom === 'uatom') {
379
+ balance = {
380
+ type: 'ibcChannel',
381
+ ibc: true,
382
+ voucherId: entry.denom,
383
+ asset: 'ATOM',
384
+ denom: voucherInfo.denom_trace.base_denom,
385
+ channel: voucherInfo.denom_trace.path,
386
+ balance: entry.amount / 1000000
387
+ };
388
+ output.push(balance);
389
+ }
390
+ else {
391
+ //TODO lookup base_denum to asset
392
+ //handle more assets
393
+ }
394
+ _b.label = 6;
395
+ case 6:
396
+ i++;
397
+ return [3 /*break*/, 4];
398
+ case 7: return [3 /*break*/, 9];
399
+ case 8:
400
+ e_6 = _b.sent();
401
+ return [3 /*break*/, 9];
402
+ case 9: return [2 /*return*/, output];
403
+ case 10:
404
+ e_7 = _b.sent();
405
+ log.error(tag, "e: ", e_7);
406
+ throw e_7;
407
+ case 11: return [2 /*return*/];
363
408
  }
364
409
  });
365
410
  });
366
411
  };
412
+ // let get_balances = async function(address:string){
413
+ // let tag = TAG + " | get_balances | "
414
+ // let output:any = {}
415
+ // try{
416
+ //
417
+ // let accountInfo = await get_account(address)
418
+ // log.debug(tag,"accountInfo: ",accountInfo)
419
+ // log.debug(tag,"accountInfo.result.value: ",accountInfo.result.value.coins[0].amount)
420
+ // if(accountInfo && accountInfo.result && accountInfo.result.value.coins[0]){
421
+ // log.debug(tag,"accountInfo: ", accountInfo.result.value.coins[0].amount )
422
+ // output.available = accountInfo.result.value.coins[0].amount / ATOM_BASE
423
+ // } else {
424
+ // output.available = 0
425
+ // }
426
+ //
427
+ //
428
+ // let rewards = await get_rewards(address)
429
+ // log.debug(tag,"rewards: ",rewards)
430
+ //
431
+ // if(rewards && rewards.result && rewards.result.total[0]){
432
+ // log.debug(tag,"rewards: ",rewards.result.total[0].amount)
433
+ // output.rewards = rewards.result.total[0].amount / ATOM_BASE
434
+ // } else {
435
+ // output.rewards = 0
436
+ // }
437
+ //
438
+ // //get current blockheight
439
+ // //let lastBlock = await get_block_height()
440
+ //
441
+ // let delegations = await get_delegations_by_address(address)
442
+ // log.debug(tag,"delegations: ",delegations)
443
+ // let totalDelegated = 0
444
+ // for(let i = 0; i < delegations.length; i++){
445
+ // let delegation = delegations[i]
446
+ // log.debug(tag,"delegation: ",delegation)
447
+ // totalDelegated = totalDelegated + parseFloat(delegation.balance)
448
+ // }
449
+ // // @ts-ignore
450
+ // totalDelegated = totalDelegated / ATOM_BASE
451
+ // log.debug(tag,"totalDelegated: ",totalDelegated)
452
+ // output.delegated = totalDelegated
453
+ //
454
+ // //TODO totalRewardsPerBlock
455
+ // // let totalRewardsPerBlock = 0
456
+ // // for(let i = 0; i < rewards.result.rewards.length; i++){
457
+ // // let reward = rewards.result.rewards[i]
458
+ // // log.debug(tag,"reward: ",reward)
459
+ // // //get rewards per block
460
+ // //
461
+ // // }
462
+ // output.totalRewardsPerBlock = 0
463
+ // //output.rewardsPerBlock = rewardsPerBlock
464
+ // //TODO unbonding
465
+ // output.unbonding = 0
466
+ //
467
+ // return output
468
+ // }catch(e){
469
+ // throw e
470
+ // }
471
+ // }
367
472
  var get_delegations_txs_address = function (address) {
368
473
  return __awaiter(this, void 0, void 0, function () {
369
- var tag, output, resp, output_4, e_6;
474
+ var tag, output, resp, output_4, e_8;
370
475
  return __generator(this, function (_a) {
371
476
  switch (_a.label) {
372
477
  case 0:
@@ -382,8 +487,8 @@ var get_delegations_txs_address = function (address) {
382
487
  output_4 = resp.data;
383
488
  return [2 /*return*/, output_4];
384
489
  case 3:
385
- e_6 = _a.sent();
386
- throw e_6;
490
+ e_8 = _a.sent();
491
+ throw e_8;
387
492
  case 4: return [2 /*return*/];
388
493
  }
389
494
  });
@@ -391,7 +496,7 @@ var get_delegations_txs_address = function (address) {
391
496
  };
392
497
  var get_rewards = function (address) {
393
498
  return __awaiter(this, void 0, void 0, function () {
394
- var tag, output, resp, output_5, e_7;
499
+ var tag, output, resp, output_5, e_9;
395
500
  return __generator(this, function (_a) {
396
501
  switch (_a.label) {
397
502
  case 0:
@@ -407,8 +512,8 @@ var get_rewards = function (address) {
407
512
  output_5 = resp.data;
408
513
  return [2 /*return*/, output_5];
409
514
  case 3:
410
- e_7 = _a.sent();
411
- throw e_7;
515
+ e_9 = _a.sent();
516
+ throw e_9;
412
517
  case 4: return [2 /*return*/];
413
518
  }
414
519
  });
@@ -416,7 +521,7 @@ var get_rewards = function (address) {
416
521
  };
417
522
  var get_delegations_by_address = function (address) {
418
523
  return __awaiter(this, void 0, void 0, function () {
419
- var tag, output, resp, output_6, e_8;
524
+ var tag, output, resp, output_6, e_10;
420
525
  return __generator(this, function (_a) {
421
526
  switch (_a.label) {
422
527
  case 0:
@@ -432,8 +537,8 @@ var get_delegations_by_address = function (address) {
432
537
  output_6 = resp.data.result;
433
538
  return [2 /*return*/, output_6];
434
539
  case 3:
435
- e_8 = _a.sent();
436
- throw e_8;
540
+ e_10 = _a.sent();
541
+ throw e_10;
437
542
  case 4: return [2 /*return*/];
438
543
  }
439
544
  });
@@ -441,7 +546,7 @@ var get_delegations_by_address = function (address) {
441
546
  };
442
547
  var get_delegations_by_validator = function (address, validator) {
443
548
  return __awaiter(this, void 0, void 0, function () {
444
- var tag, output, resp, output_7, e_9;
549
+ var tag, output, resp, output_7, e_11;
445
550
  return __generator(this, function (_a) {
446
551
  switch (_a.label) {
447
552
  case 0:
@@ -457,8 +562,8 @@ var get_delegations_by_validator = function (address, validator) {
457
562
  output_7 = resp.data.result;
458
563
  return [2 /*return*/, output_7];
459
564
  case 3:
460
- e_9 = _a.sent();
461
- throw e_9;
565
+ e_11 = _a.sent();
566
+ throw e_11;
462
567
  case 4: return [2 /*return*/];
463
568
  }
464
569
  });
@@ -466,7 +571,7 @@ var get_delegations_by_validator = function (address, validator) {
466
571
  };
467
572
  var get_current_validators = function () {
468
573
  return __awaiter(this, void 0, void 0, function () {
469
- var tag, output, resp, output_8, e_10;
574
+ var tag, output, resp, output_8, e_12;
470
575
  return __generator(this, function (_a) {
471
576
  switch (_a.label) {
472
577
  case 0:
@@ -482,8 +587,8 @@ var get_current_validators = function () {
482
587
  output_8 = resp.data.result;
483
588
  return [2 /*return*/, output_8];
484
589
  case 3:
485
- e_10 = _a.sent();
486
- throw e_10;
590
+ e_12 = _a.sent();
591
+ throw e_12;
487
592
  case 4: return [2 /*return*/];
488
593
  }
489
594
  });
@@ -491,7 +596,7 @@ var get_current_validators = function () {
491
596
  };
492
597
  var get_last_commit = function () {
493
598
  return __awaiter(this, void 0, void 0, function () {
494
- var tag, output, resp, output_9, e_11;
599
+ var tag, output, resp, output_9, e_13;
495
600
  return __generator(this, function (_a) {
496
601
  switch (_a.label) {
497
602
  case 0:
@@ -507,8 +612,8 @@ var get_last_commit = function () {
507
612
  output_9 = resp.data;
508
613
  return [2 /*return*/, output_9];
509
614
  case 3:
510
- e_11 = _a.sent();
511
- throw e_11;
615
+ e_13 = _a.sent();
616
+ throw e_13;
512
617
  case 4: return [2 /*return*/];
513
618
  }
514
619
  });
@@ -516,7 +621,7 @@ var get_last_commit = function () {
516
621
  };
517
622
  var get_block_height = function () {
518
623
  return __awaiter(this, void 0, void 0, function () {
519
- var tag, output, resp, height, e_12;
624
+ var tag, output, resp, height, e_14;
520
625
  return __generator(this, function (_a) {
521
626
  switch (_a.label) {
522
627
  case 0:
@@ -532,8 +637,8 @@ var get_block_height = function () {
532
637
  height = resp.data.block.header.height;
533
638
  return [2 /*return*/, parseInt(height)];
534
639
  case 3:
535
- e_12 = _a.sent();
536
- throw e_12;
640
+ e_14 = _a.sent();
641
+ throw e_14;
537
642
  case 4: return [2 /*return*/];
538
643
  }
539
644
  });
@@ -541,7 +646,7 @@ var get_block_height = function () {
541
646
  };
542
647
  var get_block_height_remote = function () {
543
648
  return __awaiter(this, void 0, void 0, function () {
544
- var tag, output, lastBlockRemote, e_13;
649
+ var tag, output, lastBlockRemote, e_15;
545
650
  return __generator(this, function (_a) {
546
651
  switch (_a.label) {
547
652
  case 0:
@@ -556,8 +661,8 @@ var get_block_height_remote = function () {
556
661
  log.debug(tag, "lastBlockRemote: ", lastBlockRemote.data.block.header.height);
557
662
  return [2 /*return*/, lastBlockRemote.data];
558
663
  case 3:
559
- e_13 = _a.sent();
560
- throw e_13;
664
+ e_15 = _a.sent();
665
+ throw e_15;
561
666
  case 4: return [2 /*return*/];
562
667
  }
563
668
  });
@@ -565,7 +670,7 @@ var get_block_height_remote = function () {
565
670
  };
566
671
  var get_validators_at_height = function (height) {
567
672
  return __awaiter(this, void 0, void 0, function () {
568
- var tag, output, txInfo, e_14;
673
+ var tag, output, txInfo, e_16;
569
674
  return __generator(this, function (_a) {
570
675
  switch (_a.label) {
571
676
  case 0:
@@ -582,8 +687,8 @@ var get_validators_at_height = function (height) {
582
687
  log.debug(tag, "txInfo: ", txInfo.data);
583
688
  return [2 /*return*/, txInfo.data];
584
689
  case 3:
585
- e_14 = _a.sent();
586
- throw e_14;
690
+ e_16 = _a.sent();
691
+ throw e_16;
587
692
  case 4: return [2 /*return*/];
588
693
  }
589
694
  });
@@ -591,7 +696,7 @@ var get_validators_at_height = function (height) {
591
696
  };
592
697
  var get_validators = function () {
593
698
  return __awaiter(this, void 0, void 0, function () {
594
- var tag, output, txInfo, e_15;
699
+ var tag, output, txInfo, e_17;
595
700
  return __generator(this, function (_a) {
596
701
  switch (_a.label) {
597
702
  case 0:
@@ -607,8 +712,8 @@ var get_validators = function () {
607
712
  log.debug(tag, "txInfo: ", txInfo.data);
608
713
  return [2 /*return*/, txInfo.data];
609
714
  case 3:
610
- e_15 = _a.sent();
611
- throw e_15;
715
+ e_17 = _a.sent();
716
+ throw e_17;
612
717
  case 4: return [2 /*return*/];
613
718
  }
614
719
  });
@@ -616,7 +721,7 @@ var get_validators = function () {
616
721
  };
617
722
  var get_txs_by_height = function (height) {
618
723
  return __awaiter(this, void 0, void 0, function () {
619
- var tag, output, nodeHeight, txInfo, e_16;
724
+ var tag, output, nodeHeight, txInfo, e_18;
620
725
  return __generator(this, function (_a) {
621
726
  switch (_a.label) {
622
727
  case 0:
@@ -635,14 +740,16 @@ var get_txs_by_height = function (height) {
635
740
  // @ts-ignore
636
741
  if (nodeHeight < height)
637
742
  throw Error("102: unable to get block! ");
638
- return [4 /*yield*/, axios({ method: 'GET', url: URL_GAIAD + '/txs?tx.height=' + height })];
743
+ return [4 /*yield*/, axios({ method: 'GET', url: URL_GAIAD + '/cosmos/tx/v1beta1/txs?events=tx.height=' + height })];
639
744
  case 3:
640
745
  txInfo = _a.sent();
641
- log.debug(tag, "txInfo: ", txInfo.data);
642
- return [2 /*return*/, txInfo.data.txs];
746
+ log.info(tag, "txInfo: ", txInfo);
747
+ log.info(tag, "txInfo: ", txInfo.data);
748
+ return [2 /*return*/, txInfo.data.tx_responses];
643
749
  case 4:
644
- e_16 = _a.sent();
645
- throw e_16;
750
+ e_18 = _a.sent();
751
+ console.error(e_18);
752
+ throw e_18;
646
753
  case 5: return [2 /*return*/];
647
754
  }
648
755
  });
@@ -650,7 +757,7 @@ var get_txs_by_height = function (height) {
650
757
  };
651
758
  var get_block = function (height) {
652
759
  return __awaiter(this, void 0, void 0, function () {
653
- var tag, output, txInfo, e_17;
760
+ var tag, output, txInfo, e_19;
654
761
  return __generator(this, function (_a) {
655
762
  switch (_a.label) {
656
763
  case 0:
@@ -667,9 +774,9 @@ var get_block = function (height) {
667
774
  log.debug(tag, "txInfo: ", txInfo.data);
668
775
  return [2 /*return*/, txInfo.data];
669
776
  case 3:
670
- e_17 = _a.sent();
777
+ e_19 = _a.sent();
671
778
  //TODO dont shh error fix em
672
- throw e_17;
779
+ throw e_19;
673
780
  case 4: return [2 /*return*/];
674
781
  }
675
782
  });
@@ -701,7 +808,7 @@ var get_block = function (height) {
701
808
  */
702
809
  var get_account = function (address) {
703
810
  return __awaiter(this, void 0, void 0, function () {
704
- var tag, output, txInfo, e_18;
811
+ var tag, output, txInfo, e_20;
705
812
  return __generator(this, function (_a) {
706
813
  switch (_a.label) {
707
814
  case 0:
@@ -718,8 +825,8 @@ var get_account = function (address) {
718
825
  log.debug(tag, "txInfo: ", txInfo.data);
719
826
  return [2 /*return*/, txInfo.data];
720
827
  case 3:
721
- e_18 = _a.sent();
722
- throw e_18;
828
+ e_20 = _a.sent();
829
+ throw e_20;
723
830
  case 4: return [2 /*return*/];
724
831
  }
725
832
  });
@@ -727,7 +834,7 @@ var get_account = function (address) {
727
834
  };
728
835
  var get_account_remote = function (address) {
729
836
  return __awaiter(this, void 0, void 0, function () {
730
- var tag, output, txInfo, e_19;
837
+ var tag, output, txInfo, e_21;
731
838
  return __generator(this, function (_a) {
732
839
  switch (_a.label) {
733
840
  case 0:
@@ -743,13 +850,70 @@ var get_account_remote = function (address) {
743
850
  log.debug(tag, "txInfo: ", txInfo.data);
744
851
  return [2 /*return*/, txInfo.data];
745
852
  case 3:
746
- e_19 = _a.sent();
747
- throw e_19;
853
+ e_21 = _a.sent();
854
+ throw e_21;
748
855
  case 4: return [2 /*return*/];
749
856
  }
750
857
  });
751
858
  });
752
859
  };
860
+ var encode_transaction = function (tx) {
861
+ return __awaiter(this, void 0, void 0, function () {
862
+ var tag, output, payload, urlRemote, result2, e_22, e_23;
863
+ return __generator(this, function (_a) {
864
+ switch (_a.label) {
865
+ case 0:
866
+ tag = TAG + " | encode_transaction | ";
867
+ output = {};
868
+ _a.label = 1;
869
+ case 1:
870
+ _a.trys.push([1, 6, , 7]);
871
+ log.debug(tag, "CHECKPOINT 1");
872
+ output.success = false;
873
+ _a.label = 2;
874
+ case 2:
875
+ _a.trys.push([2, 4, , 5]);
876
+ payload = {
877
+ "tx_bytes": btoa(tx),
878
+ "mode": "BROADCAST_MODE_SYNC"
879
+ };
880
+ urlRemote = URL_GAIAD + '/txs/encode';
881
+ log.info(tag, "urlRemote: ", urlRemote);
882
+ return [4 /*yield*/, axios({
883
+ url: urlRemote,
884
+ headers: {
885
+ 'api-key': process.env['NOW_NODES_API'],
886
+ 'Content-Type': 'application/json'
887
+ },
888
+ method: 'POST',
889
+ data: payload,
890
+ })];
891
+ case 3:
892
+ result2 = _a.sent();
893
+ log.info(tag, '** Broadcast ** REMOTE: result: ', result2.data);
894
+ return [3 /*break*/, 5];
895
+ case 4:
896
+ e_22 = _a.sent();
897
+ //log.error(tag,"failed second broadcast e: ",e.response)
898
+ log.error(tag, e_22);
899
+ // log.error(tag,e.response)
900
+ // log.error(tag,e.response.data)
901
+ // log.error(tag,e.response.data.error)
902
+ // log.error(tag,e.response.data.error.indexOf('RPC error -32603 - Internal error: Tx already exists in cache'))
903
+ //throw e
904
+ output.success = false;
905
+ output.error = e_22.response.data.error;
906
+ return [3 /*break*/, 5];
907
+ case 5: return [2 /*return*/, output];
908
+ case 6:
909
+ e_23 = _a.sent();
910
+ console.error(tag, "throw error: ", e_23);
911
+ return [2 /*return*/, output];
912
+ case 7: return [2 /*return*/];
913
+ }
914
+ });
915
+ });
916
+ };
753
917
  /*
754
918
 
755
919
  The tx must be a signed StdTx. The supported broadcast modes include "block"(return after tx commit), "sync"(return afer CheckTx) and "async"(return right away).
@@ -821,7 +985,111 @@ The tx must be a signed StdTx. The supported broadcast modes include "block"(ret
821
985
  */
822
986
  var broadcast_transaction = function (tx) {
823
987
  return __awaiter(this, void 0, void 0, function () {
824
- var tag, output, urlRemote, result2, logSend, e_20, e_21;
988
+ var tag, output, payload, urlRemote, result2, logSend, e_24, e_25;
989
+ return __generator(this, function (_a) {
990
+ switch (_a.label) {
991
+ case 0:
992
+ tag = TAG + " | broadcast_transaction | ";
993
+ output = {};
994
+ _a.label = 1;
995
+ case 1:
996
+ _a.trys.push([1, 6, , 7]);
997
+ log.debug(tag, "CHECKPOINT 1");
998
+ output.success = false;
999
+ _a.label = 2;
1000
+ case 2:
1001
+ _a.trys.push([2, 4, , 5]);
1002
+ payload = {
1003
+ // "tx_bytes": btoa(tx),
1004
+ // "tx_bytes":broadcastTx,
1005
+ "tx_bytes": tx,
1006
+ "mode": "BROADCAST_MODE_SYNC"
1007
+ };
1008
+ urlRemote = URL_GAIAD + '/cosmos/tx/v1beta1/txs';
1009
+ // let urlRemote = URL_GAIAD+ '/txs'
1010
+ log.info(tag, "urlRemote: ", urlRemote);
1011
+ return [4 /*yield*/, axios({
1012
+ url: urlRemote,
1013
+ headers: {
1014
+ 'api-key': process.env['NOW_NODES_API'],
1015
+ 'Content-Type': 'application/json'
1016
+ },
1017
+ method: 'POST',
1018
+ data: payload,
1019
+ })];
1020
+ case 3:
1021
+ result2 = _a.sent();
1022
+ log.info(tag, '** Broadcast ** REMOTE: result: ', result2.data);
1023
+ log.info(tag, '** Broadcast ** REMOTE: result: ', JSON.stringify(result2.data));
1024
+ if (result2.data.txhash)
1025
+ output.txid = result2.data.txhash;
1026
+ //push to seed
1027
+ // let urlRemote = URL_GAIAD+ '/broadcast_tx_sync?tx='+tx
1028
+ // log.info(tag,"urlRemote: ",urlRemote)
1029
+ // let result2 = await axios({
1030
+ // url: urlRemote,
1031
+ // headers: {
1032
+ // 'api-key': process.env['NOW_NODES_API'],
1033
+ // 'Content-Type': 'application/json'
1034
+ // },
1035
+ // method: 'GET'
1036
+ // })
1037
+ // log.info(tag,'** Broadcast ** REMOTE: result: ', result2.data)
1038
+ // if(result2.data.txhash) output.txid = result2.data.txhash
1039
+ // let urlRemote = URL_GAIAD+ '/broadcast_tx_sync'
1040
+ // log.info(tag,"urlRemote: ",urlRemote)
1041
+ // let result2 = await axios({
1042
+ // url: urlRemote,
1043
+ // headers: {
1044
+ // 'api-key': process.env['NOW_NODES_API'],
1045
+ // 'Content-Type': 'application/json'
1046
+ // },
1047
+ // method: 'POST',
1048
+ // data: tx,
1049
+ // })
1050
+ // log.info(tag,'** Broadcast ** REMOTE: result: ', result2.data)
1051
+ // if(result2.data.txhash) output.txid = result2.data.txhash
1052
+ //verify success
1053
+ if (result2.data.raw_log) {
1054
+ logSend = result2.data.raw_log;
1055
+ log.debug(tag, "logSend: ", logSend);
1056
+ }
1057
+ if (result2.data.code === 4) {
1058
+ output.success = false;
1059
+ }
1060
+ else {
1061
+ output.success = true;
1062
+ }
1063
+ output.height = result2.height;
1064
+ output.gas_wanted = result2.gas_wanted;
1065
+ output.gas_used = result2.gas_used;
1066
+ output.raw = result2.data.raw_log;
1067
+ return [3 /*break*/, 5];
1068
+ case 4:
1069
+ e_24 = _a.sent();
1070
+ //log.error(tag,"failed second broadcast e: ",e.response)
1071
+ log.error(tag, e_24);
1072
+ log.error(tag, e_24.response);
1073
+ log.error(tag, e_24.response.data);
1074
+ // log.error(tag,e.response.data.error)
1075
+ // log.error(tag,e.response.data.error.indexOf('RPC error -32603 - Internal error: Tx already exists in cache'))
1076
+ //throw e
1077
+ output.success = false;
1078
+ output.error = e_24.response.data.error;
1079
+ return [3 /*break*/, 5];
1080
+ case 5: return [2 /*return*/, output];
1081
+ case 6:
1082
+ e_25 = _a.sent();
1083
+ console.error(tag, "throw error: ", e_25);
1084
+ return [2 /*return*/, output];
1085
+ case 7: return [2 /*return*/];
1086
+ }
1087
+ });
1088
+ });
1089
+ };
1090
+ var broadcast_transaction_legacy = function (tx) {
1091
+ return __awaiter(this, void 0, void 0, function () {
1092
+ var tag, output, urlRemote, result2, logSend, e_26, e_27;
825
1093
  return __generator(this, function (_a) {
826
1094
  switch (_a.label) {
827
1095
  case 0:
@@ -835,7 +1103,7 @@ var broadcast_transaction = function (tx) {
835
1103
  _a.label = 2;
836
1104
  case 2:
837
1105
  _a.trys.push([2, 4, , 5]);
838
- urlRemote = URL_GAIAD + '/txs';
1106
+ urlRemote = "https://atom.nownodes.io" + '/txs';
839
1107
  log.debug(tag, "urlRemote: ", urlRemote);
840
1108
  return [4 /*yield*/, axios({
841
1109
  url: urlRemote,
@@ -852,31 +1120,33 @@ var broadcast_transaction = function (tx) {
852
1120
  logSend = result2.data.raw_log;
853
1121
  log.debug(tag, "logSend: ", logSend);
854
1122
  }
1123
+ if (result2.data.code === 4) {
1124
+ output.success = false;
1125
+ }
1126
+ else {
1127
+ output.success = true;
1128
+ }
855
1129
  output.height = result2.height;
856
1130
  output.gas_wanted = result2.gas_wanted;
857
1131
  output.gas_used = result2.gas_used;
858
- output.raw = result2.data;
1132
+ output.raw = result2.data.raw_log;
859
1133
  return [3 /*break*/, 5];
860
1134
  case 4:
861
- e_20 = _a.sent();
1135
+ e_26 = _a.sent();
862
1136
  //log.error(tag,"failed second broadcast e: ",e.response)
863
- log.error(tag, e_20);
864
- log.error(tag, e_20.response);
865
- log.error(tag, e_20.response.data);
866
- log.error(tag, e_20.response.data.error);
867
- log.error(tag, e_20.response.data.error.indexOf('RPC error -32603 - Internal error: Tx already exists in cache'));
1137
+ log.error(tag, e_26);
1138
+ log.error(tag, e_26.response);
1139
+ log.error(tag, e_26.response.data);
1140
+ // log.error(tag,e.response.data.error)
1141
+ // log.error(tag,e.response.data.error.indexOf('RPC error -32603 - Internal error: Tx already exists in cache'))
868
1142
  //throw e
869
1143
  output.success = false;
870
- output.error = e_20.response.data.error;
1144
+ output.error = e_26.response.data.error;
871
1145
  return [3 /*break*/, 5];
872
- case 5:
873
- if (output.txid) {
874
- output.success = true;
875
- }
876
- return [2 /*return*/, output];
1146
+ case 5: return [2 /*return*/, output];
877
1147
  case 6:
878
- e_21 = _a.sent();
879
- console.error(tag, "throw error: ", e_21);
1148
+ e_27 = _a.sent();
1149
+ console.error(tag, "throw error: ", e_27);
880
1150
  return [2 /*return*/, output];
881
1151
  case 7: return [2 /*return*/];
882
1152
  }
@@ -885,7 +1155,7 @@ var broadcast_transaction = function (tx) {
885
1155
  };
886
1156
  var get_node_info = function () {
887
1157
  return __awaiter(this, void 0, void 0, function () {
888
- var tag, output, output_10, nodeInfo, e_22;
1158
+ var tag, output, output_10, nodeInfo, e_28;
889
1159
  return __generator(this, function (_a) {
890
1160
  switch (_a.label) {
891
1161
  case 0:
@@ -901,8 +1171,8 @@ var get_node_info = function () {
901
1171
  log.debug(tag, "nodeInfo: ", nodeInfo.data);
902
1172
  return [2 /*return*/, output_10];
903
1173
  case 3:
904
- e_22 = _a.sent();
905
- throw e_22;
1174
+ e_28 = _a.sent();
1175
+ throw e_28;
906
1176
  case 4: return [2 /*return*/];
907
1177
  }
908
1178
  });
@@ -910,7 +1180,7 @@ var get_node_info = function () {
910
1180
  };
911
1181
  var get_node_info_verbose = function () {
912
1182
  return __awaiter(this, void 0, void 0, function () {
913
- var tag, output, output_11, syncInfo, nodeInfo, lastBlockRemote, lastBlock, e_23;
1183
+ var tag, output, output_11, nodeInfo, e_29;
914
1184
  return __generator(this, function (_a) {
915
1185
  switch (_a.label) {
916
1186
  case 0:
@@ -918,30 +1188,32 @@ var get_node_info_verbose = function () {
918
1188
  output = {};
919
1189
  _a.label = 1;
920
1190
  case 1:
921
- _a.trys.push([1, 6, , 7]);
1191
+ _a.trys.push([1, 3, , 4]);
922
1192
  output_11 = {};
923
- return [4 /*yield*/, axios({ method: 'GET', url: URL_GAIAD + '/syncing' })];
1193
+ return [4 /*yield*/, axios({
1194
+ method: 'GET',
1195
+ headers: {
1196
+ 'api-key': process.env['NOW_NODES_API'],
1197
+ 'Content-Type': 'application/json'
1198
+ },
1199
+ url: URL_GAIAD + '/node_info'
1200
+ })];
924
1201
  case 2:
925
- syncInfo = _a.sent();
926
- log.debug(tag, "syncInfo: ", syncInfo.data);
927
- output_11.isSyncing = syncInfo.data;
928
- return [4 /*yield*/, axios({ method: 'GET', url: URL_GAIAD + '/node_info' })];
929
- case 3:
930
1202
  nodeInfo = _a.sent();
931
- log.debug(tag, "nodeInfo: ", nodeInfo.data);
932
- output_11 = nodeInfo.data;
933
- return [4 /*yield*/, axios({ method: 'GET', url: URL_GAIAD + '/blocks/latest' })];
934
- case 4:
935
- lastBlockRemote = _a.sent();
936
- log.debug(tag, "lastBlockRemote: ", lastBlockRemote.data);
937
- //let hheight
938
- output_11.remoteHeight = lastBlockRemote.data.block_meta.header.height;
939
- return [4 /*yield*/, axios({ method: 'GET', url: URL_GAIAD + '/blocks/latest' })];
940
- case 5:
941
- lastBlock = _a.sent();
942
- log.debug(tag, "lastBlock: ", lastBlock.data);
943
- //let height
944
- output_11.height = lastBlock.data.block_meta.header.height;
1203
+ log.info(tag, "nodeInfo: ", nodeInfo.data);
1204
+ // output = nodeInfo.data
1205
+ //
1206
+ // let lastBlockRemote = await axios({method:'GET',url: URL_GAIAD+'/blocks/latest'})
1207
+ // log.debug(tag,"lastBlockRemote: ",lastBlockRemote.data)
1208
+ //
1209
+ // //let height
1210
+ // output.remoteHeight = lastBlockRemote.data.block_meta.header.height
1211
+ //
1212
+ // let lastBlock = await axios({method:'GET',url: URL_GAIAD+'/blocks/latest'})
1213
+ // log.debug(tag,"lastBlock: ",lastBlock.data)
1214
+ //
1215
+ // //let height
1216
+ // output.height = lastBlock.data.block_meta.header.height
945
1217
  //estimate time till synced
946
1218
  //get block height
947
1219
  // await sleep(1000)
@@ -962,17 +1234,17 @@ var get_node_info_verbose = function () {
962
1234
  //get block height
963
1235
  //let lastBlock = await axios({method:'GET',url:URL+'/node_info'})
964
1236
  return [2 /*return*/, output_11];
965
- case 6:
966
- e_23 = _a.sent();
967
- throw e_23;
968
- case 7: return [2 /*return*/];
1237
+ case 3:
1238
+ e_29 = _a.sent();
1239
+ throw e_29;
1240
+ case 4: return [2 /*return*/];
969
1241
  }
970
1242
  });
971
1243
  });
972
1244
  };
973
1245
  var get_node_syncing = function () {
974
1246
  return __awaiter(this, void 0, void 0, function () {
975
- var tag, output, txInfo, e_24;
1247
+ var tag, output, txInfo, e_30;
976
1248
  return __generator(this, function (_a) {
977
1249
  switch (_a.label) {
978
1250
  case 0:
@@ -987,8 +1259,8 @@ var get_node_syncing = function () {
987
1259
  log.debug(tag, "txInfo: ", txInfo.data);
988
1260
  return [2 /*return*/, txInfo.data];
989
1261
  case 3:
990
- e_24 = _a.sent();
991
- throw e_24;
1262
+ e_30 = _a.sent();
1263
+ throw e_30;
992
1264
  case 4: return [2 /*return*/];
993
1265
  }
994
1266
  });
@@ -996,7 +1268,7 @@ var get_node_syncing = function () {
996
1268
  };
997
1269
  var get_node_version = function () {
998
1270
  return __awaiter(this, void 0, void 0, function () {
999
- var tag, output, txInfo, e_25;
1271
+ var tag, output, txInfo, e_31;
1000
1272
  return __generator(this, function (_a) {
1001
1273
  switch (_a.label) {
1002
1274
  case 0:
@@ -1011,8 +1283,8 @@ var get_node_version = function () {
1011
1283
  log.debug(tag, "txInfo: ", txInfo.data);
1012
1284
  return [2 /*return*/, txInfo.data];
1013
1285
  case 3:
1014
- e_25 = _a.sent();
1015
- throw e_25;
1286
+ e_31 = _a.sent();
1287
+ throw e_31;
1016
1288
  case 4: return [2 /*return*/];
1017
1289
  }
1018
1290
  });
@@ -1059,7 +1331,7 @@ var normalize_tx = function (tx, type) {
1059
1331
  };
1060
1332
  var get_txs_by_address = function (address) {
1061
1333
  return __awaiter(this, void 0, void 0, function () {
1062
- var tag, output, output_12, url, resultSends, sends, i, tx, resultRecieves, receives, i, tx, e_26;
1334
+ var tag, output, output_12, url, resultSends, sends, e_32;
1063
1335
  return __generator(this, function (_a) {
1064
1336
  switch (_a.label) {
1065
1337
  case 0:
@@ -1067,10 +1339,10 @@ var get_txs_by_address = function (address) {
1067
1339
  output = {};
1068
1340
  _a.label = 1;
1069
1341
  case 1:
1070
- _a.trys.push([1, 4, , 5]);
1342
+ _a.trys.push([1, 3, , 4]);
1071
1343
  log.debug(tag, "checkpoint: ", address);
1072
1344
  output_12 = [];
1073
- url = URL_GAIAD + '/txs?message.sender=' + address;
1345
+ url = URL_GAIAD + '/cosmos/tx/v1beta1/txs?events=transfer.recipient=%27' + address + '%27&events=message.module=%27ibc_client%27';
1074
1346
  log.debug(tag, "url: ", url);
1075
1347
  return [4 /*yield*/, axios({
1076
1348
  url: url,
@@ -1079,34 +1351,34 @@ var get_txs_by_address = function (address) {
1079
1351
  case 2:
1080
1352
  resultSends = _a.sent();
1081
1353
  sends = resultSends.data;
1082
- log.debug('sends: ', sends);
1354
+ // log.debug('sends: ', sends)
1355
+ console.log("resp: ", sends.tx_responses);
1083
1356
  // TODO//pagnation
1084
1357
  // let pagesSends = sends.page_number
1085
1358
  // for(let i = 0; i < pagesSends; i++){
1086
1359
  //
1087
1360
  // }
1088
- for (i = 0; i < sends.txs.length; i++) {
1089
- tx = sends.txs[i];
1090
- //normalize
1091
- //tx = normalize_tx(tx,'send')
1092
- output_12.push(tx);
1093
- }
1361
+ // for(let i = 0; i < sends.txs.length; i++ ){
1362
+ // let tx = sends.txs[i]
1363
+ // //normalize
1364
+ // //tx = normalize_tx(tx,'send')
1365
+ // output.push(tx)
1366
+ // }
1094
1367
  //receives
1095
- url = URL_GAIAD + '/txs?transfer.recipient=' + address;
1096
- return [4 /*yield*/, axios({
1097
- url: url,
1098
- method: 'GET'
1099
- })];
1100
- case 3:
1101
- resultRecieves = _a.sent();
1102
- receives = resultRecieves.data;
1103
- log.debug('receives: ', receives);
1104
- for (i = 0; i < receives.txs.length; i++) {
1105
- tx = receives.txs[i];
1106
- //normalize
1107
- //tx = normalize_tx(tx,'receive')
1108
- output_12.push(tx);
1109
- }
1368
+ // url = URL_GAIAD+ '/txs?transfer.recipient='+address
1369
+ // let resultRecieves = await axios({
1370
+ // url: url,
1371
+ // method: 'GET'
1372
+ // })
1373
+ // let receives = resultRecieves.data
1374
+ // log.debug('receives: ', receives)
1375
+ //
1376
+ // for(let i = 0; i < receives.txs.length; i++ ){
1377
+ // let tx = receives.txs[i]
1378
+ // //normalize
1379
+ // //tx = normalize_tx(tx,'receive')
1380
+ // output.push(tx)
1381
+ // }
1110
1382
  //staking tx's
1111
1383
  // let resultStaking = await axios({method:'GET',url: URL_GAIAD+'/txs?delegator='+address})
1112
1384
  // let stakings = resultStaking.data
@@ -1173,18 +1445,18 @@ var get_txs_by_address = function (address) {
1173
1445
  // output.push(stakeTx)
1174
1446
  // }
1175
1447
  return [2 /*return*/, output_12];
1176
- case 4:
1177
- e_26 = _a.sent();
1178
- console.error(tag, 'Error: ', e_26);
1179
- throw e_26;
1180
- case 5: return [2 /*return*/];
1448
+ case 3:
1449
+ e_32 = _a.sent();
1450
+ console.error(tag, 'Error: ', e_32);
1451
+ throw e_32;
1452
+ case 4: return [2 /*return*/];
1181
1453
  }
1182
1454
  });
1183
1455
  });
1184
1456
  };
1185
1457
  var getTransaction = function (txid) {
1186
1458
  return __awaiter(this, void 0, void 0, function () {
1187
- var tag, output, txInfo, e_27;
1459
+ var tag, output, txInfo, e_33;
1188
1460
  return __generator(this, function (_a) {
1189
1461
  switch (_a.label) {
1190
1462
  case 0:
@@ -1202,8 +1474,8 @@ var getTransaction = function (txid) {
1202
1474
  log.debug(tag, "txInfo: ", txInfo.data);
1203
1475
  return [2 /*return*/, txInfo.data];
1204
1476
  case 3:
1205
- e_27 = _a.sent();
1206
- throw e_27;
1477
+ e_33 = _a.sent();
1478
+ throw e_33;
1207
1479
  case 4: return [2 /*return*/];
1208
1480
  }
1209
1481
  });
@@ -1211,7 +1483,7 @@ var getTransaction = function (txid) {
1211
1483
  };
1212
1484
  var getStakingInfo = function (address, valAddress) {
1213
1485
  return __awaiter(this, void 0, void 0, function () {
1214
- var tag, output, txInfo, e_28;
1486
+ var tag, output, txInfo, e_34;
1215
1487
  return __generator(this, function (_a) {
1216
1488
  switch (_a.label) {
1217
1489
  case 0:
@@ -1226,8 +1498,8 @@ var getStakingInfo = function (address, valAddress) {
1226
1498
  log.debug(tag, "txInfo: ", txInfo.data);
1227
1499
  return [2 /*return*/, txInfo.data];
1228
1500
  case 3:
1229
- e_28 = _a.sent();
1230
- throw e_28;
1501
+ e_34 = _a.sent();
1502
+ throw e_34;
1231
1503
  case 4: return [2 /*return*/];
1232
1504
  }
1233
1505
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/cosmos-network",
3
- "version": "8.1.19",
3
+ "version": "8.1.25",
4
4
  "scripts": {
5
5
  "create": "npm run build && npm run test",
6
6
  "build": "tsc -p .",
@@ -9,12 +9,13 @@
9
9
  "refresh": "rm -rf ./node_modules ./package-lock.json && npm install"
10
10
  },
11
11
  "dependencies": {
12
- "@pioneer-platform/loggerdog": "^8.1.17",
13
- "@pioneer-platform/nodes": "^8.1.17",
14
- "axios": "^0.19.2",
12
+ "@pioneer-platform/cosmos-tx-encoder": "^0.0.9",
13
+ "@pioneer-platform/loggerdog": "^8.1.31",
14
+ "@pioneer-platform/nodes": "^8.1.31",
15
+ "axios": "^1.3.4",
15
16
  "dotenv": "^8.2.0",
16
17
  "https": "^1.0.0",
17
- "typescript": "^3.9.5",
18
+ "typescript": "^5.0.2",
18
19
  "wait-promise": "^0.4.1"
19
20
  },
20
21
  "description": "Cosmos events to redis pub/sub",
@@ -23,7 +24,11 @@
23
24
  "keywords": [
24
25
  "cosmos"
25
26
  ],
27
+ "publishConfig": {
28
+ "access": "public",
29
+ "registry": "https://registry.npmjs.org/"
30
+ },
26
31
  "author": "Bithighlander <pioneer@gmail.com>",
27
32
  "license": "ISC",
28
- "gitHead": "54c5830a9aebf63dc437dd0cdd4bd3ea3edb253f"
33
+ "gitHead": "e1212fa842d8371740282be3f0cce4d32aff3201"
29
34
  }