@ref-finance/ref-sdk 1.1.3 → 1.1.4

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.
@@ -55,7 +55,7 @@ function getConfig(env) {
55
55
  case 'testnet':
56
56
  return {
57
57
  networkId: 'testnet',
58
- nodeUrl: 'https://near-testnet.infura.io/v3/388c72223585424086eea3872bb0ba2c',
58
+ nodeUrl: 'https://rpc.testnet.near.org',
59
59
  walletUrl: 'https://wallet.testnet.near.org',
60
60
  indexerUrl: 'https://testnet-indexer.ref-finance.com',
61
61
  WRAP_NEAR_CONTRACT_ID: 'wrap.testnet',
@@ -642,7 +642,7 @@ var calc_y = function calc_y(amp, x_c_amount, current_c_amounts, index_x, index_
642
642
  var c = d * d / x_c_amount;
643
643
 
644
644
  for (var i = 0; i < token_num; i++) {
645
- if (i != index_x && i != index_y) {
645
+ if (i !== index_x && i !== index_y) {
646
646
  s += current_c_amounts[i];
647
647
  c = c * d / current_c_amounts[i];
648
648
  }
@@ -3013,7 +3013,7 @@ var singlePoolSwap = function singlePoolSwap(_ref3) {
3013
3013
  var parsedAmountIn = toNonDivisibleNumber(tokenIn.decimals, amountIn); // const pools = simplePools.concat(stablePools);
3014
3014
 
3015
3015
  var simplePoolsThisPair = simplePools.filter(function (p) {
3016
- return p.tokenIds.includes(tokenIn.id) && p.tokenIds.includes(tokenOut.id);
3016
+ return p.tokenIds.includes(tokenIn.id) && p.tokenIds.includes(tokenOut.id) && (!stablePools || !isStablePool(stablePools, p.id));
3017
3017
  });
3018
3018
  var estimatesSimplePool = simplePoolsThisPair.map(function (pool) {
3019
3019
  return getSimplePoolEstimate({
@@ -7120,11 +7120,17 @@ var SwapWidget = function SwapWidget(props) {
7120
7120
  tokenIn: tokenIn,
7121
7121
  tokenOut: tokenOut,
7122
7122
  amountIn: amountIn,
7123
- simplePools: allPools.simplePools,
7123
+ simplePools: allPools.simplePools.filter(function (p) {
7124
+ return Number(p.shareSupply) > 0;
7125
+ }),
7124
7126
  options: {
7125
7127
  enableSmartRouting: enableSmartRouting,
7126
- stablePools: allPools.ratedPools.concat(allPools.unRatedPools),
7127
- stablePoolsDetail: allStablePools
7128
+ stablePools: allPools.ratedPools.concat(allPools.unRatedPools).filter(function (p) {
7129
+ return Number(p.shareSupply) > 0;
7130
+ }),
7131
+ stablePoolsDetail: allStablePools.filter(function (p) {
7132
+ return Number(p.shares_total_supply) > 0;
7133
+ })
7128
7134
  },
7129
7135
  slippageTolerance: slippageTolerance,
7130
7136
  onSwap: onSwap,