@1delta/calldatalib 0.0.34 → 0.0.37

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.
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @ts-nocheck
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.DexForkMappings = exports.DexTypeMappings = exports.BridgeIds = exports.ComposerCommands = exports.Gen2025ActionIds = exports.ERC4626Ids = exports.FlashLoanIds = exports.LenderOps = exports.LenderIds = exports.PermitIds = exports.TransferIds = exports.WrapOperation = exports.DodoSelector = exports.DexPayConfig = exports.SweepType = void 0;
4
5
  exports.encodeExternalCall = encodeExternalCall;
@@ -71,7 +72,6 @@ exports.encodeCompoundV2Deposit = encodeCompoundV2Deposit;
71
72
  exports.encodeCompoundV2Borrow = encodeCompoundV2Borrow;
72
73
  exports.encodeCompoundV2Repay = encodeCompoundV2Repay;
73
74
  exports.encodeCompoundV2Withdraw = encodeCompoundV2Withdraw;
74
- // @ts-nocheck
75
75
  const viem_1 = require("viem");
76
76
  const utils_js_1 = require("./utils.js");
77
77
  var SweepType;
@@ -200,53 +200,20 @@ var DexForkMappings;
200
200
  DexForkMappings[DexForkMappings["UNISWAP_V2"] = 0] = "UNISWAP_V2";
201
201
  })(DexForkMappings || (exports.DexForkMappings = DexForkMappings = {}));
202
202
  function encodeExternalCall(target, value, useSelfBalance, data) {
203
- return (0, utils_js_1.encodePacked)(["uint8", "address", "uint128", "uint16", "bytes"], [
204
- (0, utils_js_1.uint8)(ComposerCommands.EXT_CALL),
205
- target,
206
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(value), false, false, useSelfBalance),
207
- (0, utils_js_1.uint16)(data.length / 2 - 1),
208
- data,
209
- ]);
203
+ return (0, utils_js_1.encodePacked)(['uint8', 'address', 'uint128', 'uint16', 'bytes'], [(0, utils_js_1.uint8)(ComposerCommands.EXT_CALL), target, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(value), false, useSelfBalance), (0, utils_js_1.uint16)(data.length / 2 - 1), data]);
210
204
  }
211
205
  function encodeTryExternalCall(target, value, useSelfBalance, rOnFailure, data, catchData) {
212
- return (0, utils_js_1.encodePacked)(["uint8", "address", "uint128", "uint16", "bytes", "uint8", "uint16", "bytes"], [
213
- (0, utils_js_1.uint8)(ComposerCommands.EXT_TRY_CALL),
214
- target,
215
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(value), false, false, useSelfBalance),
216
- (0, utils_js_1.uint16)(data.length / 2 - 1),
217
- data,
218
- (0, utils_js_1.uint8)(rOnFailure ? 0 : 1),
219
- (0, utils_js_1.uint16)(catchData.length / 2 - 1),
220
- catchData,
221
- ]);
206
+ return (0, utils_js_1.encodePacked)(['uint8', 'address', 'uint128', 'uint16', 'bytes', 'uint8', 'uint16', 'bytes'], [(0, utils_js_1.uint8)(ComposerCommands.EXT_TRY_CALL), target, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(value), false, useSelfBalance), (0, utils_js_1.uint16)(data.length / 2 - 1), data, (0, utils_js_1.uint8)(rOnFailure ? 0 : 1), (0, utils_js_1.uint16)(catchData.length / 2 - 1), catchData]);
222
207
  }
223
208
  function encodeStargateV2Bridge(asset, stargatePool, dstEid, receiver, refundReceiver, amount, slippage, fee, isBusMode, isNative, composeMsg, extraOptions) {
224
209
  const partialData = encodeStargateV2BridgePartial(amount, slippage, fee, isBusMode, isNative, composeMsg, extraOptions);
225
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint32", "bytes32", "address", "bytes"], [
226
- (0, utils_js_1.uint8)(ComposerCommands.BRIDGING),
227
- (0, utils_js_1.uint8)(BridgeIds.STARGATE_V2),
228
- asset,
229
- stargatePool,
230
- dstEid,
231
- receiver,
232
- refundReceiver,
233
- partialData,
234
- ]);
210
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'uint32', 'bytes32', 'address', 'bytes'], [(0, utils_js_1.uint8)(ComposerCommands.BRIDGING), (0, utils_js_1.uint8)(BridgeIds.STARGATE_V2), asset, stargatePool, dstEid, receiver, refundReceiver, partialData]);
235
211
  }
236
212
  function encodePermit(permitId, target, data) {
237
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "uint16", "bytes"], [(0, utils_js_1.uint8)(ComposerCommands.PERMIT), (0, utils_js_1.uint8)(permitId), target, (0, utils_js_1.uint16)(data.length / 2 - 1), data]);
213
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'uint16', 'bytes'], [(0, utils_js_1.uint8)(ComposerCommands.PERMIT), (0, utils_js_1.uint8)(permitId), target, (0, utils_js_1.uint16)(data.length / 2 - 1), data]);
238
214
  }
239
215
  function encodeStargateV2BridgePartial(amount, slippage, fee, isBusMode, isNative, composeMsg, extraOptions) {
240
- return (0, utils_js_1.encodePacked)(["uint128", "uint32", "uint128", "uint8", "uint16", "uint16", "bytes", "bytes"], [
241
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, false, isNative),
242
- slippage,
243
- (0, utils_js_1.uint128)(fee),
244
- (0, utils_js_1.uint8)(isBusMode ? 1 : 0),
245
- (0, utils_js_1.uint16)(composeMsg.length / 2 - 1),
246
- (0, utils_js_1.uint16)(extraOptions.length / 2 - 1),
247
- composeMsg,
248
- extraOptions,
249
- ]);
216
+ return (0, utils_js_1.encodePacked)(['uint128', 'uint32', 'uint128', 'uint8', 'uint16', 'uint16', 'bytes', 'bytes'], [(0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, isNative), slippage, (0, utils_js_1.uint128)(fee), (0, utils_js_1.uint8)(isBusMode ? 1 : 0), (0, utils_js_1.uint16)(composeMsg.length / 2 - 1), (0, utils_js_1.uint16)(extraOptions.length / 2 - 1), composeMsg, extraOptions]);
250
217
  }
