@morpho-org/bundler-sdk-viem 3.0.0-next.2 → 3.0.0-next.4

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.
@@ -0,0 +1,35 @@
1
+ import type { SimulationResult } from "@morpho-org/simulation-sdk";
2
+ import type { Account, Address, Chain, Client, Hex, Transport } from "viem";
3
+ import type { Action, SignatureRequirement, TransactionRequirement } from "./types/index.js";
4
+ export declare class ActionBundleRequirements<TR extends {
5
+ tx: {
6
+ to: Address;
7
+ data: Hex;
8
+ };
9
+ } = TransactionRequirement, SR extends SignatureRequirement = SignatureRequirement> {
10
+ readonly txs: TR[];
11
+ readonly signatures: SR[];
12
+ constructor(txs?: TR[], signatures?: SR[]);
13
+ sign(client: Client<Transport, Chain | undefined, Account>): Promise<Hex[]>;
14
+ sign(client: Client, account: Account): Promise<Hex[]>;
15
+ }
16
+ export declare class ActionBundle<TR extends {
17
+ tx: {
18
+ to: Address;
19
+ data: Hex;
20
+ };
21
+ } = TransactionRequirement, SR extends SignatureRequirement = SignatureRequirement> {
22
+ readonly steps: SimulationResult;
23
+ readonly actions: Action[];
24
+ readonly requirements: ActionBundleRequirements<TR, SR>;
25
+ constructor(steps: SimulationResult, actions?: Action[], requirements?: ActionBundleRequirements<TR, SR>);
26
+ tx(): {
27
+ to: `0x${string}`;
28
+ value: bigint;
29
+ data: `0x${string}`;
30
+ };
31
+ txs(): {
32
+ to: Address;
33
+ data: Hex;
34
+ }[];
35
+ }
@@ -0,0 +1,28 @@
1
+ import { BundlerAction } from "./BundlerAction.js";
2
+ export class ActionBundleRequirements {
3
+ txs;
4
+ signatures;
5
+ constructor(txs = [], signatures = []) {
6
+ this.txs = txs;
7
+ this.signatures = signatures;
8
+ }
9
+ sign(client, account = client.account) {
10
+ return Promise.all(this.signatures.map((requirement) => requirement.sign(client, account)));
11
+ }
12
+ }
13
+ export class ActionBundle {
14
+ steps;
15
+ actions;
16
+ requirements;
17
+ constructor(steps, actions = [], requirements = new ActionBundleRequirements()) {
18
+ this.steps = steps;
19
+ this.actions = actions;
20
+ this.requirements = requirements;
21
+ }
22
+ tx() {
23
+ return BundlerAction.encodeBundle(this.steps[0].chainId, this.actions);
24
+ }
25
+ txs() {
26
+ return this.requirements.txs.map(({ tx }) => tx).concat([this.tx()]);
27
+ }
28
+ }
@@ -9,7 +9,7 @@ export interface BundlerCall {
9
9
  callbackHash: Hex;
10
10
  }
11
11
  /**
12
- * Namespace to easily encode calls to the Bundler contract, using ethers.
12
+ * Namespace to easily encode calls to the Bundler contract, using viem.
13
13
  */
