@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.
@@ -36,7 +36,7 @@
36
36
  case 'testnet':
37
37
  return {
38
38
  networkId: 'testnet',
39
- nodeUrl: 'https://near-testnet.infura.io/v3/388c72223585424086eea3872bb0ba2c',
39
+ nodeUrl: 'https://rpc.testnet.near.org',
40
40
  walletUrl: 'https://wallet.testnet.near.org',
41
41
  indexerUrl: 'https://testnet-indexer.ref-finance.com',
42
42
  WRAP_NEAR_CONTRACT_ID: 'wrap.testnet',
@@ -623,7 +623,7 @@
623
623
  var c = d * d / x_c_amount;
624
624
 
625
625
  for (var i = 0; i < token_num; i++) {
626
- if (i != index_x && i != index_y) {
626
+ if (i !== index_x && i !== index_y) {
627
627
  s += current_c_amounts[i];
628
628
  c = c * d / current_c_amounts[i];
629
629
  }
@@ -2994,7 +2994,7 @@
2994
2994
  var parsedAmountIn = toNonDivisibleNumber(tokenIn.decimals, amountIn); // const pools = simplePools.concat(stablePools);
2995
2995
 
2996
2996
  var simplePoolsThisPair = simplePools.filter(function (p) {
2997
- return p.tokenIds.includes(tokenIn.id) && p.tokenIds.includes(tokenOut.id);
2997
+ return p.tokenIds.includes(tokenIn.id) && p.tokenIds.includes(tokenOut.id) && (!stablePools || !isStablePool(stablePools, p.id));
2998
2998
  });
2999
2999
  var estimatesSimplePool = simplePoolsThisPair.map(function (pool) {
3000
3000
  return getSimplePoolEstimate({
@@ -7131,11 +7131,17 @@
7131
7131
  tokenIn: tokenIn,
7132
7132
  tokenOut: tokenOut,
7133
7133
  amountIn: amountIn,
7134
- simplePools: allPools.simplePools,
7134
+ simplePools: allPools.simplePools.filter(function (p) {
7135
+ return Number(p.shareSupply) > 0;
7136
+ }),
7135
7137
  options: {
7136
7138
  enableSmartRouting: enableSmartRouting,
7137
- stablePools: allPools.ratedPools.concat(allPools.unRatedPools),
7138
- stablePoolsDetail: allStablePools
7139
+ stablePools: allPools.ratedPools.concat(allPools.unRatedPools).filter(function (p) {
7140
+ return Number(p.shareSupply) > 0;
7141
+ }),
7142
+ stablePoolsDetail: allStablePools.filter(function (p) {
7143
+ return Number(p.shares_total_supply) > 0;
7144
+ })
7139
7145
  },
7140
7146
  slippageTolerance: slippageTolerance,
7141
7147
  onSwap: onSwap,