@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.
- package/dist/ref-sdk.cjs.development.js +92 -56
- package/dist/ref-sdk.cjs.development.js.map +1 -1
- package/dist/ref-sdk.cjs.production.min.js +1 -1
- package/dist/ref-sdk.cjs.production.min.js.map +1 -1
- package/dist/ref-sdk.esm.js +92 -57
- package/dist/ref-sdk.esm.js.map +1 -1
- package/dist/ref-sdk.umd.development.js +92 -56
- package/dist/ref-sdk.umd.development.js.map +1 -1
- package/dist/ref-sdk.umd.production.min.js +1 -1
- package/dist/ref-sdk.umd.production.min.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/v1-swap/pool.d.ts +3 -0
- package/package.json +1 -1
|
@@ -4606,37 +4606,72 @@ var getUnRatedPoolDetail = /*#__PURE__*/function () {
|
|
|
4606
4606
|
return _ref4.apply(this, arguments);
|
|
4607
4607
|
};
|
|
4608
4608
|
}();
|
|
4609
|
-
var
|
|
4610
|
-
var
|
|
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
|
-
|
|
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
|
-
}) :
|
|
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
|
|
4659
|
+
return _context4.stop();
|
|
4625
4660
|
}
|
|
4626
4661
|
}
|
|
4627
|
-
},
|
|
4662
|
+
}, _callee4);
|
|
4628
4663
|
}));
|
|
4629
|
-
return function getStablePools(
|
|
4630
|
-
return
|
|
4664
|
+
return function getStablePools(_x4) {
|
|
4665
|
+
return _ref7.apply(this, arguments);
|
|
4631
4666
|
};
|
|
4632
4667
|
}();
|
|
4633
4668
|
var getPool = /*#__PURE__*/function () {
|
|
4634
|
-
var
|
|
4635
|
-
return _regeneratorRuntime().wrap(function
|
|
4669
|
+
var _ref8 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(id) {
|
|
4670
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
4636
4671
|
while (1) {
|
|
4637
|
-
switch (
|
|
4672
|
+
switch (_context5.prev = _context5.next) {
|
|
4638
4673
|
case 0:
|
|
4639
|
-
|
|
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
|
|
4684
|
+
return _context5.abrupt("return", _context5.sent);
|
|
4650
4685
|
case 3:
|
|
4651
4686
|
case "end":
|
|
4652
|
-
return
|
|
4687
|
+
return _context5.stop();
|
|
4653
4688
|
}
|
|
4654
4689
|
}
|
|
4655
|
-
},
|
|
4690
|
+
}, _callee5);
|
|
4656
4691
|
}));
|
|
4657
|
-
return function getPool(
|
|
4658
|
-
return
|
|
4692
|
+
return function getPool(_x5) {
|
|
4693
|
+
return _ref8.apply(this, arguments);
|
|
4659
4694
|
};
|
|
4660
4695
|
}();
|
|
4661
4696
|
var getPoolByIds = /*#__PURE__*/function () {
|
|
4662
|
-
var
|
|
4663
|
-
return _regeneratorRuntime().wrap(function
|
|
4697
|
+
var _ref9 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(ids) {
|
|
4698
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
4664
4699
|
while (1) {
|
|
4665
|
-
switch (
|
|
4700
|
+
switch (_context6.prev = _context6.next) {
|
|
4666
4701
|
case 0:
|
|
4667
|
-
|
|
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
|
|
4714
|
+
return _context6.abrupt("return", _context6.sent);
|
|
4680
4715
|
case 3:
|
|
4681
4716
|
case "end":
|
|
4682
|
-
return
|
|
4717
|
+
return _context6.stop();
|
|
4683
4718
|
}
|
|
4684
4719
|
}
|
|
4685
|
-
},
|
|
4720
|
+
}, _callee6);
|
|
4686
4721
|
}));
|
|
4687
|
-
return function getPoolByIds(
|
|
4688
|
-
return
|
|
4722
|
+
return function getPoolByIds(_x6) {
|
|
4723
|
+
return _ref9.apply(this, arguments);
|
|
4689
4724
|
};
|
|
4690
4725
|
}();
|
|
4691
4726
|
var getRefPools = /*#__PURE__*/function () {
|
|
4692
|
-
var
|
|
4727
|
+
var _ref10 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(page, perPage) {
|
|
4693
4728
|
var index, poolData;
|
|
4694
|
-
return _regeneratorRuntime().wrap(function
|
|
4729
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
4695
4730
|
while (1) {
|
|
4696
|
-
switch (
|
|
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
|
-
|
|
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 =
|
|
4715
|
-
return
|
|
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
|
|
4760
|
+
return _context7.stop();
|
|
4726
4761
|
}
|
|
4727
4762
|
}
|
|
4728
|
-
},
|
|
4763
|
+
}, _callee7);
|
|
4729
4764
|
}));
|
|
4730
|
-
return function getRefPools(
|
|
4731
|
-
return
|
|
4765
|
+
return function getRefPools(_x7, _x8) {
|
|
4766
|
+
return _ref10.apply(this, arguments);
|
|
4732
4767
|
};
|
|
4733
4768
|
}();
|
|
4734
4769
|
var fetchAllPools = /*#__PURE__*/function () {
|
|
4735
|
-
var
|
|
4770
|
+
var _ref11 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(perPage) {
|
|
4736
4771
|
var _pools, totalPools, pages, pools;
|
|
4737
|
-
return _regeneratorRuntime().wrap(function
|
|
4772
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
4738
4773
|
while (1) {
|
|
4739
|
-
switch (
|
|
4774
|
+
switch (_context8.prev = _context8.next) {
|
|
4740
4775
|
case 0:
|
|
4741
|
-
|
|
4742
|
-
|
|
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 =
|
|
4782
|
+
_pools = _context8.sent;
|
|
4748
4783
|
if (_pools.simplePools) {
|
|
4749
|
-
|
|
4784
|
+
_context8.next = 6;
|
|
4750
4785
|
break;
|
|
4751
4786
|
}
|
|
4752
4787
|
throw Error();
|
|
4753
4788
|
case 6:
|
|
4754
|
-
return
|
|
4789
|
+
return _context8.abrupt("return", _pools);
|
|
4755
4790
|
case 9:
|
|
4756
|
-
|
|
4757
|
-
|
|
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
|
-
|
|
4797
|
+
_context8.next = 14;
|
|
4763
4798
|
return getTotalPools();
|
|
4764
4799
|
case 14:
|
|
4765
|
-
totalPools =
|
|
4800
|
+
totalPools = _context8.sent;
|
|
4766
4801
|
pages = Math.ceil(totalPools / DEFAULT_PAGE_LIMIT);
|
|
4767
|
-
|
|
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 =
|
|
4773
|
-
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
|
|
4821
|
+
return _context8.stop();
|
|
4787
4822
|
}
|
|
4788
4823
|
}
|
|
4789
|
-
},
|
|
4824
|
+
}, _callee8, null, [[0, 9]]);
|
|
4790
4825
|
}));
|
|
4791
|
-
return function fetchAllPools(
|
|
4792
|
-
return
|
|
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;
|