@rabby-wallet/rabby-swap 0.0.4 → 0.0.5

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.
@@ -12,6 +12,7 @@ import { Interface } from "@ethersproject/abi";
12
12
  import { CHAINS_ENUM, CHAINS } from "@debank/common";
13
13
  import { isSameAddress } from "../utils";
14
14
  import { ParaSwapABI } from "../abi";
15
+ import { DEX_ENUM, DEX_SPENDER_WHITELIST } from "../consts";
15
16
  const NATIVE_TOKEN = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
16
17
  const request = axios.create({
17
18
  baseURL: "https://apiv5.paraswap.io",
@@ -100,7 +101,7 @@ export const getQuote = (options) => __awaiter(void 0, void 0, void 0, function*
100
101
  : priceRoute.destToken,
101
102
  toTokenAmount: priceRoute.destAmount,
102
103
  toTokenDecimals: priceRoute.destDecimals,
103
- spender: data.to,
104
+ spender: DEX_SPENDER_WHITELIST[DEX_ENUM.PARASWAP][options.chain],
104
105
  };
105
106
  });
106
107
  export const decodeCalldata = (tx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-swap",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -9,7 +9,8 @@ import {
9
9
  DecodeCalldataResult,
10
10
  } from "../quote";
11
11
  import { isSameAddress } from "../utils";
12
- import { OneInchABI, ParaSwapABI } from "../abi";
12
+ import { ParaSwapABI } from "../abi";
13
+ import { DEX_ENUM, DEX_SPENDER_WHITELIST } from "../consts";
13
14
 
14
15
  const NATIVE_TOKEN = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
15
16
 
@@ -165,7 +166,10 @@ export const getQuote = async (options: QuoteParams): Promise<QuoteResult> => {
165
166
  : priceRoute.destToken,
166
167
  toTokenAmount: priceRoute.destAmount,
167
168
  toTokenDecimals: priceRoute.destDecimals,
168
- spender: data.to,
169
+ spender:
170
+ DEX_SPENDER_WHITELIST[DEX_ENUM.PARASWAP][
171
+ options.chain as keyof typeof DEX_SPENDER_WHITELIST[DEX_ENUM.PARASWAP]
172
+ ],
169
173
  };
170
174
  };
171
175