@ref-finance/ref-sdk 1.4.3 → 1.4.4-beta.0-development

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.
@@ -4586,37 +4586,72 @@
4586
4586
  return _ref4.apply(this, arguments);
4587
4587
  };
4588
4588
  }();
4589
- var getStablePools = /*#__PURE__*/function () {
4590
- var _ref5 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(stablePools) {
4589
+ var getDegenPoolDetail = /*#__PURE__*/function () {
4590
+ var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
4591
+ var id;
4591
4592
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
4592
4593
  while (1) {
4593
4594
  switch (_context3.prev = _context3.next) {
4594
4595
  case 0:
4595
- return _context3.abrupt("return", Promise.all(stablePools.map(function (pool) {
4596
+ id = _ref5.id;
4597
+ return _context3.abrupt("return", refFiViewFunction({
4598
+ methodName: 'get_degen_pool',
4599
+ args: {
4600
+ pool_id: Number(id)
4601
+ }
4602
+ }).then(function (pool_info) {
4603
+ return _extends({}, pool_info, {
4604
+ id: Number(id),
4605
+ pool_kind: 'DEGEN_SWAP',
4606
+ rates: pool_info.c_amounts.map(function (i) {
4607
+ return toNonDivisibleNumber(STABLE_LP_TOKEN_DECIMALS, '1');
4608
+ })
4609
+ });
4610
+ }));
4611
+ case 2:
4612
+ case "end":
4613
+ return _context3.stop();
4614
+ }
4615
+ }
4616
+ }, _callee3);
4617
+ }));
4618
+ return function getDegenPoolDetail(_x3) {
4619
+ return _ref6.apply(this, arguments);
4620
+ };
4621
+ }();
4622
+ var getStablePools = /*#__PURE__*/function () {
4623
+ var _ref7 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(stablePools) {
4624
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
4625
+ while (1) {
4626
+ switch (_context4.prev = _context4.next) {
4627
+ case 0:
4628
+ return _context4.abrupt("return", Promise.all(stablePools.map(function (pool) {
4596
4629
  return pool.pool_kind === 'RATED_SWAP' ? getRatedPoolDetail({
4597
4630
  id: pool.id
4598
- }) : getUnRatedPoolDetail({
4631
+ }) : pool.pool_kind === 'DEGEN_SWAP' ? getDegenPoolDetail({
4599
4632
  id: pool.id
4600
- });
4633
+ }) : pool.pool_kind === 'STABLE_SWAP' ? getUnRatedPoolDetail({
4634
+ id: pool.id
4635
+ }) : getPool(pool.id);
4601
4636
  })));
4602
4637
  case 1:
4603
4638
  case "end":
4604
- return _context3.stop();
4639
+ return _context4.stop();
4605
4640
  }
4606
4641
  }
4607
- }, _callee3);
4642
+ }, _callee4);
4608
4643
  }));
4609
- return function getStablePools(_x3) {
4610
- return _ref5.apply(this, arguments);
4644
+ return function getStablePools(_x4) {
4645
+ return _ref7.apply(this, arguments);
4611
4646
  };
4612
4647
  }();
4613
4648
  var getPool = /*#__PURE__*/function () {
4614
- var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(id) {
4615
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
4649
+ var _ref8 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(id) {
4650
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
4616
4651
  while (1) {
4617
- switch (_context4.prev = _context4.next) {
4652
+ switch (_context5.prev = _context5.next) {
4618
4653
  case 0:
4619
- _context4.next = 2;
4654
+ _context5.next = 2;
4620
4655
  return refFiViewFunction({
4621
4656
  methodName: 'get_pool',
4622
4657
  args: {
@@ -4626,25 +4661,25 @@
4626
4661
  return parsePool(pool, id);
4627
4662
  });
4628
4663
  case 2:
4629
- return _context4.abrupt("return", _context4.sent);
4664
+ return _context5.abrupt("return", _context5.sent);
4630
4665
  case 3:
4631
4666
  case "end":
4632
- return _context4.stop();
4667
+ return _context5.stop();
4633
4668
  }
4634
4669
  }
4635
- }, _callee4);
4670
+ }, _callee5);
4636
4671
  }));
4637
- return function getPool(_x4) {
4638
- return _ref6.apply(this, arguments);
4672
+ return function getPool(_x5) {
4673
+ return _ref8.apply(this, arguments);
4639
4674
  };
4640
4675
  }();
4641
4676
  var getPoolByIds = /*#__PURE__*/function () {
4642
- var _ref7 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(ids) {
4643
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
4677
+ var _ref9 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(ids) {
4678
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
4644
4679
  while (1) {
4645
- switch (_context5.prev = _context5.next) {
4680
+ switch (_context6.prev = _context6.next) {
4646
4681
  case 0:
4647
- _context5.next = 2;
4682
+ _context6.next = 2;
4648
4683
  return refFiViewFunction({
4649
4684
  methodName: 'get_pool_by_ids',
4650
4685
  args: {
@@ -4656,24 +4691,24 @@
4656
4691
  });
4657
4692
  });
4658
4693
  case 2:
4659
- return _context5.abrupt("return", _context5.sent);
4694
+ return _context6.abrupt("return", _context6.sent);
4660
4695
  case 3:
4661
4696
  case "end":
4662
- return _context5.stop();
4697
+ return _context6.stop();
4663
4698
  }
4664
4699
  }
4665
- }, _callee5);
4700
+ }, _callee6);
4666
4701
  }));
4667
- return function getPoolByIds(_x5) {
4668
- return _ref7.apply(this, arguments);
4702
+ return function getPoolByIds(_x6) {
4703
+ return _ref9.apply(this, arguments);
4669
4704
  };
4670
4705
  }();
