@ref-finance/ref-sdk 1.4.2 → 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 +93 -57
- 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 +93 -58
- package/dist/ref-sdk.esm.js.map +1 -1
- package/dist/ref-sdk.umd.development.js +93 -57
- 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
package/dist/ref-sdk.esm.js
CHANGED
|
@@ -4600,37 +4600,72 @@ var getUnRatedPoolDetail = /*#__PURE__*/function () {
|
|
|
4600
4600
|
return _ref4.apply(this, arguments);
|
|
4601
4601
|
};
|
|
4602
4602
|
}();
|
|
4603
|
-
var
|
|
4604
|
-
var
|
|
4603
|
+
var getDegenPoolDetail = /*#__PURE__*/function () {
|
|
4604
|
+
var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
|
|
4605
|
+
var id;
|
|
4605
4606
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
4606
4607
|
while (1) {
|
|
4607
4608
|
switch (_context3.prev = _context3.next) {
|
|
4608
4609
|
case 0:
|
|
4609
|
-
|
|
4610
|
+
id = _ref5.id;
|
|
4611
|
+
return _context3.abrupt("return", refFiViewFunction({
|
|
4612
|
+
methodName: 'get_degen_pool',
|
|
4613
|
+
args: {
|
|
4614
|
+
pool_id: Number(id)
|
|
4615
|
+
}
|
|
4616
|
+
}).then(function (pool_info) {
|
|
4617
|
+
return _extends({}, pool_info, {
|
|
4618
|
+
id: Number(id),
|
|
4619
|
+
pool_kind: 'DEGEN_SWAP',
|
|
4620
|
+
rates: pool_info.c_amounts.map(function (i) {
|
|
4621
|
+
return toNonDivisibleNumber(STABLE_LP_TOKEN_DECIMALS, '1');
|
|
4622
|
+
})
|
|
4623
|
+
});
|
|
4624
|
+
}));
|
|
4625
|
+
case 2:
|
|
4626
|
+
case "end":
|
|
4627
|
+
return _context3.stop();
|
|
4628
|
+
}
|
|
4629
|
+
}
|
|
4630
|
+
}, _callee3);
|
|
4631
|
+
}));
|
|
4632
|
+
return function getDegenPoolDetail(_x3) {
|
|
4633
|
+
return _ref6.apply(this, arguments);
|
|
4634
|
+
};
|
|
4635
|
+
}();
|
|
4636
|
+
var getStablePools = /*#__PURE__*/function () {
|
|
4637
|
+
var _ref7 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(stablePools) {
|
|
4638
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
4639
|
+
while (1) {
|
|
4640
|
+
switch (_context4.prev = _context4.next) {
|
|
4641
|
+
case 0:
|
|
4642
|
+
return _context4.abrupt("return", Promise.all(stablePools.map(function (pool) {
|
|
4610
4643
|
return pool.pool_kind === 'RATED_SWAP' ? getRatedPoolDetail({
|
|
4611
4644
|
id: pool.id
|
|
4612
|
-
}) :
|
|
4645
|
+
}) : pool.pool_kind === 'DEGEN_SWAP' ? getDegenPoolDetail({
|
|
4613
4646
|
id: pool.id
|
|
4614
|
-
})
|
|
4647
|
+
}) : pool.pool_kind === 'STABLE_SWAP' ? getUnRatedPoolDetail({
|
|
4648
|
+
id: pool.id
|
|
4649
|
+
}) : getPool(pool.id);
|
|
4615
4650
|
})));
|
|
4616
4651
|
case 1:
|
|
4617
4652
|
case "end":
|
|
4618
|
-
return
|
|
4653
|
+
return _context4.stop();
|
|
4619
4654
|
}
|
|
4620
4655
|
}
|
|
4621
|
-
},
|
|
4656
|
+
}, _callee4);
|
|
4622
4657
|
}));
|
|
4623
|
-
return function getStablePools(
|
|
4624
|
-
return
|
|
4658
|
+
return function getStablePools(_x4) {
|
|
4659
|
+
return _ref7.apply(this, arguments);
|
|
4625
4660
|
};
|
|
4626
4661
|
}();
|
|
4627
4662
|
var getPool = /*#__PURE__*/function () {
|
|
4628
|
-
var
|
|
4629
|
-
return _regeneratorRuntime().wrap(function
|
|
4663
|
+
var _ref8 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(id) {
|
|
4664
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
4630
4665
|
while (1) {
|
|
4631
|
-
switch (
|
|
4666
|
+
switch (_context5.prev = _context5.next) {
|
|
4632
4667
|
case 0:
|
|
4633
|
-
|
|
4668
|
+
_context5.next = 2;
|
|
4634
4669
|
return refFiViewFunction({
|
|
4635
4670
|
methodName: 'get_pool',
|
|
4636
4671
|
args: {
|
|
@@ -4640,25 +4675,25 @@ var getPool = /*#__PURE__*/function () {
|
|
|
4640
4675
|
return parsePool(pool, id);
|
|
4641
4676
|
});
|
|
4642
4677
|
case 2:
|
|
4643
|
-
return
|
|
4678
|
+
return _context5.abrupt("return", _context5.sent);
|
|
4644
4679
|
case 3:
|
|
4645
4680
|
case "end":
|
|
4646
|
-
return
|
|
4681
|
+
return _context5.stop();
|
|
4647
4682
|
}
|
|
4648
4683
|
}
|
|
4649
|
-
},
|
|
4684
|
+
}, _callee5);
|
|
4650
4685
|
}));
|
|
4651
|
-
return function getPool(
|
|
4652
|
-
return
|
|
4686
|
+
return function getPool(_x5) {
|
|
4687
|
+
return _ref8.apply(this, arguments);
|
|
4653
4688
|
};
|
|
4654
4689
|
}();
|
|
4655
4690
|
var getPoolByIds = /*#__PURE__*/function () {
|
|
4656
|
-
var
|
|
4657
|
-
return _regeneratorRuntime().wrap(function
|
|
4691
|
+
var _ref9 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(ids) {
|
|
4692
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
4658
4693
|
while (1) {
|
|
4659
|
-
switch (
|
|
4694
|
+
switch (_context6.prev = _context6.next) {
|
|
4660
4695
|
case 0:
|
|
4661
|
-
|
|
4696
|
+
_context6.next = 2;
|
|
4662
4697
|
return refFiViewFunction({
|
|
4663
4698
|
methodName: 'get_pool_by_ids',
|
|
4664
4699
|
args: {
|
|
@@ -4670,24 +4705,24 @@ var getPoolByIds = /*#__PURE__*/function () {
|
|
|
4670
4705
|
});
|
|
4671
4706
|
});
|
|
4672
4707
|
case 2:
|
|
4673
|
-
return
|
|
4708
|
+
return _context6.abrupt("return", _context6.sent);
|
|
4674
4709
|
case 3:
|
|
4675
4710
|
case "end":
|
|
4676
|
-
return
|
|
4711
|
+
return _context6.stop();
|
|
4677
4712
|
}
|
|
4678
4713
|
}
|
|
4679
|
-
},
|
|
4714
|
+
}, _callee6);
|
|
4680
4715
|
}));
|
|
4681
|
-
return function getPoolByIds(
|
|
4682
|
-
return
|
|
4716
|
+
return function getPoolByIds(_x6) {
|
|
4717
|
+
return _ref9.apply(this, arguments);
|
|
4683
4718
|
};
|
|
4684
4719
|
}();
|
|
4685
4720
|
var getRefPools = /*#__PURE__*/function () {
|
|
4686
|
-
var
|
|
4721
|
+
var _ref10 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(page, perPage) {
|
|
4687
4722
|
var index, poolData;
|
|
4688
|
-
return _regeneratorRuntime().wrap(function
|
|
4723
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
4689
4724
|
while (1) {
|
|
4690
|
-
switch (
|
|
4725
|
+
switch (_context7.prev = _context7.next) {
|
|
4691
4726
|
case 0:
|
|
4692
4727
|
if (page === void 0) {
|
|
4693
4728
|
page = 1;
|
|
@@ -4696,7 +4731,7 @@ var getRefPools = /*#__PURE__*/function () {
|
|
|
4696
4731
|
perPage = DEFAULT_PAGE_LIMIT;
|
|
4697
4732
|
}
|
|
4698
4733
|
index = (page - 1) * perPage;
|
|
4699
|
-
|
|
4734
|
+
_context7.next = 5;
|
|
4700
4735
|
return refFiViewFunction({
|
|
4701
4736
|
methodName: 'get_pools',
|
|
4702
4737
|
args: {
|
|
@@ -4705,8 +4740,8 @@ var getRefPools = /*#__PURE__*/function () {
|
|
|
4705
4740
|
}
|
|
4706
4741
|
});
|
|
4707
4742
|
case 5:
|
|
4708
|
-
poolData =
|
|
4709
|
-
return
|
|
4743
|
+
poolData = _context7.sent;
|
|
4744
|
+
return _context7.abrupt("return", poolData.map(function (rawPool, i) {
|
|
4710
4745
|
return parsePool(rawPool, i + index);
|
|
4711
4746
|
}).filter(function (p) {
|
|
4712
4747
|
var _p$tokenIds;
|
|
@@ -4716,55 +4751,55 @@ var getRefPools = /*#__PURE__*/function () {
|
|
|
4716
4751
|
}));
|
|
4717
4752
|
case 7:
|
|
4718
4753
|
case "end":
|
|
4719
|
-
return
|
|
4754
|
+
return _context7.stop();
|
|
4720
4755
|
}
|
|
4721
4756
|
}
|
|
4722
|
-
},
|
|
4757
|
+
}, _callee7);
|
|
4723
4758
|
}));
|
|
4724
|
-
return function getRefPools(
|
|
4725
|
-
return
|
|
4759
|
+
return function getRefPools(_x7, _x8) {
|
|
4760
|
+
return _ref10.apply(this, arguments);
|
|
4726
4761
|
};
|
|
4727
4762
|
}();
|
|
4728
4763
|
var fetchAllPools = /*#__PURE__*/function () {
|
|
4729
|
-
var
|
|
4764
|
+
var _ref11 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(perPage) {
|
|
4730
4765
|
var _pools, totalPools, pages, pools;
|
|
4731
|
-
return _regeneratorRuntime().wrap(function
|
|
4766
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
4732
4767
|
while (1) {
|
|
4733
|
-
switch (
|
|
4768
|
+
switch (_context8.prev = _context8.next) {
|
|
4734
4769
|
case 0:
|
|
4735
|
-
|
|
4736
|
-
|
|
4770
|
+
_context8.prev = 0;
|
|
4771
|
+
_context8.next = 3;
|
|
4737
4772
|
return fetch(config.indexerUrl + "/fetchAllPools").then(function (res) {
|
|
4738
4773
|
return res.json();
|
|
4739
4774
|
});
|
|
4740
4775
|
case 3:
|
|
4741
|
-
_pools =
|
|
4742
|
-
if (
|
|
4743
|
-
|
|
4776
|
+
_pools = _context8.sent;
|
|
4777
|
+
if (_pools.simplePools) {
|
|
4778
|
+
_context8.next = 6;
|
|
4744
4779
|
break;
|
|
4745
4780
|
}
|
|
4746
4781
|
throw Error();
|
|
4747
4782
|
case 6:
|
|
4748
|
-
return
|
|
4783
|
+
return _context8.abrupt("return", _pools);
|
|
4749
4784
|
case 9:
|
|
4750
|
-
|
|
4751
|
-
|
|
4785
|
+
_context8.prev = 9;
|
|
4786
|
+
_context8.t0 = _context8["catch"](0);
|
|
4752
4787
|
case 11:
|
|
4753
4788
|
if (perPage) {
|
|
4754
4789
|
DEFAULT_PAGE_LIMIT = Math.min(perPage, 500);
|
|
4755
4790
|
}
|
|
4756
|
-
|
|
4791
|
+
_context8.next = 14;
|
|
4757
4792
|
return getTotalPools();
|
|
4758
4793
|
case 14:
|
|
4759
|
-
totalPools =
|
|
4794
|
+
totalPools = _context8.sent;
|
|
4760
4795
|
pages = Math.ceil(totalPools / DEFAULT_PAGE_LIMIT);
|
|
4761
|
-
|
|
4796
|
+
_context8.next = 18;
|
|
4762
4797
|
return Promise.all([].concat(Array(pages)).fill(0).map(function (_, i) {
|
|
4763
4798
|
return getRefPools(i + 1);
|
|
4764
4799
|
}));
|
|
4765
4800
|
case 18:
|
|
4766
|
-
pools =
|
|
4767
|
-
return
|
|
4801
|
+
pools = _context8.sent.flat();
|
|
4802
|
+
return _context8.abrupt("return", {
|
|
4768
4803
|
simplePools: pools.filter(function (p) {
|
|
4769
4804
|
return p.pool_kind && p.pool_kind === 'SIMPLE_POOL';
|
|
4770
4805
|
}),
|
|
@@ -4777,13 +4812,13 @@ var fetchAllPools = /*#__PURE__*/function () {
|
|
|
4777
4812
|
});
|
|
4778
4813
|
case 20:
|
|
4779
4814
|
case "end":
|
|
4780
|
-
return
|
|
4815
|
+
return _context8.stop();
|
|
4781
4816
|
}
|
|
4782
4817
|
}
|
|
4783
|
-
},
|
|
4818
|
+
}, _callee8, null, [[0, 9]]);
|
|
4784
4819
|
}));
|
|
4785
|
-
return function fetchAllPools(
|
|
4786
|
-
return
|
|
4820
|
+
return function fetchAllPools(_x9) {
|
|
4821
|
+
return _ref11.apply(this, arguments);
|
|
4787
4822
|
};
|
|
4788
4823
|
}();
|
|
4789
4824
|
|
|
@@ -8296,5 +8331,5 @@ var get_pointorder_range = function get_pointorder_range(_ref5) {
|
|
|
8296
8331
|
});
|
|
8297
8332
|
};
|
|
8298
8333
|
|
|
8299
|
-
export { AccountIdMisMatch, CONSTANT_D, DCLInValid, DCLSwap, DCLSwapByInputOnBestPool, DCLSwapGetStorageBalance, DCL_POOL_FEE_LIST, DCL_POOL_SPLITER, DEFAULT_SLIPPAGE_TOLERANCE, DefaultMainnetTokenList, DefaultTestnetTokenList, FEE_DIVISOR, FT_MINIMUM_STORAGE_BALANCE_LARGE, InValidAccessKeyError, NEAR_META_DATA, NoAccountIdFound, NoCredential, NoFeeToPool, NoLocalSignerError, NoOrderFound, NoPoolError, NoPoolOnThisPair, NoPuiblicKeyError, NotLoginError, ONE_YOCTO_NEAR, ONLY_ZEROS, OrderNoRemainedAmount, POINTLEFTRANGE, POINTRIGHTRANGE, PoolMode, RATED_POOL_LP_TOKEN_DECIMALS, REF_FI_CONTRACT_ID, REF_META_DATA, REF_TOKEN_ID, REPLACE_TOKENS, STABLE_LP_TOKEN_DECIMALS, STORAGE_TO_REGISTER_WITH_MFT, SameInputTokenError, SlippageError, SwapRouteError, SwapWidget, TokenLinks, TokenNotExistError, WNEAR_META_DATA, WRAP_NEAR_CONTRACT_ID, WalletSelectorTransactions, ZeroInputError, calcStableSwapPriceImpact, calc_d, calc_swap, calc_y, calculateAmountReceived, calculateExchangeRate, calculateFeeCharge, calculateFeePercent, calculateMarketPrice, calculatePriceImpact, calculateSmartRoutesV2PriceImpact, calculateSmartRoutingPriceImpact, cancel_order, claim_order, config, convertToPercentDecimal, divide, estimateSwap, feeToPointDelta, fetchAllPools, find_order, formatError, formatWithCommas, ftGetBalance, ftGetStorageBalance, ftGetTokenMetadata, ftGetTokensMetadata, ftViewFunction, getAccountName, getAccountNearBalance, getAmount, getAvgFee, getConfig, getDCLPool, getDCLPoolId, getDefaultTokenList, getExpectedOutputFromSwapTodos, getGas, getGlobalWhitelist, getHybridStableSmart, getKeyStore, getMax, getMemorySigner, getMinStorageBalance, getPointByPrice, getPool, getPoolAllocationPercents, getPoolByIds, getPoolEstimate, getPoolsByTokens, getPriceImpact, getRatedPoolDetail, getRefPools, getSignedTransactionsByMemoryKey, getSimplePoolEstimate, getStablePoolDecimal, getStablePoolEstimate, getStablePools, getStablePoolsThisPair, getSwappedAmount, getTotalPools, getUnRatedPoolDetail, getUserRegisteredTokens, get_order, get_pointorder_range, init_env, instantSwap, isMobile, isStablePool, isStablePoolToken, isValidSlippageTolerance, listDCLPools, list_active_orders, list_history_orders, list_user_assets, multiply, nearDepositTransaction, nearWithdrawTransaction, parsePool, percent, percentLess, percentOf, percentOfBigNumber, pointToPrice, poolFormatter, priceToPoint, provider, quote, quote_by_output, refDCLSwapViewFunction, refFiViewFunction, registerAccountOnToken, round, scientificNotationToString, sendTransactionsByMemoryKey, separateRoutes, singlePoolSwap, subtraction, switchEnv, symbolsArr, toInternationalCurrencySystemLongString, toNonDivisibleNumber, toPrecision, toReadableNumber, toRealSymbol, transformTransactions, unNamedError };
|
|
8334
|
+
export { AccountIdMisMatch, CONSTANT_D, DCLInValid, DCLSwap, DCLSwapByInputOnBestPool, DCLSwapGetStorageBalance, DCL_POOL_FEE_LIST, DCL_POOL_SPLITER, DEFAULT_SLIPPAGE_TOLERANCE, DefaultMainnetTokenList, DefaultTestnetTokenList, FEE_DIVISOR, FT_MINIMUM_STORAGE_BALANCE_LARGE, InValidAccessKeyError, NEAR_META_DATA, NoAccountIdFound, NoCredential, NoFeeToPool, NoLocalSignerError, NoOrderFound, NoPoolError, NoPoolOnThisPair, NoPuiblicKeyError, NotLoginError, ONE_YOCTO_NEAR, ONLY_ZEROS, OrderNoRemainedAmount, POINTLEFTRANGE, POINTRIGHTRANGE, PoolMode, RATED_POOL_LP_TOKEN_DECIMALS, REF_FI_CONTRACT_ID, REF_META_DATA, REF_TOKEN_ID, REPLACE_TOKENS, STABLE_LP_TOKEN_DECIMALS, STORAGE_TO_REGISTER_WITH_MFT, SameInputTokenError, SlippageError, SwapRouteError, SwapWidget, TokenLinks, TokenNotExistError, WNEAR_META_DATA, WRAP_NEAR_CONTRACT_ID, WalletSelectorTransactions, ZeroInputError, calcStableSwapPriceImpact, calc_d, calc_swap, calc_y, calculateAmountReceived, calculateExchangeRate, calculateFeeCharge, calculateFeePercent, calculateMarketPrice, calculatePriceImpact, calculateSmartRoutesV2PriceImpact, calculateSmartRoutingPriceImpact, cancel_order, claim_order, config, convertToPercentDecimal, divide, estimateSwap, feeToPointDelta, fetchAllPools, find_order, formatError, formatWithCommas, ftGetBalance, ftGetStorageBalance, ftGetTokenMetadata, ftGetTokensMetadata, ftViewFunction, getAccountName, getAccountNearBalance, getAmount, getAvgFee, getConfig, getDCLPool, getDCLPoolId, getDefaultTokenList, getDegenPoolDetail, getExpectedOutputFromSwapTodos, getGas, getGlobalWhitelist, getHybridStableSmart, getKeyStore, getMax, getMemorySigner, getMinStorageBalance, getPointByPrice, getPool, getPoolAllocationPercents, getPoolByIds, getPoolEstimate, getPoolsByTokens, getPriceImpact, getRatedPoolDetail, getRefPools, getSignedTransactionsByMemoryKey, getSimplePoolEstimate, getStablePoolDecimal, getStablePoolEstimate, getStablePools, getStablePoolsThisPair, getSwappedAmount, getTotalPools, getUnRatedPoolDetail, getUserRegisteredTokens, get_order, get_pointorder_range, init_env, instantSwap, isMobile, isStablePool, isStablePoolToken, isValidSlippageTolerance, listDCLPools, list_active_orders, list_history_orders, list_user_assets, multiply, nearDepositTransaction, nearWithdrawTransaction, parsePool, percent, percentLess, percentOf, percentOfBigNumber, pointToPrice, poolFormatter, priceToPoint, provider, quote, quote_by_output, refDCLSwapViewFunction, refFiViewFunction, registerAccountOnToken, round, scientificNotationToString, sendTransactionsByMemoryKey, separateRoutes, singlePoolSwap, subtraction, switchEnv, symbolsArr, toInternationalCurrencySystemLongString, toNonDivisibleNumber, toPrecision, toReadableNumber, toRealSymbol, transformTransactions, unNamedError };
|
|
8300
8335
|
//# sourceMappingURL=ref-sdk.esm.js.map
|