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