@morpho-org/bundler-sdk-viem 4.3.3 → 5.0.0

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/README.md CHANGED
@@ -21,6 +21,8 @@
21
21
  <br />
22
22
  <br />
23
23
 
24
+ ## Overview
25
+
24
26
  Viem-based extension of `@morpho-org/simulation-sdk` that exports utilities to transform simple interactions on Morpho (such as `Blue_Borrow`) and Morpho Vaults (such as `MetaMorpho_Deposit`) into the required bundles (with ERC20 approvals, transfers, etc) to submit to the bundler onchain.
25
27
 
26
28
  ## Installation
@@ -32,3 +34,15 @@ npm install @morpho-org/bundler-sdk-viem
32
34
  ```bash
33
35
  yarn add @morpho-org/bundler-sdk-viem
34
36
  ```
37
+
38
+ ## Usage
39
+
40
+ Use this package to turn high-level Morpho and Morpho Vault simulation operations into executable bundler transactions, including the required approvals, transfers, and bundler actions.
41
+
42
+ ## Development
43
+
44
+ Contribute from the monorepo root. See [CONTRIBUTING.md](../../CONTRIBUTING.md) for setup, checks, and package workflow. Report vulnerabilities through [SECURITY.md](../../SECURITY.md).
45
+
46
+ ## License
47
+
48
+ MIT. See [LICENSE](./LICENSE).
@@ -19,6 +19,7 @@ class ActionBundle {
19
19
  requirements;
20
20
  steps;
21
21
  chainId;
22
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
22
23
  constructor(stepsOrChainId, actions = [], requirements = new ActionBundleRequirements()) {
23
24
  this.actions = actions;
24
25
  this.requirements = requirements;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BundlerAction = void 0;
4
- const abis_js_1 = require("./abis.js");
5
4
  const blue_sdk_1 = require("@morpho-org/blue-sdk");
6
5
  const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
7
6
  const viem_1 = require("viem");
7
+ const abis_js_1 = require("./abis.js");
8
8
  const errors_js_1 = require("./errors.js");
9
9
  const reenterAbiInputs = abis_js_1.bundler3Abi.find((item) => item.name === "reenter").inputs;
10
10
  /**
@@ -226,6 +226,7 @@ var BundlerAction;
226
226
  * @param amount The amount of native tokens to send (in wei).
227
227
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
228
228
  */
229
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
229
230
  function nativeTransfer(chainId, owner, recipient, amount, skipRevert = false) {
230
231
  const { bundler3: { bundler3, generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
231
232
  if (recipient === bundler3)
@@ -264,6 +265,7 @@ var BundlerAction;
264
265
  * @param adapter The address of the adapter to use.
265
266
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
266
267
  */
268
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
267
269
  function erc20Transfer(asset, recipient, amount, adapter, skipRevert = false) {
268
270
  return [
269
271
  {
@@ -288,6 +290,7 @@ var BundlerAction;
288
290
  * @param recipient The recipient of ERC20 tokens.
289
291
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
290
292
  */
293
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
291
294
  function erc20TransferFrom(chainId, asset, amount, recipient, skipRevert = false) {
292
295
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
293
296
  return [
@@ -316,6 +319,7 @@ var BundlerAction;
316
319
  * @param signature The Ethers signature to permit the tokens.
317
320
  * @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
318
321
  */
322
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
319
323
  function permit(chainId, owner, asset, amount, deadline, signature, skipRevert = true) {
320
324
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
321
325
  const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
@@ -354,6 +358,7 @@ var BundlerAction;
354
358
  * @param signature The Ethers signature to permit the tokens.
355
359
  * @param skipRevert Whether to allow the permit to revert without making the whole bundle revert.
356
360
  */
361
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
357
362
  function permitDai(chainId, owner, nonce, expiry, allowed, signature, skipRevert = true) {
358
363
  const { dai, bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
359
364
  if (dai == null)
@@ -413,6 +418,7 @@ var BundlerAction;
413
418
  * @param signature The Ethers signature to permit the tokens.
414
419
  * @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
415
420
  */
421
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
416
422
  function approve2(chainId, owner, permitSingle, signature, skipRevert = true) {
417
423
  const { permit2, bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
418
424
  if (permit2 == null)
@@ -450,6 +456,7 @@ var BundlerAction;
450
456
  * @param recipient The recipient of ERC20 tokens.
451
457
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
452
458
  */
459
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
453
460
  function transferFrom2(chainId, asset, amount, recipient, skipRevert = false) {
454
461
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
455
462
  return [
@@ -474,6 +481,7 @@ var BundlerAction;
474
481
  * @param amount The amount of tokens to wrap.
475
482
  * @param skipRevert Whether to allow the wrap to revert without making the whole bundler revert. Defaults to false.
476
483
  */
484
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
477
485
  function morphoWrapperDepositFor(chainId, recipient, amount, skipRevert = false) {
478
486
  if (chainId !== blue_sdk_1.ChainId.EthMainnet)
479
487
  throw new Error("MORPHO wrapping is only available on ethereum mainnet");
@@ -502,6 +510,7 @@ var BundlerAction;
502
510
  * @param amount The amount of tokens to send.
503
511
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
504
512
  */
513
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
505
514
  function erc20WrapperDepositFor(chainId, wrapper, underlying, amount, skipRevert = false) {
506
515
  const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
507
516
  if (erc20WrapperAdapter == null)
@@ -551,6 +560,7 @@ var BundlerAction;
551
560
  * @param amount The amount of tokens to send.
552
561
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
553
562
  */
563
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
554
564
  function erc20WrapperWithdrawTo(chainId, wrapper, receiver, amount, skipRevert = false) {
555
565
  const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
556
566
  if (erc20WrapperAdapter == null)
@@ -602,6 +612,7 @@ var BundlerAction;
602
612
  * @param receiver The address to send the shares to.
603
613
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
604
614
  */
615
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
605
616
  function erc4626Mint(chainId, erc4626, shares, maxSharePrice, receiver, skipRevert = false) {
606
617
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
607
618
  return [
@@ -628,6 +639,7 @@ var BundlerAction;
628
639
  * @param receiver The address to send the shares to.
629
640
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
630
641
  */
642
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
631
643
  function erc4626Deposit(chainId, erc4626, assets, maxSharePrice, receiver, skipRevert = false) {
632
644
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
633
645
  return [
@@ -655,6 +667,7 @@ var BundlerAction;
655
667
  * @param owner The address on behalf of which the assets are withdrawn.
656
668
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
657
669
  */
670
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
658
671
  function erc4626Withdraw(chainId, erc4626, assets, minSharePrice, receiver, owner, skipRevert = false) {
659
672
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
660
673
  return [
@@ -682,6 +695,7 @@ var BundlerAction;
682
695
  * @param owner The address on behalf of which the assets are withdrawn.
683
696
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
684
697
  */
698
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
685
699
  function erc4626Redeem(chainId, erc4626, shares, minSharePrice, receiver, owner, skipRevert = false) {
686
700
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
687
701
  return [
@@ -707,6 +721,7 @@ var BundlerAction;
707
721
  * @param signature The Ethers signature to authorize the account.
708
722
  * @param skipRevert Whether to allow the authorization call to revert without making the whole bundle revert. Defaults to true.
709
723
  */
724
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
710
725
  function morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert = true) {
711
726
  const { morpho, bundler3: { bundler3 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
712
727
  const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
@@ -738,6 +753,7 @@ var BundlerAction;
738
753
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupply` callback.
739
754
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
740
755
  */
756
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
741
757
  function morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
742
758
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
743
759
  const reenter = callbackCalls.length > 0;
@@ -768,6 +784,7 @@ var BundlerAction;
768
784
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupplyCollateral` callback.
769
785
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
770
786
  */
787
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
771
788
  function morphoSupplyCollateral(chainId, market, assets, onBehalf, callbackCalls, skipRevert = false) {
772
789
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
773
790
  const reenter = callbackCalls.length > 0;
@@ -799,6 +816,7 @@ var BundlerAction;
799
816
  * @param receiver The address to send borrowed tokens to.
800
817
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
801
818
  */
819
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
802
820
  function morphoBorrow(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
803
821
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
804
822
  return [
@@ -827,6 +845,7 @@ var BundlerAction;
827
845
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupply` callback.
828
846
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
829
847
  */
848
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
830
849
  function morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
831
850
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
832
851
  const reenter = callbackCalls.length > 0;
@@ -858,6 +877,7 @@ var BundlerAction;
858
877
  * @param receiver The address to send withdrawn tokens to.
859
878
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
860
879
  */
880
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
861
881
  function morphoWithdraw(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
862
882
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
863
883
  return [
@@ -883,6 +903,7 @@ var BundlerAction;
883
903
  * @param receiver The address to send withdrawn tokens to.
884
904
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
885
905
  */
906
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
886
907
  function morphoWithdrawCollateral(chainId, market, assets, receiver, skipRevert = false) {
887
908
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
888
909
  return [
@@ -908,6 +929,7 @@ var BundlerAction;
908
929
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoFlashLoan` callback.
909
930
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
910
931
  */
932
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
911
933
  function morphoFlashLoan(chainId, token, assets, callbackCalls, skipRevert = false) {
912
934
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
913
935
  const reenter = callbackCalls.length > 0;
@@ -938,6 +960,7 @@ var BundlerAction;
938
960
  * @param supplyMarketParams The market params to reallocate to.
939
961
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
940
962
  */
963
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
941
964
  function publicAllocatorReallocateTo(chainId, vault, fee, withdrawals, supplyMarketParams, skipRevert = false) {
942
965
  const { publicAllocator } = (0, blue_sdk_1.getChainAddresses)(chainId);
943
966
  if (publicAllocator == null)
@@ -968,6 +991,7 @@ var BundlerAction;
968
991
  * @param receiver The address to send the tokens to.
969
992
  * @param skipRevert Whether to allow the swap to revert without making the whole bundle revert. Defaults to false.
970
993
  */
994
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
971
995
  function paraswapBuy(chainId, augustus, callData, srcToken, dstToken, offsets, receiver, skipRevert = false) {
972
996
  const { bundler3: { paraswapAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
973
997
  if (paraswapAdapter == null)
@@ -999,6 +1023,7 @@ var BundlerAction;
999
1023
  * @param receiver The address to send the tokens to.
1000
1024
  * @param skipRevert Whether to allow the swap to revert without making the whole bundle revert. Defaults to false.
1001
1025
  */
1026
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1002
1027
  function paraswapSell(chainId, augustus, callData, srcToken, dstToken, sellEntireBalance, offsets, receiver, skipRevert = false) {
1003
1028
  const { bundler3: { paraswapAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1004
1029
  if (paraswapAdapter == null)
@@ -1038,6 +1063,7 @@ var BundlerAction;
1038
1063
  * @param receiver The address to send the tokens to.
1039
1064
  * @param skipRevert Whether to allow the swap to revert without making the whole bundle revert. Defaults to false.
1040
1065
  */
1066
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1041
1067
  function paraswapBuyMorphoDebt(chainId, augustus, callData, srcToken, marketParams, offsets, onBehalf, receiver, skipRevert = false) {
1042
1068
  const { bundler3: { paraswapAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1043
1069
  if (paraswapAdapter == null)
@@ -1076,6 +1102,7 @@ var BundlerAction;
1076
1102
  * @param proof The Merkle proof to claim the rewards.
1077
1103
  * @param skipRevert Whether to allow the claim to revert without making the whole bundle revert. Defaults to true.
1078
1104
  */
1105
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1079
1106
  function urdClaim(distributor, account, reward, amount, proof, skipRevert = true) {
1080
1107
  return [
1081
1108
  {
@@ -1100,6 +1127,7 @@ var BundlerAction;
1100
1127
  * @param recipient The address to send tokens to.
1101
1128
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1102
1129
  */
1130
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1103
1131
  function wrapNative(chainId, amount, recipient, skipRevert = false) {
1104
1132
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1105
1133
  return [
@@ -1124,6 +1152,7 @@ var BundlerAction;
1124
1152
  * @param recipient The address to send tokens to.
1125
1153
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1126
1154
  */
1155
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1127
1156
  function unwrapNative(chainId, amount, recipient, skipRevert = false) {
1128
1157
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1129
1158
  return [
@@ -1151,6 +1180,7 @@ var BundlerAction;
1151
1180
  * @param recipient The address to send stETH to.
1152
1181
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1153
1182
  */
1183
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1154
1184
  function stakeEth(chainId, amount, maxSharePrice, referral, recipient, skipRevert = false) {
1155
1185
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1156
1186
  return [
@@ -1176,6 +1206,7 @@ var BundlerAction;
1176
1206
  * @param recipient The address to send wstETH to.
1177
1207
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1178
1208
  */
1209
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1179
1210
  function wrapStEth(chainId, amount, recipient, skipRevert = false) {
1180
1211
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1181
1212
  return [
@@ -1200,6 +1231,7 @@ var BundlerAction;
1200
1231
  * @param recipient The address to send stETH to.
1201
1232
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1202
1233
  */
1234
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1203
1235
  function unwrapStEth(chainId, amount, recipient, skipRevert = false) {
1204
1236
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1205
1237
  return [
@@ -1227,6 +1259,7 @@ var BundlerAction;
1227
1259
  * @param rateMode The interest rate mode used by the debt to repay.
1228
1260
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1229
1261
  */
1262
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1230
1263
  function aaveV2Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
1231
1264
  const { bundler3: { aaveV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1232
1265
  if (aaveV2MigrationAdapter == null)
@@ -1254,6 +1287,7 @@ var BundlerAction;
1254
1287
  * @param recipient The recipient of ERC20 tokens.
1255
1288
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1256
1289
  */
1290
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1257
1291
  function aaveV2Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
1258
1292
  const { bundler3: { aaveV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1259
1293
  if (aaveV2MigrationAdapter == null)
@@ -1283,6 +1317,7 @@ var BundlerAction;
1283
1317
  * @param rateMode The interest rate mode used by the debt to repay.
1284
1318
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1285
1319
  */
1320
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1286
1321
  function aaveV3Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
1287
1322
  const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
1288
1323
  } = (0, blue_sdk_1.getChainAddresses)(chainId);
@@ -1311,6 +1346,7 @@ var BundlerAction;
1311
1346
  * @param recipient The recipient of ERC20 tokens.
1312
1347
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1313
1348
  */
1349
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1314
1350
  function aaveV3Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
1315
1351
  const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
1316
1352
  } = (0, blue_sdk_1.getChainAddresses)(chainId);
@@ -1340,6 +1376,7 @@ var BundlerAction;
1340
1376
  * @param onBehalf The address on behalf of which to repay.
1341
1377
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1342
1378
  */
1379
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1343
1380
  function aaveV3OptimizerRepay(chainId, underlying, amount, onBehalf, skipRevert = false) {
1344
1381
  const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1345
1382
  if (aaveV3OptimizerMigrationAdapter == null)
@@ -1368,6 +1405,7 @@ var BundlerAction;
1368
1405
  * @param recipient The recipient of ERC20 tokens.
1369
1406
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1370
1407
  */
1408
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1371
1409
  function aaveV3OptimizerWithdraw(chainId, underlying, amount, maxIterations, recipient, skipRevert = false) {
1372
1410
  const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1373
1411
  if (aaveV3OptimizerMigrationAdapter == null)
@@ -1395,6 +1433,7 @@ var BundlerAction;
1395
1433
  * @param recipient The recipient of ERC20 tokens.
1396
1434
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1397
1435
  */
1436
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1398
1437
  function aaveV3OptimizerWithdrawCollateral(chainId, underlying, amount, recipient, skipRevert = false) {
1399
1438
  const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1400
1439
  if (aaveV3OptimizerMigrationAdapter == null)
@@ -1425,6 +1464,7 @@ var BundlerAction;
1425
1464
  * @param signature The Ethers signature to submit.
1426
1465
  * @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
1427
1466
  */
1467
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1428
1468
  function aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, skipRevert = true) {
1429
1469
  const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1430
1470
  if (aaveV3OptimizerMigrationAdapter == null)
@@ -1485,6 +1525,7 @@ var BundlerAction;
1485
1525
  * @param onBehalf The account on behalf of which to repay.
1486
1526
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1487
1527
  */
1528
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1488
1529
  function compoundV2Repay(chainId, cToken, amount, isEth, onBehalf, skipRevert = false) {
1489
1530
  const { bundler3: { compoundV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1490
1531
  if (compoundV2MigrationAdapter == null)
@@ -1518,6 +1559,7 @@ var BundlerAction;
1518
1559
  * @param recipient The recipient of ERC20 tokens.
1519
1560
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1520
1561
  */
1562
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1521
1563
  function compoundV2Redeem(chainId, cToken, amount, isEth, recipient, skipRevert = false) {
1522
1564
  const { bundler3: { compoundV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1523
1565
  if (compoundV2MigrationAdapter == null)
@@ -1552,6 +1594,7 @@ var BundlerAction;
1552
1594
  * @param onBehalf The address on behalf of which to repay.
1553
1595
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1554
1596
  */
1597
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1555
1598
  function compoundV3Repay(chainId, instance, amount, onBehalf, skipRevert = false) {
1556
1599
  const { bundler3: { compoundV3MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1557
1600
  if (compoundV3MigrationAdapter == null)
@@ -1580,6 +1623,7 @@ var BundlerAction;
1580
1623
  * @param recipient The recipient of ERC20 tokens.
1581
1624
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1582
1625
  */
1626
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1583
1627
  function compoundV3WithdrawFrom(chainId, instance, asset, amount, recipient, skipRevert = false) {
1584
1628
  const { bundler3: { compoundV3MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1585
1629
  if (compoundV3MigrationAdapter == null)
@@ -1611,6 +1655,7 @@ var BundlerAction;
1611
1655
  * @param signature The Ethers signature to submit.
1612
1656
  * @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
1613
1657
  */
1658
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1614
1659
  function compoundV3AllowBySig(chainId, instance, owner, isAllowed, nonce, expiry, signature, skipRevert = true) {
1615
1660
  const { bundler3: { compoundV3MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1616
1661
  if (compoundV3MigrationAdapter == null)
@@ -2,17 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.encodeOperation = exports.MAX_ABSOLUTE_SHARE_PRICE = void 0;
4
4
  exports.encodeBundle = encodeBundle;
5
- const viem_1 = require("viem");
6
5
  const blue_sdk_1 = require("@morpho-org/blue-sdk");
6
+ const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
7
7
  const morpho_ts_1 = require("@morpho-org/morpho-ts");
8
8
  const simulation_sdk_1 = require("@morpho-org/simulation-sdk");
9
- const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
9
+ const viem_1 = require("viem");
10
10
  const actions_1 = require("viem/actions");
11
11
  const ActionBundle_js_1 = require("./ActionBundle.js");
12
12
  const errors_js_1 = require("./errors.js");
13
13
  exports.MAX_ABSOLUTE_SHARE_PRICE = 100n * blue_sdk_1.MathLib.RAY;
14
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
14
15
  const encodeErc20Approval = (token, spender, amount, data) => {
15
16
  const { chainId } = data;
17
+ // biome-ignore lint/style/noParameterAssign: TODO refactor to avoid mutating parameter
16
18
  amount = blue_sdk_1.MathLib.min(amount, simulation_sdk_1.MAX_TOKEN_APPROVALS[chainId]?.[token] ?? viem_1.maxUint256);
17
19
  const txRequirements = [];
18
20
  txRequirements.push({
@@ -29,6 +31,7 @@ const encodeErc20Approval = (token, spender, amount, data) => {
29
31
  });
30
32
  return txRequirements;
31
33
  };
34
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
32
35
  const encodeOperation = (operation, dataBefore, supportsSignature = true, index = 0) => {
33
36
  const { chainId } = dataBefore;
34
37
  const { morpho, bundler3: { bundler3, generalAdapter1, paraswapAdapter }, permit2, wNative, dai, wstEth, stEth, } = (0, blue_sdk_1.getChainAddresses)(chainId);
@@ -41,6 +44,7 @@ const encodeOperation = (operation, dataBefore, supportsSignature = true, index
41
44
  args: {
42
45
  ...operation.args,
43
46
  ...(callback && {
47
+ // biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
44
48
  callback: (dataBefore) => {
45
49
  callbackBundle = encodeBundle(callback.map((callbackOperation) => ({
46
50
  ...callbackOperation,
@@ -772,6 +776,7 @@ const encodeOperation = (operation, dataBefore, supportsSignature = true, index
772
776
  };
773
777
  };
774
778
  exports.encodeOperation = encodeOperation;
779
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
775
780
  function encodeBundle(operations, startData, supportsSignature = true) {
776
781
  const bundle = new ActionBundle_js_1.ActionBundle([startData]);
777
782
  for (let index = 0; index < operations.length; ++index) {
package/lib/cjs/bundle.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupBundle = void 0;
4
4
  const actions_js_1 = require("./actions.js");
5
5
  const operations_js_1 = require("./operations.js");
6
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
6
7
  const setupBundle = (inputOperations, startData, receiver, { supportsSignature, unwrapTokens, unwrapSlippage, ...options } = {}) => {
7
8
  let { operations } = (0, operations_js_1.populateBundle)(inputOperations, startData, options);
8
9
  operations = (0, operations_js_1.finalizeBundle)(operations, startData, receiver, unwrapTokens, unwrapSlippage);
package/lib/cjs/errors.js CHANGED
@@ -8,6 +8,7 @@ var BundlerErrors;
8
8
  index;
9
9
  inputOperation;
10
10
  steps;
11
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
11
12
  constructor(error, index, inputOperation, steps) {
12
13
  super(error.message);
13
14
  this.error = error;
@@ -1,8 +1,8 @@
1
+ export * from "./ActionBundle.js";
2
+ export * from "./abis.js";
1
3
  export * from "./actions.js";
2
- export * from "./operations.js";
3
- export * from "./errors.js";
4
- export * from "./types/index.js";
5
4
  export * from "./BundlerAction.js";
6
5
  export * from "./bundle.js";
7
- export * from "./ActionBundle.js";
8
- export * from "./abis.js";
6
+ export * from "./errors.js";
7
+ export * from "./operations.js";
8
+ export * from "./types/index.js";
package/lib/cjs/index.js CHANGED
@@ -14,11 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ActionBundle.js"), exports);
18
+ __exportStar(require("./abis.js"), exports);
17
19
  __exportStar(require("./actions.js"), exports);
18
- __exportStar(require("./operations.js"), exports);
19
- __exportStar(require("./errors.js"), exports);
20
- __exportStar(require("./types/index.js"), exports);
21
20
  __exportStar(require("./BundlerAction.js"), exports);
22
21
  __exportStar(require("./bundle.js"), exports);
23
- __exportStar(require("./ActionBundle.js"), exports);
24
- __exportStar(require("./abis.js"), exports);
22
+ __exportStar(require("./errors.js"), exports);
23
+ __exportStar(require("./operations.js"), exports);
24
+ __exportStar(require("./types/index.js"), exports);
@@ -10,6 +10,7 @@ const errors_js_1 = require("./errors.js");
10
10
  * The default target utilization above which the shared liquidity algorithm is triggered (scaled by WAD).
11
11
  */
12
12
  exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = 905000000000000000n;
13
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
13
14
  const populateInputTransfer = ({ address, args: { amount, from } }, data, { hasSimplePermit = false } = {}) => {
14
15
  const { bundler3: { generalAdapter1 }, permit2, } = (0, blue_sdk_1.getChainAddresses)(data.chainId);
15
16
  // If native token, it is expected to be sent along as call value.
@@ -158,6 +159,7 @@ exports.populateInputTransfer = populateInputTransfer;
158
159
  * @param wrapSlippage The slippage simulated during wraps. Should never be 0.
159
160
  * @return The bundle of operations to optimize and skim before being encoded.
160
161
  */
162
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
161
163
  const populateSubBundle = (inputOperation, data, options = {}) => {
162
164
  const { sender } = inputOperation;
163
165
  const { bundler3: { bundler3, generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(data.chainId);
@@ -221,7 +223,7 @@ const populateSubBundle = (inputOperation, data, options = {}) => {
221
223
  });
222
224
  }
223
225
  // Reallocate liquidity if necessary.
224
- if (!!publicAllocatorOptions?.enabled &&
226
+ if (publicAllocatorOptions?.enabled &&
225
227
  (mainOperation.type === "Blue_Borrow" ||
226
228
  mainOperation.type === "Blue_Withdraw")) {
227
229
  const market = data
@@ -315,7 +317,9 @@ const populateSubBundle = (inputOperation, data, options = {}) => {
315
317
  args: {
316
318
  ...mainOperation.args,
317
319
  ...(callback && {
320
+ // biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
318
321
  callback: (data) => {
322
+ // biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
319
323
  const operations = callback.flatMap((inputOperation) => {
320
324
  const subBundleOperations = (0, exports.populateSubBundle)({
321
325
  ...inputOperation,
@@ -384,6 +388,7 @@ exports.populateSubBundle = populateSubBundle;
384
388
  * @param unwrapSlippage The slippage simulated during unwraps. Should never be 0.
385
389
  * @return The optimized bundle.
386
390
  */
391
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
387
392
  const finalizeBundle = (operations, startData, receiver, unwrapTokens = new Set(), unwrapSlippage = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE) => {
388
393
  const nbOperations = operations.length;
389
394
  if (nbOperations === 0)
@@ -481,6 +486,7 @@ const finalizeBundle = (operations, startData, receiver, unwrapTokens = new Set(
481
486
  others.push(operation);
482
487
  }
483
488
  });
489
+ // biome-ignore lint/style/noParameterAssign: TODO refactor to avoid mutating parameter
484
490
  operations = [
485
491
  approvals,
486
492
  permits,
@@ -569,6 +575,7 @@ const finalizeBundle = (operations, startData, receiver, unwrapTokens = new Set(
569
575
  operation.args.owner = inputTransfer.args.from;
570
576
  });
571
577
  // Filter out useless input transfers.
578
+ // biome-ignore lint/style/noParameterAssign: TODO refactor to avoid mutating parameter
572
579
  operations = operations.filter((operation, index) => {
573
580
  if (operation.type !== "Erc20_Transfer")
574
581
  return true;
@@ -684,7 +691,7 @@ const finalizeBundle = (operations, startData, receiver, unwrapTokens = new Set(
684
691
  uniqueSkimTokens.add(blue_sdk_1.NATIVE_ADDRESS);
685
692
  break;
686
693
  default:
687
- //@ts-ignore This is dead code but acts as a guard in case a new operation is added
694
+ //@ts-expect-error This is dead code but acts as a guard in case a new operation is added
688
695
  throw new errors_js_1.BundlerErrors.MissingSkimHandler(operation.type);
689
696
  }
690
697
  if ("callback" in operation.args)
@@ -719,6 +726,7 @@ const finalizeBundle = (operations, startData, receiver, unwrapTokens = new Set(
719
726
  return finalizedOperations;
720
727
  };
721
728
  exports.finalizeBundle = finalizeBundle;
729
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
722
730
  const populateBundle = (inputOperations, data, options) => {
723
731
  const steps = [data];
724
732
  let end = data;
@@ -779,7 +787,9 @@ const getSimulatedBundlerOperation = (operation, { slippage } = {}) => {
779
787
  args: {
780
788
  ...operation.args,
781
789
  ...(callback && {
782
- callback: () => callback.map((operation) => (0, exports.getSimulatedBundlerOperation)(operation, { slippage })),
790
+ callback: () =>
791
+ // biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
792
+ callback.map((operation) => (0, exports.getSimulatedBundlerOperation)(operation, { slippage })),
783
793
  }),
784
794
  },
785
795
  };
@@ -803,11 +813,17 @@ const getSimulatedBundlerOperation = (operation, { slippage } = {}) => {
803
813
  return simulatedOperation;
804
814
  };
805
815
  exports.getSimulatedBundlerOperation = getSimulatedBundlerOperation;
806
- const handleBundlerOperation = (options) => (operation, startData, index) => (0, simulation_sdk_1.handleOperation)((0, exports.getSimulatedBundlerOperation)(operation, options), startData, index);
816
+ const handleBundlerOperation = (options) =>
817
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
818
+ (operation, startData, index) => (0, simulation_sdk_1.handleOperation)((0, exports.getSimulatedBundlerOperation)(operation, options), startData, index);
807
819
  exports.handleBundlerOperation = handleBundlerOperation;
820
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
808
821
  const handleBundlerOperations = (operations, startData, options) => (0, simulation_sdk_1.handleOperations)(operations, startData, (0, exports.handleBundlerOperation)(options));
809
822
  exports.handleBundlerOperations = handleBundlerOperations;
810
- const simulateBundlerOperation = (options) => (operation, startData, index) => (0, simulation_sdk_1.simulateOperation)((0, exports.getSimulatedBundlerOperation)(operation, options), startData, index);
823
+ const simulateBundlerOperation = (options) =>
824
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
825
+ (operation, startData, index) => (0, simulation_sdk_1.simulateOperation)((0, exports.getSimulatedBundlerOperation)(operation, options), startData, index);
811
826
  exports.simulateBundlerOperation = simulateBundlerOperation;
827
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
812
828
  const simulateBundlerOperations = (operations, startData, options) => (0, simulation_sdk_1.handleOperations)(operations, startData, (0, exports.simulateBundlerOperation)(options));
813
829
  exports.simulateBundlerOperations = simulateBundlerOperations;
@@ -1,6 +1,6 @@
1
- import type { Account, Chain, Client, Hex, TransactionRequest, Transport } from "viem";
2
1
  import type { Address, InputMarketParams } from "@morpho-org/blue-sdk";
3
2
  import type { ParaswapOffsets } from "@morpho-org/simulation-sdk";
3
+ import type { Account, Chain, Client, Hex, TransactionRequest, Transport } from "viem";
4
4
  export interface Authorization {
5
5
  authorizer: Address;
6
6
  authorized: Address;
@@ -15,6 +15,7 @@ export class ActionBundle {
15
15
  requirements;
16
16
  steps;
17
17
  chainId;
18
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
18
19
  constructor(stepsOrChainId, actions = [], requirements = new ActionBundleRequirements()) {
19
20
  this.actions = actions;
20
21
  this.requirements = requirements;
@@ -1,7 +1,7 @@
1
- import { aaveV2MigrationAdapterAbi, aaveV3MigrationAdapterAbi, aaveV3OptimizerMigrationAdapterAbi, bundler3Abi, compoundV2MigrationAdapterAbi, compoundV3MigrationAdapterAbi, coreAdapterAbi, erc20WrapperAdapterAbi, ethereumGeneralAdapter1Abi, generalAdapter1Abi, paraswapAdapterAbi, universalRewardsDistributorAbi, } from "./abis.js";
2
1
  import { ChainId, getChainAddresses, } from "@morpho-org/blue-sdk";
3
2
  import { blueAbi, erc2612Abi, permit2Abi, publicAllocatorAbi, } from "@morpho-org/blue-sdk-viem";
4
3
  import { encodeAbiParameters, encodeFunctionData, keccak256, maxUint256, parseSignature, zeroHash, } from "viem";
4
+ import { aaveV2MigrationAdapterAbi, aaveV3MigrationAdapterAbi, aaveV3OptimizerMigrationAdapterAbi, bundler3Abi, compoundV2MigrationAdapterAbi, compoundV3MigrationAdapterAbi, coreAdapterAbi, erc20WrapperAdapterAbi, ethereumGeneralAdapter1Abi, generalAdapter1Abi, paraswapAdapterAbi, universalRewardsDistributorAbi, } from "./abis.js";
5
5
  import { BundlerErrors } from "./errors.js";
6
6
  const reenterAbiInputs = bundler3Abi.find((item) => item.name === "reenter").inputs;
7
7
  /**
@@ -223,6 +223,7 @@ export var BundlerAction;
223
223
  * @param amount The amount of native tokens to send (in wei).
224
224
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
225
225
  */
226
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
226
227
  function nativeTransfer(chainId, owner, recipient, amount, skipRevert = false) {
227
228
  const { bundler3: { bundler3, generalAdapter1 }, } = getChainAddresses(chainId);
228
229
  if (recipient === bundler3)
@@ -261,6 +262,7 @@ export var BundlerAction;
261
262
  * @param adapter The address of the adapter to use.
262
263
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
263
264
  */
265
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
264
266
  function erc20Transfer(asset, recipient, amount, adapter, skipRevert = false) {
265
267
  return [
266
268
  {
@@ -285,6 +287,7 @@ export var BundlerAction;
285
287
  * @param recipient The recipient of ERC20 tokens.
286
288
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
287
289
  */
290
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
288
291
  function erc20TransferFrom(chainId, asset, amount, recipient, skipRevert = false) {
289
292
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
290
293
  return [
@@ -313,6 +316,7 @@ export var BundlerAction;
313
316
  * @param signature The Ethers signature to permit the tokens.
314
317
  * @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
315
318
  */
319
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
316
320
  function permit(chainId, owner, asset, amount, deadline, signature, skipRevert = true) {
317
321
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
318
322
  const { r, s, yParity } = parseSignature(signature);
@@ -351,6 +355,7 @@ export var BundlerAction;
351
355
  * @param signature The Ethers signature to permit the tokens.
352
356
  * @param skipRevert Whether to allow the permit to revert without making the whole bundle revert.
353
357
  */
358
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
354
359
  function permitDai(chainId, owner, nonce, expiry, allowed, signature, skipRevert = true) {
355
360
  const { dai, bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
356
361
  if (dai == null)
@@ -410,6 +415,7 @@ export var BundlerAction;
410
415
  * @param signature The Ethers signature to permit the tokens.
411
416
  * @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
412
417
  */
418
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
413
419
  function approve2(chainId, owner, permitSingle, signature, skipRevert = true) {
414
420
  const { permit2, bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
415
421
  if (permit2 == null)
@@ -447,6 +453,7 @@ export var BundlerAction;
447
453
  * @param recipient The recipient of ERC20 tokens.
448
454
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
449
455
  */
456
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
450
457
  function transferFrom2(chainId, asset, amount, recipient, skipRevert = false) {
451
458
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
452
459
  return [
@@ -471,6 +478,7 @@ export var BundlerAction;
471
478
  * @param amount The amount of tokens to wrap.
472
479
  * @param skipRevert Whether to allow the wrap to revert without making the whole bundler revert. Defaults to false.
473
480
  */
481
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
474
482
  function morphoWrapperDepositFor(chainId, recipient, amount, skipRevert = false) {
475
483
  if (chainId !== ChainId.EthMainnet)
476
484
  throw new Error("MORPHO wrapping is only available on ethereum mainnet");
@@ -499,6 +507,7 @@ export var BundlerAction;
499
507
  * @param amount The amount of tokens to send.
500
508
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
501
509
  */
510
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
502
511
  function erc20WrapperDepositFor(chainId, wrapper, underlying, amount, skipRevert = false) {
503
512
  const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = getChainAddresses(chainId);
504
513
  if (erc20WrapperAdapter == null)
@@ -548,6 +557,7 @@ export var BundlerAction;
548
557
  * @param amount The amount of tokens to send.
549
558
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
550
559
  */
560
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
551
561
  function erc20WrapperWithdrawTo(chainId, wrapper, receiver, amount, skipRevert = false) {
552
562
  const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = getChainAddresses(chainId);
553
563
  if (erc20WrapperAdapter == null)
@@ -599,6 +609,7 @@ export var BundlerAction;
599
609
  * @param receiver The address to send the shares to.
600
610
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
601
611
  */
612
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
602
613
  function erc4626Mint(chainId, erc4626, shares, maxSharePrice, receiver, skipRevert = false) {
603
614
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
604
615
  return [
@@ -625,6 +636,7 @@ export var BundlerAction;
625
636
  * @param receiver The address to send the shares to.
626
637
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
627
638
  */
639
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
628
640
  function erc4626Deposit(chainId, erc4626, assets, maxSharePrice, receiver, skipRevert = false) {
629
641
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
630
642
  return [
@@ -652,6 +664,7 @@ export var BundlerAction;
652
664
  * @param owner The address on behalf of which the assets are withdrawn.
653
665
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
654
666
  */
667
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
655
668
  function erc4626Withdraw(chainId, erc4626, assets, minSharePrice, receiver, owner, skipRevert = false) {
656
669
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
657
670
  return [
@@ -679,6 +692,7 @@ export var BundlerAction;
679
692
  * @param owner The address on behalf of which the assets are withdrawn.
680
693
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
681
694
  */
695
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
682
696
  function erc4626Redeem(chainId, erc4626, shares, minSharePrice, receiver, owner, skipRevert = false) {
683
697
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
684
698
  return [
@@ -704,6 +718,7 @@ export var BundlerAction;
704
718
  * @param signature The Ethers signature to authorize the account.
705
719
  * @param skipRevert Whether to allow the authorization call to revert without making the whole bundle revert. Defaults to true.
706
720
  */
721
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
707
722
  function morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert = true) {
708
723
  const { morpho, bundler3: { bundler3 }, } = getChainAddresses(chainId);
709
724
  const { r, s, yParity } = parseSignature(signature);
@@ -735,6 +750,7 @@ export var BundlerAction;
735
750
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupply` callback.
736
751
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
737
752
  */
753
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
738
754
  function morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
739
755
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
740
756
  const reenter = callbackCalls.length > 0;
@@ -765,6 +781,7 @@ export var BundlerAction;
765
781
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupplyCollateral` callback.
766
782
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
767
783
  */
784
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
768
785
  function morphoSupplyCollateral(chainId, market, assets, onBehalf, callbackCalls, skipRevert = false) {
769
786
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
770
787
  const reenter = callbackCalls.length > 0;
@@ -796,6 +813,7 @@ export var BundlerAction;
796
813
  * @param receiver The address to send borrowed tokens to.
797
814
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
798
815
  */
816
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
799
817
  function morphoBorrow(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
800
818
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
801
819
  return [
@@ -824,6 +842,7 @@ export var BundlerAction;
824
842
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupply` callback.
825
843
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
826
844
  */
845
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
827
846
  function morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
828
847
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
829
848
  const reenter = callbackCalls.length > 0;
@@ -855,6 +874,7 @@ export var BundlerAction;
855
874
  * @param receiver The address to send withdrawn tokens to.
856
875
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
857
876
  */
877
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
858
878
  function morphoWithdraw(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
859
879
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
860
880
  return [
@@ -880,6 +900,7 @@ export var BundlerAction;
880
900
  * @param receiver The address to send withdrawn tokens to.
881
901
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
882
902
  */
903
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
883
904
  function morphoWithdrawCollateral(chainId, market, assets, receiver, skipRevert = false) {
884
905
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
885
906
  return [
@@ -905,6 +926,7 @@ export var BundlerAction;
905
926
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoFlashLoan` callback.
906
927
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
907
928
  */
929
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
908
930
  function morphoFlashLoan(chainId, token, assets, callbackCalls, skipRevert = false) {
909
931
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
910
932
  const reenter = callbackCalls.length > 0;
@@ -935,6 +957,7 @@ export var BundlerAction;
935
957
  * @param supplyMarketParams The market params to reallocate to.
936
958
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
937
959
  */
960
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
938
961
  function publicAllocatorReallocateTo(chainId, vault, fee, withdrawals, supplyMarketParams, skipRevert = false) {
939
962
  const { publicAllocator } = getChainAddresses(chainId);
940
963
  if (publicAllocator == null)
@@ -965,6 +988,7 @@ export var BundlerAction;
965
988
  * @param receiver The address to send the tokens to.
966
989
  * @param skipRevert Whether to allow the swap to revert without making the whole bundle revert. Defaults to false.
967
990
  */
991
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
968
992
  function paraswapBuy(chainId, augustus, callData, srcToken, dstToken, offsets, receiver, skipRevert = false) {
969
993
  const { bundler3: { paraswapAdapter }, } = getChainAddresses(chainId);
970
994
  if (paraswapAdapter == null)
@@ -996,6 +1020,7 @@ export var BundlerAction;
996
1020
  * @param receiver The address to send the tokens to.
997
1021
  * @param skipRevert Whether to allow the swap to revert without making the whole bundle revert. Defaults to false.
998
1022
  */
1023
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
999
1024
  function paraswapSell(chainId, augustus, callData, srcToken, dstToken, sellEntireBalance, offsets, receiver, skipRevert = false) {
1000
1025
  const { bundler3: { paraswapAdapter }, } = getChainAddresses(chainId);
1001
1026
  if (paraswapAdapter == null)
@@ -1035,6 +1060,7 @@ export var BundlerAction;
1035
1060
  * @param receiver The address to send the tokens to.
1036
1061
  * @param skipRevert Whether to allow the swap to revert without making the whole bundle revert. Defaults to false.
1037
1062
  */
1063
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1038
1064
  function paraswapBuyMorphoDebt(chainId, augustus, callData, srcToken, marketParams, offsets, onBehalf, receiver, skipRevert = false) {
1039
1065
  const { bundler3: { paraswapAdapter }, } = getChainAddresses(chainId);
1040
1066
  if (paraswapAdapter == null)
@@ -1073,6 +1099,7 @@ export var BundlerAction;
1073
1099
  * @param proof The Merkle proof to claim the rewards.
1074
1100
  * @param skipRevert Whether to allow the claim to revert without making the whole bundle revert. Defaults to true.
1075
1101
  */
1102
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1076
1103
  function urdClaim(distributor, account, reward, amount, proof, skipRevert = true) {
1077
1104
  return [
1078
1105
  {
@@ -1097,6 +1124,7 @@ export var BundlerAction;
1097
1124
  * @param recipient The address to send tokens to.
1098
1125
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1099
1126
  */
1127
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1100
1128
  function wrapNative(chainId, amount, recipient, skipRevert = false) {
1101
1129
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
1102
1130
  return [
@@ -1121,6 +1149,7 @@ export var BundlerAction;
1121
1149
  * @param recipient The address to send tokens to.
1122
1150
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1123
1151
  */
1152
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1124
1153
  function unwrapNative(chainId, amount, recipient, skipRevert = false) {
1125
1154
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
1126
1155
  return [
@@ -1148,6 +1177,7 @@ export var BundlerAction;
1148
1177
  * @param recipient The address to send stETH to.
1149
1178
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1150
1179
  */
1180
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1151
1181
  function stakeEth(chainId, amount, maxSharePrice, referral, recipient, skipRevert = false) {
1152
1182
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
1153
1183
  return [
@@ -1173,6 +1203,7 @@ export var BundlerAction;
1173
1203
  * @param recipient The address to send wstETH to.
1174
1204
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1175
1205
  */
1206
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1176
1207
  function wrapStEth(chainId, amount, recipient, skipRevert = false) {
1177
1208
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
1178
1209
  return [
@@ -1197,6 +1228,7 @@ export var BundlerAction;
1197
1228
  * @param recipient The address to send stETH to.
1198
1229
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1199
1230
  */
1231
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1200
1232
  function unwrapStEth(chainId, amount, recipient, skipRevert = false) {
1201
1233
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
1202
1234
  return [
@@ -1224,6 +1256,7 @@ export var BundlerAction;
1224
1256
  * @param rateMode The interest rate mode used by the debt to repay.
1225
1257
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1226
1258
  */
1259
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1227
1260
  function aaveV2Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
1228
1261
  const { bundler3: { aaveV2MigrationAdapter }, } = getChainAddresses(chainId);
1229
1262
  if (aaveV2MigrationAdapter == null)
@@ -1251,6 +1284,7 @@ export var BundlerAction;
1251
1284
  * @param recipient The recipient of ERC20 tokens.
1252
1285
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1253
1286
  */
1287
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1254
1288
  function aaveV2Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
1255
1289
  const { bundler3: { aaveV2MigrationAdapter }, } = getChainAddresses(chainId);
1256
1290
  if (aaveV2MigrationAdapter == null)
@@ -1280,6 +1314,7 @@ export var BundlerAction;
1280
1314
  * @param rateMode The interest rate mode used by the debt to repay.
1281
1315
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1282
1316
  */
1317
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1283
1318
  function aaveV3Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
1284
1319
  const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
1285
1320
  } = getChainAddresses(chainId);
@@ -1308,6 +1343,7 @@ export var BundlerAction;
1308
1343
  * @param recipient The recipient of ERC20 tokens.
1309
1344
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1310
1345
  */
1346
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1311
1347
  function aaveV3Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
1312
1348
  const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
1313
1349
  } = getChainAddresses(chainId);
@@ -1337,6 +1373,7 @@ export var BundlerAction;
1337
1373
  * @param onBehalf The address on behalf of which to repay.
1338
1374
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1339
1375
  */
1376
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1340
1377
  function aaveV3OptimizerRepay(chainId, underlying, amount, onBehalf, skipRevert = false) {
1341
1378
  const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1342
1379
  if (aaveV3OptimizerMigrationAdapter == null)
@@ -1365,6 +1402,7 @@ export var BundlerAction;
1365
1402
  * @param recipient The recipient of ERC20 tokens.
1366
1403
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1367
1404
  */
1405
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1368
1406
  function aaveV3OptimizerWithdraw(chainId, underlying, amount, maxIterations, recipient, skipRevert = false) {
1369
1407
  const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1370
1408
  if (aaveV3OptimizerMigrationAdapter == null)
@@ -1392,6 +1430,7 @@ export var BundlerAction;
1392
1430
  * @param recipient The recipient of ERC20 tokens.
1393
1431
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1394
1432
  */
1433
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1395
1434
  function aaveV3OptimizerWithdrawCollateral(chainId, underlying, amount, recipient, skipRevert = false) {
1396
1435
  const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1397
1436
  if (aaveV3OptimizerMigrationAdapter == null)
@@ -1422,6 +1461,7 @@ export var BundlerAction;
1422
1461
  * @param signature The Ethers signature to submit.
1423
1462
  * @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
1424
1463
  */
1464
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1425
1465
  function aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, skipRevert = true) {
1426
1466
  const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1427
1467
  if (aaveV3OptimizerMigrationAdapter == null)
@@ -1482,6 +1522,7 @@ export var BundlerAction;
1482
1522
  * @param onBehalf The account on behalf of which to repay.
1483
1523
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1484
1524
  */
1525
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1485
1526
  function compoundV2Repay(chainId, cToken, amount, isEth, onBehalf, skipRevert = false) {
1486
1527
  const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
1487
1528
  if (compoundV2MigrationAdapter == null)
@@ -1515,6 +1556,7 @@ export var BundlerAction;
1515
1556
  * @param recipient The recipient of ERC20 tokens.
1516
1557
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1517
1558
  */
1559
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1518
1560
  function compoundV2Redeem(chainId, cToken, amount, isEth, recipient, skipRevert = false) {
1519
1561
  const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
1520
1562
  if (compoundV2MigrationAdapter == null)
@@ -1549,6 +1591,7 @@ export var BundlerAction;
1549
1591
  * @param onBehalf The address on behalf of which to repay.
1550
1592
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1551
1593
  */
1594
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1552
1595
  function compoundV3Repay(chainId, instance, amount, onBehalf, skipRevert = false) {
1553
1596
  const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
1554
1597
  if (compoundV3MigrationAdapter == null)
@@ -1577,6 +1620,7 @@ export var BundlerAction;
1577
1620
  * @param recipient The recipient of ERC20 tokens.
1578
1621
  * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1579
1622
  */
1623
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1580
1624
  function compoundV3WithdrawFrom(chainId, instance, asset, amount, recipient, skipRevert = false) {
1581
1625
  const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
1582
1626
  if (compoundV3MigrationAdapter == null)
@@ -1608,6 +1652,7 @@ export var BundlerAction;
1608
1652
  * @param signature The Ethers signature to submit.
1609
1653
  * @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
1610
1654
  */
1655
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1611
1656
  function compoundV3AllowBySig(chainId, instance, owner, isAllowed, nonce, expiry, signature, skipRevert = true) {
1612
1657
  const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
1613
1658
  if (compoundV3MigrationAdapter == null)
@@ -1,14 +1,16 @@
1
- import { encodeFunctionData, erc20Abi, hexToBigInt, maxUint256, slice, verifyTypedData, zeroAddress, } from "viem";
2
- import { DEFAULT_SLIPPAGE_TOLERANCE, MathLib, NATIVE_ADDRESS, convexWrapperTokens, erc20WrapperTokens, getChainAddresses, getUnwrappedToken, } from "@morpho-org/blue-sdk";
3
- import { Time, getValue } from "@morpho-org/morpho-ts";
4
- import { APPROVE_ONLY_ONCE_TOKENS, MAX_TOKEN_APPROVALS, getCurrent, simulateOperation, } from "@morpho-org/simulation-sdk";
1
+ import { convexWrapperTokens, DEFAULT_SLIPPAGE_TOLERANCE, erc20WrapperTokens, getChainAddresses, getUnwrappedToken, MathLib, NATIVE_ADDRESS, } from "@morpho-org/blue-sdk";
5
2
  import { blueAbi, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermitTypedData, } from "@morpho-org/blue-sdk-viem";
3
+ import { getValue, Time } from "@morpho-org/morpho-ts";
4
+ import { APPROVE_ONLY_ONCE_TOKENS, getCurrent, MAX_TOKEN_APPROVALS, simulateOperation, } from "@morpho-org/simulation-sdk";
5
+ import { encodeFunctionData, erc20Abi, hexToBigInt, maxUint256, slice, verifyTypedData, zeroAddress, } from "viem";
6
6
  import { signTypedData } from "viem/actions";
7
7
  import { ActionBundle, ActionBundleRequirements } from "./ActionBundle.js";
8
8
  import { BundlerErrors } from "./errors.js";
9
9
  export const MAX_ABSOLUTE_SHARE_PRICE = 100n * MathLib.RAY;
10
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
10
11
  const encodeErc20Approval = (token, spender, amount, data) => {
11
12
  const { chainId } = data;
13
+ // biome-ignore lint/style/noParameterAssign: TODO refactor to avoid mutating parameter
12
14
  amount = MathLib.min(amount, MAX_TOKEN_APPROVALS[chainId]?.[token] ?? maxUint256);
13
15
  const txRequirements = [];
14
16
  txRequirements.push({
@@ -25,6 +27,7 @@ const encodeErc20Approval = (token, spender, amount, data) => {
25
27
  });
26
28
  return txRequirements;
27
29
  };
30
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
28
31
  export const encodeOperation = (operation, dataBefore, supportsSignature = true, index = 0) => {
29
32
  const { chainId } = dataBefore;
30
33
  const { morpho, bundler3: { bundler3, generalAdapter1, paraswapAdapter }, permit2, wNative, dai, wstEth, stEth, } = getChainAddresses(chainId);
@@ -37,6 +40,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
37
40
  args: {
38
41
  ...operation.args,
39
42
  ...(callback && {
43
+ // biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
40
44
  callback: (dataBefore) => {
41
45
  callbackBundle = encodeBundle(callback.map((callbackOperation) => ({
42
46
  ...callbackOperation,
@@ -767,6 +771,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
767
771
  requirements,
768
772
  };
769
773
  };
774
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
770
775
  export function encodeBundle(operations, startData, supportsSignature = true) {
771
776
  const bundle = new ActionBundle([startData]);
772
777
  for (let index = 0; index < operations.length; ++index) {
package/lib/esm/bundle.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { encodeBundle } from "./actions.js";
2
2
  import { finalizeBundle, populateBundle, } from "./operations.js";
3
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
3
4
  export const setupBundle = (inputOperations, startData, receiver, { supportsSignature, unwrapTokens, unwrapSlippage, ...options } = {}) => {
4
5
  let { operations } = populateBundle(inputOperations, startData, options);
5
6
  operations = finalizeBundle(operations, startData, receiver, unwrapTokens, unwrapSlippage);
package/lib/esm/errors.js CHANGED
@@ -5,6 +5,7 @@ export var BundlerErrors;
5
5
  index;
6
6
  inputOperation;
7
7
  steps;
8
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
8
9
  constructor(error, index, inputOperation, steps) {
9
10
  super(error.message);
10
11
  this.error = error;
@@ -1,8 +1,8 @@
1
+ export * from "./ActionBundle.js";
2
+ export * from "./abis.js";
1
3
  export * from "./actions.js";
2
- export * from "./operations.js";
3
- export * from "./errors.js";
4
- export * from "./types/index.js";
5
4
  export * from "./BundlerAction.js";
6
5
  export * from "./bundle.js";
7
- export * from "./ActionBundle.js";
8
- export * from "./abis.js";
6
+ export * from "./errors.js";
7
+ export * from "./operations.js";
8
+ export * from "./types/index.js";
package/lib/esm/index.js CHANGED
@@ -1,8 +1,8 @@
1
+ export * from "./ActionBundle.js";
2
+ export * from "./abis.js";
1
3
  export * from "./actions.js";
2
- export * from "./operations.js";
3
- export * from "./errors.js";
4
- export * from "./types/index.js";
5
4
  export * from "./BundlerAction.js";
6
5
  export * from "./bundle.js";
7
- export * from "./ActionBundle.js";
8
- export * from "./abis.js";
6
+ export * from "./errors.js";
7
+ export * from "./operations.js";
8
+ export * from "./types/index.js";
@@ -1,4 +1,4 @@
1
- import { DEFAULT_SLIPPAGE_TOLERANCE, Holding, MarketUtils, MathLib, NATIVE_ADDRESS, erc20WrapperTokens, getChainAddresses, getUnwrappedToken, permissionedBackedTokens, permissionedWrapperTokens, } from "@morpho-org/blue-sdk";
1
+ import { DEFAULT_SLIPPAGE_TOLERANCE, erc20WrapperTokens, getChainAddresses, getUnwrappedToken, Holding, MarketUtils, MathLib, NATIVE_ADDRESS, permissionedBackedTokens, permissionedWrapperTokens, } from "@morpho-org/blue-sdk";
2
2
  import { entries, getLast, getValue, keys } from "@morpho-org/morpho-ts";
3
3
  import { APPROVE_ONLY_ONCE_TOKENS, handleOperation, handleOperations, produceImmutable, simulateOperation, simulateOperations, } from "@morpho-org/simulation-sdk";
4
4
  import { isAddressEqual, maxUint256 } from "viem";
@@ -7,6 +7,7 @@ import { BundlerErrors } from "./errors.js";
7
7
  * The default target utilization above which the shared liquidity algorithm is triggered (scaled by WAD).
8
8
  */
9
9
  export const DEFAULT_SUPPLY_TARGET_UTILIZATION = 905000000000000000n;
10
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
10
11
  export const populateInputTransfer = ({ address, args: { amount, from } }, data, { hasSimplePermit = false } = {}) => {
11
12
  const { bundler3: { generalAdapter1 }, permit2, } = getChainAddresses(data.chainId);
12
13
  // If native token, it is expected to be sent along as call value.
@@ -154,6 +155,7 @@ export const populateInputTransfer = ({ address, args: { amount, from } }, data,
154
155
  * @param wrapSlippage The slippage simulated during wraps. Should never be 0.
155
156
  * @return The bundle of operations to optimize and skim before being encoded.
156
157
  */
158
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
157
159
  export const populateSubBundle = (inputOperation, data, options = {}) => {
158
160
  const { sender } = inputOperation;
159
161
  const { bundler3: { bundler3, generalAdapter1 }, } = getChainAddresses(data.chainId);
@@ -217,7 +219,7 @@ export const populateSubBundle = (inputOperation, data, options = {}) => {
217
219
  });
218
220
  }
219
221
  // Reallocate liquidity if necessary.
220
- if (!!publicAllocatorOptions?.enabled &&
222
+ if (publicAllocatorOptions?.enabled &&
221
223
  (mainOperation.type === "Blue_Borrow" ||
222
224
  mainOperation.type === "Blue_Withdraw")) {
223
225
  const market = data
@@ -311,7 +313,9 @@ export const populateSubBundle = (inputOperation, data, options = {}) => {
311
313
  args: {
312
314
  ...mainOperation.args,
313
315
  ...(callback && {
316
+ // biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
314
317
  callback: (data) => {
318
+ // biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
315
319
  const operations = callback.flatMap((inputOperation) => {
316
320
  const subBundleOperations = populateSubBundle({
317
321
  ...inputOperation,
@@ -379,6 +383,7 @@ export const populateSubBundle = (inputOperation, data, options = {}) => {
379
383
  * @param unwrapSlippage The slippage simulated during unwraps. Should never be 0.
380
384
  * @return The optimized bundle.
381
385
  */
386
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
382
387
  export const finalizeBundle = (operations, startData, receiver, unwrapTokens = new Set(), unwrapSlippage = DEFAULT_SLIPPAGE_TOLERANCE) => {
383
388
  const nbOperations = operations.length;
384
389
  if (nbOperations === 0)
@@ -476,6 +481,7 @@ export const finalizeBundle = (operations, startData, receiver, unwrapTokens = n
476
481
  others.push(operation);
477
482
  }
478
483
  });
484
+ // biome-ignore lint/style/noParameterAssign: TODO refactor to avoid mutating parameter
479
485
  operations = [
480
486
  approvals,
481
487
  permits,
@@ -564,6 +570,7 @@ export const finalizeBundle = (operations, startData, receiver, unwrapTokens = n
564
570
  operation.args.owner = inputTransfer.args.from;
565
571
  });
566
572
  // Filter out useless input transfers.
573
+ // biome-ignore lint/style/noParameterAssign: TODO refactor to avoid mutating parameter
567
574
  operations = operations.filter((operation, index) => {
568
575
  if (operation.type !== "Erc20_Transfer")
569
576
  return true;
@@ -679,7 +686,7 @@ export const finalizeBundle = (operations, startData, receiver, unwrapTokens = n
679
686
  uniqueSkimTokens.add(NATIVE_ADDRESS);
680
687
  break;
681
688
  default:
682
- //@ts-ignore This is dead code but acts as a guard in case a new operation is added
689
+ //@ts-expect-error This is dead code but acts as a guard in case a new operation is added
683
690
  throw new BundlerErrors.MissingSkimHandler(operation.type);
684
691
  }
685
692
  if ("callback" in operation.args)
@@ -713,6 +720,7 @@ export const finalizeBundle = (operations, startData, receiver, unwrapTokens = n
713
720
  }
714
721
  return finalizedOperations;
715
722
  };
723
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
716
724
  export const populateBundle = (inputOperations, data, options) => {
717
725
  const steps = [data];
718
726
  let end = data;
@@ -771,7 +779,9 @@ export const getSimulatedBundlerOperation = (operation, { slippage } = {}) => {
771
779
  args: {
772
780
  ...operation.args,
773
781
  ...(callback && {
774
- callback: () => callback.map((operation) => getSimulatedBundlerOperation(operation, { slippage })),
782
+ callback: () =>
783
+ // biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
784
+ callback.map((operation) => getSimulatedBundlerOperation(operation, { slippage })),
775
785
  }),
776
786
  },
777
787
  };
@@ -794,7 +804,13 @@ export const getSimulatedBundlerOperation = (operation, { slippage } = {}) => {
794
804
  }
795
805
  return simulatedOperation;
796
806
  };
797
- export const handleBundlerOperation = (options) => (operation, startData, index) => handleOperation(getSimulatedBundlerOperation(operation, options), startData, index);
807
+ export const handleBundlerOperation = (options) =>
808
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
809
+ (operation, startData, index) => handleOperation(getSimulatedBundlerOperation(operation, options), startData, index);
810
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
798
811
  export const handleBundlerOperations = (operations, startData, options) => handleOperations(operations, startData, handleBundlerOperation(options));
799
- export const simulateBundlerOperation = (options) => (operation, startData, index) => simulateOperation(getSimulatedBundlerOperation(operation, options), startData, index);
812
+ export const simulateBundlerOperation = (options) =>
813
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
814
+ (operation, startData, index) => simulateOperation(getSimulatedBundlerOperation(operation, options), startData, index);
815
+ // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
800
816
  export const simulateBundlerOperations = (operations, startData, options) => handleOperations(operations, startData, simulateBundlerOperation(options));
@@ -1,6 +1,6 @@
1
- import type { Account, Chain, Client, Hex, TransactionRequest, Transport } from "viem";
2
1
  import type { Address, InputMarketParams } from "@morpho-org/blue-sdk";
3
2
  import type { ParaswapOffsets } from "@morpho-org/simulation-sdk";
3
+ import type { Account, Chain, Client, Hex, TransactionRequest, Transport } from "viem";
4
4
  export interface Authorization {
5
5
  authorizer: Address;
6
6
  authorized: Address;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morpho-org/bundler-sdk-viem",
3
3
  "description": "Viem-based extension of `@morpho-org/simulation-sdk` that exports utilities to transform simple interactions on Morpho (such as `Blue_Borrow`) and Morpho Vaults (such as `MetaMorpho_Deposit`) into the required bundles (with ERC20 approvals, transfers, etc) to submit to the bundler onchain.",
4
- "version": "4.3.3",
4
+ "version": "5.0.0",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -20,29 +20,29 @@
20
20
  ],
21
21
  "peerDependencies": {
22
22
  "viem": "^2.0.0",
23
- "@morpho-org/blue-sdk": "^5.22.1",
24
- "@morpho-org/blue-sdk-viem": "^4.6.3",
23
+ "@morpho-org/blue-sdk": "^6.0.0",
24
+ "@morpho-org/blue-sdk-viem": "^5.0.0",
25
25
  "@morpho-org/morpho-ts": "^2.5.1",
26
- "@morpho-org/simulation-sdk": "^3.4.2"
26
+ "@morpho-org/simulation-sdk": "^4.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@tanstack/query-core": "^5.62.16",
30
- "@tanstack/react-query": "^5.62.11",
31
- "@testing-library/dom": "^10.4.0",
32
- "@testing-library/react": "^16.1.0",
33
- "@types/lodash": "^4.17.12",
29
+ "@tanstack/query-core": "^5.100.10",
30
+ "@tanstack/react-query": "^5.100.10",
31
+ "@testing-library/dom": "^10.4.1",
32
+ "@testing-library/react": "^16.3.2",
33
+ "@types/lodash": "^4.17.24",
34
34
  "lodash": "^4.18.1",
35
- "typescript": "^5.9.3",
36
- "viem": "^2.41.2",
37
- "vitest": "^4.1.4",
38
- "@morpho-org/blue-sdk": "^5.22.1",
39
- "@morpho-org/morpho-test": "^2.5.0",
35
+ "typescript": "^6.0.3",
36
+ "viem": "^2.49.3",
37
+ "vitest": "^4.1.6",
38
+ "@morpho-org/blue-sdk": "^6.0.0",
39
+ "@morpho-org/blue-sdk-viem": "^5.0.0",
40
+ "@morpho-org/morpho-test": "^4.0.0",
40
41
  "@morpho-org/morpho-ts": "^2.5.1",
41
- "@morpho-org/blue-sdk-viem": "^4.6.3",
42
- "@morpho-org/simulation-sdk": "^3.4.2",
43
- "@morpho-org/simulation-sdk-wagmi": "^4.0.1",
44
- "@morpho-org/test": "^2.7.1",
45
- "@morpho-org/test-wagmi": "^2.1.1"
42
+ "@morpho-org/simulation-sdk": "^4.0.0",
43
+ "@morpho-org/simulation-sdk-wagmi": "^5.0.0",
44
+ "@morpho-org/test": "^2.8.0",
45
+ "@morpho-org/test-wagmi": "^3.0.0"
46
46
  },
47
47
  "scripts": {
48
48
  "prepublish": "$npm_execpath build",
package/src/index.ts CHANGED
@@ -1,8 +1,8 @@
1
+ export * from "./ActionBundle.js";
2
+ export * from "./abis.js";
1
3
  export * from "./actions.js";
2
- export * from "./operations.js";
3
- export * from "./errors.js";
4
- export * from "./types/index.js";
5
4
  export * from "./BundlerAction.js";
6
5
  export * from "./bundle.js";
7
- export * from "./ActionBundle.js";
8
- export * from "./abis.js";
6
+ export * from "./errors.js";
7
+ export * from "./operations.js";
8
+ export * from "./types/index.js";