@rabby-wallet/rabby-swap 0.0.4 → 0.0.6

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",
@@ -77,6 +78,7 @@ export const getQuote = (options) => __awaiter(void 0, void 0, void 0, function*
77
78
  userAddress: options.userAddress,
78
79
  slippage: Math.floor(options.slippage * 100),
79
80
  priceRoute: priceRoute,
81
+ partner: 'Rabby',
80
82
  };
81
83
  if (options.feeRate) {
82
84
  params.partnerFeeBps = (options.feeRate * 100).toString();
@@ -100,7 +102,7 @@ export const getQuote = (options) => __awaiter(void 0, void 0, void 0, function*
100
102
  : priceRoute.destToken,
101
103
  toTokenAmount: priceRoute.destAmount,
102
104
  toTokenDecimals: priceRoute.destDecimals,
103
- spender: data.to,
105
+ spender: DEX_SPENDER_WHITELIST[DEX_ENUM.PARASWAP][options.chain],
104
106
  };
105
107
  });
106
108
  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.6",
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
 
@@ -91,6 +92,7 @@ interface SwapParams {
91
92
  userAddress: string;
92
93
  srcAmount: string;
93
94
  priceRoute: PriceRoute;
95
+ partner: string;
94
96
  }
95
97
 
96
98
  const getPriceRoute = async (params: PriceParams): Promise<PriceResponse> => {
@@ -137,6 +139,7 @@ export const getQuote = async (options: QuoteParams): Promise<QuoteResult> => {
137
139
  userAddress: options.userAddress,
138
140
  slippage: Math.floor(options.slippage * 100),
139
141
  priceRoute: priceRoute,
142
+ partner: 'Rabby',
140
143
  };
141
144
 
142
145
  if (options.feeRate) {
@@ -165,7 +168,10 @@ export const getQuote = async (options: QuoteParams): Promise<QuoteResult> => {
165
168
  : priceRoute.destToken,
166
169
  toTokenAmount: priceRoute.destAmount,
167
170
  toTokenDecimals: priceRoute.destDecimals,
168
- spender: data.to,
171
+ spender:
172
+ DEX_SPENDER_WHITELIST[DEX_ENUM.PARASWAP][
173
+ options.chain as keyof typeof DEX_SPENDER_WHITELIST[DEX_ENUM.PARASWAP]
174
+ ],
169
175
  };
170
176
  };
171
177