251
218
  function encodeStargateV2BridgeSimpleTaxi(asset, stargatePool, dstEid, receiver, refundReceiver, amount, isNative, slippage, fee) {
252
219
  return encodeStargateV2Bridge(asset, stargatePool, dstEid, receiver, refundReceiver, amount, slippage, fee, false, isNative, (0, utils_js_1.newbytes)(0), (0, utils_js_1.newbytes)(0));
@@ -255,81 +222,18 @@ function encodeStargateV2BridgeSimpleBus(asset, stargatePool, dstEid, receiver,
255
222
  return encodeStargateV2Bridge(asset, stargatePool, dstEid, receiver, refundReceiver, amount, slippage, fee, true, isNative, (0, utils_js_1.newbytes)(0), (0, utils_js_1.newbytes)(0));
256
223
  }
257
224
  function encodeAcrossBridgeToken(spokePool, depositor, sendingAssetId, receivingAssetId, amount, fixedFee, feePercentage, destinationChainId, receiver, message) {
258
- const bridgeData = (0, utils_js_1.encodePacked)([
259
- "uint8",
260
- "uint8",
261
- "address",
262
- "address",
263
- "address",
264
- "bytes32",
265
- "uint128",
266
- "uint128",
267
- "uint32",
268
- "uint32",
269
- "bytes32",
270
- "uint16",
271
- "bytes",
272
- ], [
273
- (0, utils_js_1.uint8)(ComposerCommands.BRIDGING),
274
- (0, utils_js_1.uint8)(BridgeIds.ACROSS),
275
- spokePool,
276
- depositor,
277
- sendingAssetId,
278
- receivingAssetId,
279
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, false, false),
280
- fixedFee,
281
- feePercentage,
282
- destinationChainId,
283
- receiver,
284
- (0, utils_js_1.uint16)(message.length / 2 - 1),
285
- message,
286
- ]);
225
+ const bridgeData = (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'address', 'bytes32', 'uint128', 'uint128', 'uint32', 'uint32', 'bytes32', 'uint16', 'bytes'], [(0, utils_js_1.uint8)(ComposerCommands.BRIDGING), (0, utils_js_1.uint8)(BridgeIds.ACROSS), spokePool, depositor, sendingAssetId, receivingAssetId, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, false), fixedFee, feePercentage, destinationChainId, receiver, (0, utils_js_1.uint16)(message.length / 2 - 1), message]);
287
226
  return bridgeData;
288
227
  }
289
228
  function encodeAcrossBridgeNative(spokePool, depositor, sendingAssetId, receivingAssetId, amount, fixedFee, feePercentage, destinationChainId, receiver, message) {
290
- const bridgeData = (0, utils_js_1.encodePacked)([
291
- "uint8",
292
- "uint8",
293
- "address",
294
- "address",
295
- "address",
296
- "bytes32",
297
- "uint128",
298
- "uint128",
299
- "uint32",
300
- "uint32",
301
- "bytes32",
302
- "uint16",
303
- "bytes",
304
- ], [
305
- (0, utils_js_1.uint8)(ComposerCommands.BRIDGING),
306
- (0, utils_js_1.uint8)(BridgeIds.ACROSS),
307
- spokePool,
308
- depositor,
309
- sendingAssetId,
310
- receivingAssetId,
311
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, false, true),
312
- fixedFee,
313
- feePercentage,
314
- destinationChainId,
315
- receiver,
316
- (0, utils_js_1.uint16)(message.length / 2 - 1),
317
- message,
318
- ]);
229
+ const bridgeData = (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'address', 'bytes32', 'uint128', 'uint128', 'uint32', 'uint32', 'bytes32', 'uint16', 'bytes'], [(0, utils_js_1.uint8)(ComposerCommands.BRIDGING), (0, utils_js_1.uint8)(BridgeIds.ACROSS), spokePool, depositor, sendingAssetId, receivingAssetId, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, true), fixedFee, feePercentage, destinationChainId, receiver, (0, utils_js_1.uint16)(message.length / 2 - 1), message]);
319
230
  return bridgeData;
320
231
  }
321
232
  function encodePermit2TransferFrom(token, receiver, amount) {
322
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint128"], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.PERMIT2_TRANSFER_FROM), token, receiver, (0, utils_js_1.uint128)(amount)]);
233
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'uint128'], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.PERMIT2_TRANSFER_FROM), token, receiver, (0, utils_js_1.uint128)(amount)]);
323
234
  }
324
235
  function encodeNextGenDexUnlock(singleton, id, d) {
325
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "uint16", "uint8", "bytes"], [
326
- (0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS),
327
- (0, utils_js_1.uint8)(Gen2025ActionIds.UNLOCK),
328
- singleton,
329
- (0, utils_js_1.uint16)(d.length / 2 - 1 + 1),
330
- (0, utils_js_1.uint8)(id),
331
- d,
332
- ]);
236
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'uint16', 'uint8', 'bytes'], [(0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS), (0, utils_js_1.uint8)(Gen2025ActionIds.UNLOCK), singleton, (0, utils_js_1.uint16)(d.length / 2 - 1 + 1), (0, utils_js_1.uint8)(id), d]);
333
237
  }
334
238
  function encodeBalancerV3FlashLoan(singleton, poolId, asset, receiver, amount, flashData) {
335
239
  const take = encodeBalancerV3Take(singleton, asset, receiver, amount);
@@ -337,7 +241,7 @@ function encodeBalancerV3FlashLoan(singleton, poolId, asset, receiver, amount, f
337
241
  return encodeNextGenDexUnlock(singleton, poolId, encodeBalancerV3FlashLoanData(take, flashData, settle));
338
242
  }
339
243
  function encodeBalancerV3FlashLoanData(take, flashData, settle) {
340
- return (0, utils_js_1.encodePacked)(["bytes", "bytes", "bytes"], [take, flashData, settle]);
244
+ return (0, utils_js_1.encodePacked)(['bytes', 'bytes', 'bytes'], [take, flashData, settle]);
341
245
  }
342
246
  function encodeUniswapV4FlashLoan(singleton, poolId, asset, receiver, amount, flashData) {
343
247
  const take = encodeUniswapV4Take(singleton, asset, receiver, amount);
@@ -346,570 +250,201 @@ function encodeUniswapV4FlashLoan(singleton, poolId, asset, receiver, amount, fl
346
250
  return encodeNextGenDexUnlock(singleton, poolId, encodeUniswapV4FlashLoanData(take, sync, flashData, settle));
347
251
  }
348
252
  function encodeUniswapV4FlashLoanData(take, sync, flashData, settle) {
349
- return (0, utils_js_1.encodePacked)(["bytes", "bytes", "bytes", "bytes"], [take, sync, flashData, settle]);
253
+ return (0, utils_js_1.encodePacked)(['bytes', 'bytes', 'bytes', 'bytes'], [take, sync, flashData, settle]);
350
254
  }
351
255
  function encodeBalancerV3Take(singleton, asset, receiver, amount) {
352
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "address", "uint128"], [
353
- (0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS),
354
- (0, utils_js_1.uint8)(Gen2025ActionIds.BAL_V3_TAKE),
355
- singleton,
356
- asset,
357
- receiver,
358
- (0, utils_js_1.uint128)(amount),
359
- ]);
256
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'address', 'uint128'], [(0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS), (0, utils_js_1.uint8)(Gen2025ActionIds.BAL_V3_TAKE), singleton, asset, receiver, (0, utils_js_1.uint128)(amount)]);
360
257
  }
