@1delta/calldatalib 0.0.2 → 0.0.8
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/CalldataLib.d.ts +8 -9
- package/dist/CalldataLib.js +8 -22
- package/package.json +1 -1
package/dist/CalldataLib.d.ts
CHANGED
|
@@ -114,15 +114,14 @@ export declare function encodeUniswapV4Sync(singleton: Address, asset: Address):
|
|
|
114
114
|
export declare function encodeUniswapV4Take(singleton: Address, asset: Address, receiver: Address, amount: bigint): Hex;
|
|
115
115
|
export declare function swapHead(amount: bigint, amountOutMin: bigint, assetIn: Address): Hex;
|
|
116
116
|
export declare function attachBranch(data: Hex, hops: bigint, splits: bigint, splitsData: Hex): Hex;
|
|
117
|
-
export declare function
|
|
118
|
-
export declare function
|
|
119
|
-
export declare function
|
|
120
|
-
export declare function
|
|
121
|
-
export declare function
|
|
122
|
-
export declare function
|
|
123
|
-
export declare function
|
|
124
|
-
export declare function
|
|
125
|
-
export declare function encodeIzumiStyleSwap(tokenOut: Address, receiver: Address, forkId: bigint, pool: Address, feeTier: bigint, cfg: any, flashCalldata: Hex): Hex;
|
|
117
|
+
export declare function encodeUniswapV2StyleSwap(tokenOut: Address, receiver: Address, forkId: bigint, pool: Address, feeDenom: bigint, cfg: any, flashCalldata: Hex): Hex;
|
|
118
|
+
export declare function encodeUniswapV4StyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, manager: Address, fee: number, tickSpacing: number, hooks: Address, hookData: Hex, cfg: any): Hex;
|
|
119
|
+
export declare function encodeBalancerV2StyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, poolId: Hex, balancerVault: Address, cfg: any): Hex;
|
|
120
|
+
export declare function encodeLbStyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, pool: Address, swapForY: boolean, cfg: any): Hex;
|
|
121
|
+
export declare function encodeSyncSwapStyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, pool: Address, cfg: any): Hex;
|
|
122
|
+
export declare function encodeUniswapV3StyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, forkId: bigint, pool: Address, feeTier: bigint, cfg: any, flashCalldata: Hex): Hex;
|
|
123
|
+
export declare function encodeIzumiStyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, forkId: bigint, pool: Address, feeTier: bigint, cfg: any, flashCalldata: Hex): Hex;
|
|
124
|
+
export declare function encodeBalancerV3StyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, balancerV3Vault: Address, pool: Address, cfg: any, poolUserData: Hex): Hex;
|
|
126
125
|
export declare function encodeDodoStyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, pool: Address, selector: any, poolId: bigint, cfg: any, flashCalldata: Hex): Hex;
|
|
127
126
|
export declare function encodeWooStyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, pool: Address, cfg: any): Hex;
|
|
128
127
|
export declare function encodeGmxStyleSwap(currentData: Hex, tokenOut: Address, receiver: Address, pool: Address, cfg: any): Hex;
|
package/dist/CalldataLib.js
CHANGED
|
@@ -189,7 +189,7 @@ export function attachBranch(data, hops, splits, splitsData) {
|
|
|
189
189
|
throw new Error("Nosplitsbutsplitdataprovided");
|
|
190
190
|
return encodePacked(["bytes", "uint8", "uint8", "bytes"], [data, uint8(hops), uint8(splits), splitsData]);
|
|
191
191
|
}
|
|
192
|
-
export function
|
|
192
|
+
export function encodeUniswapV2StyleSwap(tokenOut, receiver, forkId, pool, feeDenom, cfg, flashCalldata) {
|
|
193
193
|
if (uint256(cfg) < 2 && flashCalldata.length / 2 - 1 > 2)
|
|
194
194
|
throw new Error("Invalidconfigforv2swap");
|
|
195
195
|
return encodePacked(["address", "address", "uint8", "address", "uint16", "uint8", "uint16", "bytes"], [
|
|
@@ -203,7 +203,7 @@ export function uniswapV2StyleSwap(tokenOut, receiver, forkId, pool, feeDenom, c
|
|
|
203
203
|
bytes(cfg === DexPayConfig.FLASH ? flashCalldata : newbytes(0)),
|
|
204
204
|
]);
|
|
205
205
|
}
|
|
206
|
-
export function
|
|
206
|
+
export function encodeUniswapV4StyleSwap(currentData, tokenOut, receiver, manager, fee, tickSpacing, hooks, hookData, cfg) {
|
|
207
207
|
if (cfg === DexPayConfig.FLASH)
|
|
208
208
|
throw new Error("Invalidconfigforv2swap");
|
|
209
209
|
return encodePacked(["bytes", "address", "address", "uint8", "address", "address", "uint24", "uint24", "uint8", "uint16", "bytes"], [
|
|
@@ -220,7 +220,7 @@ export function uniswapV4StyleSwap(currentData, tokenOut, receiver, manager, fee
|
|
|
220
220
|
hookData,
|
|
221
221
|
]);
|
|
222
222
|
}
|
|
223
|
-
export function
|
|
223
|
+
export function encodeBalancerV2StyleSwap(currentData, tokenOut, receiver, poolId, balancerVault, cfg) {
|
|
224
224
|
if (cfg === DexPayConfig.FLASH)
|
|
225
225
|
throw new Error("Invalidconfigforv2swap");
|
|
226
226
|
return encodePacked(["bytes", "address", "address", "uint8", "bytes32", "address", "uint16"], [
|
|
@@ -233,7 +233,7 @@ export function balancerV2StyleSwap(currentData, tokenOut, receiver, poolId, bal
|
|
|
233
233
|
uint16(uint256(cfg)),
|
|
234
234
|
]);
|
|
235
235
|
}
|
|
236
|
-
export function
|
|
236
|
+
export function encodeLbStyleSwap(currentData, tokenOut, receiver, pool, swapForY, cfg) {
|
|
237
237
|
if (cfg === DexPayConfig.FLASH)
|
|
238
238
|
throw new Error("Invalidconfigforv2swap");
|
|
239
239
|
return encodePacked(["bytes", "address", "address", "uint8", "address", "uint8", "uint16"], [
|
|
@@ -246,12 +246,12 @@ export function lbStyleSwap(currentData, tokenOut, receiver, pool, swapForY, cfg
|
|
|
246
246
|
uint16(uint256(cfg)),
|
|
247
247
|
]);
|
|
248
248
|
}
|
|
249
|
-
export function
|
|
249
|
+
export function encodeSyncSwapStyleSwap(currentData, tokenOut, receiver, pool, cfg) {
|
|
250
250
|
if (cfg === DexPayConfig.FLASH)
|
|
251
251
|
throw new Error("Invalidconfigforv2swap");
|
|
252
252
|
return encodePacked(["bytes", "address", "address", "uint8", "address", "uint16"], [currentData, tokenOut, receiver, uint8(DexTypeMappings.SYNC_SWAP_ID), pool, uint16(uint256(cfg))]);
|
|
253
253
|
}
|
|
254
|
-
export function
|
|
254
|
+
export function encodeUniswapV3StyleSwap(currentData, tokenOut, receiver, forkId, pool, feeTier, cfg, flashCalldata) {
|
|
255
255
|
if (uint256(cfg) < 2 && flashCalldata.length / 2 - 1 > 2)
|
|
256
256
|
throw new Error("Invalidconfigforv2swap");
|
|
257
257
|
return encodePacked(["bytes", "address", "address", "uint8", "address", "uint8", "uint16", "uint16", "bytes"], [
|
|
@@ -266,7 +266,7 @@ export function uniswapV3StyleSwap(currentData, tokenOut, receiver, forkId, pool
|
|
|
266
266
|
bytes(cfg === DexPayConfig.FLASH ? flashCalldata : newbytes(0)),
|
|
267
267
|
]);
|
|
268
268
|
}
|
|
269
|
-
export function
|
|
269
|
+
export function encodeIzumiStyleSwap(currentData, tokenOut, receiver, forkId, pool, feeTier, cfg, flashCalldata) {
|
|
270
270
|
if (uint256(cfg) < 2 && flashCalldata.length / 2 - 1 > 2)
|
|
271
271
|
throw new Error("Invalidconfigforv2swap");
|
|
272
272
|
return encodePacked(["bytes", "address", "address", "uint8", "address", "uint8", "uint16", "uint16", "bytes"], [
|
|
@@ -281,7 +281,7 @@ export function izumiV3StyleSwap(currentData, tokenOut, receiver, forkId, pool,
|
|
|
281
281
|
bytes(cfg === DexPayConfig.FLASH ? flashCalldata : newbytes(0)),
|
|
282
282
|
]);
|
|
283
283
|
}
|
|
284
|
-
export function
|
|
284
|
+
export function encodeBalancerV3StyleSwap(currentData, tokenOut, receiver, balancerV3Vault, pool, cfg, poolUserData) {
|
|
285
285
|
return encodePacked(["bytes", "address", "address", "uint8", "address", "address", "uint8", "uint16", "bytes"], [
|
|
286
286
|
currentData,
|
|
287
287
|
tokenOut,
|
|
@@ -294,20 +294,6 @@ export function balancerV3StyleSwap(currentData, tokenOut, receiver, balancerV3V
|
|
|
294
294
|
poolUserData,
|
|
295
295
|
]);
|
|
296
296
|
}
|
|
297
|
-
export function encodeIzumiStyleSwap(tokenOut, receiver, forkId, pool, feeTier, cfg, flashCalldata) {
|
|
298
|
-
if (uint256(cfg) < 2 && flashCalldata.length / 2 - 1 > 2)
|
|
299
|
-
throw new Error("Invalidconfigforv2swap");
|
|
300
|
-
return encodePacked(["address", "address", "uint8", "address", "uint8", "uint16", "uint16", "bytes"], [
|
|
301
|
-
tokenOut,
|
|
302
|
-
receiver,
|
|
303
|
-
uint8(DexTypeMappings.IZI_ID),
|
|
304
|
-
pool,
|
|
305
|
-
uint8(forkId),
|
|
306
|
-
uint16(feeTier),
|
|
307
|
-
uint16(cfg === DexPayConfig.FLASH ? flashCalldata.length / 2 - 1 : uint256(cfg)),
|
|
308
|
-
bytes(cfg === DexPayConfig.FLASH ? flashCalldata : newbytes(0)),
|
|
309
|
-
]);
|
|
310
|
-
}
|
|
311
297
|
export function encodeDodoStyleSwap(currentData, tokenOut, receiver, pool, selector, poolId, cfg, flashCalldata) {
|
|
312
298
|
return encodePacked(["bytes", "address", "address", "uint8", "address", "uint8", "uint16", "uint16", "bytes"], [
|
|
313
299
|
currentData,
|