14
14
  export declare namespace BundlerAction {
15
15
  function encodeBundle(chainId: ChainId, actions: Action[]): {
@@ -340,7 +340,7 @@ export declare namespace BundlerAction {
340
340
  * @param manager The address of the manager to approve. Defaults to the chain's bundler3 AaveV3OptimizerMigrationAdapter.
341
341
  * @param skipRevert Whether to allow the signature to revert without making the whole multicall revert.
342
342
  */
343
- function aaveV3OptimizerApproveManagerWithSig(chainId: ChainId, owner: Address, isApproved: boolean, nonce: bigint, deadline: bigint, signature: Hex, manager?: Address, skipRevert?: boolean): BundlerCall[];
343
+ function aaveV3OptimizerApproveManagerWithSig(chainId: ChainId, aaveV3Optimizer: Address, owner: Address, isApproved: boolean, nonce: bigint, deadline: bigint, signature: Hex, manager?: Address, skipRevert?: boolean): BundlerCall[];
344
344
  /**
345
345
  * Encodes a call to the Adapter to repay a debt on CompoundV2.
346
346
  * @param chainId The chain id for which to encode the call.
@@ -348,7 +348,7 @@ export declare namespace BundlerAction {
348
348
  * @param amount The amount of debt to repay.
349
349
  * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
350
350
  */
351
- function compoundV2Repay(chainId: ChainId, cToken: Address, amount: bigint, recipient?: Address): BundlerCall[];
351
+ function compoundV2Repay(chainId: ChainId, cToken: Address, amount: bigint, isEth: boolean, onBehalf: Address): BundlerCall[];
352
352
  /**
353
353
  * Encodes a call to the Adapter to withdraw collateral from CompoundV2.
354
354
  * @param chainId The chain id for which to encode the call.
@@ -356,7 +356,7 @@ export declare namespace BundlerAction {
356
356
  * @param amount The amount to withdraw.
357
357
  * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
358
358
  */
359
- function compoundV2Redeem(chainId: ChainId, cToken: Address, amount: bigint, recipient?: Address): BundlerCall[];
359
+ function compoundV2Redeem(chainId: ChainId, cToken: Address, amount: bigint, isEth: boolean, recipient?: Address): BundlerCall[];
360
360
  /**
361
361
  * Encodes a call to the Adapter to repay a debt on CompoundV3.
362
362
  * @param chainId The chain id for which to encode the call.
@@ -388,4 +388,3 @@ export declare namespace BundlerAction {
388
388
  */
389
389
  function compoundV3AllowBySig(chainId: ChainId, instance: Address, owner: Address, isAllowed: boolean, nonce: bigint, expiry: bigint, signature: Hex, manager?: Address, skipRevert?: boolean): BundlerCall[];
390
390
  }
391
- export default BundlerAction;
@@ -5,7 +5,7 @@ import { encodeAbiParameters, encodeFunctionData, keccak256, maxUint256, parseSi
5
5
  import { BundlerErrors } from "./errors.js";
6
6
  const reenterSelectorHash = keccak256(toFunctionSelector(bundler3Abi.find((item) => item.type === "function" && item.name === "reenter")));
7
7
  /**
8
- * Namespace to easily encode calls to the Bundler contract, using ethers.
8
+ * Namespace to easily encode calls to the Bundler contract, using viem.
9
9
  */
10
10
  export var BundlerAction;
11
11
  (function (BundlerAction) {
@@ -178,10 +178,10 @@ export var BundlerAction;
178
178
  return BundlerAction.aaveV3OptimizerWithdrawCollateral(chainId, ...args);
179
179
  }
180
180
  case "aaveV3OptimizerApproveManagerWithSig": {
181
- const [owner, isApproved, nonce, deadline, signature, manager, skipRevert,] = args;
181
+ const [aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, manager, skipRevert,] = args;
182
182
  if (signature == null)
183
183
  throw new BundlerErrors.MissingSignature();
184
- return BundlerAction.aaveV3OptimizerApproveManagerWithSig(chainId, owner, isApproved, nonce, deadline, signature, manager, skipRevert);
184
+ return BundlerAction.aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, manager, skipRevert);
185
185
  }
186
186
  /* CompoundV2 */
187
187
  case "compoundV2Repay": {
@@ -867,6 +867,8 @@ export var BundlerAction;
867
867
  */
868
868
  function publicAllocatorReallocateTo(chainId, vault, fee, withdrawals, supplyMarketParams) {
869
869
  const { publicAllocator } = getChainAddresses(chainId);
870
+ if (publicAllocator == null)
871
+ throw new BundlerErrors.UnexpectedAction("reallocateTo", chainId);
870
872
  return [
871
873
  {
872
874
  to: publicAllocator,
@@ -1239,9 +1241,9 @@ export var BundlerAction;
1239
1241
  * @param manager The address of the manager to approve. Defaults to the chain's bundler3 AaveV3OptimizerMigrationAdapter.
1240
1242
  * @param skipRevert Whether to allow the signature to revert without making the whole multicall revert.
1241
1243
  */
1242
- function aaveV3OptimizerApproveManagerWithSig(chainId, owner, isApproved, nonce, deadline, signature, manager, skipRevert = true) {
1243
- const { aaveV3Optimizer, bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1244
- if (aaveV3Optimizer == null || aaveV3OptimizerMigrationAdapter == null)
1244
+ function aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, manager, skipRevert = true) {
1245
+ const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
1246
+ if (aaveV3OptimizerMigrationAdapter == null)
1245
1247
  throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerApproveManagerWithSig", chainId);
1246
1248
  manager ??= aaveV3OptimizerMigrationAdapter;
1247
1249
  const { r, s, yParity } = parseSignature(signature);
@@ -1299,12 +1301,10 @@ export var BundlerAction;
1299
1301
  * @param amount The amount of debt to repay.
1300
1302
  * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
1301
1303
  */
1302
- function compoundV2Repay(chainId, cToken, amount, recipient) {
1303
- const { cEth, bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
1304
- if (cEth == null || compoundV2MigrationAdapter == null)
1304
+ function compoundV2Repay(chainId, cToken, amount, isEth, onBehalf) {
1305
+ const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
1306
+ if (compoundV2MigrationAdapter == null)
1305
1307
  throw new BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
1306
- const isEth = cToken === cEth;
1307
- recipient ??= compoundV2MigrationAdapter;
1308
1308
  return [
1309
1309
  {
1310
1310
  to: compoundV2MigrationAdapter,
@@ -1312,12 +1312,12 @@ export var BundlerAction;
1312
1312
  ? encodeFunctionData({
1313
1313
  abi: compoundV2MigrationAdapterAbi,
1314
1314
  functionName: "compoundV2RepayEth",
1315
- args: [amount, recipient],
1315
+ args: [amount, onBehalf],
1316
1316
  })
1317
1317
  : encodeFunctionData({
1318
1318
  abi: compoundV2MigrationAdapterAbi,
1319
1319
  functionName: "compoundV2RepayErc20",
1320
- args: [cToken, amount, recipient],
1320
+ args: [cToken, amount, onBehalf],
1321
1321
  }),
1322
1322
  value: isEth ? amount : 0n,
1323
1323
  skipRevert: false,
@@ -1333,11 +1333,10 @@ export var BundlerAction;
1333
1333
  * @param amount The amount to withdraw.
1334
1334
  * @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
1335
1335
  */
1336
- function compoundV2Redeem(chainId, cToken, amount, recipient) {
1337
- const { cEth, bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
1338
- if (cEth == null || compoundV2MigrationAdapter == null)
1336
+ function compoundV2Redeem(chainId, cToken, amount, isEth, recipient) {
1337
+ const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
1338
+ if (compoundV2MigrationAdapter == null)
1339
1339
  throw new BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
1340
- const isEth = cToken === cEth;
1341
1340
  recipient ??= compoundV2MigrationAdapter;
1342
1341
  return [
1343
1342
  {
@@ -1466,4 +1465,3 @@ export var BundlerAction;
1466
1465
  }
1467
1466
  BundlerAction.compoundV3AllowBySig = compoundV3AllowBySig;
1468
1467
  })(BundlerAction || (BundlerAction = {}));
1469
- export default BundlerAction;
package/lib/actions.d.ts CHANGED
@@ -1,14 +1,12 @@
1
1
  import { type Address } from "viem";
2
- import { ChainId } from "@morpho-org/blue-sdk";
3
2
  import { type MaybeDraft, type SimulationState } from "@morpho-org/simulation-sdk";
4
- import type { Action, ActionBundle, BundlerOperation, TransactionRequirement } from "./types/index.js";
5
- export declare const APPROVE_ONLY_ONCE_TOKENS: Partial<Record<ChainId, Address[]>>;
3
+ import { ActionBundle, ActionBundleRequirements } from "./ActionBundle.js";
4
+ import type { Action, BundlerOperation, TransactionRequirement } from "./types/index.js";
5
+ export declare const APPROVE_ONLY_ONCE_TOKENS: Partial<Record<number, Address[]>>;
6
+ export declare const MAX_TOKEN_APPROVALS: Partial<Record<number, Record<Address, bigint>>>;
6
7
  export declare const encodeOperation: (operation: BundlerOperation, dataBefore: MaybeDraft<SimulationState>, supportsSignature?: boolean, index?: number) => {
7
8
  dataAfter: MaybeDraft<SimulationState>;
8
9
  actions: Action[];
9
- requirements: {
10
- signatures: import("./types/actions.js").SignatureRequirement[];
11
- txs: TransactionRequirement[];
12
- };
10
+ requirements: ActionBundleRequirements<TransactionRequirement, import("./types/actions.js").SignatureRequirement>;
13
11
  };
14
- export declare function encodeBundle(operations: BundlerOperation[], startData: MaybeDraft<SimulationState>, supportsSignature?: boolean): ActionBundle;
12
+ export declare function encodeBundle(operations: BundlerOperation[], startData: MaybeDraft<SimulationState>, supportsSignature?: boolean): ActionBundle<TransactionRequirement, import("./types/actions.js").SignatureRequirement>;
package/lib/actions.js CHANGED
@@ -4,14 +4,14 @@ import { Time, getValue } from "@morpho-org/morpho-ts";
4
4
  import { simulateOperation, } from "@morpho-org/simulation-sdk";
5
5
  import { blueAbi, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermitTypedData, } from "@morpho-org/blue-sdk-viem";
6
6
  import { signTypedData } from "viem/actions";
7
- import BundlerAction from "./BundlerAction.js";
7
+ import { ActionBundle, ActionBundleRequirements } from "./ActionBundle.js";
8
8
  export const APPROVE_ONLY_ONCE_TOKENS = {
9
9
  [ChainId.EthMainnet]: [
10
10
  "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
11
11
  "0xD533a949740bb3306d119CC777fa900bA034cd52", // CRV
12
12
  ],
13
13
  };
14
- const MAX_TOKEN_APPROVALS = {
14
+ export const MAX_TOKEN_APPROVALS = {
15
15
  [ChainId.EthMainnet]: {
16
16
  "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984": MathLib.maxUint(96), // UNI --> see https://github.com/Uniswap/governance/blob/eabd8c71ad01f61fb54ed6945162021ee419998e/contracts/Uni.sol#L154
17
17
  },
@@ -67,10 +67,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
67
67
  const deadline = Time.timestamp() + Time.s.from.h(24n);
68
68
  const { morpho, bundler3: { bundler3, generalAdapter1 }, permit2, wNative, dai, wstEth, stEth, } = getChainAddresses(chainId);
69
69
  const actions = [];
70
- const requirements = {
71
- signatures: [],
72
- txs: [],
73
- };
70
+ const requirements = new ActionBundleRequirements();
74
71
  let callbackBundle;
75
72
  const callback = getValue(operation.args, "callback");
76
73
  const simulatedOperation = {
@@ -346,7 +343,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
346
343
  break;
347
344
  }
348
345
  default: {
349
- if (erc20WrapperTokens[chainId].has(address)) {
346
+ if (erc20WrapperTokens[chainId]?.has(address)) {
350
347
  const underlying = getUnwrappedToken(address, chainId);
351
348
  if (underlying == null)
352
349
  throw Error(`unknown wrapped token: ${address}`);
@@ -357,7 +354,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
357
354
  break;
358
355
  }
359
356
  // Convex token wrapping is executed onchain along with supplyCollateral, via depositFor.
360
- if (!convexWrapperTokens[chainId].has(address))
357
+ if (!convexWrapperTokens[chainId]?.has(address))
361
358
  throw Error(`unexpected token wrap: ${address}`);
362
359
  }
363
360
  }
@@ -381,7 +378,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
381
378
  break;
382
379
  }
383
380
  default: {
384
- if (!erc20WrapperTokens[chainId].has(address))
381
+ if (!erc20WrapperTokens[chainId]?.has(address))
385
382
  throw Error(`unexpected token unwrap: ${address}`);
386
383
  actions.push({
387
384
  type: "erc20WrapperWithdrawTo",
@@ -448,7 +445,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
448
445
  case "Blue_SupplyCollateral": {
449
446
  const { id, assets, onBehalf } = operation.args;
450
447
  const { params } = dataBefore.getMarket(id);
451
- if (convexWrapperTokens[chainId].has(params.collateralToken)) {
448
+ if (convexWrapperTokens[chainId]?.has(params.collateralToken)) {
452
449
  const underlying = getUnwrappedToken(address, chainId);
453
450
  if (underlying == null)
454
451
  throw Error(`unknown wrapped token: ${address}`);
@@ -531,24 +528,13 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
531
528
  };
532
529
  };
533
530
  export function encodeBundle(operations, startData, supportsSignature = true) {
534
- const { chainId } = startData;
535
- const actions = [];
536
- const requirements = {
537
- signatures: [],
538
- txs: [],
539
- };
540
- const steps = [startData];
531
+ const bundle = new ActionBundle([startData]);
541
532
  for (let index = 0; index < operations.length; ++index) {
542
- const bundle = encodeOperation(operations[index], steps[index], supportsSignature, index);
543
- steps.push(bundle.dataAfter);
544
- actions.push(...bundle.actions);
545
- requirements.signatures.push(...bundle.requirements.signatures);
546
- requirements.txs.push(...bundle.requirements.txs);
533
+ const { dataAfter, actions, requirements } = encodeOperation(operations[index], bundle.steps[index], supportsSignature, index);
534
+ bundle.steps.push(dataAfter);
535
+ bundle.actions.push(...actions);
536
+ bundle.requirements.signatures.push(...requirements.signatures);
537
+ bundle.requirements.txs.push(...requirements.txs);
547
538
  }
548
- return {
549
- steps,
550
- actions,
551
- requirements,
552
- tx: () => BundlerAction.encodeBundle(chainId, actions),
553
- };
539
+ return bundle;
554
540
  }
@@ -0,0 +1,12 @@
1
+ import type { SimulationState } from "@morpho-org/simulation-sdk";
2
+ import type { Address } from "viem";
3
+ import { type BundlingOptions } from "./operations.js";
4
+ import type { InputBundlerOperation } from "./types/index.js";
5
+ export declare const setupBundle: (inputOperations: InputBundlerOperation[], startData: SimulationState, receiver: Address, { supportsSignature, unwrapTokens, unwrapSlippage, ...options }?: BundlingOptions & {
6
+ supportsSignature?: boolean;
7
+ unwrapTokens?: Set<Address>;
8
+ unwrapSlippage?: bigint;
9
+ }) => {
10
+ operations: import("./types/operations.js").BundlerOperation[];
11
+ bundle: import("./ActionBundle.js").ActionBundle<import("./types/actions.js").TransactionRequirement, import("./types/actions.js").SignatureRequirement>;
12
+ };
package/lib/bundle.js ADDED
@@ -0,0 +1,11 @@
1
+ import { encodeBundle } from "./actions.js";
2
+ import { finalizeBundle, populateBundle, } from "./operations.js";
3
+ export const setupBundle = (inputOperations, startData, receiver, { supportsSignature, unwrapTokens, unwrapSlippage, ...options } = {}) => {
4
+ let { operations } = populateBundle(inputOperations, startData, options);
5
+ operations = finalizeBundle(operations, startData, receiver, unwrapTokens, unwrapSlippage);
6
+ const bundle = encodeBundle(operations, startData, supportsSignature);
7
+ return {
8
+ operations,
9
+ bundle,
10
+ };
11
+ };
package/lib/index.d.ts CHANGED
@@ -2,3 +2,6 @@ export * from "./actions.js";
2
2
  export * from "./operations.js";
3
3
  export * from "./errors.js";
4
4
  export * from "./types/index.js";
5
+ export * from "./BundlerAction.js";
6
+ export * from "./bundle.js";
7
+ export * from "./ActionBundle.js";
package/lib/index.js CHANGED
@@ -2,3 +2,6 @@ export * from "./actions.js";
2
2
  export * from "./operations.js";
3
3
  export * from "./errors.js";
4
4
  export * from "./types/index.js";
5
+ export * from "./BundlerAction.js";
6
+ export * from "./bundle.js";
7
+ export * from "./ActionBundle.js";
package/lib/operations.js CHANGED
@@ -45,8 +45,8 @@ export const populateInputTransfer = ({ address, args: { amount, from } }, data,
45
45
  hasSimplePermit);
46
46
  const useSimpleTransfer = permit2 == null ||
47
47
  // Token is permissioned and Permit2 may not be authorized so Permit2 cannot be used.
48
- permissionedWrapperTokens[data.chainId].has(address) ||
49
- permissionedBackedTokens[data.chainId].has(address);
48
+ !!permissionedWrapperTokens[data.chainId]?.has(address) ||
49
+ !!permissionedBackedTokens[data.chainId]?.has(address);
50
50
  if (useSimplePermit)
51
51
  operations.push({
52
52
  type: "Erc20_Permit",
@@ -138,7 +138,7 @@ export const populateSubBundle = (inputOperation, data, options = {}) => {
138
138
  ? data.getWrappedToken(inputOperation.address)
139
139
  : undefined;
140
140
  const isErc20Wrapper = !!wrappedToken &&
141
- erc20WrapperTokens[data.chainId].has(wrappedToken.address);
141
+ !!erc20WrapperTokens[data.chainId]?.has(wrappedToken.address);
142
142
  // Transform input operation to act on behalf of the sender, via the bundler.
143
143
  const mainOperation = produceImmutable(inputOperation, (draft) => {
144
144
  draft.sender = generalAdapter1;
@@ -394,7 +394,7 @@ export const finalizeBundle = (operations, startData, receiver, unwrapTokens = n
394
394
  const { address, sender, args: { amount, from, to }, } = operation;
395
395
  if (from !== generalAdapter1 &&
396
396
  to === generalAdapter1 &&
397
- !erc20WrapperTokens[startData.chainId].has(address)) {
397
+ !erc20WrapperTokens[startData.chainId]?.has(address)) {
398
398
  const duplicateTransfer = inputTransfers.find((transfer) => transfer.address === address &&
399
399
  transfer.sender === sender &&
400
400
  transfer.args.from === from);
@@ -1,6 +1,5 @@
1
1
  import type { Account, Chain, Client, Hex, TransactionRequest, Transport } from "viem";
2
2
  import type { Address, InputMarketParams } from "@morpho-org/blue-sdk";
3
- import type { SimulationResult } from "@morpho-org/simulation-sdk";
4
3
  export interface Authorization {
5
4
  authorizer: Address;
6
5
  authorized: Address;
@@ -196,6 +195,7 @@ export interface ActionArgs {
196
195
  recipient?: Address
197
196
  ];
198
197
  aaveV3OptimizerApproveManagerWithSig: [
198
+ aaveV3Optimizer: Address,
199
199
  owner: Address,
200
200
  isApproved: boolean,
201
201
  nonce: bigint,
@@ -204,8 +204,18 @@ export interface ActionArgs {
204
204
  manager?: Address,
205
205
  skipRevert?: boolean
206
206
  ];
207
- compoundV2Repay: [cToken: Address, amount: bigint, onBehalf: Address];
208
- compoundV2Redeem: [cToken: Address, amount: bigint, recipient?: Address];
207
+ compoundV2Repay: [
208
+ cToken: Address,
209
+ amount: bigint,
210
+ isEth: boolean,
211
+ onBehalf: Address
212
+ ];
213
+ compoundV2Redeem: [
214
+ cToken: Address,
215
+ amount: bigint,
216
+ isEth: boolean,
217
+ recipient?: Address
218
+ ];
209
219
  compoundV3Repay: [instance: Address, amount: bigint, onBehalf: Address];
210
220
  compoundV3WithdrawFrom: [
211
221
  instance: Address,
@@ -256,15 +266,3 @@ export interface SignatureRequirement {
256
266
  action: Action;
257
267
  sign: SignatureRequirementFunction;
258
268
  }
259
- export interface ActionBundle {
260
- steps: SimulationResult;
261
- actions: Action[];
262
- requirements: {
263
- signatures: SignatureRequirement[];
264
- txs: TransactionRequirement[];
265
- };
266
- tx: () => TransactionRequest & {
267
- to: Address;
268
- data: Hex;
269
- };
270
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morpho-org/bundler-sdk-viem",
3
3
  "description": "Viem-based extension of `@morpho-org/simulation-sdk` that exports utilities to transform simple interactions on Morpho (such as `Blue_Borrow`) and Morpho Vaults (such as `MetaMorpho_Deposit`) into the required bundles (with ERC20 approvals, transfers, etc) to submit to the bundler onchain.",
4
- "version": "3.0.0-next.2",
4
+ "version": "3.0.0-next.4",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -21,9 +21,9 @@
21
21
  "peerDependencies": {
22
22
  "viem": "^2.0.0",
23
23
  "@morpho-org/blue-sdk": "^2.3.1",
24
+ "@morpho-org/blue-sdk-viem": "^2.2.2",
24
25
  "@morpho-org/morpho-ts": "^2.1.0",
25
- "@morpho-org/simulation-sdk": "^2.1.3",
26
- "@morpho-org/blue-sdk-viem": "^2.2.2"
26
+ "@morpho-org/simulation-sdk": "^2.1.3"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@tanstack/query-core": "^5.62.16",
@@ -35,14 +35,14 @@
35
35
  "typescript": "^5.7.2",
36
36
  "viem": "^2.23.0",
37
37
  "vitest": "^3.0.5",
38
- "@morpho-org/blue-sdk": "^2.3.1",
39
38
  "@morpho-org/morpho-ts": "^2.1.0",
40
- "@morpho-org/simulation-sdk": "^2.1.3",
41
- "@morpho-org/morpho-test": "^2.2.1",
39
+ "@morpho-org/blue-sdk": "^2.3.1",
42
40
  "@morpho-org/blue-sdk-viem": "^2.2.2",
41
+ "@morpho-org/morpho-test": "^2.2.1",
42
+ "@morpho-org/simulation-sdk": "^2.1.3",
43
43
  "@morpho-org/simulation-sdk-wagmi": "^2.0.5",
44
- "@morpho-org/test-wagmi": "^2.0.4",
45
- "@morpho-org/test": "^2.0.6"
44
+ "@morpho-org/test": "^2.0.6",
45
+ "@morpho-org/test-wagmi": "^2.0.4"
46
46
  },
47
47
  "scripts": {
48
48
  "prepublish": "$npm_execpath build",