361
258
  function encodeUniswapV4Sync(singleton, asset) {
362
259
  if (asset === viem_1.zeroAddress)
363
260
  return `0x0`;
364
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address"], [(0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS), (0, utils_js_1.uint8)(Gen2025ActionIds.UNI_V4_SYNC), singleton, asset]);
261
+ ;
262
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS), (0, utils_js_1.uint8)(Gen2025ActionIds.UNI_V4_SYNC), singleton, asset]);
365
263
  }
366
264
  function encodeUniswapV4Take(singleton, asset, receiver, amount) {
367
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "address", "uint128"], [
368
- (0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS),
369
- (0, utils_js_1.uint8)(Gen2025ActionIds.UNI_V4_TAKE),
370
- singleton,
371
- asset,
372
- receiver,
373
- (0, utils_js_1.uint128)(amount),
374
- ]);
265
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'address', 'uint128'], [(0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS), (0, utils_js_1.uint8)(Gen2025ActionIds.UNI_V4_TAKE), singleton, asset, receiver, (0, utils_js_1.uint128)(amount)]);
375
266
  }
376
267
  function swapHead(amount, amountOutMin, assetIn) {
377
- return (0, utils_js_1.encodePacked)(["uint8", "uint128", "uint128", "address"], [
378
- (0, utils_js_1.uint8)(ComposerCommands.SWAPS),
379
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, false, false),
380
- (0, utils_js_1.uint128)(amountOutMin),
381
- assetIn,
382
- ]);
268
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint128', 'uint128', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.SWAPS), (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, false), (0, utils_js_1.uint128)(amountOutMin), assetIn]);
383
269
  }
384
270
  function attachBranch(data, hops, splits, splitsData) {
385
271
  if (hops !== 0n && splits !== 0n)
386
272
  throw new Error("Invalidbranching");
387
273
  if (splitsData.length / 2 - 1 > 0 && splits === 0n)
388
274
  throw new Error("Nosplitsbutsplitdataprovided");
389
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "bytes"], [data, (0, utils_js_1.uint8)(hops), (0, utils_js_1.uint8)(splits), splitsData]);
275
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'bytes'], [data, (0, utils_js_1.uint8)(hops), (0, utils_js_1.uint8)(splits), splitsData]);
390
276
  }
391
277
  function encodeUniswapV2StyleSwap(tokenOut, receiver, forkId, pool, feeDenom, cfg, flashCalldata) {
392
278
  if ((0, utils_js_1.uint256)(cfg) < 2 && flashCalldata.length / 2 - 1 > 2)
393
279
  throw new Error("Invalidconfigforv2swap");
394
- return (0, utils_js_1.encodePacked)(["address", "address", "uint8", "address", "uint16", "uint8", "uint16", "bytes"], [
395
- tokenOut,
396
- receiver,
397
- (0, utils_js_1.uint8)(DexTypeMappings.UNISWAP_V2_ID),
398
- pool,
399
- (0, utils_js_1.uint16)(feeDenom),
400
- (0, utils_js_1.uint8)(forkId),
401
- (0, utils_js_1.uint16)(cfg === DexPayConfig.FLASH ? flashCalldata.length / 2 - 1 : (0, utils_js_1.uint256)(cfg)),
402
- (0, utils_js_1.bytes)(cfg === DexPayConfig.FLASH ? flashCalldata : (0, utils_js_1.newbytes)(0)),
403
- ]);
280
+ return (0, utils_js_1.encodePacked)(['address', 'address', 'uint8', 'address', 'uint16', 'uint8', 'uint16', 'bytes'], [tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.UNISWAP_V2_ID), pool, (0, utils_js_1.uint16)(feeDenom), (0, utils_js_1.uint8)(forkId), (0, utils_js_1.uint16)(cfg === DexPayConfig.FLASH ? flashCalldata.length / 2 - 1 : (0, utils_js_1.uint256)(cfg)), (0, utils_js_1.bytes)(cfg === DexPayConfig.FLASH ? flashCalldata : (0, utils_js_1.newbytes)(0))]);
404
281
  }
405
282
  function encodeUniswapV4StyleSwap(currentData, tokenOut, receiver, manager, fee, tickSpacing, hooks, hookData, cfg) {
406
283
  if (cfg === DexPayConfig.FLASH)
407
284
  throw new Error("Invalidconfigforv2swap");
408
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "address", "uint24", "uint24", "uint8", "uint16", "bytes"], [
409
- currentData,
410
- tokenOut,
411
- receiver,
412
- (0, utils_js_1.uint8)(DexTypeMappings.UNISWAP_V4_ID),
413
- hooks,
414
- manager,
415
- fee,
416
- tickSpacing,
417
- (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg)),
418
- (0, utils_js_1.uint16)(hookData.length / 2 - 1),
419
- hookData,
420
- ]);
285
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'address', 'uint24', 'uint24', 'uint8', 'uint16', 'bytes'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.UNISWAP_V4_ID), hooks, manager, fee, tickSpacing, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg)), (0, utils_js_1.uint16)(hookData.length / 2 - 1), hookData]);
421
286
  }
422
287
  function encodeBalancerV2StyleSwap(currentData, tokenOut, receiver, poolId, balancerVault, cfg) {
423
288
  if (cfg === DexPayConfig.FLASH)
424
289
  throw new Error("Invalidconfigforv2swap");
425
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "bytes32", "address", "uint8"], [
426
- currentData,
427
- tokenOut,
428
- receiver,
429
- (0, utils_js_1.uint8)(DexTypeMappings.BALANCER_V2_ID),
430
- poolId,
431
- balancerVault,
432
- (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg)),
433
- ]);
290
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'bytes32', 'address', 'uint8'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.BALANCER_V2_ID), poolId, balancerVault, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
434
291
  }
435
292
  function encodeLbStyleSwap(currentData, tokenOut, receiver, pool, swapForY, cfg) {
436
293
  if (cfg === DexPayConfig.FLASH)
437
294
  throw new Error("Invalidconfigforv2swap");
438
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "uint8", "uint8"], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.LB_ID), pool, (0, utils_js_1.uint8)(swapForY ? 1 : 0), (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
295
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'uint8', 'uint8'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.LB_ID), pool, (0, utils_js_1.uint8)(swapForY ? 1 : 0), (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
439
296
  }
