@morpho-org/bundler-sdk-viem 3.0.0-next.9 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,20 @@
1
- import { aaveV2MigrationAdapterAbi, aaveV3MigrationAdapterAbi, aaveV3OptimizerMigrationAdapterAbi, bundler3Abi, compoundV2MigrationAdapterAbi, compoundV3MigrationAdapterAbi, coreAdapterAbi, erc20WrapperAdapterAbi, ethereumGeneralAdapter1Abi, generalAdapter1Abi, universalRewardsDistributorAbi, } from "./abis.js";
2
- import { getChainAddresses, } from "@morpho-org/blue-sdk";
3
- import { blueAbi, erc2612Abi, permit2Abi, publicAllocatorAbi, } from "@morpho-org/blue-sdk-viem";
4
- import { encodeAbiParameters, encodeFunctionData, keccak256, maxUint256, parseSignature, zeroHash, } from "viem";
5
- import { BundlerErrors } from "./errors.js";
6
- const reenterAbiInputs = bundler3Abi.find((item) => item.name === "reenter").inputs;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BundlerAction = void 0;
4
+ const abis_js_1 = require("./abis.js");
5
+ const blue_sdk_1 = require("@morpho-org/blue-sdk");
6
+ const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
7
+ const viem_1 = require("viem");
8
+ const errors_js_1 = require("./errors.js");
9
+ const reenterAbiInputs = abis_js_1.bundler3Abi.find((item) => item.name === "reenter").inputs;
7
10
  /**
8
11
  * Namespace to easily encode calls to the Bundler contract, using viem.
9
12
  */
10
- export var BundlerAction;
13
+ var BundlerAction;
11
14
  (function (BundlerAction) {
12
15
  function encodeBundle(chainId, actions) {
13
- const { bundler3: { bundler3, generalAdapter1 }, } = getChainAddresses(chainId);
16
+ const { bundler3: { bundler3, generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
14
17
  let value = 0n;
15
- let generalAdapter1Value = 0n;
16
18
  for (const { type, args } of actions) {
17
19
  if (type !== "nativeTransfer")
18
20
  continue;
@@ -21,23 +23,13 @@ export var BundlerAction;
21
23
  owner !== generalAdapter1 &&
22
24
  (recipient === bundler3 || recipient === generalAdapter1))
23
25
  value += amount;
24
- if (owner !== generalAdapter1 && recipient === generalAdapter1)
25
- generalAdapter1Value += amount;
26
26
  }
27
27
  const encodedActions = actions.flatMap(BundlerAction.encode.bind(null, chainId));
28
- if (generalAdapter1Value > 0n)
29
- encodedActions.unshift({
30
- to: generalAdapter1,
31
- value: generalAdapter1Value,
32
- data: "0x",
33
- skipRevert: false,
34
- callbackHash: zeroHash,
35
- });
36
28
  return {
37
29
  to: bundler3,
38
30
  value,
39
- data: encodeFunctionData({
40
- abi: bundler3Abi,
31
+ data: (0, viem_1.encodeFunctionData)({
32
+ abi: abis_js_1.bundler3Abi,
41
33
  functionName: "multicall",
42
34
  args: [encodedActions],
43
35
  }),
@@ -51,7 +43,7 @@ export var BundlerAction;
51
43
  return BundlerAction.nativeTransfer(chainId, ...args);
52
44
  }
53
45
  case "erc20Transfer": {
54
- return BundlerAction.erc20Transfer(chainId, ...args);
46
+ return BundlerAction.erc20Transfer(...args);
55
47
  }
56
48
  case "erc20TransferFrom": {
57
49
  return BundlerAction.erc20TransferFrom(chainId, ...args);
@@ -65,22 +57,22 @@ export var BundlerAction;
65
57
  }
66
58
  /* Permit */
67
59
  case "permit": {
68
- const [sender, asset, amount, deadline, signature, spender, skipRevert,] = args;
60
+ const [sender, asset, amount, deadline, signature, skipRevert] = args;
69
61
  if (signature == null)
70
- throw new BundlerErrors.MissingSignature();
71
- return BundlerAction.permit(chainId, sender, asset, amount, deadline, signature, spender, skipRevert);
62
+ throw new errors_js_1.BundlerErrors.MissingSignature();
63
+ return BundlerAction.permit(chainId, sender, asset, amount, deadline, signature, skipRevert);
72
64
  }
73
65
  case "permitDai": {
74
- const [sender, nonce, expiry, allowed, signature, spender, skipRevert] = args;
66
+ const [sender, nonce, expiry, allowed, signature, skipRevert] = args;
75
67
  if (signature == null)
76
- throw new BundlerErrors.MissingSignature();
77
- return BundlerAction.permitDai(chainId, sender, nonce, expiry, allowed, signature, spender, skipRevert);
68
+ throw new errors_js_1.BundlerErrors.MissingSignature();
69
+ return BundlerAction.permitDai(chainId, sender, nonce, expiry, allowed, signature, skipRevert);
78
70
  }
79
71
  /* Permit2 */
80
72
  case "approve2": {
81
73
  const [sender, permitSingle, signature, skipRevert] = args;
82
74
  if (signature == null)
83
- throw new BundlerErrors.MissingSignature();
75
+ throw new errors_js_1.BundlerErrors.MissingSignature();
84
76
  return BundlerAction.approve2(chainId, sender, permitSingle, signature, skipRevert);
85
77
  }
86
78
  case "transferFrom2": {
@@ -103,23 +95,23 @@ export var BundlerAction;
103
95
  case "morphoSetAuthorizationWithSig": {
104
96
  const [authorization, signature, skipRevert] = args;
105
97
  if (signature == null)
106
- throw new BundlerErrors.MissingSignature();
98
+ throw new errors_js_1.BundlerErrors.MissingSignature();
107
99
  return BundlerAction.morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert);
108
100
  }
109
101
  case "morphoSupply": {
110
- const [market, assets, shares, slippageAmount, onBehalf, onMorphoSupply,] = args;
111
- return BundlerAction.morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, onMorphoSupply.flatMap(BundlerAction.encode.bind(null, chainId)));
102
+ const [market, assets, shares, slippageAmount, onBehalf, onMorphoSupply, skipRevert,] = args;
103
+ return BundlerAction.morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, onMorphoSupply.flatMap(BundlerAction.encode.bind(null, chainId)), skipRevert);
112
104
  }
113
105
  case "morphoSupplyCollateral": {
114
- const [market, amount, onBehalf, onMorphoSupplyCollateral] = args;
115
- return BundlerAction.morphoSupplyCollateral(chainId, market, amount, onBehalf, onMorphoSupplyCollateral.flatMap(BundlerAction.encode.bind(null, chainId)));
106
+ const [market, amount, onBehalf, onMorphoSupplyCollateral, skipRevert] = args;
107
+ return BundlerAction.morphoSupplyCollateral(chainId, market, amount, onBehalf, onMorphoSupplyCollateral.flatMap(BundlerAction.encode.bind(null, chainId)), skipRevert);
116
108
  }
117
109
  case "morphoBorrow": {
118
110
  return BundlerAction.morphoBorrow(chainId, ...args);
119
111
  }
120
112
  case "morphoRepay": {
121
- const [market, assets, shares, slippageAmount, onBehalf, onMorphoRepay,] = args;
122
- return BundlerAction.morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, onMorphoRepay.flatMap(BundlerAction.encode.bind(null, chainId)));
113
+ const [market, assets, shares, slippageAmount, onBehalf, onMorphoRepay, skipRevert,] = args;
114
+ return BundlerAction.morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, onMorphoRepay.flatMap(BundlerAction.encode.bind(null, chainId)), skipRevert);
123
115
  }
124
116
  case "morphoWithdraw": {
125
117
  return BundlerAction.morphoWithdraw(chainId, ...args);
@@ -178,10 +170,10 @@ export var BundlerAction;
178
170
  return BundlerAction.aaveV3OptimizerWithdrawCollateral(chainId, ...args);
179
171
  }
180
172
  case "aaveV3OptimizerApproveManagerWithSig": {
181
- const [aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, manager, skipRevert,] = args;
173
+ const [aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, skipRevert,] = args;
182
174
  if (signature == null)
183
- throw new BundlerErrors.MissingSignature();
184
- return BundlerAction.aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, manager, skipRevert);
175
+ throw new errors_js_1.BundlerErrors.MissingSignature();
176
+ return BundlerAction.aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, skipRevert);
185
177
  }
186
178
  /* CompoundV2 */
187
179
  case "compoundV2Repay": {
@@ -198,10 +190,10 @@ export var BundlerAction;
198
190
  return BundlerAction.compoundV3WithdrawFrom(chainId, ...args);
199
191
  }
200
192
  case "compoundV3AllowBySig": {
201
- const [instance, owner, isAllowed, nonce, expiry, signature, manager, skipRevert,] = args;
193
+ const [instance, owner, isAllowed, nonce, expiry, signature, skipRevert,] = args;
202
194
  if (signature == null)
203
- throw new BundlerErrors.MissingSignature();
204
- return BundlerAction.compoundV3AllowBySig(chainId, instance, owner, isAllowed, nonce, expiry, signature, manager, skipRevert);
195
+ throw new errors_js_1.BundlerErrors.MissingSignature();
196
+ return BundlerAction.compoundV3AllowBySig(chainId, instance, owner, isAllowed, nonce, expiry, signature, skipRevert);
205
197
  }
206
198
  }
207
199
  throw Error(`unhandled action encoding: ${type}`);
@@ -209,28 +201,29 @@ export var BundlerAction;
209
201
  BundlerAction.encode = encode;
210
202
  /* ERC20 */
211
203
  /**
212
- * Encodes a call to the Adapter to transfer native tokens (ETH on ethereum, MATIC on polygon, etc).
204
+ * Encodes a call to the GeneralAdapter1 to transfer native tokens (ETH on ethereum, MATIC on polygon, etc).
213
205
  * @param chainId The chain id for which to encode the call.
214
206
  * @param owner The owner of native tokens.
215
207
  * @param recipient The address to send native tokens to.
216
208
  * @param amount The amount of native tokens to send (in wei).
209
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
217
210
  */
