@rabby-wallet/rabby-swap 0.0.5 → 0.0.7

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/consts.d.ts CHANGED
@@ -40,6 +40,8 @@ export declare const DEX_ROUTER_WHITELIST: {
40
40
  POLYGON: string;
41
41
  BSC: string;
42
42
  AVAX: string;
43
+ ARBITRUM: string;
44
+ OP: string;
43
45
  };
44
46
  "0xAPI": {
45
47
  ETH: string;
@@ -70,6 +72,8 @@ export declare const DEX_SPENDER_WHITELIST: {
70
72
  POLYGON: string;
71
73
  BSC: string;
72
74
  AVAX: string;
75
+ OP: string;
76
+ ARBITRUM: string;
73
77
  };
74
78
  "0xAPI": {
75
79
  ETH: string;
package/dist/consts.js CHANGED
@@ -45,6 +45,8 @@ export const DEX_ROUTER_WHITELIST = {
45
45
  [CHAINS_ENUM.POLYGON]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
46
46
  [CHAINS_ENUM.BSC]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
47
47
  [CHAINS_ENUM.AVAX]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
48
+ [CHAINS_ENUM.ARBITRUM]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
49
+ [CHAINS_ENUM.OP]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
48
50
  },
49
51
  [DEX_ENUM.ZEROXAPI]: {
50
52
  [CHAINS_ENUM.ETH]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
@@ -75,6 +77,8 @@ export const DEX_SPENDER_WHITELIST = {
75
77
  [CHAINS_ENUM.POLYGON]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
76
78
  [CHAINS_ENUM.BSC]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
77
79
  [CHAINS_ENUM.AVAX]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
80
+ [CHAINS_ENUM.OP]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
81
+ [CHAINS_ENUM.ARBITRUM]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
78
82
  },
79
83
  [DEX_ENUM.ZEROXAPI]: {
80
84
  [CHAINS_ENUM.ETH]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
@@ -75,6 +75,7 @@ export const getQuote = (options) => __awaiter(void 0, void 0, void 0, function*
75
75
  if (options.feeRate) {
76
76
  params.buyTokenPercentageFee = options.feeRate / 100;
77
77
  params.feeRecipient = options.feeAddress;
78
+ params.affiliateAddress = options.feeAddress;
78
79
  }
79
80
  const { data } = yield request.get("/swap/v1/quote", {
80
81
  params,
@@ -41,6 +41,8 @@ export const SUPPORT_CHAINS = [
41
41
  CHAINS_ENUM.POLYGON,
42
42
  CHAINS_ENUM.BSC,
43
43
  CHAINS_ENUM.AVAX,
44
+ CHAINS_ENUM.OP,
45
+ CHAINS_ENUM.ARBITRUM,
44
46
  ];
45
47
  const getPriceRoute = (params) => __awaiter(void 0, void 0, void 0, function* () {
46
48
  const { data } = yield request.get("/prices", {
@@ -78,6 +80,7 @@ export const getQuote = (options) => __awaiter(void 0, void 0, void 0, function*
78
80
  userAddress: options.userAddress,
79
81
  slippage: Math.floor(options.slippage * 100),
80
82
  priceRoute: priceRoute,
83
+ partner: 'Rabby',
81
84
  };
82
85
  if (options.feeRate) {
83
86
  params.partnerFeeBps = (options.feeRate * 100).toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-swap",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/consts.ts CHANGED
@@ -48,6 +48,8 @@ export const DEX_ROUTER_WHITELIST = {
48
48
  [CHAINS_ENUM.POLYGON]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
49
49
  [CHAINS_ENUM.BSC]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
50
50
  [CHAINS_ENUM.AVAX]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
51
+ [CHAINS_ENUM.ARBITRUM]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
52
+ [CHAINS_ENUM.OP]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
51
53
  },
52
54
  [DEX_ENUM.ZEROXAPI]: {
53
55
  [CHAINS_ENUM.ETH]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
@@ -79,6 +81,8 @@ export const DEX_SPENDER_WHITELIST = {
79
81
  [CHAINS_ENUM.POLYGON]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
80
82
  [CHAINS_ENUM.BSC]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
81
83
  [CHAINS_ENUM.AVAX]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
84
+ [CHAINS_ENUM.OP]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
85
+ [CHAINS_ENUM.ARBITRUM]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
82
86
  },
83
87
  [DEX_ENUM.ZEROXAPI]: {
84
88
  [CHAINS_ENUM.ETH]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
package/src/dexs/0xapi.ts CHANGED
@@ -44,6 +44,7 @@ interface SwapParams {
44
44
  skipValidation: boolean;
45
45
  buyTokenPercentageFee?: number;
46
46
  feeRecipient?: string;
47
+ affiliateAddress?: string;
47
48
  }
48
49
 
49
50
  interface SwapResponse extends Tx {
@@ -100,6 +101,7 @@ export const getQuote = async (options: QuoteParams): Promise<QuoteResult> => {
100
101
  if (options.feeRate) {
101
102
  params.buyTokenPercentageFee = options.feeRate / 100;
102
103
  params.feeRecipient = options.feeAddress;
104
+ params.affiliateAddress = options.feeAddress;
103
105
  }
104
106
 
105
107
  const { data } = await request.get<SwapResponse>("/swap/v1/quote", {
@@ -42,6 +42,8 @@ export const SUPPORT_CHAINS = [
42
42
  CHAINS_ENUM.POLYGON,
43
43
  CHAINS_ENUM.BSC,
44
44
  CHAINS_ENUM.AVAX,
45
+ CHAINS_ENUM.OP,
46
+ CHAINS_ENUM.ARBITRUM,
45
47
  ];
46
48
 
47
49
  interface PriceParams {
@@ -92,6 +94,7 @@ interface SwapParams {
92
94
  userAddress: string;
93
95
  srcAmount: string;
94
96
  priceRoute: PriceRoute;
97
+ partner: string;
95
98
  }
96
99
 
97
100
  const getPriceRoute = async (params: PriceParams): Promise<PriceResponse> => {
@@ -138,6 +141,7 @@ export const getQuote = async (options: QuoteParams): Promise<QuoteResult> => {
138
141
  userAddress: options.userAddress,
139
142
  slippage: Math.floor(options.slippage * 100),
140
143
  priceRoute: priceRoute,
144
+ partner: 'Rabby',
141
145
  };
142
146
 
143
147
  if (options.feeRate) {