440
297
  function encodeSyncSwapStyleSwap(currentData, tokenOut, receiver, pool, cfg) {
441
298
  if (cfg === DexPayConfig.FLASH)
442
299
  throw new Error("Invalidconfigforv2swap");
443
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "uint8"], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.SYNC_SWAP_ID), pool, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
300
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'uint8'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.SYNC_SWAP_ID), pool, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
444
301
  }
445
302
  function encodeUniswapV3StyleSwap(currentData, tokenOut, receiver, forkId, pool, feeTier, cfg, flashCalldata) {
446
303
  if ((0, utils_js_1.uint256)(cfg) < 2 && flashCalldata.length / 2 - 1 > 2)
447
304
  throw new Error("Invalidconfigforv2swap");
448
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "uint8", "uint16", "uint16", "bytes"], [
449
- currentData,
450
- tokenOut,
451
- receiver,
452
- (0, utils_js_1.uint8)(DexTypeMappings.UNISWAP_V3_ID),
453
- pool,
454
- (0, utils_js_1.uint8)(forkId),
455
- (0, utils_js_1.uint16)(feeTier),
456
- (0, utils_js_1.uint16)(cfg === DexPayConfig.FLASH ? flashCalldata.length / 2 - 1 : (0, utils_js_1.uint256)(cfg)),
457
- (0, utils_js_1.bytes)(cfg === DexPayConfig.FLASH ? flashCalldata : (0, utils_js_1.newbytes)(0)),
458
- ]);
305
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'uint8', 'uint16', 'uint16', 'bytes'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.UNISWAP_V3_ID), pool, (0, utils_js_1.uint8)(forkId), (0, utils_js_1.uint16)(feeTier), (0, utils_js_1.uint16)(cfg === DexPayConfig.FLASH ? flashCalldata.length / 2 - 1 : (0, utils_js_1.uint256)(cfg)), (0, utils_js_1.bytes)(cfg === DexPayConfig.FLASH ? flashCalldata : (0, utils_js_1.newbytes)(0))]);
459
306
  }
460
307
  function encodeIzumiStyleSwap(currentData, tokenOut, receiver, forkId, pool, feeTier, cfg, flashCalldata) {
461
308
  if ((0, utils_js_1.uint256)(cfg) < 2 && flashCalldata.length / 2 - 1 > 2)
462
309
  throw new Error("Invalidconfigforv2swap");
463
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "uint8", "uint16", "uint16", "bytes"], [
464
- currentData,
465
- tokenOut,
466
- receiver,
467
- (0, utils_js_1.uint8)(DexTypeMappings.IZI_ID),
468
- pool,
469
- (0, utils_js_1.uint8)(forkId),
470
- (0, utils_js_1.uint16)(feeTier),
471
- (0, utils_js_1.uint16)(cfg === DexPayConfig.FLASH ? flashCalldata.length / 2 - 1 : (0, utils_js_1.uint256)(cfg)),
472
- (0, utils_js_1.bytes)(cfg === DexPayConfig.FLASH ? flashCalldata : (0, utils_js_1.newbytes)(0)),
473
- ]);
310
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'uint8', 'uint16', 'uint16', 'bytes'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.IZI_ID), pool, (0, utils_js_1.uint8)(forkId), (0, utils_js_1.uint16)(feeTier), (0, utils_js_1.uint16)(cfg === DexPayConfig.FLASH ? flashCalldata.length / 2 - 1 : (0, utils_js_1.uint256)(cfg)), (0, utils_js_1.bytes)(cfg === DexPayConfig.FLASH ? flashCalldata : (0, utils_js_1.newbytes)(0))]);
474
311
  }
475
312
  function encodeBalancerV3StyleSwap(currentData, tokenOut, receiver, balancerV3Vault, pool, cfg, poolUserData) {
476
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "address", "uint8", "uint16", "bytes"], [
477
- currentData,
478
- tokenOut,
479
- receiver,
480
- (0, utils_js_1.uint8)(DexTypeMappings.BALANCER_V3_ID),
481
- pool,
482
- balancerV3Vault,
483
- (0, utils_js_1.uint8)(cfg),
484
- (0, utils_js_1.uint16)(poolUserData.length / 2 - 1),
485
- poolUserData,
486
- ]);
313
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'address', 'uint8', 'uint16', 'bytes'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.BALANCER_V3_ID), pool, balancerV3Vault, (0, utils_js_1.uint8)(cfg), (0, utils_js_1.uint16)(poolUserData.length / 2 - 1), poolUserData]);
487
314
  }
488
315
  function encodeDodoStyleSwap(currentData, tokenOut, receiver, pool, selector, poolId, cfg, flashCalldata) {
489
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "uint8", "uint16", "uint16", "bytes"], [
490
- currentData,
491
- tokenOut,
492
- receiver,
493
- (0, utils_js_1.uint8)(DexTypeMappings.DODO_ID),
494
- pool,
495
- (0, utils_js_1.uint8)(selector),
496
- (0, utils_js_1.uint16)(poolId),
497
- (0, utils_js_1.uint16)(cfg === DexPayConfig.FLASH ? flashCalldata.length / 2 - 1 : (0, utils_js_1.uint256)(cfg)),
498
- (0, utils_js_1.bytes)(cfg === DexPayConfig.FLASH ? flashCalldata : (0, utils_js_1.newbytes)(0)),
499
- ]);
316
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'uint8', 'uint16', 'uint16', 'bytes'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.DODO_ID), pool, (0, utils_js_1.uint8)(selector), (0, utils_js_1.uint16)(poolId), (0, utils_js_1.uint16)(cfg === DexPayConfig.FLASH ? flashCalldata.length / 2 - 1 : (0, utils_js_1.uint256)(cfg)), (0, utils_js_1.bytes)(cfg === DexPayConfig.FLASH ? flashCalldata : (0, utils_js_1.newbytes)(0))]);
500
317
  }
501
318
  function encodeWooStyleSwap(currentData, tokenOut, receiver, pool, cfg) {
502
319
  if (cfg === DexPayConfig.FLASH)
503
320
  throw new Error("NoflashforWoo");
504
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "uint8"], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.WOO_FI_ID), pool, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
321
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'uint8'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.WOO_FI_ID), pool, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
505
322
  }