218
- function nativeTransfer(chainId, owner, recipient, amount) {
219
- const { bundler3: { bundler3, generalAdapter1 }, } = getChainAddresses(chainId);
211
+ function nativeTransfer(chainId, owner, recipient, amount, skipRevert = false) {
212
+ const { bundler3: { bundler3, generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
220
213
  if (recipient === bundler3)
221
214
  return [];
222
215
  if (owner === generalAdapter1)
223
216
  return [
224
217
  {
225
218
  to: generalAdapter1,
226
- data: encodeFunctionData({
227
- abi: coreAdapterAbi,
219
+ data: (0, viem_1.encodeFunctionData)({
220
+ abi: abis_js_1.coreAdapterAbi,
228
221
  functionName: "nativeTransfer",
229
222
  args: [recipient, amount],
230
223
  }),
231
224
  value: 0n,
232
225
  skipRevert: false,
233
- callbackHash: zeroHash,
226
+ callbackHash: viem_1.zeroHash,
234
227
  },
235
228
  ];
236
229
  return [
@@ -238,114 +231,120 @@ export var BundlerAction;
238
231
  to: recipient,
239
232
  data: "0x",
240
233
  value: amount,
241
- skipRevert: false,
242
- callbackHash: zeroHash,
234
+ skipRevert,
235
+ callbackHash: viem_1.zeroHash,
243
236
  },
244
237
  ];
245
238
  }
246
239
  BundlerAction.nativeTransfer = nativeTransfer;
247
240
  /**
248
- * Encodes a call to the Adapter to transfer ERC20 tokens.
241
+ * Encodes a call to the requested adapter to transfer ERC20 tokens.
249
242
  * @param chainId The chain id for which to encode the call.
250
243
  * @param asset The address of the ERC20 token to transfer.
251
244
  * @param recipient The address to send tokens to.
252
245
  * @param amount The amount of tokens to send.
246
+ * @param adapter The address of the adapter to use.
247
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
253
248
  */
254
- function erc20Transfer(chainId, asset, recipient, amount, adapter) {
255
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
256
- adapter ??= generalAdapter1;
249
+ function erc20Transfer(asset, recipient, amount, adapter, skipRevert = false) {
257
250
  return [
258
251
  {
259
252
  to: adapter,
260
- data: encodeFunctionData({
261
- abi: coreAdapterAbi,
253
+ data: (0, viem_1.encodeFunctionData)({
254
+ abi: abis_js_1.coreAdapterAbi,
262
255
  functionName: "erc20Transfer",
263
256
  args: [asset, recipient, amount],
264
257
  }),
265
258
  value: 0n,
266
- skipRevert: false,
267
- callbackHash: zeroHash,
259
+ skipRevert,
260
+ callbackHash: viem_1.zeroHash,
268
261
  },
269
262
  ];
270
263
  }
271
264
  BundlerAction.erc20Transfer = erc20Transfer;
272
265
  /**
273
- * Encodes a call to the Adapter to transfer ERC20 tokens from the sender to the Bundler.
266
+ * Encodes a call to the GeneralAdapter1 to transfer ERC20 tokens with `transferFrom`.
274
267
  * @param chainId The chain id for which to encode the call.
275
268
  * @param asset The address of the ERC20 token to transfer.
276
269
  * @param amount The amount of tokens to send.
277
- * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
270
+ * @param recipient The recipient of ERC20 tokens.
271
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
278
272
  */
279
- function erc20TransferFrom(chainId, asset, amount, recipient) {
280
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
281
- recipient ??= generalAdapter1;
273
+ function erc20TransferFrom(chainId, asset, amount, recipient, skipRevert = false) {
274
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
282
275
  return [
283
276
  {
284
277
  to: generalAdapter1,
285
- data: encodeFunctionData({
286
- abi: generalAdapter1Abi,
278
+ data: (0, viem_1.encodeFunctionData)({
279
+ abi: abis_js_1.generalAdapter1Abi,
287
280
  functionName: "erc20TransferFrom",
288
281
  args: [asset, recipient, amount],
289
282
  }),
290
283
  value: 0n,
291
- skipRevert: false,
292
- callbackHash: zeroHash,
284
+ skipRevert,
285
+ callbackHash: viem_1.zeroHash,
293
286
  },
294
287
  ];
295
288
  }
296
289
  BundlerAction.erc20TransferFrom = erc20TransferFrom;
297
290
  /* Permit */
298
291
  /**
299
- * Encodes a call to the Adapter to permit an ERC20 token.
292
+ * Encodes a call to the GeneralAdapter1 to permit an ERC20 token.
300
293
  * @param chainId The chain id for which to encode the call.
301
294
  * @param owner The address which owns the tokens.
302
295
  * @param asset The address of the ERC20 token to permit.
303
296
  * @param amount The amount of tokens to permit.
304
297
  * @param deadline The timestamp until which the signature is valid.
305
298
  * @param signature The Ethers signature to permit the tokens.
306
- * @param spender The address allowed to spend the tokens.
307
- * @param skipRevert Whether to allow the permit to revert without making the whole multicall revert.
299
+ * @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
308
300
  */
309
- function permit(chainId, owner, asset, amount, deadline, signature, spender, skipRevert = true) {
310
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
311
- const { r, s, yParity } = parseSignature(signature);
312
- spender ??= generalAdapter1;
301
+ function permit(chainId, owner, asset, amount, deadline, signature, skipRevert = true) {
302
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
303
+ const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
313
304
  return [
314
305
  {
315
306
  to: asset,
316
- data: encodeFunctionData({
317
- abi: erc2612Abi,
307
+ data: (0, viem_1.encodeFunctionData)({
308
+ abi: blue_sdk_viem_1.erc2612Abi,
318
309
  functionName: "permit",
319
- args: [owner, spender, amount, deadline, yParity + 27, r, s],
310
+ args: [
311
+ owner,
312
+ // Never permit any other address than the GeneralAdapter1 otherwise
313
+ // there are no guarantees that the signature can't be used independently.
314
+ generalAdapter1,
315
+ amount,
316
+ deadline,
317
+ yParity + 27,
318
+ r,
319
+ s,
320
+ ],
320
321
  }),
321
322
  value: 0n,
322
323
  skipRevert,
323
- callbackHash: zeroHash,
324
+ callbackHash: viem_1.zeroHash,
324
325
  },
325
326
  ];
326
327
  }
327
328
  BundlerAction.permit = permit;
328
329
  /**
329
- * Encodes a call to the Adapter to permit DAI.
330
+ * Encodes a call to the GeneralAdapter1 to permit DAI.
330
331
  * @param chainId The chain id for which to encode the call.
331
332
  * @param owner The address which owns the tokens.
332
333
  * @param nonce The permit nonce used.
333
334
  * @param expiry The timestamp until which the signature is valid.
334
335
  * @param allowed The amount of DAI to permit.
335
336
  * @param signature The Ethers signature to permit the tokens.
336
- * @param spender The address allowed to spend the tokens.
337
- * @param skipRevert Whether to allow the permit to revert without making the whole multicall revert.
337
+ * @param skipRevert Whether to allow the permit to revert without making the whole bundle revert.
338
338
  */
339
- function permitDai(chainId, owner, nonce, expiry, allowed, signature, spender, skipRevert = true) {
340
- const { dai, bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
339
+ function permitDai(chainId, owner, nonce, expiry, allowed, signature, skipRevert = true) {
340
+ const { dai, bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
341
341
  if (dai == null)
342
- throw new BundlerErrors.UnexpectedAction("permitDai", chainId);
343
- spender ??= generalAdapter1;
344
- const { r, s, yParity } = parseSignature(signature);
342
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("permitDai", chainId);
343
+ const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
345
344
  return [
346
345
  {
347
346
  to: dai,
348
- data: encodeFunctionData({
347
+ data: (0, viem_1.encodeFunctionData)({
349
348
  abi: [
350
349
  {
351
350
  constant: false,
@@ -367,300 +366,325 @@ export var BundlerAction;
367
366
  },
368
367
  ],
369
368
  functionName: "permit",
370
- args: [owner, spender, nonce, expiry, allowed, yParity + 27, r, s],
369
+ args: [
370
+ owner,
371
+ // Never permit any other address than the GeneralAdapter1 otherwise
372
+ // there are no guarantees that the signature can't be used independently.
373
+ generalAdapter1,
374
+ nonce,
375
+ expiry,
376
+ allowed,
377
+ yParity + 27,
378
+ r,
379
+ s,
380
+ ],
371
381
  }),
372
382
  value: 0n,
373
383
  skipRevert,
374
- callbackHash: zeroHash,
384
+ callbackHash: viem_1.zeroHash,
375
385
  },
376
386
  ];
377
387
  }
378
388
  BundlerAction.permitDai = permitDai;
379
389
  /* Permit2 */
380
390
  /**
381
- * Encodes a call to the Adapter to permit ERC20 tokens via Permit2.
391
+ * Encodes a call to permit the chain's GeneralAdapter1 ERC20 tokens via Permit2.
382
392
  * @param chainId The chain id for which to encode the call.
383
393
  * @param owner The owner of ERC20 tokens.
384
394
  * @param permitSingle The permit details to submit to Permit2.
385
395
  * @param signature The Ethers signature to permit the tokens.
386
- * @param skipRevert Whether to allow the permit to revert without making the whole multicall revert.
396
+ * @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
387
397
  */
388
398
  function approve2(chainId, owner, permitSingle, signature, skipRevert = true) {
389
- const { permit2 } = getChainAddresses(chainId);
399
+ const { permit2, bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
390
400
  if (permit2 == null)
391
- throw new BundlerErrors.UnexpectedAction("approve2", chainId);
401
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("approve2", chainId);
392
402
  return [
393
403
  {
394
404
  to: permit2,
395
- data: encodeFunctionData({
396
- abi: permit2Abi,
405
+ data: (0, viem_1.encodeFunctionData)({
406
+ abi: blue_sdk_viem_1.permit2Abi,
397
407
  functionName: "permit",
398
- args: [owner, permitSingle, signature],
408
+ args: [
409
+ owner,
410
+ {
411
+ ...permitSingle,
412
+ // Never permit any other address than the GeneralAdapter1 otherwise
413
+ // there are no guarantees that the signature can't be used independently.
414
+ spender: generalAdapter1,
415
+ },
416
+ signature,
417
+ ],
399
418
  }),
400
419
  value: 0n,
401
420
  skipRevert,
402
- callbackHash: zeroHash,
421
+ callbackHash: viem_1.zeroHash,
403
422
  },
404
423
  ];
405
424
  }
406
425
  BundlerAction.approve2 = approve2;
407
426
  /**
408
- * Encodes a call to the Adapter to transfer ERC20 tokens via Permit2 from the sender to the Bundler.
427
+ * Encodes a call to the GeneralAdapter1 to transfer ERC20 tokens via Permit2.
409
428
  * @param chainId The chain id for which to encode the call.
410
429
  * @param asset The address of the ERC20 token to transfer.
411
430
  * @param owner The owner of ERC20 tokens.
412
431
  * @param amount The amount of tokens to send.
413
- * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
432
+ * @param recipient The recipient of ERC20 tokens.
433
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
414
434
  */
415
- function transferFrom2(chainId, asset, owner, amount, recipient) {
416
- const { permit2, bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
417
- if (permit2 == null)
418
- throw new BundlerErrors.UnexpectedAction("transferFrom2", chainId);
419
- recipient ??= generalAdapter1;
435
+ function transferFrom2(chainId, asset, amount, recipient, skipRevert = false) {
436
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
420
437
  return [
421
438
  {
422
- to: permit2,
423
- data: encodeFunctionData({
424
- abi: permit2Abi,
425
- functionName: "transferFrom",
426
- // TODO: batch all permit2 transfers via transferFrom(AllowanceTransferDetails[] calldata)
427
- args: [owner, recipient, amount, asset],
439
+ to: generalAdapter1,
440
+ data: (0, viem_1.encodeFunctionData)({
441
+ abi: abis_js_1.generalAdapter1Abi,
442
+ functionName: "permit2TransferFrom",
443
+ args: [asset, recipient, amount],
428
444
  }),
429
445
  value: 0n,
430
- skipRevert: false,
431
- callbackHash: zeroHash,
446
+ skipRevert,
447
+ callbackHash: viem_1.zeroHash,
432
448
  },
433
449
  ];
434
450
  }
435
451
  BundlerAction.transferFrom2 = transferFrom2;
436
452
  /* ERC20 Wrapper */
437
453
  /**
438
- * Encodes a call to the Adapter to wrap ERC20 tokens via the provided ERC20Wrapper.
454
+ * Encodes a call to the GeneralAdapter1 to wrap ERC20 tokens via the provided ERC20Wrapper.
439
455
  * @param chainId The chain id for which to encode the call.
440
456
  * @param wrapper The address of the ERC20 wrapper token.
441
457
  * @param underlying The address of the underlying ERC20 token.
442
458
  * @param amount The amount of tokens to send.
459
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
443
460
  */
444
- function erc20WrapperDepositFor(chainId, wrapper, underlying, amount) {
445
- const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = getChainAddresses(chainId);
461
+ function erc20WrapperDepositFor(chainId, wrapper, underlying, amount, skipRevert = false) {
462
+ const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
446
463
  if (erc20WrapperAdapter == null)
447
- throw new BundlerErrors.UnexpectedAction("erc20WrapperDepositFor", chainId);
464
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("erc20WrapperDepositFor", chainId);
448
465
  return [
449
466
  {
450
467
  to: generalAdapter1,
451
- data: encodeFunctionData({
452
- abi: generalAdapter1Abi,
468
+ data: (0, viem_1.encodeFunctionData)({
469
+ abi: abis_js_1.generalAdapter1Abi,
453
470
  functionName: "erc20Transfer",
454
- args: [underlying, erc20WrapperAdapter, maxUint256],
471
+ args: [underlying, erc20WrapperAdapter, viem_1.maxUint256],
455
472
  }),
456
473
  value: 0n,
457
- skipRevert: false,
458
- callbackHash: zeroHash,
474
+ skipRevert,
475
+ callbackHash: viem_1.zeroHash,
459
476
  },
460
477
  {
461
478
  to: erc20WrapperAdapter,
462
- data: encodeFunctionData({
463
- abi: erc20WrapperAdapterAbi,
479
+ data: (0, viem_1.encodeFunctionData)({
480
+ abi: abis_js_1.erc20WrapperAdapterAbi,
464
481
  functionName: "erc20WrapperDepositFor",
465
482
  args: [wrapper, amount],
466
483
  }),
467
484
  value: 0n,
468
- skipRevert: false,
469
- callbackHash: zeroHash,
485
+ skipRevert,
486
+ callbackHash: viem_1.zeroHash,
470
487
  },
471
488
  {
472
489
  to: erc20WrapperAdapter,
473
- data: encodeFunctionData({
474
- abi: erc20WrapperAdapterAbi,
490
+ data: (0, viem_1.encodeFunctionData)({
491
+ abi: abis_js_1.erc20WrapperAdapterAbi,
475
492
  functionName: "erc20Transfer",
476
- args: [underlying, generalAdapter1, maxUint256],
493
+ args: [underlying, generalAdapter1, viem_1.maxUint256],
477
494
  }),
478
495
  value: 0n,
479
- skipRevert: false,
480
- callbackHash: zeroHash,
496
+ skipRevert,
497
+ callbackHash: viem_1.zeroHash,
481
498
  },
482
499
  ];
483
500
  }
484
501
  BundlerAction.erc20WrapperDepositFor = erc20WrapperDepositFor;
485
502
  /**
486
- * Encodes a call to the Adapter to unwrap ERC20 tokens from the provided ERC20Wrapper.
503
+ * Encodes a call to the GeneralAdapter1 to unwrap ERC20 tokens from the provided ERC20Wrapper.
487
504
  * @param chainId The chain id for which to encode the call.
488
505
  * @param wrapper The address of the ERC20 wrapper token.
489
506
  * @param account The address to send the underlying ERC20 tokens.
490
507
  * @param amount The amount of tokens to send.
508
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
491
509
  */
492
- function erc20WrapperWithdrawTo(chainId, wrapper, receiver, amount) {
493
- const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = getChainAddresses(chainId);
510
+ function erc20WrapperWithdrawTo(chainId, wrapper, receiver, amount, skipRevert = false) {
511
+ const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
494
512
  if (erc20WrapperAdapter == null)
495
- throw new BundlerErrors.UnexpectedAction("erc20WrapperWithdrawTo", chainId);
513
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("erc20WrapperWithdrawTo", chainId);
496
514
  return [
497
515
  {
498
516
  to: generalAdapter1,
499
- data: encodeFunctionData({
500
- abi: generalAdapter1Abi,
517
+ data: (0, viem_1.encodeFunctionData)({
518
+ abi: abis_js_1.generalAdapter1Abi,
501
519
  functionName: "erc20Transfer",
502
- args: [wrapper, erc20WrapperAdapter, maxUint256],
520
+ args: [wrapper, erc20WrapperAdapter, viem_1.maxUint256],
503
521
  }),
504
522
  value: 0n,
505
- skipRevert: false,
506
- callbackHash: zeroHash,
523
+ skipRevert,
524
+ callbackHash: viem_1.zeroHash,
507
525
  },
508
526
  {
509
527
  to: erc20WrapperAdapter,
510
- data: encodeFunctionData({
511
- abi: erc20WrapperAdapterAbi,
528
+ data: (0, viem_1.encodeFunctionData)({
529
+ abi: abis_js_1.erc20WrapperAdapterAbi,
512
530
  functionName: "erc20WrapperWithdrawTo",
513
531
  args: [wrapper, receiver, amount],
514
532
  }),
515
533
  value: 0n,
516
- skipRevert: false,
517
- callbackHash: zeroHash,
534
+ skipRevert,
535
+ callbackHash: viem_1.zeroHash,
518
536
  },
519
537
  {
520
538
  to: erc20WrapperAdapter,
521
- data: encodeFunctionData({
522
- abi: erc20WrapperAdapterAbi,
539
+ data: (0, viem_1.encodeFunctionData)({
540
+ abi: abis_js_1.erc20WrapperAdapterAbi,
523
541
  functionName: "erc20Transfer",
524
- args: [wrapper, generalAdapter1, maxUint256],
542
+ args: [wrapper, generalAdapter1, viem_1.maxUint256],
525
543
  }),
526
544
  value: 0n,
527
- skipRevert: false,
528
- callbackHash: zeroHash,
545
+ skipRevert,
546
+ callbackHash: viem_1.zeroHash,
529
547
  },
530
548
  ];
531
549
  }
532
550
  BundlerAction.erc20WrapperWithdrawTo = erc20WrapperWithdrawTo;
533
551
  /* ERC4626 */
534
552
  /**
535
- * Encodes a call to the Adapter to mint shares of the provided ERC4626 vault.
553
+ * Encodes a call to the GeneralAdapter1 to mint shares of the provided ERC4626 vault.
536
554
  * @param chainId The chain id for which to encode the call.
537
555
  * @param erc4626 The address of the ERC4626 vault.
538
556
  * @param shares The amount of shares to mint.
539
557
  * @param maxSharePrice The maximum amount of assets to pay to get 1 share (scaled by RAY).
540
558
  * @param receiver The address to send the shares to.
559
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
541
560
  */
542
- function erc4626Mint(chainId, erc4626, shares, maxSharePrice, receiver) {
543
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
561
+ function erc4626Mint(chainId, erc4626, shares, maxSharePrice, receiver, skipRevert = false) {
562
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
544
563
  return [
545
564
  {
546
565
  to: generalAdapter1,
547
- data: encodeFunctionData({
548
- abi: generalAdapter1Abi,
566
+ data: (0, viem_1.encodeFunctionData)({
567
+ abi: abis_js_1.generalAdapter1Abi,
549
568
  functionName: "erc4626Mint",
550
569
  args: [erc4626, shares, maxSharePrice, receiver],
551
570
  }),
552
571
  value: 0n,
553
- skipRevert: false,
554
- callbackHash: zeroHash,
572
+ skipRevert,
573
+ callbackHash: viem_1.zeroHash,
555
574
  },
556
575
  ];
557
576
  }
558
577
  BundlerAction.erc4626Mint = erc4626Mint;
559
578
  /**
560
- * Encodes a call to the Adapter to deposit assets into the provided ERC4626 vault.
579
+ * Encodes a call to the GeneralAdapter1 to deposit assets into the provided ERC4626 vault.
561
580
  * @param chainId The chain id for which to encode the call.
562
581
  * @param erc4626 The address of the ERC4626 vault.
563
582
  * @param assets The amount of assets to deposit.
564
583
  * @param maxSharePrice The maximum amount of assets to pay to get 1 share (scaled by RAY).
565
584
  * @param receiver The address to send the shares to.
585
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
566
586
  */
567
- function erc4626Deposit(chainId, erc4626, assets, maxSharePrice, receiver) {
568
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
587
+ function erc4626Deposit(chainId, erc4626, assets, maxSharePrice, receiver, skipRevert = false) {
588
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
569
589
  return [
570
590
  {
571
591
  to: generalAdapter1,
572
- data: encodeFunctionData({
573
- abi: generalAdapter1Abi,
592
+ data: (0, viem_1.encodeFunctionData)({
593
+ abi: abis_js_1.generalAdapter1Abi,
574
594
  functionName: "erc4626Deposit",
575
595
  args: [erc4626, assets, maxSharePrice, receiver],
576
596
  }),
577
597
  value: 0n,
578
- skipRevert: false,
579
- callbackHash: zeroHash,
598
+ skipRevert,
599
+ callbackHash: viem_1.zeroHash,
580
600
  },
581
601
  ];
582
602
  }
583
603
  BundlerAction.erc4626Deposit = erc4626Deposit;
584
604
  /**
585
- * Encodes a call to the Adapter to withdraw assets from the provided ERC4626 vault.
605
+ * Encodes a call to the GeneralAdapter1 to withdraw assets from the provided ERC4626 vault.
586
606
  * @param chainId The chain id for which to encode the call.
587
607
  * @param erc4626 The address of the ERC4626 vault.
588
608
  * @param assets The amount of assets to withdraw.
589
609
  * @param minSharePrice The minimum number of assets to receive per share (scaled by RAY).
590
610
  * @param receiver The address to send the assets to.
591
611
  * @param owner The address on behalf of which the assets are withdrawn.
612
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
592
613
  */
593
- function erc4626Withdraw(chainId, erc4626, assets, minSharePrice, receiver, owner) {
594
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
614
+ function erc4626Withdraw(chainId, erc4626, assets, minSharePrice, receiver, owner, skipRevert = false) {
615
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
595
616
  return [
596
617
  {
597
618
  to: generalAdapter1,
598
- data: encodeFunctionData({
599
- abi: generalAdapter1Abi,
619
+ data: (0, viem_1.encodeFunctionData)({
620
+ abi: abis_js_1.generalAdapter1Abi,
600
621
  functionName: "erc4626Withdraw",
601
622
  args: [erc4626, assets, minSharePrice, receiver, owner],
602
623
  }),
603
624
  value: 0n,
604
- skipRevert: false,
605
- callbackHash: zeroHash,
625
+ skipRevert,
626
+ callbackHash: viem_1.zeroHash,
606
627
  },
607
628
  ];
608
629
  }
609
630
  BundlerAction.erc4626Withdraw = erc4626Withdraw;
610
631
  /**
611
- * Encodes a call to the Adapter to redeem shares from the provided ERC4626 vault.
632
+ * Encodes a call to the GeneralAdapter1 to redeem shares from the provided ERC4626 vault.
612
633
  * @param chainId The chain id for which to encode the call.
613
634
  * @param erc4626 The address of the ERC4626 vault.
614
635
  * @param shares The amount of shares to redeem.
615
636
  * @param minSharePrice The minimum number of assets to receive per share (scaled by RAY).
616
637
  * @param receiver The address to send the assets to.
617
638
  * @param owner The address on behalf of which the assets are withdrawn.
639
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
618
640
  */
619
- function erc4626Redeem(chainId, erc4626, shares, minSharePrice, receiver, owner) {
620
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
641
+ function erc4626Redeem(chainId, erc4626, shares, minSharePrice, receiver, owner, skipRevert = false) {
642
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
621
643
  return [
622
644
  {
623
645
  to: generalAdapter1,
624
- data: encodeFunctionData({
625
- abi: generalAdapter1Abi,
646
+ data: (0, viem_1.encodeFunctionData)({
647
+ abi: abis_js_1.generalAdapter1Abi,
626
648
  functionName: "erc4626Redeem",
627
649
  args: [erc4626, shares, minSharePrice, receiver, owner],
628
650
  }),
629
651
  value: 0n,
630
- skipRevert: false,
631
- callbackHash: zeroHash,
652
+ skipRevert,
653
+ callbackHash: viem_1.zeroHash,
632
654
  },
633
655
  ];
634
656
  }
635
657
  BundlerAction.erc4626Redeem = erc4626Redeem;
636
658
  /* Morpho */
637
659
  /**
638
- * Encodes a call to the Adapter to authorize an account on Morpho Blue.
660
+ * Encodes a call to authorize an account on Morpho Blue.
639
661
  * @param chainId The chain id for which to encode the call.
640
662
  * @param authorization The authorization details to submit to Morpho Blue.
641
663
  * @param signature The Ethers signature to authorize the account.
642
- * @param skipRevert Whether to allow the authorization call to revert without making the whole multicall revert.
664
+ * @param skipRevert Whether to allow the authorization call to revert without making the whole bundle revert. Defaults to true.
643
665
  */
644
666
  function morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert = true) {
645
- const { morpho } = getChainAddresses(chainId);
646
- const { r, s, yParity } = parseSignature(signature);
667
+ const { morpho, bundler3: { bundler3 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
668
+ const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
669
+ if (authorization.authorized === bundler3)
670
+ throw new errors_js_1.BundlerErrors.UnexpectedSignature(authorization.authorized);
647
671
  return [
648
672
  {
649
673
  to: morpho,
650
- data: encodeFunctionData({
651
- abi: blueAbi,
674
+ data: (0, viem_1.encodeFunctionData)({
675
+ abi: blue_sdk_viem_1.blueAbi,
652
676
  functionName: "setAuthorizationWithSig",
653
677
  args: [authorization, { v: yParity + 27, r, s }],
654
678
  }),
655
679
  value: 0n,
656
680
  skipRevert,
657
- callbackHash: zeroHash,
681
+ callbackHash: viem_1.zeroHash,
658
682
  },
659
683
  ];
660
684
  }
661
685
  BundlerAction.morphoSetAuthorizationWithSig = morphoSetAuthorizationWithSig;
662
686
  /**
663
- * Encodes a call to the Adapter to supply to a Morpho Blue market.
687
+ * Encodes a call to the GeneralAdapter1 to supply to a Morpho Blue market.
664
688
  * @param chainId The chain id for which to encode the call.
665
689
  * @param market The market params to supply to.
666
690
  * @param assets The amount of assets to supply.
@@ -668,85 +692,88 @@ export var BundlerAction;
668
692
  * @param slippageAmount The maximum (resp. minimum) amount of assets (resp. supply shares) to supply (resp. mint) (protects the sender from unexpected slippage).
669
693
  * @param onBehalf The address to supply on behalf of.
670
694
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupply` callback.
695
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
671
696
  */
672
- function morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls) {
673
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
697
+ function morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
698
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
674
699
  const reenter = callbackCalls.length > 0;
675
700
  const reenterData = reenter
676
- ? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
701
+ ? (0, viem_1.encodeAbiParameters)(reenterAbiInputs, [callbackCalls])
677
702
  : "0x";
678
703
  return [
679
704
  {
680
705
  to: generalAdapter1,
681
- data: encodeFunctionData({
682
- abi: generalAdapter1Abi,
706
+ data: (0, viem_1.encodeFunctionData)({
707
+ abi: abis_js_1.generalAdapter1Abi,
683
708
  functionName: "morphoSupply",
684
709
  args: [market, assets, shares, slippageAmount, onBehalf, reenterData],
685
710
  }),
686
711
  value: 0n,
687
- skipRevert: false,
688
- callbackHash: reenter ? keccak256(reenterData) : zeroHash,
712
+ skipRevert,
713
+ callbackHash: reenter ? (0, viem_1.keccak256)(reenterData) : viem_1.zeroHash,
689
714
  },
690
715
  ];
691
716
  }
692
717
  BundlerAction.morphoSupply = morphoSupply;
693
718
  /**
694
- * Encodes a call to the Adapter to supply collateral to a Morpho Blue market.
719
+ * Encodes a call to the GeneralAdapter1 to supply collateral to a Morpho Blue market.
695
720
  * @param chainId The chain id for which to encode the call.
696
721
  * @param market The market params to supply to.
697
722
  * @param assets The amount of assets to supply.
698
723
  * @param onBehalf The address to supply on behalf of.
699
724
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupplyCollateral` callback.
725
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
700
726
  */
701
- function morphoSupplyCollateral(chainId, market, assets, onBehalf, callbackCalls) {
702
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
727
+ function morphoSupplyCollateral(chainId, market, assets, onBehalf, callbackCalls, skipRevert = false) {
728
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
703
729
  const reenter = callbackCalls.length > 0;
704
730
  const reenterData = reenter
705
- ? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
731
+ ? (0, viem_1.encodeAbiParameters)(reenterAbiInputs, [callbackCalls])
706
732
  : "0x";
707
733
  return [
708
734
  {
709
735
  to: generalAdapter1,
710
- data: encodeFunctionData({
711
- abi: generalAdapter1Abi,
736
+ data: (0, viem_1.encodeFunctionData)({
737
+ abi: abis_js_1.generalAdapter1Abi,
712
738
  functionName: "morphoSupplyCollateral",
713
739
  args: [market, assets, onBehalf, reenterData],
714
740
  }),
715
741
  value: 0n,
716
- skipRevert: false,
717
- callbackHash: reenter ? keccak256(reenterData) : zeroHash,
742
+ skipRevert,
743
+ callbackHash: reenter ? (0, viem_1.keccak256)(reenterData) : viem_1.zeroHash,
718
744
  },
719
745
  ];
720
746
  }
721
747
  BundlerAction.morphoSupplyCollateral = morphoSupplyCollateral;
722
748
  /**
723
- * Encodes a call to the Adapter to borrow from a Morpho Blue market.
749
+ * Encodes a call to the GeneralAdapter1 to borrow from a Morpho Blue market.
724
750
  * @param chainId The chain id for which to encode the call.
725
751
  * @param market The market params to borrow from.
726
752
  * @param assets The amount of assets to borrow.
727
753
  * @param shares The amount of borrow shares to mint.
728
754
  * @param slippageAmount The minimum (resp. maximum) amount of assets (resp. borrow shares) to borrow (resp. mint) (protects the sender from unexpected slippage).
729
755
  * @param receiver The address to send borrowed tokens to.
756
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
730
757
  */
731
- function morphoBorrow(chainId, market, assets, shares, slippageAmount, receiver) {
732
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
758
+ function morphoBorrow(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
759
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
733
760
  return [
734
761
  {
735
762
  to: generalAdapter1,
736
- data: encodeFunctionData({
737
- abi: generalAdapter1Abi,
763
+ data: (0, viem_1.encodeFunctionData)({
764
+ abi: abis_js_1.generalAdapter1Abi,
738
765
  functionName: "morphoBorrow",
739
766
  args: [market, assets, shares, slippageAmount, receiver],
740
767
  }),
741
768
  value: 0n,
742
- skipRevert: false,
743
- callbackHash: zeroHash,
769
+ skipRevert,
770
+ callbackHash: viem_1.zeroHash,
744
771
  },
745
772
  ];
746
773
  }
747
774
  BundlerAction.morphoBorrow = morphoBorrow;
748
775
  /**
749
- * Encodes a call to the Adapter to repay to a Morpho Blue market.
776
+ * Encodes a call to the GeneralAdapter1 to repay to a Morpho Blue market.
750
777
  * @param chainId The chain id for which to encode the call.
751
778
  * @param market The market params to repay to.
752
779
  * @param assets The amount of assets to repay.
@@ -754,508 +781,515 @@ export var BundlerAction;
754
781
  * @param slippageAmount The maximum (resp. minimum) amount of assets (resp. borrow shares) to repay (resp. redeem) (protects the sender from unexpected slippage).
755
782
  * @param onBehalf The address to repay on behalf of.
756
783
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupply` callback.
784
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
757
785
  */
758
- function morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls) {
759
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
786
+ function morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
787
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
760
788
  const reenter = callbackCalls.length > 0;
761
789
  const reenterData = reenter
762
- ? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
790
+ ? (0, viem_1.encodeAbiParameters)(reenterAbiInputs, [callbackCalls])
763
791
  : "0x";
764
792
  return [
765
793
  {
766
794
  to: generalAdapter1,
767
- data: encodeFunctionData({
768
- abi: generalAdapter1Abi,
795
+ data: (0, viem_1.encodeFunctionData)({
796
+ abi: abis_js_1.generalAdapter1Abi,
769
797
  functionName: "morphoRepay",
770
798
  args: [market, assets, shares, slippageAmount, onBehalf, reenterData],
771
799
  }),
772
800
  value: 0n,
773
- skipRevert: false,
774
- callbackHash: reenter ? keccak256(reenterData) : zeroHash,
801
+ skipRevert,
802
+ callbackHash: reenter ? (0, viem_1.keccak256)(reenterData) : viem_1.zeroHash,
775
803
  },
776
804
  ];
777
805
  }
778
806
  BundlerAction.morphoRepay = morphoRepay;
779
807
  /**
780
- * Encodes a call to the Adapter to withdraw from a Morpho Blue market.
808
+ * Encodes a call to the GeneralAdapter1 to withdraw from a Morpho Blue market.
781
809
  * @param chainId The chain id for which to encode the call.
782
810
  * @param market The market params to withdraw from.
783
811
  * @param assets The amount of assets to withdraw.
784
812
  * @param shares The amount of supply shares to redeem.
785
813
  * @param slippageAmount The minimum (resp. maximum) amount of assets (resp. supply shares) to withdraw (resp. redeem) (protects the sender from unexpected slippage).
786
814
  * @param receiver The address to send withdrawn tokens to.
815
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
787
816
  */
788
- function morphoWithdraw(chainId, market, assets, shares, slippageAmount, receiver) {
789
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
817
+ function morphoWithdraw(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
818
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
790
819
  return [
791
820
  {
792
821
  to: generalAdapter1,
793
- data: encodeFunctionData({
794
- abi: generalAdapter1Abi,
822
+ data: (0, viem_1.encodeFunctionData)({
823
+ abi: abis_js_1.generalAdapter1Abi,
795
824
  functionName: "morphoWithdraw",
796
825
  args: [market, assets, shares, slippageAmount, receiver],
797
826
  }),
798
827
  value: 0n,
799
- skipRevert: false,
800
- callbackHash: zeroHash,
828
+ skipRevert,
829
+ callbackHash: viem_1.zeroHash,
801
830
  },
802
831
  ];
803
832
  }
804
833
  BundlerAction.morphoWithdraw = morphoWithdraw;
805
834
  /**
806
- * Encodes a call to the Adapter to withdraw collateral from a Morpho Blue market.
835
+ * Encodes a call to the GeneralAdapter1 to withdraw collateral from a Morpho Blue market.
807
836
  * @param chainId The chain id for which to encode the call.
808
837
  * @param market The market params to withdraw from.
809
838
  * @param assets The amount of assets to withdraw.
810
839
  * @param receiver The address to send withdrawn tokens to.
840
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
811
841
  */
812
- function morphoWithdrawCollateral(chainId, market, assets, receiver) {
813
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
842
+ function morphoWithdrawCollateral(chainId, market, assets, receiver, skipRevert = false) {
843
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
814
844
  return [
815
845
  {
816
846
  to: generalAdapter1,
817
- data: encodeFunctionData({
818
- abi: generalAdapter1Abi,
847
+ data: (0, viem_1.encodeFunctionData)({
848
+ abi: abis_js_1.generalAdapter1Abi,
819
849
  functionName: "morphoWithdrawCollateral",
820
850
  args: [market, assets, receiver],
821
851
  }),
822
852
  value: 0n,
823
- skipRevert: false,
824
- callbackHash: zeroHash,
853
+ skipRevert,
854
+ callbackHash: viem_1.zeroHash,
825
855
  },
826
856
  ];
827
857
  }
828
858
  BundlerAction.morphoWithdrawCollateral = morphoWithdrawCollateral;
829
859
  /**
830
- * Encodes a call to the Adapter to flash loan from Morpho Blue.
860
+ * Encodes a call to the GeneralAdapter1 to flash loan from Morpho Blue.
831
861
  * @param chainId The chain id for which to encode the call.
832
862
  * @param asset The address of the ERC20 token to flash loan.
833
863
  * @param amount The amount of tokens to flash loan.
834
864
  * @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoFlashLoan` callback.
865
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
835
866
  */
836
- function morphoFlashLoan(chainId, asset, amount, callbackCalls) {
837
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
867
+ function morphoFlashLoan(chainId, asset, amount, callbackCalls, skipRevert = false) {
868
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
838
869
  const reenter = callbackCalls.length > 0;
839
870
  const reenterData = reenter
840
- ? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
871
+ ? (0, viem_1.encodeAbiParameters)(reenterAbiInputs, [callbackCalls])
841
872
  : "0x";
842
873
  return [
843
874
  {
844
875
  to: generalAdapter1,
845
- data: encodeFunctionData({
846
- abi: generalAdapter1Abi,
876
+ data: (0, viem_1.encodeFunctionData)({
877
+ abi: abis_js_1.generalAdapter1Abi,
847
878
  functionName: "morphoFlashLoan",
848
879
  args: [
849
880
  asset,
850
881
  amount,
851
- encodeFunctionData({
852
- abi: bundler3Abi,
882
+ (0, viem_1.encodeFunctionData)({
883
+ abi: abis_js_1.bundler3Abi,
853
884
  functionName: "reenter",
854
885
  args: [callbackCalls],
855
886
  }),
856
887
  ],
857
888
  }),
858
889
  value: 0n,
859
- skipRevert: false,
860
- callbackHash: reenter ? keccak256(reenterData) : zeroHash,
890
+ skipRevert,
891
+ callbackHash: reenter ? (0, viem_1.keccak256)(reenterData) : viem_1.zeroHash,
861
892
  },
862
893
  ];
863
894
  }
864
895
  BundlerAction.morphoFlashLoan = morphoFlashLoan;
865
896
  /**
866
- * Encodes a call to the Adapter to trigger a public reallocation on the PublicAllocator.
897
+ * Encodes a call to trigger a public reallocation on the PublicAllocator.
867
898
  * @param chainId The chain id for which to encode the call.
868
899
  * @param vault The vault to reallocate.
869
900
  * @param fee The vault public reallocation fee.
870
901
  * @param withdrawals The array of withdrawals to perform, before supplying everything to the supply market.
871
902
  * @param supplyMarketParams The market params to reallocate to.
903
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
872
904
  */
873
- function publicAllocatorReallocateTo(chainId, vault, fee, withdrawals, supplyMarketParams) {
874
- const { publicAllocator } = getChainAddresses(chainId);
905
+ function publicAllocatorReallocateTo(chainId, vault, fee, withdrawals, supplyMarketParams, skipRevert = false) {
906
+ const { publicAllocator } = (0, blue_sdk_1.getChainAddresses)(chainId);
875
907
  if (publicAllocator == null)
876
- throw new BundlerErrors.UnexpectedAction("reallocateTo", chainId);
908
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("reallocateTo", chainId);
877
909
  return [
878
910
  {
879
911
  to: publicAllocator,
880
- data: encodeFunctionData({
881
- abi: publicAllocatorAbi,
912
+ data: (0, viem_1.encodeFunctionData)({
913
+ abi: blue_sdk_viem_1.publicAllocatorAbi,
882
914
  functionName: "reallocateTo",
883
915
  args: [vault, withdrawals, supplyMarketParams],
884
916
  }),
885
917
  value: fee,
886
- skipRevert: false,
887
- callbackHash: zeroHash,
918
+ skipRevert,
919
+ callbackHash: viem_1.zeroHash,
888
920
  },
889
921
  ];
890
922
  }
891
923
  BundlerAction.publicAllocatorReallocateTo = publicAllocatorReallocateTo;
892
924
  /* Universal Rewards Distributor */
893
925
  /**
894
- * Encodes a call to the Adapter to claim rewards from the Universal Rewards Distributor.
926
+ * Encodes a call to the Universal Rewards Distributor to claim rewards.
895
927
  * @param chainId The chain id for which to encode the call.
896
928
  * @param distributor The address of the distributor to claim rewards from.
897
929
  * @param account The address to claim rewards for.
898
930
  * @param reward The address of the reward token to claim.
899
931
  * @param amount The amount of rewards to claim.
900
932
  * @param proof The Merkle proof to claim the rewards.
901
- * @param skipRevert Whether to allow the claim to revert without making the whole multicall revert.
933
+ * @param skipRevert Whether to allow the claim to revert without making the whole bundle revert. Defaults to true.
902
934
  */
903
935
  function urdClaim(distributor, account, reward, amount, proof, skipRevert = true) {
904
936
  return [
905
937
  {
906
938
  to: distributor,
907
- data: encodeFunctionData({
908
- abi: universalRewardsDistributorAbi,
939
+ data: (0, viem_1.encodeFunctionData)({
940
+ abi: abis_js_1.universalRewardsDistributorAbi,
909
941
  functionName: "claim",
910
942
  args: [account, reward, amount, proof],
911
943
  }),
912
944
  value: 0n,
913
945
  skipRevert,
914
- callbackHash: zeroHash,
946
+ callbackHash: viem_1.zeroHash,
915
947
  },
916
948
  ];
917
949
  }
918
950
  BundlerAction.urdClaim = urdClaim;
919
951
  /* Wrapped Native */
920
952
  /**
921
- * Encodes a call to the Adapter to wrap native tokens (ETH to WETH on ethereum, MATIC to WMATIC on polygon, etc).
953
+ * Encodes a call to the GeneralAdapter1 to wrap native tokens (ETH to WETH on ethereum, MATIC to WMATIC on polygon, etc).
922
954
  * @param chainId The chain id for which to encode the call.
923
955
  * @param amount The amount of native tokens to wrap (in wei).
924
- * @param recipient The address to send tokens to. Defaults to the chain's bundler3 general adapter.
956
+ * @param recipient The address to send tokens to.
957
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
925
958
  */
926
- function wrapNative(chainId, amount, recipient) {
927
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
928
- recipient ??= generalAdapter1;
959
+ function wrapNative(chainId, amount, recipient, skipRevert = false) {
960
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
929
961
  return [
930
962
  {
931
963
  to: generalAdapter1,
932
- data: encodeFunctionData({
933
- abi: generalAdapter1Abi,
964
+ data: (0, viem_1.encodeFunctionData)({
965
+ abi: abis_js_1.generalAdapter1Abi,
934
966
  functionName: "wrapNative",
935
967
  args: [amount, recipient],
936
968
  }),
937
969
  value: 0n,
938
- skipRevert: false,
939
- callbackHash: zeroHash,
970
+ skipRevert,
971
+ callbackHash: viem_1.zeroHash,
940
972
  },
941
973
  ];
942
974
  }
943
975
  BundlerAction.wrapNative = wrapNative;
944
976
  /**
945
- * Encodes a call to the Adapter to unwrap native tokens (WETH to ETH on ethereum, WMATIC to MATIC on polygon, etc).
977
+ * Encodes a call to the GeneralAdapter1 to unwrap native tokens (WETH to ETH on ethereum, WMATIC to MATIC on polygon, etc).
946
978
  * @param chainId The chain id for which to encode the call.
947
979
  * @param amount The amount of native tokens to unwrap (in wei).
948
- * @param recipient The address to send tokens to. Defaults to the chain's bundler3 general adapter.
980
+ * @param recipient The address to send tokens to.
981
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
949
982
  */
950
- function unwrapNative(chainId, amount, recipient) {
951
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
952
- recipient ??= generalAdapter1;
983
+ function unwrapNative(chainId, amount, recipient, skipRevert = false) {
984
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
953
985
  return [
954
986
  {
955
987
  to: generalAdapter1,
956
- data: encodeFunctionData({
957
- abi: generalAdapter1Abi,
988
+ data: (0, viem_1.encodeFunctionData)({
989
+ abi: abis_js_1.generalAdapter1Abi,
958
990
  functionName: "unwrapNative",
959
991
  args: [amount, recipient],
960
992
  }),
961
993
  value: 0n,
962
- skipRevert: false,
963
- callbackHash: zeroHash,
994
+ skipRevert,
995
+ callbackHash: viem_1.zeroHash,
964
996
  },
965
997
  ];
966
998
  }
967
999
  BundlerAction.unwrapNative = unwrapNative;
968
1000
  /* stETH */
969
1001
  /**
970
- * Encodes a call to the Adapter to stake native tokens using Lido (ETH to stETH on ethereum).
1002
+ * Encodes a call to the GeneralAdapter1 to stake native tokens using Lido (ETH to stETH on ethereum).
971
1003
  * @param chainId The chain id for which to encode the call.
972
1004
  * @param amount The amount of native tokens to stake (in wei).
973
1005
  * @param maxSharePrice The maximum amount of wei to pay for minting 1 share (scaled by RAY).
974
1006
  * @param referral The referral address to use.
975
- * @param recipient The address to send stETH to. Defaults to the chain's bundler3 general adapter.
1007
+ * @param recipient The address to send stETH to.
1008
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
976
1009
  */
977
- function stakeEth(chainId, amount, maxSharePrice, referral, recipient) {
978
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
979
- recipient ??= generalAdapter1;
1010
+ function stakeEth(chainId, amount, maxSharePrice, referral, recipient, skipRevert = false) {
1011
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
980
1012
  return [
981
1013
  {
982
1014
  to: generalAdapter1,
983
- data: encodeFunctionData({
984
- abi: ethereumGeneralAdapter1Abi,
1015
+ data: (0, viem_1.encodeFunctionData)({
1016
+ abi: abis_js_1.ethereumGeneralAdapter1Abi,
985
1017
  functionName: "stakeEth",
986
1018
  args: [amount, maxSharePrice, referral, recipient],
987
1019
  }),
988
1020
  value: 0n,
989
- skipRevert: false,
990
- callbackHash: zeroHash,
1021
+ skipRevert,
1022
+ callbackHash: viem_1.zeroHash,
991
1023
  },
992
1024
  ];
993
1025
  }
994
1026
  BundlerAction.stakeEth = stakeEth;
995
1027
  /* Wrapped stETH */
996
1028
  /**
997
- * Encodes a call to the Adapter to wrap stETH (stETH to wstETH on ethereum).
1029
+ * Encodes a call to the GeneralAdapter1 to wrap stETH (stETH to wstETH on ethereum).
998
1030
  * @param chainId The chain id for which to encode the call.
999
1031
  * @param amount The amount of stETH to wrap (in wei).
1000
- * @param recipient The address to send wstETH to. Defaults to the chain's bundler3 general adapter.
1032
+ * @param recipient The address to send wstETH to.
1033
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1001
1034
  */
1002
- function wrapStEth(chainId, amount, recipient) {
1003
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
1004
- recipient ??= generalAdapter1;
1035
+ function wrapStEth(chainId, amount, recipient, skipRevert = false) {
1036
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1005
1037
  return [
1006
1038
  {
1007
1039
  to: generalAdapter1,
1008
- data: encodeFunctionData({
1009
- abi: ethereumGeneralAdapter1Abi,
1040
+ data: (0, viem_1.encodeFunctionData)({
1041
+ abi: abis_js_1.ethereumGeneralAdapter1Abi,
1010
1042
  functionName: "wrapStEth",
1011
1043
  args: [amount, recipient],
1012
1044
  }),
1013
1045
  value: 0n,
1014
- skipRevert: false,
1015
- callbackHash: zeroHash,
1046
+ skipRevert,
1047
+ callbackHash: viem_1.zeroHash,
1016
1048
  },
1017
1049
  ];
1018
1050
  }
1019
1051
  BundlerAction.wrapStEth = wrapStEth;
1020
1052
  /**
1021
- * Encodes a call to the Adapter to unwrap wstETH (wstETH to stETH on ethereum).
1053
+ * Encodes a call to the GeneralAdapter1 to unwrap wstETH (wstETH to stETH on ethereum).
1022
1054
  * @param chainId The chain id for which to encode the call.
1023
1055
  * @param amount The amount of wstETH to unwrap (in wei).
1024
- * @param recipient The address to send stETH to. Defaults to the chain's bundler3 general adapter.
1056
+ * @param recipient The address to send stETH to.
1057
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1025
1058
  */
1026
- function unwrapStEth(chainId, amount, recipient) {
1027
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
1028
- recipient ??= generalAdapter1;
1059
+ function unwrapStEth(chainId, amount, recipient, skipRevert = false) {
1060
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1029
1061
  return [
1030
1062
  {
1031
1063
  to: generalAdapter1,
1032
- data: encodeFunctionData({
1033
- abi: ethereumGeneralAdapter1Abi,
1064
+ data: (0, viem_1.encodeFunctionData)({
1065
+ abi: abis_js_1.ethereumGeneralAdapter1Abi,
1034
1066
  functionName: "unwrapStEth",
1035
1067
  args: [amount, recipient],
1036
1068
  }),
1037
1069
  value: 0n,
1038
- skipRevert: false,
1039
- callbackHash: zeroHash,
1070
+ skipRevert,
1071
+ callbackHash: viem_1.zeroHash,
1040
1072
  },
1041
1073
  ];
1042
1074
  }
1043
1075
  BundlerAction.unwrapStEth = unwrapStEth;
1044
1076
  /* AaveV2 */
1045
1077
  /**
1046
- * Encodes a call to the Adapter to repay a debt on AaveV2.
1078
+ * Encodes a call to the AaveV2MigrationAdapter to repay a debt on AaveV2.
1047
1079
  * @param chainId The chain id for which to encode the call.
1048
1080
  * @param asset The debt asset to repay.
1049
1081
  * @param amount The amount of debt to repay.
1050
1082
  * @param onBehalf The address on behalf of which to repay.
1051
1083
  * @param rateMode The interest rate mode used by the debt to repay.
1084
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1052
1085
  */
1053
- function aaveV2Repay(chainId, asset, amount, onBehalf, rateMode = 1n) {
1054
- const { bundler3: { aaveV2MigrationAdapter }, } = getChainAddresses(chainId);
1086
+ function aaveV2Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
1087
+ const { bundler3: { aaveV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1055
1088
  if (aaveV2MigrationAdapter == null)
1056
- throw new BundlerErrors.UnexpectedAction("aaveV2Repay", chainId);
1089
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV2Repay", chainId);
1057
1090
  return [
1058
1091
  {
1059
1092
  to: aaveV2MigrationAdapter,
1060
- data: encodeFunctionData({
1061
- abi: aaveV2MigrationAdapterAbi,
1093
+ data: (0, viem_1.encodeFunctionData)({
1094
+ abi: abis_js_1.aaveV2MigrationAdapterAbi,
1062
1095
  functionName: "aaveV2Repay",
1063
1096
  args: [asset, amount, rateMode, onBehalf],
1064
1097
  }),
1065
1098
  value: 0n,
1066
- skipRevert: false,
1067
- callbackHash: zeroHash,
1099
+ skipRevert,
1100
+ callbackHash: viem_1.zeroHash,
1068
1101
  },
1069
1102
  ];
1070
1103
  }
1071
1104
  BundlerAction.aaveV2Repay = aaveV2Repay;
1072
1105
  /**
1073
- * Encodes a call to the Adapter to withdrawn from AaveV2.
1106
+ * Encodes a call to the AaveV2MigrationAdapter to withdraw from AaveV2.
1074
1107
  * @param chainId The chain id for which to encode the call.
1075
1108
  * @param asset The asset to withdraw.
1076
1109
  * @param amount The amount of asset to withdraw.
1077
- * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
1110
+ * @param recipient The recipient of ERC20 tokens.
1111
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1078
1112
  */
1079
- function aaveV2Withdraw(chainId, asset, amount, recipient) {
1080
- const { bundler3: { aaveV2MigrationAdapter }, } = getChainAddresses(chainId);
1113
+ function aaveV2Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
1114
+ const { bundler3: { aaveV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1081
1115
  if (aaveV2MigrationAdapter == null)
1082
- throw new BundlerErrors.UnexpectedAction("aaveV2Withdraw", chainId);
1083
- recipient ??= aaveV2MigrationAdapter;
1116
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV2Withdraw", chainId);
1084
1117
  return [
1085
1118
  {
1086
1119
  to: aaveV2MigrationAdapter,
1087
- data: encodeFunctionData({
1088
- abi: aaveV2MigrationAdapterAbi,
1120
+ data: (0, viem_1.encodeFunctionData)({
1121
+ abi: abis_js_1.aaveV2MigrationAdapterAbi,
1089
1122
  functionName: "aaveV2Withdraw",
1090
1123
  args: [asset, amount, recipient],
1091
1124
  }),
1092
1125
  value: 0n,
1093
- skipRevert: false,
1094
- callbackHash: zeroHash,
1126
+ skipRevert,
1127
+ callbackHash: viem_1.zeroHash,
1095
1128
  },
1096
1129
  ];
1097
1130
  }
1098
1131
  BundlerAction.aaveV2Withdraw = aaveV2Withdraw;
1099
1132
  /* AaveV3 */
1100
1133
  /**
1101
- * Encodes a call to the Adapter to repay a debt on AaveV3.
1134
+ * Encodes a call to the AaveV3CoreMigrationAdapter to repay a debt on AaveV3.
1102
1135
  * @param chainId The chain id for which to encode the call.
1103
1136
  * @param asset The debt asset to repay.
1104
1137
  * @param amount The amount of debt to repay.
1105
1138
  * @param onBehalf The address on behalf of which to repay.
1106
1139
  * @param rateMode The interest rate mode used by the debt to repay.
1140
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1107
1141
  */
1108
- function aaveV3Repay(chainId, asset, amount, onBehalf, rateMode = 1n) {
1142
+ function aaveV3Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
1109
1143
  const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
1110
- } = getChainAddresses(chainId);
1144
+ } = (0, blue_sdk_1.getChainAddresses)(chainId);
1111
1145
  if (aaveV3CoreMigrationAdapter == null)
1112
- throw new BundlerErrors.UnexpectedAction("aaveV3Repay", chainId);
1146
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3Repay", chainId);
1113
1147
  return [
1114
1148
  {
1115
1149
  to: aaveV3CoreMigrationAdapter,
1116
- data: encodeFunctionData({
1117
- abi: aaveV3MigrationAdapterAbi,
1150
+ data: (0, viem_1.encodeFunctionData)({
1151
+ abi: abis_js_1.aaveV3MigrationAdapterAbi,
1118
1152
  functionName: "aaveV3Repay",
1119
1153
  args: [asset, amount, rateMode, onBehalf],
1120
1154
  }),
1121
1155
  value: 0n,
1122
- skipRevert: false,
1123
- callbackHash: zeroHash,
1156
+ skipRevert,
1157
+ callbackHash: viem_1.zeroHash,
1124
1158
  },
1125
1159
  ];
1126
1160
  }
1127
1161
  BundlerAction.aaveV3Repay = aaveV3Repay;
1128
1162
  /**
1129
- * Encodes a call to the Adapter to withdrawn from AaveV3.
1163
+ * Encodes a call to the AaveV3CoreMigrationAdapter to withdrawn from AaveV3.
1130
1164
  * @param chainId The chain id for which to encode the call.
1131
1165
  * @param asset The asset to withdraw.
1132
1166
  * @param amount The amount of asset to withdraw.
1133
- * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
1167
+ * @param recipient The recipient of ERC20 tokens.
1168
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1134
1169
  */
1135
- function aaveV3Withdraw(chainId, asset, amount, recipient) {
1170
+ function aaveV3Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
1136
1171
  const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
1137
- } = getChainAddresses(chainId);
1172
+ } = (0, blue_sdk_1.getChainAddresses)(chainId);
1138
1173
  if (aaveV3CoreMigrationAdapter == null)
1139
- throw new BundlerErrors.UnexpectedAction("aaveV3Withdraw", chainId);
1140
- recipient ??= aaveV3CoreMigrationAdapter;
1174
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3Withdraw", chainId);
1141
1175
  return [
1142
1176
  {
1143
1177
  to: aaveV3CoreMigrationAdapter,
1144
- data: encodeFunctionData({
1145
- abi: aaveV3MigrationAdapterAbi,
1178
+ data: (0, viem_1.encodeFunctionData)({
1179
+ abi: abis_js_1.aaveV3MigrationAdapterAbi,
1146
1180
  functionName: "aaveV3Withdraw",
1147
1181
  args: [asset, amount, recipient],
1148
1182
  }),
1149
1183
  value: 0n,
1150
- skipRevert: false,
1151
- callbackHash: zeroHash,
1184
+ skipRevert,
1185
+ callbackHash: viem_1.zeroHash,
1152
1186
  },
1153
1187
  ];
1154
1188
  }
1155
1189
  BundlerAction.aaveV3Withdraw = aaveV3Withdraw;
1156
1190
  /* AaveV3 Optimizer */
1157
1191
  /**
1158
- * Encodes a call to the Adapter to repay a debt on Morpho's AaveV3Optimizer.
1192
+ * Encodes a call to the AaveV3OptimizerMigrationAdapter to repay a debt on Morpho's AaveV3Optimizer.
1159
1193
  * @param chainId The chain id for which to encode the call.
1160
1194
  * @param underlying The underlying debt asset to repay.
1161
1195
  * @param amount The amount of debt to repay.
1162
1196
  * @param onBehalf The address on behalf of which to repay.
1197
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1163
1198
  */
1164
- function aaveV3OptimizerRepay(chainId, underlying, amount, onBehalf) {
1165
- const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1199
+ function aaveV3OptimizerRepay(chainId, underlying, amount, onBehalf, skipRevert = false) {
1200
+ const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1166
1201
  if (aaveV3OptimizerMigrationAdapter == null)
1167
- throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerRepay", chainId);
1202
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3OptimizerRepay", chainId);
1168
1203
  return [
1169
1204
  {
1170
1205
  to: aaveV3OptimizerMigrationAdapter,
1171
- data: encodeFunctionData({
1172
- abi: aaveV3OptimizerMigrationAdapterAbi,
1206
+ data: (0, viem_1.encodeFunctionData)({
1207
+ abi: abis_js_1.aaveV3OptimizerMigrationAdapterAbi,
1173
1208
  functionName: "aaveV3OptimizerRepay",
1174
1209
  args: [underlying, amount, onBehalf],
1175
1210
  }),
1176
1211
  value: 0n,
1177
- skipRevert: false,
1178
- callbackHash: zeroHash,
1212
+ skipRevert,
1213
+ callbackHash: viem_1.zeroHash,
1179
1214
  },
1180
1215
  ];
1181
1216
  }
1182
1217
  BundlerAction.aaveV3OptimizerRepay = aaveV3OptimizerRepay;
1183
1218
  /**
1184
- * Encodes a call to the Adapter to withdraw from Morpho's AaveV3Optimizer.
1219
+ * Encodes a call to the AaveV3OptimizerMigrationAdapter to withdraw from Morpho's AaveV3Optimizer.
1185
1220
  * @param chainId The chain id for which to encode the call.
1186
1221
  * @param underlying The underlying asset to withdraw.
1187
1222
  * @param amount The amount to withdraw.
1188
1223
  * @param maxIterations The maximum amount of iterations to use for the withdrawal.
1189
- * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
1224
+ * @param recipient The recipient of ERC20 tokens.
1225
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1190
1226
  */
1191
- function aaveV3OptimizerWithdraw(chainId, underlying, amount, maxIterations, recipient) {
1192
- const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1227
+ function aaveV3OptimizerWithdraw(chainId, underlying, amount, maxIterations, recipient, skipRevert = false) {
1228
+ const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1193
1229
  if (aaveV3OptimizerMigrationAdapter == null)
1194
- throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdraw", chainId);
1195
- recipient ??= aaveV3OptimizerMigrationAdapter;
1230
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdraw", chainId);
1196
1231
  return [
1197
1232
  {
1198
1233
  to: aaveV3OptimizerMigrationAdapter,
1199
- data: encodeFunctionData({
1200
- abi: aaveV3OptimizerMigrationAdapterAbi,
1234
+ data: (0, viem_1.encodeFunctionData)({
1235
+ abi: abis_js_1.aaveV3OptimizerMigrationAdapterAbi,
1201
1236
  functionName: "aaveV3OptimizerWithdraw",
1202
1237
  args: [underlying, amount, maxIterations, recipient],
1203
1238
  }),
1204
1239
  value: 0n,
1205
- skipRevert: false,
1206
- callbackHash: zeroHash,
1240
+ skipRevert,
1241
+ callbackHash: viem_1.zeroHash,
1207
1242
  },
1208
1243
  ];
1209
1244
  }
1210
1245
  BundlerAction.aaveV3OptimizerWithdraw = aaveV3OptimizerWithdraw;
1211
1246
  /**
1212
- * Encodes a call to the Adapter to withdraw collateral from Morpho's AaveV3Optimizer.
1247
+ * Encodes a call to the AaveV3OptimizerMigrationAdapter to withdraw collateral from Morpho's AaveV3Optimizer.
1213
1248
  * @param chainId The chain id for which to encode the call.
1214
1249
  * @param underlying The underlying asset to withdraw.
1215
1250
  * @param amount The amount to withdraw.
1216
- * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
1251
+ * @param recipient The recipient of ERC20 tokens.
1252
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1217
1253
  */
1218
- function aaveV3OptimizerWithdrawCollateral(chainId, underlying, amount, recipient) {
1219
- const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1254
+ function aaveV3OptimizerWithdrawCollateral(chainId, underlying, amount, recipient, skipRevert = false) {
1255
+ const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1220
1256
  if (aaveV3OptimizerMigrationAdapter == null)
1221
- throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdrawCollateral", chainId);
1222
- recipient ??= aaveV3OptimizerMigrationAdapter;
1257
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdrawCollateral", chainId);
1223
1258
  return [
1224
1259
  {
1225
1260
  to: aaveV3OptimizerMigrationAdapter,
1226
- data: encodeFunctionData({
1227
- abi: aaveV3OptimizerMigrationAdapterAbi,
1261
+ data: (0, viem_1.encodeFunctionData)({
1262
+ abi: abis_js_1.aaveV3OptimizerMigrationAdapterAbi,
1228
1263
  functionName: "aaveV3OptimizerWithdrawCollateral",
1229
1264
  args: [underlying, amount, recipient],
1230
1265
  }),
1231
1266
  value: 0n,
1232
- skipRevert: false,
1233
- callbackHash: zeroHash,
1267
+ skipRevert,
1268
+ callbackHash: viem_1.zeroHash,
1234
1269
  },
1235
1270
  ];
1236
1271
  }
1237
1272
  BundlerAction.aaveV3OptimizerWithdrawCollateral = aaveV3OptimizerWithdrawCollateral;
1238
1273
  /**
1239
- * Encodes a call to the Adapter to approve the Bundler as the sender's manager on Morpho's AaveV3Optimizer.
1274
+ * Encodes a call to the AaveV3 optimizer to approve the chain's AaveV3OptimizerMigrationAdapter.
1275
+ * as the sender's manager on Morpho's AaveV3Optimizer.
1240
1276
  * @param chainId The chain id for which to encode the call.
1241
1277
  * @param owner The owner of the AaveV3Optimizer position.
1242
1278
  * @param isApproved Whether the manager is approved.
1243
1279
  * @param nonce The nonce used to sign.
1244
1280
  * @param deadline The timestamp until which the signature is valid.
1245
1281
  * @param signature The Ethers signature to submit.
1246
- * @param manager The address of the manager to approve. Defaults to the chain's bundler3 AaveV3OptimizerMigrationAdapter.
1247
- * @param skipRevert Whether to allow the signature to revert without making the whole multicall revert.
1282
+ * @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
1248
1283
  */
1249
- function aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, manager, skipRevert = true) {
1250
- const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1284
+ function aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, skipRevert = true) {
1285
+ const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1251
1286
  if (aaveV3OptimizerMigrationAdapter == null)
1252
- throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerApproveManagerWithSig", chainId);
1253
- manager ??= aaveV3OptimizerMigrationAdapter;
1254
- const { r, s, yParity } = parseSignature(signature);
1287
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3OptimizerApproveManagerWithSig", chainId);
1288
+ const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
1255
1289
  return [
1256
1290
  {
1257
1291
  to: aaveV3Optimizer,
1258
- data: encodeFunctionData({
1292
+ data: (0, viem_1.encodeFunctionData)({
1259
1293
  abi: [
1260
1294
  {
1261
1295
  inputs: [
@@ -1284,7 +1318,7 @@ export var BundlerAction;
1284
1318
  functionName: "approveManagerWithSig",
1285
1319
  args: [
1286
1320
  owner,
1287
- manager,
1321
+ aaveV3OptimizerMigrationAdapter,
1288
1322
  isApproved,
1289
1323
  nonce,
1290
1324
  deadline,
@@ -1293,134 +1327,137 @@ export var BundlerAction;
1293
1327
  }),
1294
1328
  value: 0n,
1295
1329
  skipRevert,
1296
- callbackHash: zeroHash,
1330
+ callbackHash: viem_1.zeroHash,
1297
1331
  },
1298
1332
  ];
1299
1333
  }
1300
1334
  BundlerAction.aaveV3OptimizerApproveManagerWithSig = aaveV3OptimizerApproveManagerWithSig;
1301
1335
  /* CompoundV2 */
1302
1336
  /**
1303
- * Encodes a call to the Adapter to repay a debt on CompoundV2.
1337
+ * Encodes a call to the CompoundV2MigrationAdapter to repay a debt on CompoundV2.
1304
1338
  * @param chainId The chain id for which to encode the call.
1305
1339
  * @param cToken The cToken on which to repay the debt.
1306
1340
  * @param amount The amount of debt to repay.
1307
- * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
1341
+ * @param onBehalf The account on behalf of which to repay.
1342
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1308
1343
  */
1309
- function compoundV2Repay(chainId, cToken, amount, isEth, onBehalf) {
1310
- const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
1344
+ function compoundV2Repay(chainId, cToken, amount, isEth, onBehalf, skipRevert = false) {
1345
+ const { bundler3: { compoundV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1311
1346
  if (compoundV2MigrationAdapter == null)
1312
- throw new BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
1347
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
1313
1348
  return [
1314
1349
  {
1315
1350
  to: compoundV2MigrationAdapter,
1316
1351
  data: isEth
1317
- ? encodeFunctionData({
1318
- abi: compoundV2MigrationAdapterAbi,
1352
+ ? (0, viem_1.encodeFunctionData)({
1353
+ abi: abis_js_1.compoundV2MigrationAdapterAbi,
1319
1354
  functionName: "compoundV2RepayEth",
1320
1355
  args: [amount, onBehalf],
1321
1356
  })
1322
- : encodeFunctionData({
1323
- abi: compoundV2MigrationAdapterAbi,
1357
+ : (0, viem_1.encodeFunctionData)({
1358
+ abi: abis_js_1.compoundV2MigrationAdapterAbi,
1324
1359
  functionName: "compoundV2RepayErc20",
1325
1360
  args: [cToken, amount, onBehalf],
1326
1361
  }),
1327
1362
  value: isEth ? amount : 0n,
1328
- skipRevert: false,
1329
- callbackHash: zeroHash,
1363
+ skipRevert,
1364
+ callbackHash: viem_1.zeroHash,
1330
1365
  },
1331
1366
  ];
1332
1367
  }
1333
1368
  BundlerAction.compoundV2Repay = compoundV2Repay;
1334
1369
  /**
1335
- * Encodes a call to the Adapter to withdraw collateral from CompoundV2.
1370
+ * Encodes a call to the CompoundV2MigrationAdapter to withdraw collateral from CompoundV2.
1336
1371
  * @param chainId The chain id for which to encode the call.
1337
1372
  * @param cToken The cToken on which to withdraw.
1338
1373
  * @param amount The amount to withdraw.
1339
- * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
1374
+ * @param recipient The recipient of ERC20 tokens.
1375
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1340
1376
  */
1341
- function compoundV2Redeem(chainId, cToken, amount, isEth, recipient) {
1342
- const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
1377
+ function compoundV2Redeem(chainId, cToken, amount, isEth, recipient, skipRevert = false) {
1378
+ const { bundler3: { compoundV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1343
1379
  if (compoundV2MigrationAdapter == null)
1344
- throw new BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
1345
- recipient ??= compoundV2MigrationAdapter;
1380
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
1346
1381
  return [
1347
1382
  {
1348
1383
  to: compoundV2MigrationAdapter,
1349
1384
  data: isEth
1350
- ? encodeFunctionData({
1351
- abi: compoundV2MigrationAdapterAbi,
1385
+ ? (0, viem_1.encodeFunctionData)({
1386
+ abi: abis_js_1.compoundV2MigrationAdapterAbi,
1352
1387
  functionName: "compoundV2RedeemEth",
1353
1388
  args: [amount, recipient],
1354
1389
  })
1355
- : encodeFunctionData({
1356
- abi: compoundV2MigrationAdapterAbi,
1390
+ : (0, viem_1.encodeFunctionData)({
1391
+ abi: abis_js_1.compoundV2MigrationAdapterAbi,
1357
1392
  functionName: "compoundV2RedeemErc20",
1358
1393
  args: [cToken, amount, recipient],
1359
1394
  }),
1360
1395
  value: 0n,
1361
- skipRevert: false,
1362
- callbackHash: zeroHash,
1396
+ skipRevert,
1397
+ callbackHash: viem_1.zeroHash,
1363
1398
  },
1364
1399
  ];
1365
1400
  }
1366
1401
  BundlerAction.compoundV2Redeem = compoundV2Redeem;
1367
1402
  /* CompoundV3 */
1368
1403
  /**
1369
- * Encodes a call to the Adapter to repay a debt on CompoundV3.
1404
+ * Encodes a call to the CompoundV3MigrationAdapter to repay a debt on CompoundV3.
1370
1405
  * @param chainId The chain id for which to encode the call.
1371
1406
  * @param instance The CompoundV3 instance on which to repay the debt.
1372
1407
  * @param amount The amount of debt to repay.
1373
1408
  * @param onBehalf The address on behalf of which to repay.
1409
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1374
1410
  */
1375
- function compoundV3Repay(chainId, instance, amount, onBehalf) {
1376
- const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
1411
+ function compoundV3Repay(chainId, instance, amount, onBehalf, skipRevert = false) {
1412
+ const { bundler3: { compoundV3MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1377
1413
  if (compoundV3MigrationAdapter == null)
1378
- throw new BundlerErrors.UnexpectedAction("compoundV3Repay", chainId);
1414
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV3Repay", chainId);
1379
1415
  return [
1380
1416
  {
1381
1417
  to: compoundV3MigrationAdapter,
1382
- data: encodeFunctionData({
1383
- abi: compoundV3MigrationAdapterAbi,
1418
+ data: (0, viem_1.encodeFunctionData)({
1419
+ abi: abis_js_1.compoundV3MigrationAdapterAbi,
1384
1420
  functionName: "compoundV3Repay",
1385
1421
  args: [instance, amount, onBehalf],
1386
1422
  }),
1387
1423
  value: 0n,
1388
- skipRevert: false,
1389
- callbackHash: zeroHash,
1424
+ skipRevert,
1425
+ callbackHash: viem_1.zeroHash,
1390
1426
  },
1391
1427
  ];
1392
1428
  }
1393
1429
  BundlerAction.compoundV3Repay = compoundV3Repay;
1394
1430
  /**
1395
- * Encodes a call to the Adapter to withdraw collateral from CompoundV3.
1431
+ * Encodes a call to the CompoundV3MigrationAdapter to withdraw collateral from CompoundV3.
1396
1432
  * @param chainId The chain id for which to encode the call.
1397
1433
  * @param instance The CompoundV3 instance on which to withdraw.
1398
1434
  * @param asset The asset to withdraw.
1399
1435
  * @param amount The amount to withdraw.
1400
- * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
1436
+ * @param recipient The recipient of ERC20 tokens.
1437
+ * @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
1401
1438
  */
1402
- function compoundV3WithdrawFrom(chainId, instance, asset, amount, recipient) {
1403
- const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
1439
+ function compoundV3WithdrawFrom(chainId, instance, asset, amount, recipient, skipRevert = false) {
1440
+ const { bundler3: { compoundV3MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1404
1441
  if (compoundV3MigrationAdapter == null)
1405
- throw new BundlerErrors.UnexpectedAction("compoundV3WithdrawFrom", chainId);
1406
- recipient ??= compoundV3MigrationAdapter;
1442
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV3WithdrawFrom", chainId);
1407
1443
  return [
1408
1444
  {
1409
1445
  to: compoundV3MigrationAdapter,
1410
- data: encodeFunctionData({
1411
- abi: compoundV3MigrationAdapterAbi,
1446
+ data: (0, viem_1.encodeFunctionData)({
1447
+ abi: abis_js_1.compoundV3MigrationAdapterAbi,
1412
1448
  functionName: "compoundV3WithdrawFrom",
1413
1449
  args: [instance, asset, amount, recipient],
1414
1450
  }),
1415
1451
  value: 0n,
1416
- skipRevert: false,
1417
- callbackHash: zeroHash,
1452
+ skipRevert,
1453
+ callbackHash: viem_1.zeroHash,
1418
1454
  },
1419
1455
  ];
1420
1456
  }
1421
1457
  BundlerAction.compoundV3WithdrawFrom = compoundV3WithdrawFrom;
1422
1458
  /**
1423
- * Encodes a call to the Adapter to allow the Bundler to act on the sender's position on CompoundV3.
1459
+ * Encodes a call to the CompoundV3 instance to allow the chain's CompoundV3MigrationAdapter.
1460
+ * to act on the sender's position on CompoundV3.
1424
1461
  * @param chainId The chain id for which to encode the call.
1425
1462
  * @param instance The CompoundV3 instance on which to submit the signature.
1426
1463
  * @param owner The owner of the CompoundV3 position.
@@ -1428,19 +1465,17 @@ export var BundlerAction;
1428
1465
  * @param nonce The nonce used to sign.
1429
1466
  * @param expiry The timestamp until which the signature is valid.
1430
1467
  * @param signature The Ethers signature to submit.
1431
- * @param manager The address of the manager to approve. Defaults to the chain's bundler3 CompoundV3MigrationAdapter.
1432
- * @param skipRevert Whether to allow the signature to revert without making the whole multicall revert.
1468
+ * @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
1433
1469
  */
1434
- function compoundV3AllowBySig(chainId, instance, owner, isAllowed, nonce, expiry, signature, manager, skipRevert = true) {
1435
- const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
1470
+ function compoundV3AllowBySig(chainId, instance, owner, isAllowed, nonce, expiry, signature, skipRevert = true) {
1471
+ const { bundler3: { compoundV3MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
1436
1472
  if (compoundV3MigrationAdapter == null)
1437
- throw new BundlerErrors.UnexpectedAction("compoundV3AllowBySig", chainId);
1438
- const { r, s, yParity } = parseSignature(signature);
1439
- manager ??= compoundV3MigrationAdapter;
1473
+ throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV3AllowBySig", chainId);
1474
+ const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
1440
1475
  return [
1441
1476
  {
1442
1477
  to: instance,
1443
- data: encodeFunctionData({
1478
+ data: (0, viem_1.encodeFunctionData)({
1444
1479
  abi: [
1445
1480
  {
1446
1481
  inputs: [
@@ -1460,13 +1495,22 @@ export var BundlerAction;
1460
1495
  },
1461
1496
  ],
1462
1497
  functionName: "allowBySig",
1463
- args: [owner, manager, isAllowed, nonce, expiry, yParity + 27, r, s],
1498
+ args: [
1499
+ owner,
1500
+ compoundV3MigrationAdapter,
1501
+ isAllowed,
1502
+ nonce,
1503
+ expiry,
1504
+ yParity + 27,
1505
+ r,
1506
+ s,
1507
+ ],
1464
1508
  }),
1465
1509
  value: 0n,
1466
1510
  skipRevert,
1467
- callbackHash: zeroHash,
1511
+ callbackHash: viem_1.zeroHash,
1468
1512
  },
1469
1513
  ];
1470
1514
  }
1471
1515
  BundlerAction.compoundV3AllowBySig = compoundV3AllowBySig;
1472
- })(BundlerAction || (BundlerAction = {}));
1516
+ })(BundlerAction || (exports.BundlerAction = BundlerAction = {}));