4671
4706
  var getRefPools = /*#__PURE__*/function () {
4672
- var _ref8 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, perPage) {
4707
+ var _ref10 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(page, perPage) {
4673
4708
  var index, poolData;
4674
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
4709
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
4675
4710
  while (1) {
4676
- switch (_context6.prev = _context6.next) {
4711
+ switch (_context7.prev = _context7.next) {
4677
4712
  case 0:
4678
4713
  if (page === void 0) {
4679
4714
  page = 1;
@@ -4682,7 +4717,7 @@
4682
4717
  perPage = DEFAULT_PAGE_LIMIT;
4683
4718
  }
4684
4719
  index = (page - 1) * perPage;
4685
- _context6.next = 5;
4720
+ _context7.next = 5;
4686
4721
  return refFiViewFunction({
4687
4722
  methodName: 'get_pools',
4688
4723
  args: {
@@ -4691,8 +4726,8 @@
4691
4726
  }
4692
4727
  });
4693
4728
  case 5:
4694
- poolData = _context6.sent;
4695
- return _context6.abrupt("return", poolData.map(function (rawPool, i) {
4729
+ poolData = _context7.sent;
4730
+ return _context7.abrupt("return", poolData.map(function (rawPool, i) {
4696
4731
  return parsePool(rawPool, i + index);
4697
4732
  }).filter(function (p) {
4698
4733
  var _p$tokenIds;
@@ -4702,55 +4737,55 @@
4702
4737
  }));
4703
4738
  case 7:
4704
4739
  case "end":
4705
- return _context6.stop();
4740
+ return _context7.stop();
4706
4741
  }
4707
4742
  }
4708
- }, _callee6);
4743
+ }, _callee7);
4709
4744
  }));
4710
- return function getRefPools(_x6, _x7) {
4711
- return _ref8.apply(this, arguments);
4745
+ return function getRefPools(_x7, _x8) {
4746
+ return _ref10.apply(this, arguments);
4712
4747
  };
4713
4748
  }();
4714
4749
  var fetchAllPools = /*#__PURE__*/function () {
4715
- var _ref9 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(perPage) {
4750
+ var _ref11 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(perPage) {
4716
4751
  var _pools, totalPools, pages, pools;
4717
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
4752
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
4718
4753
  while (1) {
4719
- switch (_context7.prev = _context7.next) {
4754
+ switch (_context8.prev = _context8.next) {
4720
4755
  case 0:
4721
- _context7.prev = 0;
4722
- _context7.next = 3;
4756
+ _context8.prev = 0;
4757
+ _context8.next = 3;
4723
4758
  return fetch(exports.config.indexerUrl + "/fetchAllPools").then(function (res) {
4724
4759
  return res.json();
4725
4760
  });
4726
4761
  case 3:
4727
- _pools = _context7.sent;
4762
+ _pools = _context8.sent;
4728
4763
  if (_pools.simplePools) {
4729
- _context7.next = 6;
4764
+ _context8.next = 6;
4730
4765
  break;
4731
4766
  }
4732
4767
  throw Error();
4733
4768
  case 6:
4734
- return _context7.abrupt("return", _pools);
4769
+ return _context8.abrupt("return", _pools);
4735
4770
  case 9:
4736
- _context7.prev = 9;
4737
- _context7.t0 = _context7["catch"](0);
4771
+ _context8.prev = 9;
4772
+ _context8.t0 = _context8["catch"](0);
4738
4773
  case 11:
4739
4774
  if (perPage) {
4740
4775
  DEFAULT_PAGE_LIMIT = Math.min(perPage, 500);
4741
4776
  }
4742
- _context7.next = 14;
4777
+ _context8.next = 14;
4743
4778
  return getTotalPools();
4744
4779
  case 14:
4745
- totalPools = _context7.sent;
4780
+ totalPools = _context8.sent;
4746
4781
  pages = Math.ceil(totalPools / DEFAULT_PAGE_LIMIT);
4747
- _context7.next = 18;
4782
+ _context8.next = 18;
4748
4783
  return Promise.all([].concat(Array(pages)).fill(0).map(function (_, i) {
4749
4784
  return getRefPools(i + 1);
4750
4785
  }));
4751
4786
  case 18:
4752
- pools = _context7.sent.flat();
4753
- return _context7.abrupt("return", {
4787
+ pools = _context8.sent.flat();
4788
+ return _context8.abrupt("return", {
4754
4789
  simplePools: pools.filter(function (p) {
4755
4790
  return p.pool_kind && p.pool_kind === 'SIMPLE_POOL';
4756
4791
  }),
@@ -4763,13 +4798,13 @@
4763
4798
  });
4764
4799
  case 20:
4765
4800
  case "end":
4766
- return _context7.stop();
4801
+ return _context8.stop();
4767
4802
  }
4768
4803
  }
4769
- }, _callee7, null, [[0, 9]]);
4804
+ }, _callee8, null, [[0, 9]]);
4770
4805
  }));
4771
- return function fetchAllPools(_x8) {
4772
- return _ref9.apply(this, arguments);
4806
+ return function fetchAllPools(_x9) {
4807
+ return _ref11.apply(this, arguments);
4773
4808
  };
4774
4809
  }();
4775
4810
 
@@ -8358,6 +8393,7 @@
8358
8393
  exports.getDCLPool = getDCLPool;
8359
8394
  exports.getDCLPoolId = getDCLPoolId;
8360
8395
  exports.getDefaultTokenList = getDefaultTokenList;
8396
+ exports.getDegenPoolDetail = getDegenPoolDetail;
8361
8397
  exports.getExpectedOutputFromSwapTodos = getExpectedOutputFromSwapTodos;
8362
8398
  exports.getGas = getGas;
8363
8399
  exports.getGlobalWhitelist = getGlobalWhitelist;