506
323
  function encodeGmxStyleSwap(currentData, tokenOut, receiver, pool, cfg) {
507
324
  if (cfg === DexPayConfig.FLASH)
508
325
  throw new Error("NoflashforWoo");
509
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "uint8"], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.GMX_ID), pool, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
326
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'uint8'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.GMX_ID), pool, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
510
327
  }
511
328
  function encodeKtxStyleSwap(currentData, tokenOut, receiver, pool, cfg) {
512
329
  if (cfg === DexPayConfig.FLASH)
513
330
  throw new Error("NoflashforWoo");
514
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "address", "uint8"], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.KTX_ID), pool, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
331
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'address', 'uint8'], [currentData, tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.KTX_ID), pool, (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
515
332
  }
516
333
  function encodeCurveStyleSwap(tokenOut, receiver, pool, indexIn, indexOut, selectorId, cfg) {
517
334
  if (cfg === DexPayConfig.FLASH)
518
335
  throw new Error("FlashnotyetsupportedforCurve");
519
- return (0, utils_js_1.encodePacked)(["address", "address", "uint8", "address", "uint8", "uint8", "uint8", "uint16"], [
520
- tokenOut,
521
- receiver,
522
- (0, utils_js_1.uint8)(DexTypeMappings.CURVE_V1_STANDARD_ID),
523
- pool,
524
- (0, utils_js_1.uint8)(indexIn),
525
- (0, utils_js_1.uint8)(indexOut),
526
- (0, utils_js_1.uint8)(selectorId),
527
- (0, utils_js_1.uint16)((0, utils_js_1.uint256)(cfg)),
528
- ]);
336
+ return (0, utils_js_1.encodePacked)(['address', 'address', 'uint8', 'address', 'uint8', 'uint8', 'uint8', 'uint16'], [tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.CURVE_V1_STANDARD_ID), pool, (0, utils_js_1.uint8)(indexIn), (0, utils_js_1.uint8)(indexOut), (0, utils_js_1.uint8)(selectorId), (0, utils_js_1.uint16)((0, utils_js_1.uint256)(cfg))]);
529
337
  }
530
338
  function encodeCurveNGStyleSwap(tokenOut, receiver, pool, indexIn, indexOut, selectorId, cfg) {
531
339
  if (cfg === DexPayConfig.FLASH)
532
340
  throw new Error("FlashnotyetsupportedforCurve");
533
- return (0, utils_js_1.encodePacked)(["address", "address", "uint8", "address", "uint8", "uint8", "uint8", "uint16"], [
534
- tokenOut,
535
- receiver,
536
- (0, utils_js_1.uint8)(DexTypeMappings.CURVE_RECEIVED_ID),
537
- pool,
538
- (0, utils_js_1.uint8)(indexIn),
539
- (0, utils_js_1.uint8)(indexOut),
540
- (0, utils_js_1.uint8)(selectorId),
541
- (0, utils_js_1.uint16)((0, utils_js_1.uint256)(cfg)),
542
- ]);
341
+ return (0, utils_js_1.encodePacked)(['address', 'address', 'uint8', 'address', 'uint8', 'uint8', 'uint8', 'uint16'], [tokenOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.CURVE_RECEIVED_ID), pool, (0, utils_js_1.uint8)(indexIn), (0, utils_js_1.uint8)(indexOut), (0, utils_js_1.uint8)(selectorId), (0, utils_js_1.uint16)((0, utils_js_1.uint256)(cfg))]);
543
342
  }
544
343
  function encodeWrapperSwap(currentData, assetOut, receiver, operation, cfg) {
545
- return (0, utils_js_1.encodePacked)(["bytes", "address", "address", "uint8", "uint8", "uint8"], [
546
- currentData,
547
- assetOut,
548
- receiver,
549
- (0, utils_js_1.uint8)(DexTypeMappings.ASSET_WRAP_ID),
550
- (0, utils_js_1.uint8)((0, utils_js_1.uint256)(operation)),
551
- (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg)),
552
- ]);
344
+ return (0, utils_js_1.encodePacked)(['bytes', 'address', 'address', 'uint8', 'uint8', 'uint8'], [currentData, assetOut, receiver, (0, utils_js_1.uint8)(DexTypeMappings.ASSET_WRAP_ID), (0, utils_js_1.uint8)((0, utils_js_1.uint256)(operation)), (0, utils_js_1.uint8)((0, utils_js_1.uint256)(cfg))]);
553
345
  }
554
346
  function encodeNextGenDexSettle(singleton, nativeAmount) {
555
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "uint128"], [
556
- (0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS),
557
- (0, utils_js_1.uint8)(Gen2025ActionIds.UNI_V4_SETTLE),
558
- singleton,
559
- (0, utils_js_1.uint128)(nativeAmount),
560
- ]);
347
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'uint128'], [(0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS), (0, utils_js_1.uint8)(Gen2025ActionIds.UNI_V4_SETTLE), singleton, (0, utils_js_1.uint128)(nativeAmount)]);
561
348
  }
562
349
  function encodeNextGenDexSettleBalancer(singleton, asset, amountHint) {
563
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint128"], [
564
- (0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS),
565
- (0, utils_js_1.uint8)(Gen2025ActionIds.BAL_V3_SETTLE),
566
- singleton,
567
- asset,
568
- (0, utils_js_1.uint128)(amountHint >= 0xffffffffffffffffffffffffffffffn ? 0xffffffffffffffffffffffffffffffn : amountHint),
569
- ]);
350
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'uint128'], [(0, utils_js_1.uint8)(ComposerCommands.GEN_2025_SINGELTONS), (0, utils_js_1.uint8)(Gen2025ActionIds.BAL_V3_SETTLE), singleton, asset, (0, utils_js_1.uint128)(amountHint >= 0xffffffffffffffffffffffffffffffn ? 0xffffffffffffffffffffffffffffffn : amountHint)]);
570
351
  }
571
352
  function encodeTransferIn(asset, receiver, amount) {
572
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint128"], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.TRANSFER_FROM), asset, receiver, (0, utils_js_1.uint128)(amount)]);
353
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'uint128'], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.TRANSFER_FROM), asset, receiver, (0, utils_js_1.uint128)(amount)]);
573
354
  }
574
355
  function encodeSweep(asset, receiver, amount, sweepType) {
575
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint8", "uint128"], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.SWEEP), asset, receiver, sweepType, (0, utils_js_1.uint128)(amount)]);
356
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'uint8', 'uint128'], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.SWEEP), asset, receiver, sweepType, (0, utils_js_1.uint128)(amount)]);
576
357
  }
