@1delta/calldatalib 0.0.46 → 0.0.49

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.
@@ -49,6 +49,7 @@ exports.encodeNextGenDexSettleBalancer = encodeNextGenDexSettleBalancer;
49
49
  exports.encodeTransferIn = encodeTransferIn;
50
50
  exports.encodeSweep = encodeSweep;
51
51
  exports.encodeWrap = encodeWrap;
52
+ exports.encodeWrapWithReceiver = encodeWrapWithReceiver;
52
53
  exports.encodeApprove = encodeApprove;
53
54
  exports.encodeUnwrap = encodeUnwrap;
54
55
  exports.encodeBalancerV2FlashLoan = encodeBalancerV2FlashLoan;
@@ -57,7 +58,7 @@ exports.encodeUint8AndBytes = encodeUint8AndBytes;
57
58
  exports.encodeMorphoMarket = encodeMorphoMarket;
58
59
  exports.encodeMorphoDepositCollateral = encodeMorphoDepositCollateral;
59
60
  exports.encodeMorphoDeposit = encodeMorphoDeposit;
60
- exports.encodeErc4646Deposit = encodeErc4646Deposit;
61
+ exports.encodeErc4626Deposit = encodeErc4626Deposit;
61
62
  exports.encodeErc4646Withdraw = encodeErc4646Withdraw;
62
63
  exports.encodeMorphoWithdraw = encodeMorphoWithdraw;
63
64
  exports.encodeMorphoWithdrawCollateral = encodeMorphoWithdrawCollateral;
@@ -117,6 +118,7 @@ var TransferIds;
117
118
  TransferIds[TransferIds["UNWRAP_WNATIVE"] = 3] = "UNWRAP_WNATIVE";
118
119
  TransferIds[TransferIds["PERMIT2_TRANSFER_FROM"] = 4] = "PERMIT2_TRANSFER_FROM";
119
120
  TransferIds[TransferIds["APPROVE"] = 5] = "APPROVE";
121
+ TransferIds[TransferIds["WRAP"] = 6] = "WRAP";
120
122
  })(TransferIds || (exports.TransferIds = TransferIds = {}));
121
123
  var PermitIds;
122
124
  (function (PermitIds) {
@@ -446,12 +448,7 @@ function encodeUniswapV4Take(singleton, asset, receiver, amount) {
446
448
  ]);
447
449
  }
448
450
  function swapHead(amount, amountOutMin, assetIn) {
449
- return (0, utils_js_1.encodePacked)(["uint8", "uint128", "uint128", "address"], [
450
- (0, utils_js_1.uint8)(ComposerCommands.SWAPS),
451
- (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, false),
452
- (0, utils_js_1.uint128)(amountOutMin),
453
- assetIn,
454
- ]);
451
+ return (0, utils_js_1.encodePacked)(["uint8", "uint128", "uint128", "address"], [(0, utils_js_1.uint8)(ComposerCommands.SWAPS), (0, utils_js_1.uint128)(amount), (0, utils_js_1.uint128)(amountOutMin), assetIn]);
455
452
  }
456
453
  function attachBranch(data, hops, splits, splitsData) {
457
454
  if (hops !== 0n && splits !== 0n)
@@ -656,6 +653,9 @@ function encodeWrap(amount, wrapTarget) {
656
653
  (0, utils_js_1.uint128)(amount),
657
654
  ]);
658
655
  }
656
+ function encodeWrapWithReceiver(amount, weth, receiver) {
657
+ return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint128"], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.WRAP), weth, receiver, (0, utils_js_1.uint128)(amount)]);
658
+ }
659
659
  function encodeApprove(asset, target) {
660
660
  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]);
661
661
  }
@@ -725,7 +725,7 @@ function encodeMorphoDeposit(market, isShares, assets, receiver, data, morphoB,
725
725
  data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
726
726
  ]);
727
727
  }
728
- function encodeErc4646Deposit(asset, vault, isShares, assets, receiver) {
728
+ function encodeErc4626Deposit(asset, vault, isShares, assets, receiver) {
729
729
  return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "address", "address", "uint128", "address"], [
730
730
  encodeApprove(asset, vault),
731
731
  (0, utils_js_1.uint8)(ComposerCommands.ERC4626),
@@ -32,6 +32,7 @@ export var TransferIds;
32
32
  TransferIds[TransferIds["UNWRAP_WNATIVE"] = 3] = "UNWRAP_WNATIVE";
33
33
  TransferIds[TransferIds["PERMIT2_TRANSFER_FROM"] = 4] = "PERMIT2_TRANSFER_FROM";
34
34
  TransferIds[TransferIds["APPROVE"] = 5] = "APPROVE";
35
+ TransferIds[TransferIds["WRAP"] = 6] = "WRAP";
35
36
  })(TransferIds || (TransferIds = {}));
36
37
  export var PermitIds;
37
38
  (function (PermitIds) {
@@ -361,12 +362,7 @@ export function encodeUniswapV4Take(singleton, asset, receiver, amount) {
361
362
  ]);
362
363
  }
