@pioneer-platform/osmosis-network 8.1.35 → 8.1.37

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/LICENSE +674 -0
  2. package/lib/index.js +328 -85
  3. package/package.json +5 -4
package/lib/index.js CHANGED
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  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;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -79,6 +79,8 @@ https://github.com/osmosis-labs/osmosis-frontend/tree/master/src/stores/osmosis/
79
79
  */
80
80
  var pjson = require("../package.json");
81
81
  var TAG = " | " + pjson.name.replace("@pioneer-platform/", "") + " | ";
82
+ // @ts-ignore
83
+ var lodash_1 = require("lodash");
82
84
  require("dotenv").config({ path: '../../../.env' });
83
85
  var Axios = require('axios');
84
86
  var https = require('https');
@@ -134,6 +136,9 @@ module.exports = {
134
136
  getPools: function () {
135
137
  return get_pools();
136
138
  },
139
+ getPool: function (pair) {
140
+ return get_pool(pair);
141
+ },
137
142
  getValidators: function () {
138
143
  return get_validators();
139
144
  },
@@ -152,11 +157,29 @@ module.exports = {
152
157
  getBlock: function (block) {
153
158
  return get_block(block);
154
159
  },
160
+ getEpochProvisions: function () {
161
+ return get_epoch_provisions();
162
+ },
155
163
  getTransaction: function (txid) {
156
164
  return get_transaction(txid);
157
165
  },
158
- getStakingTxs: function (address) {
159
- return get_staking_txs(address);
166
+ getMintParams: function () {
167
+ return get_mint_params();
168
+ },
169
+ getSupply: function (denom) {
170
+ return get_total_supply(denom);
171
+ },
172
+ getPoolInfo: function () {
173
+ return get_pool_info();
174
+ },
175
+ getDistrobution: function () {
176
+ return get_distrobution_params();
177
+ },
178
+ getAPR: function () {
179
+ return get_APR();
180
+ },
181
+ getEpochs: function () {
182
+ return get_epochs();
160
183
  },
161
184
  transaction: function (txid) {
162
185
  return get_transaction(txid);
@@ -168,9 +191,215 @@ module.exports = {
168
191
  /**********************************
169
192
  // Lib
170
193
  //**********************************/
194
+ var get_APR = function () {
195
+ return __awaiter(this, void 0, void 0, function () {
196
+ var tag, mintParams, distributionProportions, getEpochs, epochProvisionInfo, durationSeconds, epochProvision, poolInfo, bondedToken, mintingEpochProvision, yearMintingProvision, totalSupply, ratio, inflation, apr, e_1;
197
+ return __generator(this, function (_a) {
198
+ switch (_a.label) {
199
+ case 0:
200
+ tag = TAG + " | get_APR | ";
201
+ _a.label = 1;
202
+ case 1:
203
+ _a.trys.push([1, 6, , 7]);
204
+ return [4 /*yield*/, get_mint_params()];
205
+ case 2:
206
+ mintParams = _a.sent();
207
+ log.info(tag, "mintParams:", mintParams);
208
+ distributionProportions = mintParams.params.distribution_proportions.staking;
209
+ log.info(tag, "distributionProportions:", distributionProportions);
210
+ return [4 /*yield*/, get_epochs()];
211
+ case 3:
212
+ getEpochs = _a.sent();
213
+ log.info(tag, "getEpochs:", getEpochs);
214
+ epochProvisionInfo = getEpochs.epochs.filter(function (e) { return e.identifier === 'day'; });
215
+ epochProvisionInfo = epochProvisionInfo[0];
216
+ log.info(tag, "epochProvisionInfo:", epochProvisionInfo);
217
+ durationSeconds = epochProvisionInfo.duration.replace("s", "");
218
+ log.info(tag, "durationSeconds:", durationSeconds);
219
+ return [4 /*yield*/, get_epoch_provisions()
220
+ //get bonded tokens
221
+ ];
222
+ case 4:
223
+ epochProvision = _a.sent();
224
+ return [4 /*yield*/, get_pool_info()];
225
+ case 5:
226
+ poolInfo = _a.sent();
227
+ bondedToken = poolInfo.pool.bonded_tokens;
228
+ log.info(tag, "bondedToken:", bondedToken);
229
+ // mintingEpochProvision = epochProvision * distributionProportions
230
+ log.info(tag, "epochProvision:", epochProvision);
231
+ log.info(tag, "distributionProportions:", distributionProportions);
232
+ mintingEpochProvision = epochProvision * distributionProportions;
233
+ log.info(tag, "mintingEpochProvision:", mintingEpochProvision);
234
+ yearMintingProvision = mintingEpochProvision * ((365 * 24 * 3600) / durationSeconds);
235
+ log.info(tag, "yearMintingProvision:", yearMintingProvision);
236
+ totalSupply = 1000000000;
237
+ // //let totalSupply = await get_total_supply('uosmo')
238
+ // log.info(tag,"totalSupply:",totalSupply)
239
+ // totalSupply = totalSupply.result.amount
240
+ // log.info(tag,"totalSupply:",totalSupply)
241
+ if (!totalSupply)
242
+ throw Error("unable to calc APR: missing totalSupply");
243
+ if (!epochProvision)
244
+ throw Error("unable to calc APR: missing epochProvision");
245
+ ratio = bondedToken / totalSupply;
246
+ log.info(tag, "ratio:", ratio);
247
+ inflation = yearMintingProvision / totalSupply;
248
+ log.info(tag, "inflation:", inflation);
249
+ apr = inflation / ratio;
250
+ log.info(tag, "apr:", apr);
251
+ apr = apr * 100;
252
+ return [2 /*return*/, apr];
253
+ case 6:
254
+ e_1 = _a.sent();
255
+ throw e_1;
256
+ case 7: return [2 /*return*/];
257
+ }
258
+ });
259
+ });
260
+ };
261
+ var get_distrobution_params = function () {
262
+ return __awaiter(this, void 0, void 0, function () {
263
+ var tag, output, txInfo, e_2;
264
+ return __generator(this, function (_a) {
265
+ switch (_a.label) {
266
+ case 0:
267
+ tag = TAG + " | get_distrobution_params | ";
268
+ output = {};
269
+ _a.label = 1;
270
+ case 1:
271
+ _a.trys.push([1, 3, , 4]);
272
+ return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/cosmos/distribution/v1beta1/params' })];
273
+ case 2:
274
+ txInfo = _a.sent();
275
+ return [2 /*return*/, txInfo.data];
276
+ case 3:
277
+ e_2 = _a.sent();
278
+ throw e_2;
279
+ case 4: return [2 /*return*/];
280
+ }
281
+ });
282
+ });
283
+ };
284
+ var get_pool_info = function () {
285
+ return __awaiter(this, void 0, void 0, function () {
286
+ var tag, output, txInfo, e_3;
287
+ return __generator(this, function (_a) {
288
+ switch (_a.label) {
289
+ case 0:
290
+ tag = TAG + " | get_pool_info | ";
291
+ output = {};
292
+ _a.label = 1;
293
+ case 1:
294
+ _a.trys.push([1, 3, , 4]);
295
+ return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/cosmos/staking/v1beta1/pool' })];
296
+ case 2:
297
+ txInfo = _a.sent();
298
+ return [2 /*return*/, txInfo.data];
299
+ case 3:
300
+ e_3 = _a.sent();
301
+ throw e_3;
302
+ case 4: return [2 /*return*/];
303
+ }
304
+ });
305
+ });
306
+ };
307
+ var get_epoch_provisions = function () {
308
+ return __awaiter(this, void 0, void 0, function () {
309
+ var tag, output, txInfo, e_4;
310
+ return __generator(this, function (_a) {
311
+ switch (_a.label) {
312
+ case 0:
313
+ tag = TAG + " | get_total_supply | ";
314
+ output = {};
315
+ _a.label = 1;
316
+ case 1:
317
+ _a.trys.push([1, 3, , 4]);
318
+ return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/osmosis/mint/v1beta1/epoch_provisions' })];
319
+ case 2:
320
+ txInfo = _a.sent();
321
+ return [2 /*return*/, txInfo.data.epoch_provisions];
322
+ case 3:
323
+ e_4 = _a.sent();
324
+ throw e_4;
325
+ case 4: return [2 /*return*/];
326
+ }
327
+ });
328
+ });
329
+ };
330
+ var get_total_supply = function (denom) {
331
+ return __awaiter(this, void 0, void 0, function () {
332
+ var tag, output, txInfo, e_5;
333
+ return __generator(this, function (_a) {
334
+ switch (_a.label) {
335
+ case 0:
336
+ tag = TAG + " | get_total_supply | ";
337
+ output = {};
338
+ _a.label = 1;
339
+ case 1:
340
+ _a.trys.push([1, 3, , 4]);
341
+ log.info(tag, "url: ", URL_OSMO_LCD + '/bank/total/' + denom);
342
+ return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/bank/total/' + denom })];
343
+ case 2:
344
+ txInfo = _a.sent();
345
+ return [2 /*return*/, txInfo.data];
346
+ case 3:
347
+ e_5 = _a.sent();
348
+ throw e_5;
349
+ case 4: return [2 /*return*/];
350
+ }
351
+ });
352
+ });
353
+ };
354
+ var get_mint_params = function () {
355
+ return __awaiter(this, void 0, void 0, function () {
356
+ var tag, output, txInfo, e_6;
357
+ return __generator(this, function (_a) {
358
+ switch (_a.label) {
359
+ case 0:
360
+ tag = TAG + " | get_mint_params | ";
361
+ output = {};
362
+ _a.label = 1;
363
+ case 1:
364
+ _a.trys.push([1, 3, , 4]);
365
+ return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/osmosis/mint/v1beta1/params' })];
366
+ case 2:
367
+ txInfo = _a.sent();
368
+ return [2 /*return*/, txInfo.data];
369
+ case 3:
370
+ e_6 = _a.sent();
371
+ throw e_6;
372
+ case 4: return [2 /*return*/];
373
+ }
374
+ });
375
+ });
376
+ };
377
+ var get_epochs = function () {
378
+ return __awaiter(this, void 0, void 0, function () {
379
+ var tag, output, txInfo, e_7;
380
+ return __generator(this, function (_a) {
381
+ switch (_a.label) {
382
+ case 0:
383
+ tag = TAG + " | get_epochs | ";
384
+ output = {};
385
+ _a.label = 1;
386
+ case 1:
387
+ _a.trys.push([1, 3, , 4]);
388
+ return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + "/osmosis/epochs/v1beta1/epochs" })];
389
+ case 2:
390
+ txInfo = _a.sent();
391
+ return [2 /*return*/, txInfo.data];
392
+ case 3:
393
+ e_7 = _a.sent();
394
+ throw e_7;
395
+ case 4: return [2 /*return*/];
396
+ }
397
+ });
398
+ });
399
+ };
171
400
  var get_voucher_info = function (voucher) {
172
401
  return __awaiter(this, void 0, void 0, function () {
173
- var tag, url, txInfo, e_1;
402
+ var tag, url, txInfo, e_8;
174
403
  return __generator(this, function (_a) {
175
404
  switch (_a.label) {
176
405
  case 0:
@@ -179,15 +408,15 @@ var get_voucher_info = function (voucher) {
179
408
  case 1:
180
409
  _a.trys.push([1, 3, , 4]);
181
410
  url = URL_OSMO_LCD + '/ibc/applications/transfer/v1beta1/denom_traces/' + voucher;
182
- log.debug(tag, "url: ", url);
411
+ log.info(tag, "url: ", url);
183
412
  return [4 /*yield*/, axios({ method: 'GET', url: url })];
184
413
  case 2:
185
414
  txInfo = _a.sent();
186
- log.debug(tag, "txInfo: ", txInfo.data);
415
+ log.info(tag, "txInfo: ", txInfo.data);
187
416
  return [2 /*return*/, txInfo.data];
188
417
  case 3:
189
- e_1 = _a.sent();
190
- throw e_1;
418
+ e_8 = _a.sent();
419
+ throw e_8;
191
420
  case 4: return [2 /*return*/];
192
421
  }
193
422
  });
@@ -195,7 +424,7 @@ var get_voucher_info = function (voucher) {
195
424
  };
196
425
  var get_block = function (height) {
197
426
  return __awaiter(this, void 0, void 0, function () {
198
- var tag, output, txInfo, e_2;
427
+ var tag, output, txInfo, e_9;
199
428
  return __generator(this, function (_a) {
200
429
  switch (_a.label) {
201
430
  case 0:
@@ -227,9 +456,9 @@ var get_block = function (height) {
227
456
  log.debug(tag, "txInfo: ", txInfo.data.block.data.txs);
228
457
  return [2 /*return*/, txInfo.data];
229
458
  case 3:
230
- e_2 = _a.sent();
459
+ e_9 = _a.sent();
231
460
  //TODO dont shh error fix em
232
- throw e_2;
461
+ throw e_9;
233
462
  case 4: return [2 /*return*/];
234
463
  }
235
464
  });
@@ -237,7 +466,7 @@ var get_block = function (height) {
237
466
  };
238
467
  var get_staking_txs = function (address) {
239
468
  return __awaiter(this, void 0, void 0, function () {
240
- var tag, output, txInfo, e_3;
469
+ var tag, output, txInfo, e_10;
241
470
  return __generator(this, function (_a) {
242
471
  switch (_a.label) {
243
472
  case 0:
@@ -252,8 +481,8 @@ var get_staking_txs = function (address) {
252
481
  log.debug(tag, "txInfo: ", txInfo.data);
253
482
  return [2 /*return*/, txInfo.data];
254
483
  case 3:
255
- e_3 = _a.sent();
256
- throw e_3;
484
+ e_10 = _a.sent();
485
+ throw e_10;
257
486
  case 4: return [2 /*return*/];
258
487
  }
259
488
  });
@@ -261,7 +490,7 @@ var get_staking_txs = function (address) {
261
490
  };
262
491
  var get_rewards = function (address) {
263
492
  return __awaiter(this, void 0, void 0, function () {
264
- var tag, output, resp, output_1, e_4;
493
+ var tag, output, resp, output_1, e_11;
265
494
  return __generator(this, function (_a) {
266
495
  switch (_a.label) {
267
496
  case 0:
@@ -277,8 +506,8 @@ var get_rewards = function (address) {
277
506
  output_1 = resp.data;
278
507
  return [2 /*return*/, output_1];
279
508
  case 3:
280
- e_4 = _a.sent();
281
- throw e_4;
509
+ e_11 = _a.sent();
510
+ throw e_11;
282
511
  case 4: return [2 /*return*/];
283
512
  }
284
513
  });
@@ -287,7 +516,7 @@ var get_rewards = function (address) {
287
516
  //
288
517
  var get_block_height = function () {
289
518
  return __awaiter(this, void 0, void 0, function () {
290
- var tag, output, resp, height, e_5;
519
+ var tag, output, resp, height, e_12;
291
520
  return __generator(this, function (_a) {
292
521
  switch (_a.label) {
293
522
  case 0:
@@ -303,32 +532,55 @@ var get_block_height = function () {
303
532
  height = resp.data.block.header.height;
304
533
  return [2 /*return*/, parseInt(height)];
305
534
  case 3:
306
- e_5 = _a.sent();
307
- throw e_5;
535
+ e_12 = _a.sent();
536
+ throw e_12;
308
537
  case 4: return [2 /*return*/];
309
538
  }
310
539
  });
311
540
  });
312
541
  };
313
- var get_pool = function (poolId) {
542
+ //get pools
543
+ var get_pool = function (pair) {
314
544
  return __awaiter(this, void 0, void 0, function () {
315
- var tag, output, poolInfo, e_6;
545
+ var tag, output, assets, poolInfo, sellAssetDenom_1, buyAssetDenom_1, foundPool, e_13;
316
546
  return __generator(this, function (_a) {
317
547
  switch (_a.label) {
318
548
  case 0:
319
- tag = TAG + " | get_pools | ";
549
+ tag = TAG + " | get_pool | ";
320
550
  output = {};
321
551
  _a.label = 1;
322
552
  case 1:
323
553
  _a.trys.push([1, 3, , 4]);
324
- return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/osmosis/gamm/v1beta1/pool/' + poolId })];
554
+ if (pair.indexOf("_") === -1)
555
+ throw Error("Pair needs to use _ example (ATOM_OSMO)");
556
+ assets = pair.split("_");
557
+ if (assets[0] === 'ATOM')
558
+ assets[0] = "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2";
559
+ if (assets[1] === 'ATOM')
560
+ assets[1] = "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2";
561
+ if (assets[0] === 'OSMO')
562
+ assets[0] = "uosmo";
563
+ if (assets[1] === 'OSMO')
564
+ assets[1] = "uosmo";
565
+ return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/osmosis/gamm/v1beta1/pools' })
566
+ // log.debug(tag,"poolInfo: ",poolInfo.data)
567
+ ];
325
568
  case 2:
326
569
  poolInfo = _a.sent();
327
- log.debug(tag, "poolInfo: ", poolInfo.data);
328
- return [2 /*return*/, poolInfo.data];
570
+ sellAssetDenom_1 = assets[0];
571
+ buyAssetDenom_1 = assets[1];
572
+ foundPool = (0, lodash_1.find)(poolInfo.data.pools, function (pool) {
573
+ var token0Denom = pool.poolAssets[0].token.denom;
574
+ var token1Denom = pool.poolAssets[1].token.denom;
575
+ return ((token0Denom === sellAssetDenom_1 && token1Denom === buyAssetDenom_1) ||
576
+ (token0Denom === buyAssetDenom_1 && token1Denom === sellAssetDenom_1));
577
+ });
578
+ if (!foundPool)
579
+ throw new Error('Couldnt find pool');
580
+ return [2 /*return*/, foundPool];
329
581
  case 3:
330
- e_6 = _a.sent();
331
- throw e_6;
582
+ e_13 = _a.sent();
583
+ throw e_13;
332
584
  case 4: return [2 /*return*/];
333
585
  }
334
586
  });
@@ -337,7 +589,7 @@ var get_pool = function (poolId) {
337
589
  //get pools
338
590
  var get_pools = function () {
339
591
  return __awaiter(this, void 0, void 0, function () {
340
- var tag, output, poolInfo, e_7;
592
+ var tag, output, poolInfo, e_14;
341
593
  return __generator(this, function (_a) {
342
594
  switch (_a.label) {
343
595
  case 0:
@@ -356,8 +608,8 @@ var get_pools = function () {
356
608
  // log.debug(tag,"txInfo: ",poolInfo.data)
357
609
  return [2 /*return*/, poolInfo.data];
358
610
  case 3:
359
- e_7 = _a.sent();
360
- throw e_7;
611
+ e_14 = _a.sent();
612
+ throw e_14;
361
613
  case 4: return [2 /*return*/];
362
614
  }
363
615
  });
@@ -365,7 +617,7 @@ var get_pools = function () {
365
617
  };
366
618
  var get_delegations_by_address = function (address) {
367
619
  return __awaiter(this, void 0, void 0, function () {
368
- var tag, output, resp, output_2, e_8;
620
+ var tag, output, resp, output_2, e_15;
369
621
  return __generator(this, function (_a) {
370
622
  switch (_a.label) {
371
623
  case 0:
@@ -381,8 +633,8 @@ var get_delegations_by_address = function (address) {
381
633
  output_2 = resp.data.result;
382
634
  return [2 /*return*/, output_2];
383
635
  case 3:
384
- e_8 = _a.sent();
385
- throw e_8;
636
+ e_15 = _a.sent();
637
+ throw e_15;
386
638
  case 4: return [2 /*return*/];
387
639
  }
388
640
  });
@@ -390,7 +642,7 @@ var get_delegations_by_address = function (address) {
390
642
  };
391
643
  var get_delegations = function (address, valAddress) {
392
644
  return __awaiter(this, void 0, void 0, function () {
393
- var tag, output, txInfo, e_9;
645
+ var tag, output, txInfo, e_16;
394
646
  return __generator(this, function (_a) {
395
647
  switch (_a.label) {
396
648
  case 0:
@@ -409,8 +661,8 @@ var get_delegations = function (address, valAddress) {
409
661
  // log.debug(tag,"txInfo: ",txInfo.data)
410
662
  return [2 /*return*/, txInfo.data];
411
663
  case 3:
412
- e_9 = _a.sent();
413
- throw e_9;
664
+ e_16 = _a.sent();
665
+ throw e_16;
414
666
  case 4: return [2 /*return*/];
415
667
  }
416
668
  });
@@ -418,7 +670,7 @@ var get_delegations = function (address, valAddress) {
418
670
  };
419
671
  var get_validators = function () {
420
672
  return __awaiter(this, void 0, void 0, function () {
421
- var tag, output, txInfo, validators, e_10;
673
+ var tag, output, txInfo, validators, e_17;
422
674
  return __generator(this, function (_a) {
423
675
  switch (_a.label) {
424
676
  case 0:
@@ -442,8 +694,8 @@ var get_validators = function () {
442
694
  validators.reverse();
443
695
  return [2 /*return*/, validators];
444
696
  case 3:
445
- e_10 = _a.sent();
446
- throw e_10;
697
+ e_17 = _a.sent();
698
+ throw e_17;
447
699
  case 4: return [2 /*return*/];
448
700
  }
449
701
  });
@@ -451,7 +703,7 @@ var get_validators = function () {
451
703
  };
452
704
  var get_transaction = function (txid) {
453
705
  return __awaiter(this, void 0, void 0, function () {
454
- var tag, txInfo, e_11;
706
+ var tag, txInfo, e_18;
455
707
  return __generator(this, function (_a) {
456
708
  switch (_a.label) {
457
709
  case 0:
@@ -465,9 +717,9 @@ var get_transaction = function (txid) {
465
717
  log.debug(tag, "txInfo: ", txInfo.data);
466
718
  return [2 /*return*/, txInfo.data];
467
719
  case 3:
468
- e_11 = _a.sent();
720
+ e_18 = _a.sent();
469
721
  //if not found
470
- throw Error(e_11);
722
+ throw e_18;
471
723
  case 4: return [2 /*return*/];
472
724
  }
473
725
  });
@@ -475,7 +727,7 @@ var get_transaction = function (txid) {
475
727
  };
476
728
  var broadcast_transaction = function (tx) {
477
729
  return __awaiter(this, void 0, void 0, function () {
478
- var tag, output, payload, urlRemote, result2, logSend, e_12, e_13;
730
+ var tag, output, payload, urlRemote, result2, logSend, e_19, e_20;
479
731
  return __generator(this, function (_a) {
480
732
  switch (_a.label) {
481
733
  case 0:
@@ -518,16 +770,7 @@ var broadcast_transaction = function (tx) {
518
770
  output.raw = result2.data;
519
771
  return [3 /*break*/, 5];
520
772
  case 4:
521
- e_12 = _a.sent();
522
- //log.error(tag,"failed second broadcast e: ",e.response)
523
- log.error(tag, e_12);
524
- log.error(tag, e_12.response);
525
- log.error(tag, e_12.response.data);
526
- log.error(tag, e_12.response.data.error);
527
- log.error(tag, e_12.response.data.error.indexOf('RPC error -32603 - Internal error: Tx already exists in cache'));
528
- //throw e
529
- output.success = false;
530
- output.error = e_12.response.data.error;
773
+ e_19 = _a.sent();
531
774
  return [3 /*break*/, 5];
532
775
  case 5:
533
776
  if (output.txid) {
@@ -535,8 +778,8 @@ var broadcast_transaction = function (tx) {
535
778
  }
536
779
  return [2 /*return*/, output];
537
780
  case 6:
538
- e_13 = _a.sent();
539
- console.error(tag, "throw error: ", e_13);
781
+ e_20 = _a.sent();
782
+ console.error(tag, "throw error: ", e_20);
540
783
  return [2 /*return*/, output];
541
784
  case 7: return [2 /*return*/];
542
785
  }
@@ -545,7 +788,7 @@ var broadcast_transaction = function (tx) {
545
788
  };
546
789
  var get_account_info = function (address) {
547
790
  return __awaiter(this, void 0, void 0, function () {
548
- var tag, txInfo, e_14;
791
+ var tag, txInfo, e_21;
549
792
  return __generator(this, function (_a) {
550
793
  switch (_a.label) {
551
794
  case 0:
@@ -561,9 +804,9 @@ var get_account_info = function (address) {
561
804
  log.debug(tag, "txInfo: ", txInfo.data);
562
805
  return [2 /*return*/, txInfo.data];
563
806
  case 3:
564
- e_14 = _a.sent();
565
- log.error(tag, "e: ", e_14);
566
- throw e_14;
807
+ e_21 = _a.sent();
808
+ log.error(tag, "e: ", e_21);
809
+ throw e_21;
567
810
  case 4: return [2 /*return*/];
568
811
  }
569
812
  });
@@ -647,7 +890,7 @@ var normalize_tx = function (tx, address) {
647
890
  };
648
891
  var get_txs_at_height = function (height) {
649
892
  return __awaiter(this, void 0, void 0, function () {
650
- var tag, output, url, resultSends, sends, e_15;
893
+ var tag, output, url, resultSends, sends, e_22;
651
894
  return __generator(this, function (_a) {
652
895
  switch (_a.label) {
653
896
  case 0:
@@ -672,9 +915,9 @@ var get_txs_at_height = function (height) {
672
915
  //log.debug('sends: ', sends)
673
916
  return [2 /*return*/, sends];
674
917
  case 3:
675
- e_15 = _a.sent();
676
- log.error(tag, "e: ", e_15);
677
- throw e_15;
918
+ e_22 = _a.sent();
919
+ log.error(tag, "e: ", e_22);
920
+ throw e_22;
678
921
  case 4: return [2 /*return*/];
679
922
  }
680
923
  });
@@ -682,7 +925,7 @@ var get_txs_at_height = function (height) {
682
925
  };
683
926
  var get_txs_by_address = function (address) {
684
927
  return __awaiter(this, void 0, void 0, function () {
685
- var tag, output, url, resultSends, sends, i, tx, e_16;
928
+ var tag, output, url, resultSends, sends, i, tx, e_23;
686
929
  return __generator(this, function (_a) {
687
930
  switch (_a.label) {
688
931
  case 0:
@@ -730,9 +973,9 @@ var get_txs_by_address = function (address) {
730
973
  // }
731
974
  return [2 /*return*/, output];
732
975
  case 3:
733
- e_16 = _a.sent();
734
- log.error(tag, "e: ", e_16);
735
- throw e_16;
976
+ e_23 = _a.sent();
977
+ log.error(tag, "e: ", e_23);
978
+ throw e_23;
736
979
  case 4: return [2 /*return*/];
737
980
  }
738
981
  });
@@ -741,7 +984,7 @@ var get_txs_by_address = function (address) {
741
984
  var get_balances = function (address) {
742
985
  var _a;
743
986
  return __awaiter(this, void 0, void 0, function () {
744
- var tag, output, accountInfo, i, entry, balance, voucher, voucherInfo, balance, poolInfo, totalShares, poolAssets, assetAtom, assetOsmo, totalAtom, totalOsmo, yourLpTokens, yourLpPercent, yourAtomInPool, yourOsmoInPool, balance, e_17, e_18;
987
+ var tag, output, accountInfo, i, entry, balance, voucher, voucherInfo, balance, poolInfo, totalShares, poolAssets, assetAtom, assetOsmo, totalAtom, totalOsmo, yourLpTokens, yourLpPercent, yourAtomInPool, yourOsmoInPool, balance, e_24, e_25;
745
988
  return __generator(this, function (_b) {
746
989
  switch (_b.label) {
747
990
  case 0:
@@ -756,7 +999,7 @@ var get_balances = function (address) {
756
999
  return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/bank/balances/' + address })];
757
1000
  case 3:
758
1001
  accountInfo = _b.sent();
759
- log.debug(tag, "accountInfo: ", accountInfo.data);
1002
+ log.info(tag, "accountInfo: ", accountInfo.data);
760
1003
  if (!((_a = accountInfo.data) === null || _a === void 0 ? void 0 : _a.result)) return [3 /*break*/, 9];
761
1004
  i = 0;
762
1005
  _b.label = 4;
@@ -774,11 +1017,11 @@ var get_balances = function (address) {
774
1017
  }
775
1018
  if (!(entry.denom.indexOf('ibc/') >= 0)) return [3 /*break*/, 6];
776
1019
  voucher = entry.denom.replace('ibc/', '');
777
- log.debug(tag, "voucher: ", voucher);
1020
+ log.info(tag, "voucher: ", voucher);
778
1021
  return [4 /*yield*/, get_voucher_info(voucher)];
779
1022
  case 5:
780
1023
  voucherInfo = _b.sent();
781
- log.debug(tag, "voucherInfo: ", voucherInfo);
1024
+ log.info(tag, "voucherInfo: ", voucherInfo);
782
1025
  if (voucherInfo.denom_trace.base_denom === 'uatom') {
783
1026
  balance = {
784
1027
  type: 'ibcChannel',
@@ -840,13 +1083,13 @@ var get_balances = function (address) {
840
1083
  return [3 /*break*/, 4];
841
1084
  case 9: return [3 /*break*/, 11];
842
1085
  case 10:
843
- e_17 = _b.sent();
1086
+ e_24 = _b.sent();
844
1087
  return [3 /*break*/, 11];
845
1088
  case 11: return [2 /*return*/, output];
846
1089
  case 12:
847
- e_18 = _b.sent();
848
- log.error(tag, "e: ", e_18);
849
- throw e_18;
1090
+ e_25 = _b.sent();
1091
+ log.error(tag, "e: ", e_25);
1092
+ throw e_25;
850
1093
  case 13: return [2 /*return*/];
851
1094
  }
852
1095
  });
@@ -855,7 +1098,7 @@ var get_balances = function (address) {
855
1098
  var get_balance = function (address) {
856
1099
  var _a;
857
1100
  return __awaiter(this, void 0, void 0, function () {
858
- var tag, output, accountInfo, i, entry, e_19, e_20;
1101
+ var tag, output, accountInfo, i, entry, e_26, e_27;
859
1102
  return __generator(this, function (_b) {
860
1103
  switch (_b.label) {
861
1104
  case 0:
@@ -884,13 +1127,13 @@ var get_balance = function (address) {
884
1127
  output = output / BASE_OSMO;
885
1128
  return [3 /*break*/, 5];
886
1129
  case 4:
887
- e_19 = _b.sent();
1130
+ e_26 = _b.sent();
888
1131
  return [3 /*break*/, 5];
889
1132
  case 5: return [2 /*return*/, output];
890
1133
  case 6:
891
- e_20 = _b.sent();
892
- log.error(tag, "e: ", e_20);
893
- throw e_20;
1134
+ e_27 = _b.sent();
1135
+ log.error(tag, "e: ", e_27);
1136
+ throw e_27;
894
1137
  case 7: return [2 /*return*/];
895
1138
  }
896
1139
  });
@@ -898,7 +1141,7 @@ var get_balance = function (address) {
898
1141
  };
899
1142
  var get_node_info_verbose = function () {
900
1143
  return __awaiter(this, void 0, void 0, function () {
901
- var tag, output, syncInfo, nodeInfo, e_21;
1144
+ var tag, output, syncInfo, nodeInfo, e_28;
902
1145
  return __generator(this, function (_a) {
903
1146
  switch (_a.label) {
904
1147
  case 0:
@@ -923,9 +1166,9 @@ var get_node_info_verbose = function () {
923
1166
  //output.height = lastBlock.data.block.header.height
924
1167
  return [2 /*return*/, output];
925
1168
  case 4:
926
- e_21 = _a.sent();
927
- log.error(tag, "e: ", e_21);
928
- throw e_21;
1169
+ e_28 = _a.sent();
1170
+ log.error(tag, "e: ", e_28);
1171
+ throw e_28;
929
1172
  case 5: return [2 /*return*/];
930
1173
  }
931
1174
  });