577
358
  function encodeWrap(amount, wrapTarget) {
578
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint8", "uint128"], [
579
- (0, utils_js_1.uint8)(ComposerCommands.TRANSFERS),
580
- (0, utils_js_1.uint8)(TransferIds.SWEEP),
581
- viem_1.zeroAddress,
582
- wrapTarget,
583
- (0, utils_js_1.uint8)(SweepType.AMOUNT),
584
- (0, utils_js_1.uint128)(amount),
585
- ]);
359
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'uint8', 'uint128'], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.SWEEP), viem_1.zeroAddress, wrapTarget, (0, utils_js_1.uint8)(SweepType.AMOUNT), (0, utils_js_1.uint128)(amount)]);
586
360
  }
587
361
  function encodeApprove(asset, target) {
588
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address"], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.APPROVE), asset, target]);
362
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.APPROVE), asset, target]);
589
363
  }
590
364
  function encodeUnwrap(target, receiver, amount, sweepType) {
591
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint8", "uint128"], [
592
- (0, utils_js_1.uint8)(ComposerCommands.TRANSFERS),
593
- (0, utils_js_1.uint8)(TransferIds.UNWRAP_WNATIVE),
594
- target,
595
- receiver,
596
- sweepType,
597
- (0, utils_js_1.uint128)(amount),
598
- ]);
365
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'address', 'uint8', 'uint128'], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.UNWRAP_WNATIVE), target, receiver, sweepType, (0, utils_js_1.uint128)(amount)]);
599
366
  }
600
367
  function encodeBalancerV2FlashLoan(asset, amount, poolId, data) {
601
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "uint128", "uint16", "bytes"], [
602
- (0, utils_js_1.uint8)(ComposerCommands.FLASH_LOAN),
603
- (0, utils_js_1.uint8)(FlashLoanIds.BALANCER_V2),
604
- asset,
605
- (0, utils_js_1.uint128)(amount),
606
- (0, utils_js_1.uint16)(data.length / 2 - 1 + 1),
607
- encodeUint8AndBytes(poolId, data),
608
- ]);
368
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'uint128', 'uint16', 'bytes'], [(0, utils_js_1.uint8)(ComposerCommands.FLASH_LOAN), (0, utils_js_1.uint8)(FlashLoanIds.BALANCER_V2), asset, (0, utils_js_1.uint128)(amount), (0, utils_js_1.uint16)(data.length / 2 - 1 + 1), encodeUint8AndBytes(poolId, data)]);
609
369
  }
610
370
  function encodeFlashLoan(asset, amount, pool, poolType, poolId, data) {
611
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "address", "address", "uint128", "uint16", "bytes"], [
612
- encodeApprove(asset, pool),
613
- (0, utils_js_1.uint8)(ComposerCommands.FLASH_LOAN),
614
- poolType,
615
- asset,
616
- pool,
617
- (0, utils_js_1.uint128)(amount),
618
- (0, utils_js_1.uint16)(data.length / 2 - 1 + 1),
619
- encodeUint8AndBytes(poolId, data),
620
- ]);
371
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'address', 'address', 'uint128', 'uint16', 'bytes'], [encodeApprove(asset, pool), (0, utils_js_1.uint8)(ComposerCommands.FLASH_LOAN), poolType, asset, pool, (0, utils_js_1.uint128)(amount), (0, utils_js_1.uint16)(data.length / 2 - 1 + 1), encodeUint8AndBytes(poolId, data)]);
621
372
  }
622
373
  function encodeUint8AndBytes(poolId, data) {
623
- return (0, utils_js_1.encodePacked)(["uint8", "bytes"], [(0, utils_js_1.uint8)(poolId), data]);
374
+ return (0, utils_js_1.encodePacked)(['uint8', 'bytes'], [(0, utils_js_1.uint8)(poolId), data]);
624
375
  }
625
376
  function encodeMorphoMarket(loanToken, collateralToken, oracle, irm, lltv) {
626
- return (0, utils_js_1.encodePacked)(["address", "address", "address", "address", "uint128"], [loanToken, collateralToken, oracle, irm, (0, utils_js_1.uint128)(lltv)]);
377
+ return (0, utils_js_1.encodePacked)(['address', 'address', 'address', 'address', 'uint128'], [loanToken, collateralToken, oracle, irm, (0, utils_js_1.uint128)(lltv)]);
627
378
  }
628
379
  function encodeMorphoDepositCollateral(market, assets, receiver, data, morphoB, pId) {
629
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
630
- encodeApprove((0, utils_js_1.getMorphoCollateral)(market), morphoB),
631
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
632
- (0, utils_js_1.uint8)(LenderOps.DEPOSIT),
633
- (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO),
634
- market,
635
- (0, utils_js_1.uint128)(assets),
636
- receiver,
637
- morphoB,
638
- (0, utils_js_1.uint16)(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0),
639
- data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
640
- ]);
380
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'bytes', 'uint128', 'address', 'address', 'uint16', 'bytes'], [encodeApprove((0, utils_js_1.getMorphoCollateral)(market), morphoB), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.DEPOSIT), (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO), market, (0, utils_js_1.uint128)(assets), receiver, morphoB, (0, utils_js_1.uint16)(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0), data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data)]);
641
381
  }
642
382
  function encodeMorphoDeposit(market, isShares, assets, receiver, data, morphoB, pId) {
643
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
644
- encodeApprove((0, utils_js_1.getMorphoLoanAsset)(market), morphoB),
645
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
646
- (0, utils_js_1.uint8)(LenderOps.DEPOSIT_LENDING_TOKEN),
647
- (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO),
648
- market,
649
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false, false),
650
- receiver,
651
- morphoB,
652
- (0, utils_js_1.uint16)(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0),
653
- data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
654
- ]);
383
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'bytes', 'uint128', 'address', 'address', 'uint16', 'bytes'], [encodeApprove((0, utils_js_1.getMorphoLoanAsset)(market), morphoB), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.DEPOSIT_LENDING_TOKEN), (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO), market, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false), receiver, morphoB, (0, utils_js_1.uint16)(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0), data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data)]);
655
384
  }
656
385
  function encodeErc4646Deposit(asset, vault, isShares, assets, receiver) {
657
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "address", "address", "uint128", "address"], [
658
- encodeApprove(asset, vault),
659
- (0, utils_js_1.uint8)(ComposerCommands.ERC4626),
660
- (0, utils_js_1.uint8)(0),
661
- asset,
662
- vault,
663
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false, false),
664
- receiver,
665
- ]);
386
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'address', 'address', 'uint128', 'address'], [encodeApprove(asset, vault), (0, utils_js_1.uint8)(ComposerCommands.ERC4626), (0, utils_js_1.uint8)(0), asset, vault, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false), receiver]);
666
387
  }