363
364
  export function swapHead(amount, amountOutMin, assetIn) {
364
- return encodePacked(["uint8", "uint128", "uint128", "address"], [
365
- uint8(ComposerCommands.SWAPS),
366
- generateAmountBitmap(uint128(amount), false, false),
367
- uint128(amountOutMin),
368
- assetIn,
369
- ]);
365
+ return encodePacked(["uint8", "uint128", "uint128", "address"], [uint8(ComposerCommands.SWAPS), uint128(amount), uint128(amountOutMin), assetIn]);
370
366
  }
371
367
  export function attachBranch(data, hops, splits, splitsData) {
372
368
  if (hops !== 0n && splits !== 0n)
@@ -571,6 +567,9 @@ export function encodeWrap(amount, wrapTarget) {
571
567
  uint128(amount),
572
568
  ]);
573
569
  }
570
+ export function encodeWrapWithReceiver(amount, weth, receiver) {
571
+ return encodePacked(["uint8", "uint8", "address", "address", "uint128"], [uint8(ComposerCommands.TRANSFERS), uint8(TransferIds.WRAP), weth, receiver, uint128(amount)]);
572
+ }
574
573
  export function encodeApprove(asset, target) {
575
574
  return encodePacked(["uint8", "uint8", "address", "address"], [uint8(ComposerCommands.TRANSFERS), uint8(TransferIds.APPROVE), asset, target]);
576
575
  }
@@ -640,7 +639,7 @@ export function encodeMorphoDeposit(market, isShares, assets, receiver, data, mo
640
639
  data.length / 2 - 1 === 0 ? newbytes(0) : encodeUint8AndBytes(uint8(pId), data),
641
640
  ]);
642
641
  }
643
- export function encodeErc4646Deposit(asset, vault, isShares, assets, receiver) {
642
+ export function encodeErc4626Deposit(asset, vault, isShares, assets, receiver) {
644
643
  return encodePacked(["bytes", "uint8", "uint8", "address", "address", "uint128", "address"], [
645
644
  encodeApprove(asset, vault),
646
645
  uint8(ComposerCommands.ERC4626),
@@ -24,7 +24,8 @@ export declare enum TransferIds {
24
24
  WRAP_NATIVE = 2,
25
25
  UNWRAP_WNATIVE = 3,
26
26
  PERMIT2_TRANSFER_FROM = 4,
27
- APPROVE = 5
27
+ APPROVE = 5,
28
+ WRAP = 6
28
29
  }
29
30
  export declare enum PermitIds {
30
31
  TOKEN_PERMIT = 0,
@@ -172,6 +173,7 @@ export declare function encodeNextGenDexSettleBalancer(singleton: Address, asset
172
173
  export declare function encodeTransferIn(asset: Address, receiver: Address, amount: bigint): Hex;
173
174
  export declare function encodeSweep(asset: Address, receiver: Address, amount: bigint, sweepType: any): Hex;
174
175
  export declare function encodeWrap(amount: bigint, wrapTarget: Address): Hex;
176
+ export declare function encodeWrapWithReceiver(amount: bigint, weth: Address, receiver: Address): Hex;
175
177
  export declare function encodeApprove(asset: Address, target: Address): Hex;
176
178
  export declare function encodeUnwrap(target: Address, receiver: Address, amount: bigint, sweepType: any): Hex;
177
179
  export declare function encodeBalancerV2FlashLoan(asset: Address, amount: bigint, poolId: number, data: Hex): Hex;
@@ -180,7 +182,7 @@ export declare function encodeUint8AndBytes(poolId: number, data: Hex): Hex;
180
182
  export declare function encodeMorphoMarket(loanToken: Address, collateralToken: Address, oracle: Address, irm: Address, lltv: bigint): Hex;
181
183
  export declare function encodeMorphoDepositCollateral(market: Hex, assets: bigint, receiver: Address, data: Hex, morphoB: Address, pId: bigint): Hex;
182
184
  export declare function encodeMorphoDeposit(market: Hex, isShares: boolean, assets: bigint, receiver: Address, data: Hex, morphoB: Address, pId: bigint): Hex;
183
- export declare function encodeErc4646Deposit(asset: Address, vault: Address, isShares: boolean, assets: bigint, receiver: Address): Hex;
185
+ export declare function encodeErc4626Deposit(asset: Address, vault: Address, isShares: boolean, assets: bigint, receiver: Address): Hex;
184
186
  export declare function encodeErc4646Withdraw(vault: Address, isShares: boolean, assets: bigint, receiver: Address): Hex;
185
187
  export declare function encodeMorphoWithdraw(market: Hex, isShares: boolean, assets: bigint, receiver: Address, morphoB: Address): Hex;
186
188
  export declare function encodeMorphoWithdrawCollateral(market: Hex, assets: bigint, receiver: Address, morphoB: Address): Hex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1delta/calldatalib",
3
- "version": "0.0.46",
3
+ "version": "0.0.49",
4
4
  "description": "Generated CalldataLib TypeScript functions for 1delta smart contracts",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",