@morpho-org/bundler-sdk-viem 3.0.0 → 3.1.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/lib/ActionBundle.js +9 -4
- package/lib/BundlerAction.d.ts +9 -1
- package/lib/BundlerAction.js +260 -227
- package/lib/abis.js +80 -77
- package/lib/actions.js +75 -70
- package/lib/bundle.js +10 -6
- package/lib/errors.js +5 -2
- package/lib/index.js +24 -8
- package/lib/operations.js +81 -68
- package/lib/types/actions.d.ts +5 -0
- package/lib/types/actions.js +2 -1
- package/lib/types/index.js +18 -2
- package/lib/types/operations.js +16 -10
- package/package.json +8 -9
package/lib/BundlerAction.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
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
|
-
|
|
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
18
|
for (const { type, args } of actions) {
|
|
16
19
|
if (type !== "nativeTransfer")
|
|
@@ -25,8 +28,8 @@ export var BundlerAction;
|
|
|
25
28
|
return {
|
|
26
29
|
to: bundler3,
|
|
27
30
|
value,
|
|
28
|
-
data: encodeFunctionData({
|
|
29
|
-
abi: bundler3Abi,
|
|
31
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
32
|
+
abi: abis_js_1.bundler3Abi,
|
|
30
33
|
functionName: "multicall",
|
|
31
34
|
args: [encodedActions],
|
|
32
35
|
}),
|
|
@@ -56,20 +59,20 @@ export var BundlerAction;
|
|
|
56
59
|
case "permit": {
|
|
57
60
|
const [sender, asset, amount, deadline, signature, skipRevert] = args;
|
|
58
61
|
if (signature == null)
|
|
59
|
-
throw new BundlerErrors.MissingSignature();
|
|
62
|
+
throw new errors_js_1.BundlerErrors.MissingSignature();
|
|
60
63
|
return BundlerAction.permit(chainId, sender, asset, amount, deadline, signature, skipRevert);
|
|
61
64
|
}
|
|
62
65
|
case "permitDai": {
|
|
63
66
|
const [sender, nonce, expiry, allowed, signature, skipRevert] = args;
|
|
64
67
|
if (signature == null)
|
|
65
|
-
throw new BundlerErrors.MissingSignature();
|
|
68
|
+
throw new errors_js_1.BundlerErrors.MissingSignature();
|
|
66
69
|
return BundlerAction.permitDai(chainId, sender, nonce, expiry, allowed, signature, skipRevert);
|
|
67
70
|
}
|
|
68
71
|
/* Permit2 */
|
|
69
72
|
case "approve2": {
|
|
70
73
|
const [sender, permitSingle, signature, skipRevert] = args;
|
|
71
74
|
if (signature == null)
|
|
72
|
-
throw new BundlerErrors.MissingSignature();
|
|
75
|
+
throw new errors_js_1.BundlerErrors.MissingSignature();
|
|
73
76
|
return BundlerAction.approve2(chainId, sender, permitSingle, signature, skipRevert);
|
|
74
77
|
}
|
|
75
78
|
case "transferFrom2": {
|
|
@@ -92,7 +95,7 @@ export var BundlerAction;
|
|
|
92
95
|
case "morphoSetAuthorizationWithSig": {
|
|
93
96
|
const [authorization, signature, skipRevert] = args;
|
|
94
97
|
if (signature == null)
|
|
95
|
-
throw new BundlerErrors.MissingSignature();
|
|
98
|
+
throw new errors_js_1.BundlerErrors.MissingSignature();
|
|
96
99
|
return BundlerAction.morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert);
|
|
97
100
|
}
|
|
98
101
|
case "morphoSupply": {
|
|
@@ -169,7 +172,7 @@ export var BundlerAction;
|
|
|
169
172
|
case "aaveV3OptimizerApproveManagerWithSig": {
|
|
170
173
|
const [aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, skipRevert,] = args;
|
|
171
174
|
if (signature == null)
|
|
172
|
-
throw new BundlerErrors.MissingSignature();
|
|
175
|
+
throw new errors_js_1.BundlerErrors.MissingSignature();
|
|
173
176
|
return BundlerAction.aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, skipRevert);
|
|
174
177
|
}
|
|
175
178
|
/* CompoundV2 */
|
|
@@ -189,9 +192,13 @@ export var BundlerAction;
|
|
|
189
192
|
case "compoundV3AllowBySig": {
|
|
190
193
|
const [instance, owner, isAllowed, nonce, expiry, signature, skipRevert,] = args;
|
|
191
194
|
if (signature == null)
|
|
192
|
-
throw new BundlerErrors.MissingSignature();
|
|
195
|
+
throw new errors_js_1.BundlerErrors.MissingSignature();
|
|
193
196
|
return BundlerAction.compoundV3AllowBySig(chainId, instance, owner, isAllowed, nonce, expiry, signature, skipRevert);
|
|
194
197
|
}
|
|
198
|
+
/* MORPHO token */
|
|
199
|
+
case "morphoWrapperDepositFor": {
|
|
200
|
+
return BundlerAction.morphoWrapperDepositFor(chainId, ...args);
|
|
201
|
+
}
|
|
195
202
|
}
|
|
196
203
|
throw Error(`unhandled action encoding: ${type}`);
|
|
197
204
|
}
|
|
@@ -206,21 +213,21 @@ export var BundlerAction;
|
|
|
206
213
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
207
214
|
*/
|
|
208
215
|
function nativeTransfer(chainId, owner, recipient, amount, skipRevert = false) {
|
|
209
|
-
const { bundler3: { bundler3, generalAdapter1 }, } = getChainAddresses(chainId);
|
|
216
|
+
const { bundler3: { bundler3, generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
210
217
|
if (recipient === bundler3)
|
|
211
218
|
return [];
|
|
212
219
|
if (owner === generalAdapter1)
|
|
213
220
|
return [
|
|
214
221
|
{
|
|
215
222
|
to: generalAdapter1,
|
|
216
|
-
data: encodeFunctionData({
|
|
217
|
-
abi: coreAdapterAbi,
|
|
223
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
224
|
+
abi: abis_js_1.coreAdapterAbi,
|
|
218
225
|
functionName: "nativeTransfer",
|
|
219
226
|
args: [recipient, amount],
|
|
220
227
|
}),
|
|
221
228
|
value: 0n,
|
|
222
229
|
skipRevert: false,
|
|
223
|
-
callbackHash: zeroHash,
|
|
230
|
+
callbackHash: viem_1.zeroHash,
|
|
224
231
|
},
|
|
225
232
|
];
|
|
226
233
|
return [
|
|
@@ -229,7 +236,7 @@ export var BundlerAction;
|
|
|
229
236
|
data: "0x",
|
|
230
237
|
value: amount,
|
|
231
238
|
skipRevert,
|
|
232
|
-
callbackHash: zeroHash,
|
|
239
|
+
callbackHash: viem_1.zeroHash,
|
|
233
240
|
},
|
|
234
241
|
];
|
|
235
242
|
}
|
|
@@ -247,14 +254,14 @@ export var BundlerAction;
|
|
|
247
254
|
return [
|
|
248
255
|
{
|
|
249
256
|
to: adapter,
|
|
250
|
-
data: encodeFunctionData({
|
|
251
|
-
abi: coreAdapterAbi,
|
|
257
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
258
|
+
abi: abis_js_1.coreAdapterAbi,
|
|
252
259
|
functionName: "erc20Transfer",
|
|
253
260
|
args: [asset, recipient, amount],
|
|
254
261
|
}),
|
|
255
262
|
value: 0n,
|
|
256
263
|
skipRevert,
|
|
257
|
-
callbackHash: zeroHash,
|
|
264
|
+
callbackHash: viem_1.zeroHash,
|
|
258
265
|
},
|
|
259
266
|
];
|
|
260
267
|
}
|
|
@@ -268,18 +275,18 @@ export var BundlerAction;
|
|
|
268
275
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
269
276
|
*/
|
|
270
277
|
function erc20TransferFrom(chainId, asset, amount, recipient, skipRevert = false) {
|
|
271
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
278
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
272
279
|
return [
|
|
273
280
|
{
|
|
274
281
|
to: generalAdapter1,
|
|
275
|
-
data: encodeFunctionData({
|
|
276
|
-
abi: generalAdapter1Abi,
|
|
282
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
283
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
277
284
|
functionName: "erc20TransferFrom",
|
|
278
285
|
args: [asset, recipient, amount],
|
|
279
286
|
}),
|
|
280
287
|
value: 0n,
|
|
281
288
|
skipRevert,
|
|
282
|
-
callbackHash: zeroHash,
|
|
289
|
+
callbackHash: viem_1.zeroHash,
|
|
283
290
|
},
|
|
284
291
|
];
|
|
285
292
|
}
|
|
@@ -296,13 +303,13 @@ export var BundlerAction;
|
|
|
296
303
|
* @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
|
|
297
304
|
*/
|
|
298
305
|
function permit(chainId, owner, asset, amount, deadline, signature, skipRevert = true) {
|
|
299
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
300
|
-
const { r, s, yParity } = parseSignature(signature);
|
|
306
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
307
|
+
const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
|
|
301
308
|
return [
|
|
302
309
|
{
|
|
303
310
|
to: asset,
|
|
304
|
-
data: encodeFunctionData({
|
|
305
|
-
abi: erc2612Abi,
|
|
311
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
312
|
+
abi: blue_sdk_viem_1.erc2612Abi,
|
|
306
313
|
functionName: "permit",
|
|
307
314
|
args: [
|
|
308
315
|
owner,
|
|
@@ -318,7 +325,7 @@ export var BundlerAction;
|
|
|
318
325
|
}),
|
|
319
326
|
value: 0n,
|
|
320
327
|
skipRevert,
|
|
321
|
-
callbackHash: zeroHash,
|
|
328
|
+
callbackHash: viem_1.zeroHash,
|
|
322
329
|
},
|
|
323
330
|
];
|
|
324
331
|
}
|
|
@@ -334,14 +341,14 @@ export var BundlerAction;
|
|
|
334
341
|
* @param skipRevert Whether to allow the permit to revert without making the whole bundle revert.
|
|
335
342
|
*/
|
|
336
343
|
function permitDai(chainId, owner, nonce, expiry, allowed, signature, skipRevert = true) {
|
|
337
|
-
const { dai, bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
344
|
+
const { dai, bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
338
345
|
if (dai == null)
|
|
339
|
-
throw new BundlerErrors.UnexpectedAction("permitDai", chainId);
|
|
340
|
-
const { r, s, yParity } = parseSignature(signature);
|
|
346
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("permitDai", chainId);
|
|
347
|
+
const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
|
|
341
348
|
return [
|
|
342
349
|
{
|
|
343
350
|
to: dai,
|
|
344
|
-
data: encodeFunctionData({
|
|
351
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
345
352
|
abi: [
|
|
346
353
|
{
|
|
347
354
|
constant: false,
|
|
@@ -378,7 +385,7 @@ export var BundlerAction;
|
|
|
378
385
|
}),
|
|
379
386
|
value: 0n,
|
|
380
387
|
skipRevert,
|
|
381
|
-
callbackHash: zeroHash,
|
|
388
|
+
callbackHash: viem_1.zeroHash,
|
|
382
389
|
},
|
|
383
390
|
];
|
|
384
391
|
}
|
|
@@ -393,14 +400,14 @@ export var BundlerAction;
|
|
|
393
400
|
* @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
|
|
394
401
|
*/
|
|
395
402
|
function approve2(chainId, owner, permitSingle, signature, skipRevert = true) {
|
|
396
|
-
const { permit2, bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
403
|
+
const { permit2, bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
397
404
|
if (permit2 == null)
|
|
398
|
-
throw new BundlerErrors.UnexpectedAction("approve2", chainId);
|
|
405
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("approve2", chainId);
|
|
399
406
|
return [
|
|
400
407
|
{
|
|
401
408
|
to: permit2,
|
|
402
|
-
data: encodeFunctionData({
|
|
403
|
-
abi: permit2Abi,
|
|
409
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
410
|
+
abi: blue_sdk_viem_1.permit2Abi,
|
|
404
411
|
functionName: "permit",
|
|
405
412
|
args: [
|
|
406
413
|
owner,
|
|
@@ -415,7 +422,7 @@ export var BundlerAction;
|
|
|
415
422
|
}),
|
|
416
423
|
value: 0n,
|
|
417
424
|
skipRevert,
|
|
418
|
-
callbackHash: zeroHash,
|
|
425
|
+
callbackHash: viem_1.zeroHash,
|
|
419
426
|
},
|
|
420
427
|
];
|
|
421
428
|
}
|
|
@@ -430,22 +437,48 @@ export var BundlerAction;
|
|
|
430
437
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
431
438
|
*/
|
|
432
439
|
function transferFrom2(chainId, asset, amount, recipient, skipRevert = false) {
|
|
433
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
440
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
434
441
|
return [
|
|
435
442
|
{
|
|
436
443
|
to: generalAdapter1,
|
|
437
|
-
data: encodeFunctionData({
|
|
438
|
-
abi: generalAdapter1Abi,
|
|
444
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
445
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
439
446
|
functionName: "permit2TransferFrom",
|
|
440
447
|
args: [asset, recipient, amount],
|
|
441
448
|
}),
|
|
442
449
|
value: 0n,
|
|
443
450
|
skipRevert,
|
|
444
|
-
callbackHash: zeroHash,
|
|
451
|
+
callbackHash: viem_1.zeroHash,
|
|
445
452
|
},
|
|
446
453
|
];
|
|
447
454
|
}
|
|
448
455
|
BundlerAction.transferFrom2 = transferFrom2;
|
|
456
|
+
/**
|
|
457
|
+
* Encodes a call to the GeneralAdapter1 to wrap legacy MORPHO tokens.
|
|
458
|
+
* @param chainId The chain id for which to encode the call.
|
|
459
|
+
* @param recipient The recipient of MORPHO tokens.
|
|
460
|
+
* @param amount The amount of tokens to wrap.
|
|
461
|
+
* @param skipRevert Whether to allow the wrap to revert without making the whole bundler revert. Defaults to false.
|
|
462
|
+
*/
|
|
463
|
+
function morphoWrapperDepositFor(chainId, recipient, amount, skipRevert = false) {
|
|
464
|
+
if (chainId !== blue_sdk_1.ChainId.EthMainnet)
|
|
465
|
+
throw new Error("MORPHO wrapping is only available on ethereum mainnet");
|
|
466
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
467
|
+
return [
|
|
468
|
+
{
|
|
469
|
+
to: generalAdapter1,
|
|
470
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
471
|
+
abi: abis_js_1.ethereumGeneralAdapter1Abi,
|
|
472
|
+
functionName: "morphoWrapperDepositFor",
|
|
473
|
+
args: [recipient, amount],
|
|
474
|
+
}),
|
|
475
|
+
value: 0n,
|
|
476
|
+
skipRevert,
|
|
477
|
+
callbackHash: viem_1.zeroHash,
|
|
478
|
+
},
|
|
479
|
+
];
|
|
480
|
+
}
|
|
481
|
+
BundlerAction.morphoWrapperDepositFor = morphoWrapperDepositFor;
|
|
449
482
|
/* ERC20 Wrapper */
|
|
450
483
|
/**
|
|
451
484
|
* Encodes a call to the GeneralAdapter1 to wrap ERC20 tokens via the provided ERC20Wrapper.
|
|
@@ -456,42 +489,42 @@ export var BundlerAction;
|
|
|
456
489
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
457
490
|
*/
|
|
458
491
|
function erc20WrapperDepositFor(chainId, wrapper, underlying, amount, skipRevert = false) {
|
|
459
|
-
const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = getChainAddresses(chainId);
|
|
492
|
+
const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
460
493
|
if (erc20WrapperAdapter == null)
|
|
461
|
-
throw new BundlerErrors.UnexpectedAction("erc20WrapperDepositFor", chainId);
|
|
494
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("erc20WrapperDepositFor", chainId);
|
|
462
495
|
return [
|
|
463
496
|
{
|
|
464
497
|
to: generalAdapter1,
|
|
465
|
-
data: encodeFunctionData({
|
|
466
|
-
abi: generalAdapter1Abi,
|
|
498
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
499
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
467
500
|
functionName: "erc20Transfer",
|
|
468
|
-
args: [underlying, erc20WrapperAdapter, maxUint256],
|
|
501
|
+
args: [underlying, erc20WrapperAdapter, viem_1.maxUint256],
|
|
469
502
|
}),
|
|
470
503
|
value: 0n,
|
|
471
504
|
skipRevert,
|
|
472
|
-
callbackHash: zeroHash,
|
|
505
|
+
callbackHash: viem_1.zeroHash,
|
|
473
506
|
},
|
|
474
507
|
{
|
|
475
508
|
to: erc20WrapperAdapter,
|
|
476
|
-
data: encodeFunctionData({
|
|
477
|
-
abi: erc20WrapperAdapterAbi,
|
|
509
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
510
|
+
abi: abis_js_1.erc20WrapperAdapterAbi,
|
|
478
511
|
functionName: "erc20WrapperDepositFor",
|
|
479
512
|
args: [wrapper, amount],
|
|
480
513
|
}),
|
|
481
514
|
value: 0n,
|
|
482
515
|
skipRevert,
|
|
483
|
-
callbackHash: zeroHash,
|
|
516
|
+
callbackHash: viem_1.zeroHash,
|
|
484
517
|
},
|
|
485
518
|
{
|
|
486
519
|
to: erc20WrapperAdapter,
|
|
487
|
-
data: encodeFunctionData({
|
|
488
|
-
abi: erc20WrapperAdapterAbi,
|
|
520
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
521
|
+
abi: abis_js_1.erc20WrapperAdapterAbi,
|
|
489
522
|
functionName: "erc20Transfer",
|
|
490
|
-
args: [underlying, generalAdapter1, maxUint256],
|
|
523
|
+
args: [underlying, generalAdapter1, viem_1.maxUint256],
|
|
491
524
|
}),
|
|
492
525
|
value: 0n,
|
|
493
526
|
skipRevert,
|
|
494
|
-
callbackHash: zeroHash,
|
|
527
|
+
callbackHash: viem_1.zeroHash,
|
|
495
528
|
},
|
|
496
529
|
];
|
|
497
530
|
}
|
|
@@ -505,42 +538,42 @@ export var BundlerAction;
|
|
|
505
538
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
506
539
|
*/
|
|
507
540
|
function erc20WrapperWithdrawTo(chainId, wrapper, receiver, amount, skipRevert = false) {
|
|
508
|
-
const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = getChainAddresses(chainId);
|
|
541
|
+
const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
509
542
|
if (erc20WrapperAdapter == null)
|
|
510
|
-
throw new BundlerErrors.UnexpectedAction("erc20WrapperWithdrawTo", chainId);
|
|
543
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("erc20WrapperWithdrawTo", chainId);
|
|
511
544
|
return [
|
|
512
545
|
{
|
|
513
546
|
to: generalAdapter1,
|
|
514
|
-
data: encodeFunctionData({
|
|
515
|
-
abi: generalAdapter1Abi,
|
|
547
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
548
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
516
549
|
functionName: "erc20Transfer",
|
|
517
|
-
args: [wrapper, erc20WrapperAdapter, maxUint256],
|
|
550
|
+
args: [wrapper, erc20WrapperAdapter, viem_1.maxUint256],
|
|
518
551
|
}),
|
|
519
552
|
value: 0n,
|
|
520
553
|
skipRevert,
|
|
521
|
-
callbackHash: zeroHash,
|
|
554
|
+
callbackHash: viem_1.zeroHash,
|
|
522
555
|
},
|
|
523
556
|
{
|
|
524
557
|
to: erc20WrapperAdapter,
|
|
525
|
-
data: encodeFunctionData({
|
|
526
|
-
abi: erc20WrapperAdapterAbi,
|
|
558
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
559
|
+
abi: abis_js_1.erc20WrapperAdapterAbi,
|
|
527
560
|
functionName: "erc20WrapperWithdrawTo",
|
|
528
561
|
args: [wrapper, receiver, amount],
|
|
529
562
|
}),
|
|
530
563
|
value: 0n,
|
|
531
564
|
skipRevert,
|
|
532
|
-
callbackHash: zeroHash,
|
|
565
|
+
callbackHash: viem_1.zeroHash,
|
|
533
566
|
},
|
|
534
567
|
{
|
|
535
568
|
to: erc20WrapperAdapter,
|
|
536
|
-
data: encodeFunctionData({
|
|
537
|
-
abi: erc20WrapperAdapterAbi,
|
|
569
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
570
|
+
abi: abis_js_1.erc20WrapperAdapterAbi,
|
|
538
571
|
functionName: "erc20Transfer",
|
|
539
|
-
args: [wrapper, generalAdapter1, maxUint256],
|
|
572
|
+
args: [wrapper, generalAdapter1, viem_1.maxUint256],
|
|
540
573
|
}),
|
|
541
574
|
value: 0n,
|
|
542
575
|
skipRevert,
|
|
543
|
-
callbackHash: zeroHash,
|
|
576
|
+
callbackHash: viem_1.zeroHash,
|
|
544
577
|
},
|
|
545
578
|
];
|
|
546
579
|
}
|
|
@@ -556,18 +589,18 @@ export var BundlerAction;
|
|
|
556
589
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
557
590
|
*/
|
|
558
591
|
function erc4626Mint(chainId, erc4626, shares, maxSharePrice, receiver, skipRevert = false) {
|
|
559
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
592
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
560
593
|
return [
|
|
561
594
|
{
|
|
562
595
|
to: generalAdapter1,
|
|
563
|
-
data: encodeFunctionData({
|
|
564
|
-
abi: generalAdapter1Abi,
|
|
596
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
597
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
565
598
|
functionName: "erc4626Mint",
|
|
566
599
|
args: [erc4626, shares, maxSharePrice, receiver],
|
|
567
600
|
}),
|
|
568
601
|
value: 0n,
|
|
569
602
|
skipRevert,
|
|
570
|
-
callbackHash: zeroHash,
|
|
603
|
+
callbackHash: viem_1.zeroHash,
|
|
571
604
|
},
|
|
572
605
|
];
|
|
573
606
|
}
|
|
@@ -582,18 +615,18 @@ export var BundlerAction;
|
|
|
582
615
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
583
616
|
*/
|
|
584
617
|
function erc4626Deposit(chainId, erc4626, assets, maxSharePrice, receiver, skipRevert = false) {
|
|
585
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
618
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
586
619
|
return [
|
|
587
620
|
{
|
|
588
621
|
to: generalAdapter1,
|
|
589
|
-
data: encodeFunctionData({
|
|
590
|
-
abi: generalAdapter1Abi,
|
|
622
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
623
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
591
624
|
functionName: "erc4626Deposit",
|
|
592
625
|
args: [erc4626, assets, maxSharePrice, receiver],
|
|
593
626
|
}),
|
|
594
627
|
value: 0n,
|
|
595
628
|
skipRevert,
|
|
596
|
-
callbackHash: zeroHash,
|
|
629
|
+
callbackHash: viem_1.zeroHash,
|
|
597
630
|
},
|
|
598
631
|
];
|
|
599
632
|
}
|
|
@@ -609,18 +642,18 @@ export var BundlerAction;
|
|
|
609
642
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
610
643
|
*/
|
|
611
644
|
function erc4626Withdraw(chainId, erc4626, assets, minSharePrice, receiver, owner, skipRevert = false) {
|
|
612
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
645
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
613
646
|
return [
|
|
614
647
|
{
|
|
615
648
|
to: generalAdapter1,
|
|
616
|
-
data: encodeFunctionData({
|
|
617
|
-
abi: generalAdapter1Abi,
|
|
649
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
650
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
618
651
|
functionName: "erc4626Withdraw",
|
|
619
652
|
args: [erc4626, assets, minSharePrice, receiver, owner],
|
|
620
653
|
}),
|
|
621
654
|
value: 0n,
|
|
622
655
|
skipRevert,
|
|
623
|
-
callbackHash: zeroHash,
|
|
656
|
+
callbackHash: viem_1.zeroHash,
|
|
624
657
|
},
|
|
625
658
|
];
|
|
626
659
|
}
|
|
@@ -636,18 +669,18 @@ export var BundlerAction;
|
|
|
636
669
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
637
670
|
*/
|
|
638
671
|
function erc4626Redeem(chainId, erc4626, shares, minSharePrice, receiver, owner, skipRevert = false) {
|
|
639
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
672
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
640
673
|
return [
|
|
641
674
|
{
|
|
642
675
|
to: generalAdapter1,
|
|
643
|
-
data: encodeFunctionData({
|
|
644
|
-
abi: generalAdapter1Abi,
|
|
676
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
677
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
645
678
|
functionName: "erc4626Redeem",
|
|
646
679
|
args: [erc4626, shares, minSharePrice, receiver, owner],
|
|
647
680
|
}),
|
|
648
681
|
value: 0n,
|
|
649
682
|
skipRevert,
|
|
650
|
-
callbackHash: zeroHash,
|
|
683
|
+
callbackHash: viem_1.zeroHash,
|
|
651
684
|
},
|
|
652
685
|
];
|
|
653
686
|
}
|
|
@@ -661,21 +694,21 @@ export var BundlerAction;
|
|
|
661
694
|
* @param skipRevert Whether to allow the authorization call to revert without making the whole bundle revert. Defaults to true.
|
|
662
695
|
*/
|
|
663
696
|
function morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert = true) {
|
|
664
|
-
const { morpho, bundler3: { bundler3 }, } = getChainAddresses(chainId);
|
|
665
|
-
const { r, s, yParity } = parseSignature(signature);
|
|
697
|
+
const { morpho, bundler3: { bundler3 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
698
|
+
const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
|
|
666
699
|
if (authorization.authorized === bundler3)
|
|
667
|
-
throw new BundlerErrors.UnexpectedSignature(authorization.authorized);
|
|
700
|
+
throw new errors_js_1.BundlerErrors.UnexpectedSignature(authorization.authorized);
|
|
668
701
|
return [
|
|
669
702
|
{
|
|
670
703
|
to: morpho,
|
|
671
|
-
data: encodeFunctionData({
|
|
672
|
-
abi: blueAbi,
|
|
704
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
705
|
+
abi: blue_sdk_viem_1.blueAbi,
|
|
673
706
|
functionName: "setAuthorizationWithSig",
|
|
674
707
|
args: [authorization, { v: yParity + 27, r, s }],
|
|
675
708
|
}),
|
|
676
709
|
value: 0n,
|
|
677
710
|
skipRevert,
|
|
678
|
-
callbackHash: zeroHash,
|
|
711
|
+
callbackHash: viem_1.zeroHash,
|
|
679
712
|
},
|
|
680
713
|
];
|
|
681
714
|
}
|
|
@@ -692,22 +725,22 @@ export var BundlerAction;
|
|
|
692
725
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
693
726
|
*/
|
|
694
727
|
function morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
|
|
695
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
728
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
696
729
|
const reenter = callbackCalls.length > 0;
|
|
697
730
|
const reenterData = reenter
|
|
698
|
-
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
731
|
+
? (0, viem_1.encodeAbiParameters)(reenterAbiInputs, [callbackCalls])
|
|
699
732
|
: "0x";
|
|
700
733
|
return [
|
|
701
734
|
{
|
|
702
735
|
to: generalAdapter1,
|
|
703
|
-
data: encodeFunctionData({
|
|
704
|
-
abi: generalAdapter1Abi,
|
|
736
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
737
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
705
738
|
functionName: "morphoSupply",
|
|
706
739
|
args: [market, assets, shares, slippageAmount, onBehalf, reenterData],
|
|
707
740
|
}),
|
|
708
741
|
value: 0n,
|
|
709
742
|
skipRevert,
|
|
710
|
-
callbackHash: reenter ? keccak256(reenterData) : zeroHash,
|
|
743
|
+
callbackHash: reenter ? (0, viem_1.keccak256)(reenterData) : viem_1.zeroHash,
|
|
711
744
|
},
|
|
712
745
|
];
|
|
713
746
|
}
|
|
@@ -722,22 +755,22 @@ export var BundlerAction;
|
|
|
722
755
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
723
756
|
*/
|
|
724
757
|
function morphoSupplyCollateral(chainId, market, assets, onBehalf, callbackCalls, skipRevert = false) {
|
|
725
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
758
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
726
759
|
const reenter = callbackCalls.length > 0;
|
|
727
760
|
const reenterData = reenter
|
|
728
|
-
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
761
|
+
? (0, viem_1.encodeAbiParameters)(reenterAbiInputs, [callbackCalls])
|
|
729
762
|
: "0x";
|
|
730
763
|
return [
|
|
731
764
|
{
|
|
732
765
|
to: generalAdapter1,
|
|
733
|
-
data: encodeFunctionData({
|
|
734
|
-
abi: generalAdapter1Abi,
|
|
766
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
767
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
735
768
|
functionName: "morphoSupplyCollateral",
|
|
736
769
|
args: [market, assets, onBehalf, reenterData],
|
|
737
770
|
}),
|
|
738
771
|
value: 0n,
|
|
739
772
|
skipRevert,
|
|
740
|
-
callbackHash: reenter ? keccak256(reenterData) : zeroHash,
|
|
773
|
+
callbackHash: reenter ? (0, viem_1.keccak256)(reenterData) : viem_1.zeroHash,
|
|
741
774
|
},
|
|
742
775
|
];
|
|
743
776
|
}
|
|
@@ -753,18 +786,18 @@ export var BundlerAction;
|
|
|
753
786
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
754
787
|
*/
|
|
755
788
|
function morphoBorrow(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
|
|
756
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
789
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
757
790
|
return [
|
|
758
791
|
{
|
|
759
792
|
to: generalAdapter1,
|
|
760
|
-
data: encodeFunctionData({
|
|
761
|
-
abi: generalAdapter1Abi,
|
|
793
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
794
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
762
795
|
functionName: "morphoBorrow",
|
|
763
796
|
args: [market, assets, shares, slippageAmount, receiver],
|
|
764
797
|
}),
|
|
765
798
|
value: 0n,
|
|
766
799
|
skipRevert,
|
|
767
|
-
callbackHash: zeroHash,
|
|
800
|
+
callbackHash: viem_1.zeroHash,
|
|
768
801
|
},
|
|
769
802
|
];
|
|
770
803
|
}
|
|
@@ -781,22 +814,22 @@ export var BundlerAction;
|
|
|
781
814
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
782
815
|
*/
|
|
783
816
|
function morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
|
|
784
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
817
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
785
818
|
const reenter = callbackCalls.length > 0;
|
|
786
819
|
const reenterData = reenter
|
|
787
|
-
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
820
|
+
? (0, viem_1.encodeAbiParameters)(reenterAbiInputs, [callbackCalls])
|
|
788
821
|
: "0x";
|
|
789
822
|
return [
|
|
790
823
|
{
|
|
791
824
|
to: generalAdapter1,
|
|
792
|
-
data: encodeFunctionData({
|
|
793
|
-
abi: generalAdapter1Abi,
|
|
825
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
826
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
794
827
|
functionName: "morphoRepay",
|
|
795
828
|
args: [market, assets, shares, slippageAmount, onBehalf, reenterData],
|
|
796
829
|
}),
|
|
797
830
|
value: 0n,
|
|
798
831
|
skipRevert,
|
|
799
|
-
callbackHash: reenter ? keccak256(reenterData) : zeroHash,
|
|
832
|
+
callbackHash: reenter ? (0, viem_1.keccak256)(reenterData) : viem_1.zeroHash,
|
|
800
833
|
},
|
|
801
834
|
];
|
|
802
835
|
}
|
|
@@ -812,18 +845,18 @@ export var BundlerAction;
|
|
|
812
845
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
813
846
|
*/
|
|
814
847
|
function morphoWithdraw(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
|
|
815
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
848
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
816
849
|
return [
|
|
817
850
|
{
|
|
818
851
|
to: generalAdapter1,
|
|
819
|
-
data: encodeFunctionData({
|
|
820
|
-
abi: generalAdapter1Abi,
|
|
852
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
853
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
821
854
|
functionName: "morphoWithdraw",
|
|
822
855
|
args: [market, assets, shares, slippageAmount, receiver],
|
|
823
856
|
}),
|
|
824
857
|
value: 0n,
|
|
825
858
|
skipRevert,
|
|
826
|
-
callbackHash: zeroHash,
|
|
859
|
+
callbackHash: viem_1.zeroHash,
|
|
827
860
|
},
|
|
828
861
|
];
|
|
829
862
|
}
|
|
@@ -837,18 +870,18 @@ export var BundlerAction;
|
|
|
837
870
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
838
871
|
*/
|
|
839
872
|
function morphoWithdrawCollateral(chainId, market, assets, receiver, skipRevert = false) {
|
|
840
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
873
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
841
874
|
return [
|
|
842
875
|
{
|
|
843
876
|
to: generalAdapter1,
|
|
844
|
-
data: encodeFunctionData({
|
|
845
|
-
abi: generalAdapter1Abi,
|
|
877
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
878
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
846
879
|
functionName: "morphoWithdrawCollateral",
|
|
847
880
|
args: [market, assets, receiver],
|
|
848
881
|
}),
|
|
849
882
|
value: 0n,
|
|
850
883
|
skipRevert,
|
|
851
|
-
callbackHash: zeroHash,
|
|
884
|
+
callbackHash: viem_1.zeroHash,
|
|
852
885
|
},
|
|
853
886
|
];
|
|
854
887
|
}
|
|
@@ -862,22 +895,22 @@ export var BundlerAction;
|
|
|
862
895
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
863
896
|
*/
|
|
864
897
|
function morphoFlashLoan(chainId, asset, amount, callbackCalls, skipRevert = false) {
|
|
865
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
898
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
866
899
|
const reenter = callbackCalls.length > 0;
|
|
867
900
|
const reenterData = reenter
|
|
868
|
-
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
901
|
+
? (0, viem_1.encodeAbiParameters)(reenterAbiInputs, [callbackCalls])
|
|
869
902
|
: "0x";
|
|
870
903
|
return [
|
|
871
904
|
{
|
|
872
905
|
to: generalAdapter1,
|
|
873
|
-
data: encodeFunctionData({
|
|
874
|
-
abi: generalAdapter1Abi,
|
|
906
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
907
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
875
908
|
functionName: "morphoFlashLoan",
|
|
876
909
|
args: [
|
|
877
910
|
asset,
|
|
878
911
|
amount,
|
|
879
|
-
encodeFunctionData({
|
|
880
|
-
abi: bundler3Abi,
|
|
912
|
+
(0, viem_1.encodeFunctionData)({
|
|
913
|
+
abi: abis_js_1.bundler3Abi,
|
|
881
914
|
functionName: "reenter",
|
|
882
915
|
args: [callbackCalls],
|
|
883
916
|
}),
|
|
@@ -885,7 +918,7 @@ export var BundlerAction;
|
|
|
885
918
|
}),
|
|
886
919
|
value: 0n,
|
|
887
920
|
skipRevert,
|
|
888
|
-
callbackHash: reenter ? keccak256(reenterData) : zeroHash,
|
|
921
|
+
callbackHash: reenter ? (0, viem_1.keccak256)(reenterData) : viem_1.zeroHash,
|
|
889
922
|
},
|
|
890
923
|
];
|
|
891
924
|
}
|
|
@@ -900,20 +933,20 @@ export var BundlerAction;
|
|
|
900
933
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
901
934
|
*/
|
|
902
935
|
function publicAllocatorReallocateTo(chainId, vault, fee, withdrawals, supplyMarketParams, skipRevert = false) {
|
|
903
|
-
const { publicAllocator } = getChainAddresses(chainId);
|
|
936
|
+
const { publicAllocator } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
904
937
|
if (publicAllocator == null)
|
|
905
|
-
throw new BundlerErrors.UnexpectedAction("reallocateTo", chainId);
|
|
938
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("reallocateTo", chainId);
|
|
906
939
|
return [
|
|
907
940
|
{
|
|
908
941
|
to: publicAllocator,
|
|
909
|
-
data: encodeFunctionData({
|
|
910
|
-
abi: publicAllocatorAbi,
|
|
942
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
943
|
+
abi: blue_sdk_viem_1.publicAllocatorAbi,
|
|
911
944
|
functionName: "reallocateTo",
|
|
912
945
|
args: [vault, withdrawals, supplyMarketParams],
|
|
913
946
|
}),
|
|
914
947
|
value: fee,
|
|
915
948
|
skipRevert,
|
|
916
|
-
callbackHash: zeroHash,
|
|
949
|
+
callbackHash: viem_1.zeroHash,
|
|
917
950
|
},
|
|
918
951
|
];
|
|
919
952
|
}
|
|
@@ -933,14 +966,14 @@ export var BundlerAction;
|
|
|
933
966
|
return [
|
|
934
967
|
{
|
|
935
968
|
to: distributor,
|
|
936
|
-
data: encodeFunctionData({
|
|
937
|
-
abi: universalRewardsDistributorAbi,
|
|
969
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
970
|
+
abi: abis_js_1.universalRewardsDistributorAbi,
|
|
938
971
|
functionName: "claim",
|
|
939
972
|
args: [account, reward, amount, proof],
|
|
940
973
|
}),
|
|
941
974
|
value: 0n,
|
|
942
975
|
skipRevert,
|
|
943
|
-
callbackHash: zeroHash,
|
|
976
|
+
callbackHash: viem_1.zeroHash,
|
|
944
977
|
},
|
|
945
978
|
];
|
|
946
979
|
}
|
|
@@ -954,18 +987,18 @@ export var BundlerAction;
|
|
|
954
987
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
955
988
|
*/
|
|
956
989
|
function wrapNative(chainId, amount, recipient, skipRevert = false) {
|
|
957
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
990
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
958
991
|
return [
|
|
959
992
|
{
|
|
960
993
|
to: generalAdapter1,
|
|
961
|
-
data: encodeFunctionData({
|
|
962
|
-
abi: generalAdapter1Abi,
|
|
994
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
995
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
963
996
|
functionName: "wrapNative",
|
|
964
997
|
args: [amount, recipient],
|
|
965
998
|
}),
|
|
966
999
|
value: 0n,
|
|
967
1000
|
skipRevert,
|
|
968
|
-
callbackHash: zeroHash,
|
|
1001
|
+
callbackHash: viem_1.zeroHash,
|
|
969
1002
|
},
|
|
970
1003
|
];
|
|
971
1004
|
}
|
|
@@ -978,18 +1011,18 @@ export var BundlerAction;
|
|
|
978
1011
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
979
1012
|
*/
|
|
980
1013
|
function unwrapNative(chainId, amount, recipient, skipRevert = false) {
|
|
981
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
1014
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
982
1015
|
return [
|
|
983
1016
|
{
|
|
984
1017
|
to: generalAdapter1,
|
|
985
|
-
data: encodeFunctionData({
|
|
986
|
-
abi: generalAdapter1Abi,
|
|
1018
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1019
|
+
abi: abis_js_1.generalAdapter1Abi,
|
|
987
1020
|
functionName: "unwrapNative",
|
|
988
1021
|
args: [amount, recipient],
|
|
989
1022
|
}),
|
|
990
1023
|
value: 0n,
|
|
991
1024
|
skipRevert,
|
|
992
|
-
callbackHash: zeroHash,
|
|
1025
|
+
callbackHash: viem_1.zeroHash,
|
|
993
1026
|
},
|
|
994
1027
|
];
|
|
995
1028
|
}
|
|
@@ -1005,18 +1038,18 @@ export var BundlerAction;
|
|
|
1005
1038
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1006
1039
|
*/
|
|
1007
1040
|
function stakeEth(chainId, amount, maxSharePrice, referral, recipient, skipRevert = false) {
|
|
1008
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
1041
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1009
1042
|
return [
|
|
1010
1043
|
{
|
|
1011
1044
|
to: generalAdapter1,
|
|
1012
|
-
data: encodeFunctionData({
|
|
1013
|
-
abi: ethereumGeneralAdapter1Abi,
|
|
1045
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1046
|
+
abi: abis_js_1.ethereumGeneralAdapter1Abi,
|
|
1014
1047
|
functionName: "stakeEth",
|
|
1015
1048
|
args: [amount, maxSharePrice, referral, recipient],
|
|
1016
1049
|
}),
|
|
1017
1050
|
value: 0n,
|
|
1018
1051
|
skipRevert,
|
|
1019
|
-
callbackHash: zeroHash,
|
|
1052
|
+
callbackHash: viem_1.zeroHash,
|
|
1020
1053
|
},
|
|
1021
1054
|
];
|
|
1022
1055
|
}
|
|
@@ -1030,18 +1063,18 @@ export var BundlerAction;
|
|
|
1030
1063
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1031
1064
|
*/
|
|
1032
1065
|
function wrapStEth(chainId, amount, recipient, skipRevert = false) {
|
|
1033
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
1066
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1034
1067
|
return [
|
|
1035
1068
|
{
|
|
1036
1069
|
to: generalAdapter1,
|
|
1037
|
-
data: encodeFunctionData({
|
|
1038
|
-
abi: ethereumGeneralAdapter1Abi,
|
|
1070
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1071
|
+
abi: abis_js_1.ethereumGeneralAdapter1Abi,
|
|
1039
1072
|
functionName: "wrapStEth",
|
|
1040
1073
|
args: [amount, recipient],
|
|
1041
1074
|
}),
|
|
1042
1075
|
value: 0n,
|
|
1043
1076
|
skipRevert,
|
|
1044
|
-
callbackHash: zeroHash,
|
|
1077
|
+
callbackHash: viem_1.zeroHash,
|
|
1045
1078
|
},
|
|
1046
1079
|
];
|
|
1047
1080
|
}
|
|
@@ -1054,18 +1087,18 @@ export var BundlerAction;
|
|
|
1054
1087
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1055
1088
|
*/
|
|
1056
1089
|
function unwrapStEth(chainId, amount, recipient, skipRevert = false) {
|
|
1057
|
-
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
1090
|
+
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1058
1091
|
return [
|
|
1059
1092
|
{
|
|
1060
1093
|
to: generalAdapter1,
|
|
1061
|
-
data: encodeFunctionData({
|
|
1062
|
-
abi: ethereumGeneralAdapter1Abi,
|
|
1094
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1095
|
+
abi: abis_js_1.ethereumGeneralAdapter1Abi,
|
|
1063
1096
|
functionName: "unwrapStEth",
|
|
1064
1097
|
args: [amount, recipient],
|
|
1065
1098
|
}),
|
|
1066
1099
|
value: 0n,
|
|
1067
1100
|
skipRevert,
|
|
1068
|
-
callbackHash: zeroHash,
|
|
1101
|
+
callbackHash: viem_1.zeroHash,
|
|
1069
1102
|
},
|
|
1070
1103
|
];
|
|
1071
1104
|
}
|
|
@@ -1081,20 +1114,20 @@ export var BundlerAction;
|
|
|
1081
1114
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1082
1115
|
*/
|
|
1083
1116
|
function aaveV2Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
|
|
1084
|
-
const { bundler3: { aaveV2MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1117
|
+
const { bundler3: { aaveV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1085
1118
|
if (aaveV2MigrationAdapter == null)
|
|
1086
|
-
throw new BundlerErrors.UnexpectedAction("aaveV2Repay", chainId);
|
|
1119
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV2Repay", chainId);
|
|
1087
1120
|
return [
|
|
1088
1121
|
{
|
|
1089
1122
|
to: aaveV2MigrationAdapter,
|
|
1090
|
-
data: encodeFunctionData({
|
|
1091
|
-
abi: aaveV2MigrationAdapterAbi,
|
|
1123
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1124
|
+
abi: abis_js_1.aaveV2MigrationAdapterAbi,
|
|
1092
1125
|
functionName: "aaveV2Repay",
|
|
1093
1126
|
args: [asset, amount, rateMode, onBehalf],
|
|
1094
1127
|
}),
|
|
1095
1128
|
value: 0n,
|
|
1096
1129
|
skipRevert,
|
|
1097
|
-
callbackHash: zeroHash,
|
|
1130
|
+
callbackHash: viem_1.zeroHash,
|
|
1098
1131
|
},
|
|
1099
1132
|
];
|
|
1100
1133
|
}
|
|
@@ -1108,20 +1141,20 @@ export var BundlerAction;
|
|
|
1108
1141
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1109
1142
|
*/
|
|
1110
1143
|
function aaveV2Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
|
|
1111
|
-
const { bundler3: { aaveV2MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1144
|
+
const { bundler3: { aaveV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1112
1145
|
if (aaveV2MigrationAdapter == null)
|
|
1113
|
-
throw new BundlerErrors.UnexpectedAction("aaveV2Withdraw", chainId);
|
|
1146
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV2Withdraw", chainId);
|
|
1114
1147
|
return [
|
|
1115
1148
|
{
|
|
1116
1149
|
to: aaveV2MigrationAdapter,
|
|
1117
|
-
data: encodeFunctionData({
|
|
1118
|
-
abi: aaveV2MigrationAdapterAbi,
|
|
1150
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1151
|
+
abi: abis_js_1.aaveV2MigrationAdapterAbi,
|
|
1119
1152
|
functionName: "aaveV2Withdraw",
|
|
1120
1153
|
args: [asset, amount, recipient],
|
|
1121
1154
|
}),
|
|
1122
1155
|
value: 0n,
|
|
1123
1156
|
skipRevert,
|
|
1124
|
-
callbackHash: zeroHash,
|
|
1157
|
+
callbackHash: viem_1.zeroHash,
|
|
1125
1158
|
},
|
|
1126
1159
|
];
|
|
1127
1160
|
}
|
|
@@ -1138,20 +1171,20 @@ export var BundlerAction;
|
|
|
1138
1171
|
*/
|
|
1139
1172
|
function aaveV3Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
|
|
1140
1173
|
const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
|
|
1141
|
-
} = getChainAddresses(chainId);
|
|
1174
|
+
} = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1142
1175
|
if (aaveV3CoreMigrationAdapter == null)
|
|
1143
|
-
throw new BundlerErrors.UnexpectedAction("aaveV3Repay", chainId);
|
|
1176
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3Repay", chainId);
|
|
1144
1177
|
return [
|
|
1145
1178
|
{
|
|
1146
1179
|
to: aaveV3CoreMigrationAdapter,
|
|
1147
|
-
data: encodeFunctionData({
|
|
1148
|
-
abi: aaveV3MigrationAdapterAbi,
|
|
1180
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1181
|
+
abi: abis_js_1.aaveV3MigrationAdapterAbi,
|
|
1149
1182
|
functionName: "aaveV3Repay",
|
|
1150
1183
|
args: [asset, amount, rateMode, onBehalf],
|
|
1151
1184
|
}),
|
|
1152
1185
|
value: 0n,
|
|
1153
1186
|
skipRevert,
|
|
1154
|
-
callbackHash: zeroHash,
|
|
1187
|
+
callbackHash: viem_1.zeroHash,
|
|
1155
1188
|
},
|
|
1156
1189
|
];
|
|
1157
1190
|
}
|
|
@@ -1166,20 +1199,20 @@ export var BundlerAction;
|
|
|
1166
1199
|
*/
|
|
1167
1200
|
function aaveV3Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
|
|
1168
1201
|
const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
|
|
1169
|
-
} = getChainAddresses(chainId);
|
|
1202
|
+
} = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1170
1203
|
if (aaveV3CoreMigrationAdapter == null)
|
|
1171
|
-
throw new BundlerErrors.UnexpectedAction("aaveV3Withdraw", chainId);
|
|
1204
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3Withdraw", chainId);
|
|
1172
1205
|
return [
|
|
1173
1206
|
{
|
|
1174
1207
|
to: aaveV3CoreMigrationAdapter,
|
|
1175
|
-
data: encodeFunctionData({
|
|
1176
|
-
abi: aaveV3MigrationAdapterAbi,
|
|
1208
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1209
|
+
abi: abis_js_1.aaveV3MigrationAdapterAbi,
|
|
1177
1210
|
functionName: "aaveV3Withdraw",
|
|
1178
1211
|
args: [asset, amount, recipient],
|
|
1179
1212
|
}),
|
|
1180
1213
|
value: 0n,
|
|
1181
1214
|
skipRevert,
|
|
1182
|
-
callbackHash: zeroHash,
|
|
1215
|
+
callbackHash: viem_1.zeroHash,
|
|
1183
1216
|
},
|
|
1184
1217
|
];
|
|
1185
1218
|
}
|
|
@@ -1194,20 +1227,20 @@ export var BundlerAction;
|
|
|
1194
1227
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1195
1228
|
*/
|
|
1196
1229
|
function aaveV3OptimizerRepay(chainId, underlying, amount, onBehalf, skipRevert = false) {
|
|
1197
|
-
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
|
|
1230
|
+
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1198
1231
|
if (aaveV3OptimizerMigrationAdapter == null)
|
|
1199
|
-
throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerRepay", chainId);
|
|
1232
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3OptimizerRepay", chainId);
|
|
1200
1233
|
return [
|
|
1201
1234
|
{
|
|
1202
1235
|
to: aaveV3OptimizerMigrationAdapter,
|
|
1203
|
-
data: encodeFunctionData({
|
|
1204
|
-
abi: aaveV3OptimizerMigrationAdapterAbi,
|
|
1236
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1237
|
+
abi: abis_js_1.aaveV3OptimizerMigrationAdapterAbi,
|
|
1205
1238
|
functionName: "aaveV3OptimizerRepay",
|
|
1206
1239
|
args: [underlying, amount, onBehalf],
|
|
1207
1240
|
}),
|
|
1208
1241
|
value: 0n,
|
|
1209
1242
|
skipRevert,
|
|
1210
|
-
callbackHash: zeroHash,
|
|
1243
|
+
callbackHash: viem_1.zeroHash,
|
|
1211
1244
|
},
|
|
1212
1245
|
];
|
|
1213
1246
|
}
|
|
@@ -1222,20 +1255,20 @@ export var BundlerAction;
|
|
|
1222
1255
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1223
1256
|
*/
|
|
1224
1257
|
function aaveV3OptimizerWithdraw(chainId, underlying, amount, maxIterations, recipient, skipRevert = false) {
|
|
1225
|
-
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
|
|
1258
|
+
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1226
1259
|
if (aaveV3OptimizerMigrationAdapter == null)
|
|
1227
|
-
throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdraw", chainId);
|
|
1260
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdraw", chainId);
|
|
1228
1261
|
return [
|
|
1229
1262
|
{
|
|
1230
1263
|
to: aaveV3OptimizerMigrationAdapter,
|
|
1231
|
-
data: encodeFunctionData({
|
|
1232
|
-
abi: aaveV3OptimizerMigrationAdapterAbi,
|
|
1264
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1265
|
+
abi: abis_js_1.aaveV3OptimizerMigrationAdapterAbi,
|
|
1233
1266
|
functionName: "aaveV3OptimizerWithdraw",
|
|
1234
1267
|
args: [underlying, amount, maxIterations, recipient],
|
|
1235
1268
|
}),
|
|
1236
1269
|
value: 0n,
|
|
1237
1270
|
skipRevert,
|
|
1238
|
-
callbackHash: zeroHash,
|
|
1271
|
+
callbackHash: viem_1.zeroHash,
|
|
1239
1272
|
},
|
|
1240
1273
|
];
|
|
1241
1274
|
}
|
|
@@ -1249,20 +1282,20 @@ export var BundlerAction;
|
|
|
1249
1282
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1250
1283
|
*/
|
|
1251
1284
|
function aaveV3OptimizerWithdrawCollateral(chainId, underlying, amount, recipient, skipRevert = false) {
|
|
1252
|
-
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
|
|
1285
|
+
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1253
1286
|
if (aaveV3OptimizerMigrationAdapter == null)
|
|
1254
|
-
throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdrawCollateral", chainId);
|
|
1287
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdrawCollateral", chainId);
|
|
1255
1288
|
return [
|
|
1256
1289
|
{
|
|
1257
1290
|
to: aaveV3OptimizerMigrationAdapter,
|
|
1258
|
-
data: encodeFunctionData({
|
|
1259
|
-
abi: aaveV3OptimizerMigrationAdapterAbi,
|
|
1291
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1292
|
+
abi: abis_js_1.aaveV3OptimizerMigrationAdapterAbi,
|
|
1260
1293
|
functionName: "aaveV3OptimizerWithdrawCollateral",
|
|
1261
1294
|
args: [underlying, amount, recipient],
|
|
1262
1295
|
}),
|
|
1263
1296
|
value: 0n,
|
|
1264
1297
|
skipRevert,
|
|
1265
|
-
callbackHash: zeroHash,
|
|
1298
|
+
callbackHash: viem_1.zeroHash,
|
|
1266
1299
|
},
|
|
1267
1300
|
];
|
|
1268
1301
|
}
|
|
@@ -1279,14 +1312,14 @@ export var BundlerAction;
|
|
|
1279
1312
|
* @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
|
|
1280
1313
|
*/
|
|
1281
1314
|
function aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, skipRevert = true) {
|
|
1282
|
-
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
|
|
1315
|
+
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1283
1316
|
if (aaveV3OptimizerMigrationAdapter == null)
|
|
1284
|
-
throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerApproveManagerWithSig", chainId);
|
|
1285
|
-
const { r, s, yParity } = parseSignature(signature);
|
|
1317
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("aaveV3OptimizerApproveManagerWithSig", chainId);
|
|
1318
|
+
const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
|
|
1286
1319
|
return [
|
|
1287
1320
|
{
|
|
1288
1321
|
to: aaveV3Optimizer,
|
|
1289
|
-
data: encodeFunctionData({
|
|
1322
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1290
1323
|
abi: [
|
|
1291
1324
|
{
|
|
1292
1325
|
inputs: [
|
|
@@ -1324,7 +1357,7 @@ export var BundlerAction;
|
|
|
1324
1357
|
}),
|
|
1325
1358
|
value: 0n,
|
|
1326
1359
|
skipRevert,
|
|
1327
|
-
callbackHash: zeroHash,
|
|
1360
|
+
callbackHash: viem_1.zeroHash,
|
|
1328
1361
|
},
|
|
1329
1362
|
];
|
|
1330
1363
|
}
|
|
@@ -1339,26 +1372,26 @@ export var BundlerAction;
|
|
|
1339
1372
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1340
1373
|
*/
|
|
1341
1374
|
function compoundV2Repay(chainId, cToken, amount, isEth, onBehalf, skipRevert = false) {
|
|
1342
|
-
const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1375
|
+
const { bundler3: { compoundV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1343
1376
|
if (compoundV2MigrationAdapter == null)
|
|
1344
|
-
throw new BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
|
|
1377
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
|
|
1345
1378
|
return [
|
|
1346
1379
|
{
|
|
1347
1380
|
to: compoundV2MigrationAdapter,
|
|
1348
1381
|
data: isEth
|
|
1349
|
-
? encodeFunctionData({
|
|
1350
|
-
abi: compoundV2MigrationAdapterAbi,
|
|
1382
|
+
? (0, viem_1.encodeFunctionData)({
|
|
1383
|
+
abi: abis_js_1.compoundV2MigrationAdapterAbi,
|
|
1351
1384
|
functionName: "compoundV2RepayEth",
|
|
1352
1385
|
args: [amount, onBehalf],
|
|
1353
1386
|
})
|
|
1354
|
-
: encodeFunctionData({
|
|
1355
|
-
abi: compoundV2MigrationAdapterAbi,
|
|
1387
|
+
: (0, viem_1.encodeFunctionData)({
|
|
1388
|
+
abi: abis_js_1.compoundV2MigrationAdapterAbi,
|
|
1356
1389
|
functionName: "compoundV2RepayErc20",
|
|
1357
1390
|
args: [cToken, amount, onBehalf],
|
|
1358
1391
|
}),
|
|
1359
1392
|
value: isEth ? amount : 0n,
|
|
1360
1393
|
skipRevert,
|
|
1361
|
-
callbackHash: zeroHash,
|
|
1394
|
+
callbackHash: viem_1.zeroHash,
|
|
1362
1395
|
},
|
|
1363
1396
|
];
|
|
1364
1397
|
}
|
|
@@ -1372,26 +1405,26 @@ export var BundlerAction;
|
|
|
1372
1405
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1373
1406
|
*/
|
|
1374
1407
|
function compoundV2Redeem(chainId, cToken, amount, isEth, recipient, skipRevert = false) {
|
|
1375
|
-
const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1408
|
+
const { bundler3: { compoundV2MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1376
1409
|
if (compoundV2MigrationAdapter == null)
|
|
1377
|
-
throw new BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
|
|
1410
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
|
|
1378
1411
|
return [
|
|
1379
1412
|
{
|
|
1380
1413
|
to: compoundV2MigrationAdapter,
|
|
1381
1414
|
data: isEth
|
|
1382
|
-
? encodeFunctionData({
|
|
1383
|
-
abi: compoundV2MigrationAdapterAbi,
|
|
1415
|
+
? (0, viem_1.encodeFunctionData)({
|
|
1416
|
+
abi: abis_js_1.compoundV2MigrationAdapterAbi,
|
|
1384
1417
|
functionName: "compoundV2RedeemEth",
|
|
1385
1418
|
args: [amount, recipient],
|
|
1386
1419
|
})
|
|
1387
|
-
: encodeFunctionData({
|
|
1388
|
-
abi: compoundV2MigrationAdapterAbi,
|
|
1420
|
+
: (0, viem_1.encodeFunctionData)({
|
|
1421
|
+
abi: abis_js_1.compoundV2MigrationAdapterAbi,
|
|
1389
1422
|
functionName: "compoundV2RedeemErc20",
|
|
1390
1423
|
args: [cToken, amount, recipient],
|
|
1391
1424
|
}),
|
|
1392
1425
|
value: 0n,
|
|
1393
1426
|
skipRevert,
|
|
1394
|
-
callbackHash: zeroHash,
|
|
1427
|
+
callbackHash: viem_1.zeroHash,
|
|
1395
1428
|
},
|
|
1396
1429
|
];
|
|
1397
1430
|
}
|
|
@@ -1406,20 +1439,20 @@ export var BundlerAction;
|
|
|
1406
1439
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1407
1440
|
*/
|
|
1408
1441
|
function compoundV3Repay(chainId, instance, amount, onBehalf, skipRevert = false) {
|
|
1409
|
-
const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1442
|
+
const { bundler3: { compoundV3MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1410
1443
|
if (compoundV3MigrationAdapter == null)
|
|
1411
|
-
throw new BundlerErrors.UnexpectedAction("compoundV3Repay", chainId);
|
|
1444
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV3Repay", chainId);
|
|
1412
1445
|
return [
|
|
1413
1446
|
{
|
|
1414
1447
|
to: compoundV3MigrationAdapter,
|
|
1415
|
-
data: encodeFunctionData({
|
|
1416
|
-
abi: compoundV3MigrationAdapterAbi,
|
|
1448
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1449
|
+
abi: abis_js_1.compoundV3MigrationAdapterAbi,
|
|
1417
1450
|
functionName: "compoundV3Repay",
|
|
1418
1451
|
args: [instance, amount, onBehalf],
|
|
1419
1452
|
}),
|
|
1420
1453
|
value: 0n,
|
|
1421
1454
|
skipRevert,
|
|
1422
|
-
callbackHash: zeroHash,
|
|
1455
|
+
callbackHash: viem_1.zeroHash,
|
|
1423
1456
|
},
|
|
1424
1457
|
];
|
|
1425
1458
|
}
|
|
@@ -1434,20 +1467,20 @@ export var BundlerAction;
|
|
|
1434
1467
|
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1435
1468
|
*/
|
|
1436
1469
|
function compoundV3WithdrawFrom(chainId, instance, asset, amount, recipient, skipRevert = false) {
|
|
1437
|
-
const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1470
|
+
const { bundler3: { compoundV3MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1438
1471
|
if (compoundV3MigrationAdapter == null)
|
|
1439
|
-
throw new BundlerErrors.UnexpectedAction("compoundV3WithdrawFrom", chainId);
|
|
1472
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV3WithdrawFrom", chainId);
|
|
1440
1473
|
return [
|
|
1441
1474
|
{
|
|
1442
1475
|
to: compoundV3MigrationAdapter,
|
|
1443
|
-
data: encodeFunctionData({
|
|
1444
|
-
abi: compoundV3MigrationAdapterAbi,
|
|
1476
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1477
|
+
abi: abis_js_1.compoundV3MigrationAdapterAbi,
|
|
1445
1478
|
functionName: "compoundV3WithdrawFrom",
|
|
1446
1479
|
args: [instance, asset, amount, recipient],
|
|
1447
1480
|
}),
|
|
1448
1481
|
value: 0n,
|
|
1449
1482
|
skipRevert,
|
|
1450
|
-
callbackHash: zeroHash,
|
|
1483
|
+
callbackHash: viem_1.zeroHash,
|
|
1451
1484
|
},
|
|
1452
1485
|
];
|
|
1453
1486
|
}
|
|
@@ -1465,14 +1498,14 @@ export var BundlerAction;
|
|
|
1465
1498
|
* @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
|
|
1466
1499
|
*/
|
|
1467
1500
|
function compoundV3AllowBySig(chainId, instance, owner, isAllowed, nonce, expiry, signature, skipRevert = true) {
|
|
1468
|
-
const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1501
|
+
const { bundler3: { compoundV3MigrationAdapter }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
1469
1502
|
if (compoundV3MigrationAdapter == null)
|
|
1470
|
-
throw new BundlerErrors.UnexpectedAction("compoundV3AllowBySig", chainId);
|
|
1471
|
-
const { r, s, yParity } = parseSignature(signature);
|
|
1503
|
+
throw new errors_js_1.BundlerErrors.UnexpectedAction("compoundV3AllowBySig", chainId);
|
|
1504
|
+
const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
|
|
1472
1505
|
return [
|
|
1473
1506
|
{
|
|
1474
1507
|
to: instance,
|
|
1475
|
-
data: encodeFunctionData({
|
|
1508
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
1476
1509
|
abi: [
|
|
1477
1510
|
{
|
|
1478
1511
|
inputs: [
|
|
@@ -1505,9 +1538,9 @@ export var BundlerAction;
|
|
|
1505
1538
|
}),
|
|
1506
1539
|
value: 0n,
|
|
1507
1540
|
skipRevert,
|
|
1508
|
-
callbackHash: zeroHash,
|
|
1541
|
+
callbackHash: viem_1.zeroHash,
|
|
1509
1542
|
},
|
|
1510
1543
|
];
|
|
1511
1544
|
}
|
|
1512
1545
|
BundlerAction.compoundV3AllowBySig = compoundV3AllowBySig;
|
|
1513
|
-
})(BundlerAction || (BundlerAction = {}));
|
|
1546
|
+
})(BundlerAction || (exports.BundlerAction = BundlerAction = {}));
|