667
388
  function encodeErc4646Withdraw(vault, isShares, assets, receiver) {
668
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "uint128", "address"], [
669
- (0, utils_js_1.uint8)(ComposerCommands.ERC4626),
670
- (0, utils_js_1.uint8)(1),
671
- vault,
672
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false, false),
673
- receiver,
674
- ]);
389
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'address', 'uint128', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.ERC4626), (0, utils_js_1.uint8)(1), vault, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false), receiver]);
675
390
  }
676
391
  function encodeMorphoWithdraw(market, isShares, assets, receiver, morphoB) {
677
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address"], [
678
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
679
- (0, utils_js_1.uint8)(LenderOps.WITHDRAW_LENDING_TOKEN),
680
- (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO),
681
- market,
682
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false, false),
683
- receiver,
684
- morphoB,
685
- ]);
392
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'bytes', 'uint128', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.WITHDRAW_LENDING_TOKEN), (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO), market, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false), receiver, morphoB]);
686
393
  }
687
394
  function encodeMorphoWithdrawCollateral(market, assets, receiver, morphoB) {
688
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address"], [
689
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
690
- (0, utils_js_1.uint8)(LenderOps.WITHDRAW),
691
- (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO),
692
- market,
693
- (0, utils_js_1.uint128)(assets),
694
- receiver,
695
- morphoB,
696
- ]);
395
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'bytes', 'uint128', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.WITHDRAW), (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO), market, (0, utils_js_1.uint128)(assets), receiver, morphoB]);
697
396
  }
698
397
  function encodeMorphoBorrow(market, isShares, assets, receiver, morphoB) {
699
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address"], [
700
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
701
- (0, utils_js_1.uint8)(LenderOps.BORROW),
702
- (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO),
703
- market,
704
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false, false),
705
- receiver,
706
- morphoB,
707
- ]);
708
- }
709
- function encodeMorphoRepay(market, isShares, unsafe, assets, receiver, data, morphoB, pId) {
710
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
711
- encodeApprove((0, utils_js_1.getMorphoLoanAsset)(market), morphoB),
712
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
713
- (0, utils_js_1.uint8)(LenderOps.REPAY),
714
- (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO),
715
- market,
716
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, unsafe, false),
717
- receiver,
718
- morphoB,
719
- (0, utils_js_1.uint16)(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0),
720
- data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
721
- ]);
398
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'bytes', 'uint128', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.BORROW), (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO), market, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false), receiver, morphoB]);
399
+ }
400
+ function encodeMorphoRepay(market, isShares, assets, receiver, data, morphoB, pId) {
401
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'bytes', 'uint128', 'address', 'address', 'uint16', 'bytes'], [encodeApprove((0, utils_js_1.getMorphoLoanAsset)(market), morphoB), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.REPAY), (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO), market, (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, false), receiver, morphoB, (0, utils_js_1.uint16)(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0), data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data)]);
722
402
  }
723
403
  function encodeAaveDeposit(token, amount, receiver, pool) {
724
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
725
- encodeApprove(token, pool),
726
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
727
- (0, utils_js_1.uint8)(LenderOps.DEPOSIT),
728
- (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V3 - 1),
729
- token,
730
- (0, utils_js_1.uint128)(amount),
731
- receiver,
732
- pool,
733
- ]);
404
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address'], [encodeApprove(token, pool), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.DEPOSIT), (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V3 - 1), token, (0, utils_js_1.uint128)(amount), receiver, pool]);
734
405
  }
735
406
  function encodeAaveBorrow(token, amount, receiver, mode, pool) {
736
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "address", "uint128", "address", "uint8", "address"], [
737
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
738
- (0, utils_js_1.uint8)(LenderOps.BORROW),
739
- (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V3 - 1),
740
- token,
741
- (0, utils_js_1.uint128)(amount),
742
- receiver,
743
- (0, utils_js_1.uint8)(mode),
744
- pool,
745
- ]);
407
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'uint8', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.BORROW), (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V3 - 1), token, (0, utils_js_1.uint128)(amount), receiver, (0, utils_js_1.uint8)(mode), pool]);
746
408
  }
747
409
  function encodeAaveRepay(token, amount, receiver, mode, dToken, pool) {
748
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "uint8", "address", "address"], [
749
- encodeApprove(token, pool),
750
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
751
- (0, utils_js_1.uint8)(LenderOps.REPAY),
752
- (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V3 - 1),
753
- token,
754
- (0, utils_js_1.uint128)(amount),
755
- receiver,
756
- (0, utils_js_1.uint8)(mode),
757
- dToken,
758
- pool,
759
- ]);
410
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'uint8', 'address', 'address'], [encodeApprove(token, pool), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.REPAY), (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V3 - 1), token, (0, utils_js_1.uint128)(amount), receiver, (0, utils_js_1.uint8)(mode), dToken, pool]);
760
411
  }
761
412
  function encodeAaveWithdraw(token, amount, receiver, aToken, pool) {
762
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "address", "uint128", "address", "address", "address"], [
763
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
764
- (0, utils_js_1.uint8)(LenderOps.WITHDRAW),
765
- (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V3 - 1),
766
- token,
767
- (0, utils_js_1.uint128)(amount),
768
- receiver,
769
- aToken,
770
- pool,
771
- ]);
413
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.WITHDRAW), (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V3 - 1), token, (0, utils_js_1.uint128)(amount), receiver, aToken, pool]);
772
414
  }
773
415
  function encodeAaveV2Deposit(token, amount, receiver, pool) {
774
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
775
- encodeApprove(token, pool),
776
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
777
- (0, utils_js_1.uint8)(LenderOps.DEPOSIT),
778
- (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V2 - 1),
779
- token,
780
- (0, utils_js_1.uint128)(amount),
781
- receiver,
782
- pool,
783
- ]);
416
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address'], [encodeApprove(token, pool), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.DEPOSIT), (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V2 - 1), token, (0, utils_js_1.uint128)(amount), receiver, pool]);
784
417
  }
785
418
  function encodeAaveV2Borrow(token, amount, receiver, mode, pool) {
786
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "address", "uint128", "address", "uint8", "address"], [
787
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
788
- (0, utils_js_1.uint8)(LenderOps.BORROW),
789
- (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V2 - 1),
790
- token,
791
- (0, utils_js_1.uint128)(amount),
792
- receiver,
793
- (0, utils_js_1.uint8)(mode),
794
- pool,
795
- ]);
419
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'uint8', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.BORROW), (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V2 - 1), token, (0, utils_js_1.uint128)(amount), receiver, (0, utils_js_1.uint8)(mode), pool]);
796
420
  }
797
421
  function encodeAaveV2Repay(token, amount, receiver, mode, dToken, pool) {
798
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "uint8", "address", "address"], [
799
- encodeApprove(token, pool),
800
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
801
- (0, utils_js_1.uint8)(LenderOps.REPAY),
802
- (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V2 - 1),
803
- token,
804
- (0, utils_js_1.uint128)(amount),
805
- receiver,
806
- (0, utils_js_1.uint8)(mode),
807
- dToken,
808
- pool,
809
- ]);
422
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'uint8', 'address', 'address'], [encodeApprove(token, pool), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.REPAY), (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V2 - 1), token, (0, utils_js_1.uint128)(amount), receiver, (0, utils_js_1.uint8)(mode), dToken, pool]);
810
423
  }
811
424
  function encodeAaveV2Withdraw(token, amount, receiver, aToken, pool) {
812
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "address", "uint128", "address", "address", "address"], [
813
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
814
- (0, utils_js_1.uint8)(LenderOps.WITHDRAW),
815
- (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V2 - 1),
816
- token,
817
- (0, utils_js_1.uint128)(amount),
818
- receiver,
819
- aToken,
820
- pool,
821
- ]);
425
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.WITHDRAW), (0, utils_js_1.uint16)(LenderIds.UP_TO_AAVE_V2 - 1), token, (0, utils_js_1.uint128)(amount), receiver, aToken, pool]);
822
426
  }
823
427
  function encodeCompoundV3Deposit(token, amount, receiver, comet) {
824
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
825
- encodeApprove(token, comet),
826
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
827
- (0, utils_js_1.uint8)(LenderOps.DEPOSIT),
828
- (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V3 - 1),
829
- token,
830
- (0, utils_js_1.uint128)(amount),
831
- receiver,
832
- comet,
833
- ]);
428
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address'], [encodeApprove(token, comet), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.DEPOSIT), (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V3 - 1), token, (0, utils_js_1.uint128)(amount), receiver, comet]);
834
429
  }
835
430
  function encodeCompoundV3Borrow(token, amount, receiver, comet) {
836
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
837
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
838
- (0, utils_js_1.uint8)(LenderOps.BORROW),
839
- (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V3 - 1),
840
- token,
841
- (0, utils_js_1.uint128)(amount),
842
- receiver,
843
- comet,
844
- ]);
431
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.BORROW), (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V3 - 1), token, (0, utils_js_1.uint128)(amount), receiver, comet]);
845
432
  }
846
433
  function encodeCompoundV3Repay(token, amount, receiver, comet) {
847
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
848
- encodeApprove(token, comet),
849
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
850
- (0, utils_js_1.uint8)(LenderOps.REPAY),
851
- (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V3 - 1),
852
- token,
853
- (0, utils_js_1.uint128)(amount),
854
- receiver,
855
- comet,
856
- ]);
434
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address'], [encodeApprove(token, comet), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.REPAY), (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V3 - 1), token, (0, utils_js_1.uint128)(amount), receiver, comet]);
857
435
  }
858
436
  function encodeCompoundV3Withdraw(token, amount, receiver, comet, isBase) {
859
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "address", "uint128", "address", "uint8", "address"], [
860
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
861
- (0, utils_js_1.uint8)(LenderOps.WITHDRAW),
862
- (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V3 - 1),
863
- token,
864
- (0, utils_js_1.uint128)(amount),
865
- receiver,
866
- isBase ? (0, utils_js_1.uint8)(1) : (0, utils_js_1.uint8)(0),
867
- comet,
868
- ]);
437
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'uint8', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.WITHDRAW), (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V3 - 1), token, (0, utils_js_1.uint128)(amount), receiver, isBase ? (0, utils_js_1.uint8)(1) : (0, utils_js_1.uint8)(0), comet]);
869
438
  }
870
439
  function encodeCompoundV2Deposit(token, amount, receiver, cToken) {
871
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
872
- token === viem_1.zeroAddress ? (0, utils_js_1.newbytes)(0) : encodeApprove(token, cToken),
873
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
874
- (0, utils_js_1.uint8)(LenderOps.DEPOSIT),
875
- (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V2 - 1),
876
- token,
877
- (0, utils_js_1.uint128)(amount),
878
- receiver,
879
- cToken,
880
- ]);
440
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address'], [token === viem_1.zeroAddress ? (0, utils_js_1.newbytes)(0) : encodeApprove(token, cToken), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.DEPOSIT), (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V2 - 1), token, (0, utils_js_1.uint128)(amount), receiver, cToken]);
881
441
  }
882
442
  function encodeCompoundV2Borrow(token, amount, receiver, cToken) {
883
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
884
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
885
- (0, utils_js_1.uint8)(LenderOps.BORROW),
886
- (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V2 - 1),
887
- token,
888
- (0, utils_js_1.uint128)(amount),
889
- receiver,
890
- cToken,
891
- ]);
443
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.BORROW), (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V2 - 1), token, (0, utils_js_1.uint128)(amount), receiver, cToken]);
892
444
  }
893
445
  function encodeCompoundV2Repay(token, amount, receiver, cToken) {
894
- return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
895
- token === viem_1.zeroAddress ? (0, utils_js_1.newbytes)(0) : encodeApprove(token, cToken),
896
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
897
- (0, utils_js_1.uint8)(LenderOps.REPAY),
898
- (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V2 - 1),
899
- token,
900
- (0, utils_js_1.uint128)(amount),
901
- receiver,
902
- cToken,
903
- ]);
446
+ return (0, utils_js_1.encodePacked)(['bytes', 'uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address'], [token === viem_1.zeroAddress ? (0, utils_js_1.newbytes)(0) : encodeApprove(token, cToken), (0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.REPAY), (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V2 - 1), token, (0, utils_js_1.uint128)(amount), receiver, cToken]);
904
447
  }
905
448
  function encodeCompoundV2Withdraw(token, amount, receiver, cToken) {
906
- return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
907
- (0, utils_js_1.uint8)(ComposerCommands.LENDING),
908
- (0, utils_js_1.uint8)(LenderOps.WITHDRAW),
909
- (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V2 - 1),
910
- token,
911
- (0, utils_js_1.uint128)(amount),
912
- receiver,
913
- cToken,
914
- ]);
449
+ return (0, utils_js_1.encodePacked)(['uint8', 'uint8', 'uint16', 'address', 'uint128', 'address', 'address'], [(0, utils_js_1.uint8)(ComposerCommands.LENDING), (0, utils_js_1.uint8)(LenderOps.WITHDRAW), (0, utils_js_1.uint16)(LenderIds.UP_TO_COMPOUND_V2 - 1), token, (0, utils_js_1.uint128)(amount), receiver, cToken]);
915
450
  }