@morpho-org/bundler-sdk-viem 3.0.0-next.1 → 3.0.0-next.11

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,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;
@@ -24,15 +23,37 @@ export interface Permit2PermitSingle {
24
23
  sigDeadline: bigint;
25
24
  }
26
25
  export interface ActionArgs {
27
- nativeTransfer: [owner: Address, recipient: Address, amount: bigint];
28
- erc20Transfer: [asset: Address, recipient: Address, amount: bigint];
29
- erc20TransferFrom: [asset: Address, amount: bigint, recipient?: Address];
26
+ nativeTransfer: [
27
+ owner: Address,
28
+ recipient: Address,
29
+ amount: bigint,
30
+ skipRevert?: boolean
31
+ ];
32
+ erc20Transfer: [
33
+ asset: Address,
34
+ recipient: Address,
35
+ amount: bigint,
36
+ adapter?: Address,
37
+ skipRevert?: boolean
38
+ ];
39
+ erc20TransferFrom: [
40
+ asset: Address,
41
+ amount: bigint,
42
+ recipient?: Address,
43
+ skipRevert?: boolean
44
+ ];
30
45
  erc20WrapperDepositFor: [
31
46
  wrapper: Address,
32
47
  underlying: Address,
33
- amount: bigint
48
+ amount: bigint,
49
+ skipRevert?: boolean
50
+ ];
51
+ erc20WrapperWithdrawTo: [
52
+ wrapper: Address,
53
+ receiver: Address,
54
+ amount: bigint,
55
+ skipRevert?: boolean
34
56
  ];
35
- erc20WrapperWithdrawTo: [wrapper: Address, receiver: Address, amount: bigint];
36
57
  permit: [
37
58
  owner: Address,
38
59
  asset: Address,
@@ -61,33 +82,38 @@ export interface ActionArgs {
61
82
  asset: Address,
62
83
  owner: Address,
63
84
  amount: bigint,
64
- recipient?: Address
85
+ recipient?: Address,
86
+ skipRevert?: boolean
65
87
  ];
66
88
  erc4626Mint: [
67
89
  erc4626: Address,
68
90
  shares: bigint,
69
91
  maxSharePrice: bigint,
70
- receiver: Address
92
+ receiver: Address,
93
+ skipRevert?: boolean
71
94
  ];
72
95
  erc4626Deposit: [
73
96
  erc4626: Address,
74
97
  assets: bigint,
75
98
  maxSharePrice: bigint,
76
- receiver: Address
99
+ receiver: Address,
100
+ skipRevert?: boolean
77
101
  ];
78
102
  erc4626Withdraw: [
79
103
  erc4626: Address,
80
104
  assets: bigint,
81
105
  minSharePrice: bigint,
82
106
  receiver: Address,
83
- owner: Address
107
+ owner: Address,
108
+ skipRevert?: boolean
84
109
  ];
85
110
  erc4626Redeem: [
86
111
  erc4626: Address,
87
112
  shares: bigint,
88
113
  minSharePrice: bigint,
89
114
  receiver: Address,
90
- owner: Address
115
+ owner: Address,
116
+ skipRevert?: boolean
91
117
  ];
92
118
  morphoSetAuthorizationWithSig: [
93
119
  authorization: {
@@ -106,20 +132,23 @@ export interface ActionArgs {
106
132
  shares: bigint,
107
133
  slippageAmount: bigint,
108
134
  onBehalf: Address,
109
- onMorphoSupply: Action[]
135
+ onMorphoSupply: Action[],
136
+ skipRevert?: boolean
110
137
  ];
111
138
  morphoSupplyCollateral: [
112
139
  market: InputMarketParams,
113
140
  assets: bigint,
114
141
  onBehalf: Address,
115
- onMorphoSupplyCollateral: Action[]
142
+ onMorphoSupplyCollateral: Action[],
143
+ skipRevert?: boolean
116
144
  ];
117
145
  morphoBorrow: [
118
146
  market: InputMarketParams,
119
147
  assets: bigint,
120
148
  shares: bigint,
121
149
  slippageAmount: bigint,
122
- receiver: Address
150
+ receiver: Address,
151
+ skipRevert?: boolean
123
152
  ];
124
153
  morphoRepay: [
125
154
  market: InputMarketParams,
@@ -127,25 +156,29 @@ export interface ActionArgs {
127
156
  shares: bigint,
128
157
  slippageAmount: bigint,
129
158
  onBehalf: Address,
130
- onMorphoRepay: Action[]
159
+ onMorphoRepay: Action[],
160
+ skipRevert?: boolean
131
161
  ];
132
162
  morphoWithdraw: [
133
163
  market: InputMarketParams,
134
164
  assets: bigint,
135
165
  shares: bigint,
136
166
  slippageAmount: bigint,
137
- receiver: Address
167
+ receiver: Address,
168
+ skipRevert?: boolean
138
169
  ];
139
170
  morphoWithdrawCollateral: [
140
171
  market: InputMarketParams,
141
172
  assets: bigint,
142
- receiver: Address
173
+ receiver: Address,
174
+ skipRevert?: boolean
143
175
  ];
144
176
  reallocateTo: [
145
177
  vault: Address,
146
178
  fee: bigint,
147
179
  withdrawals: InputReallocation[],
148
- supplyMarket: InputMarketParams
180
+ supplyMarket: InputMarketParams,
181
+ skipRevert?: boolean
149
182
  ];
150
183
  urdClaim: [
151
184
  distributor: Address,
@@ -155,47 +188,64 @@ export interface ActionArgs {
155
188
  proof: Hex[],
156
189
  skipRevert?: boolean
157
190
  ];
158
- wrapNative: [amount: bigint, recipient?: Address];
159
- unwrapNative: [amount: bigint, recipient?: Address];
191
+ wrapNative: [amount: bigint, recipient?: Address, skipRevert?: boolean];
192
+ unwrapNative: [amount: bigint, recipient?: Address, skipRevert?: boolean];
160
193
  stakeEth: [
161
194
  amount: bigint,
162
195
  minShares: bigint,
163
196
  referral: Address,
164
- recipient?: Address
197
+ recipient?: Address,
198
+ skipRevert?: boolean
165
199
  ];
166
- wrapStEth: [amount: bigint, recipient?: Address];
167
- unwrapStEth: [amount: bigint, recipient?: Address];
200
+ wrapStEth: [amount: bigint, recipient?: Address, skipRevert?: boolean];
201
+ unwrapStEth: [amount: bigint, recipient?: Address, skipRevert?: boolean];
168
202
  aaveV2Repay: [
169
203
  asset: Address,
170
204
  amount: bigint,
171
205
  onBehalf: Address,
172
- rateMode?: bigint
206
+ rateMode?: bigint,
207
+ skipRevert?: boolean
208
+ ];
209
+ aaveV2Withdraw: [
210
+ asset: Address,
211
+ amount: bigint,
212
+ recipient?: Address,
213
+ skipRevert?: boolean
173
214
  ];
174
- aaveV2Withdraw: [asset: Address, amount: bigint, recipient?: Address];
175
215
  aaveV3Repay: [
176
216
  asset: Address,
177
217
  amount: bigint,
178
218
  onBehalf: Address,
179
- rateMode?: bigint
219
+ rateMode?: bigint,
220
+ skipRevert?: boolean
221
+ ];
222
+ aaveV3Withdraw: [
223
+ asset: Address,
224
+ amount: bigint,
225
+ recipient?: Address,
226
+ skipRevert?: boolean
180
227
  ];
181
- aaveV3Withdraw: [asset: Address, amount: bigint, recipient?: Address];
182
228
  aaveV3OptimizerRepay: [
183
229
  underlying: Address,
184
230
  amount: bigint,
185
- onBehalf: Address
231
+ onBehalf: Address,
232
+ skipRevert?: boolean
186
233
  ];
187
234
  aaveV3OptimizerWithdraw: [
188
235
  underlying: Address,
189
236
  amount: bigint,
190
237
  maxIterations: bigint,
191
- recipient?: Address
238
+ recipient?: Address,
239
+ skipRevert?: boolean
192
240
  ];
193
241
  aaveV3OptimizerWithdrawCollateral: [
194
242
  underlying: Address,
195
243
  amount: bigint,
196
- recipient?: Address
244
+ recipient?: Address,
245
+ skipRevert?: boolean
197
246
  ];
198
247
  aaveV3OptimizerApproveManagerWithSig: [
248
+ aaveV3Optimizer: Address,
199
249
  owner: Address,
200
250
  isApproved: boolean,
201
251
  nonce: bigint,
@@ -204,14 +254,32 @@ export interface ActionArgs {
204
254
  manager?: Address,
205
255
  skipRevert?: boolean
206
256
  ];
207
- compoundV2Repay: [cToken: Address, amount: bigint, onBehalf: Address];
208
- compoundV2Redeem: [cToken: Address, amount: bigint, recipient?: Address];
209
- compoundV3Repay: [instance: Address, amount: bigint, onBehalf: Address];
257
+ compoundV2Repay: [
258
+ cToken: Address,
259
+ amount: bigint,
260
+ isEth: boolean,
261
+ onBehalf: Address,
262
+ skipRevert?: boolean
263
+ ];
264
+ compoundV2Redeem: [
265
+ cToken: Address,
266
+ amount: bigint,
267
+ isEth: boolean,
268
+ recipient?: Address,
269
+ skipRevert?: boolean
270
+ ];
271
+ compoundV3Repay: [
272
+ instance: Address,
273
+ amount: bigint,
274
+ onBehalf: Address,
275
+ skipRevert?: boolean
276
+ ];
210
277
  compoundV3WithdrawFrom: [
211
278
  instance: Address,
212
279
  asset: Address,
213
280
  amount: bigint,
214
- recipient?: Address
281
+ recipient?: Address,
282
+ skipRevert?: boolean
215
283
  ];
216
284
  compoundV3AllowBySig: [
217
285
  instance: Address,
@@ -256,15 +324,3 @@ export interface SignatureRequirement {
256
324
  action: Action;
257
325
  sign: SignatureRequirementFunction;
258
326
  }
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
- }
@@ -21,7 +21,7 @@ export type CallbackBundlerOperations = {
21
21
  [OperationType in CallbackBundlerOperationType]: WithOperationArgs<OperationType, BundlerOperationArgs>;
22
22
  };
23
23
  export type CallbackBundlerOperation = CallbackBundlerOperations[CallbackBundlerOperationType];
24
- export declare const BLUE_INPUT_OPERATIONS: readonly ["Blue_Borrow", "Blue_Repay", "Blue_Supply", "Blue_SupplyCollateral", "Blue_Withdraw", "Blue_WithdrawCollateral"];
24
+ export declare const BLUE_INPUT_OPERATIONS: readonly ["Blue_Borrow", "Blue_Repay", "Blue_Supply", "Blue_SupplyCollateral", "Blue_Withdraw", "Blue_WithdrawCollateral", "Blue_SetAuthorization"];
25
25
  export type BlueInputBundlerOperationType = (typeof BLUE_INPUT_OPERATIONS)[number];
26
26
  export interface BlueInputBundlerOperationArgs extends Omit<OperationArgs, (typeof CALLBACK_OPERATIONS)[number]> {
27
27
  Blue_SupplyCollateral: Omit<BlueOperationArgs["Blue_SupplyCollateral"], "callback"> & {
@@ -24,6 +24,7 @@ export const BLUE_INPUT_OPERATIONS = [
24
24
  "Blue_SupplyCollateral",
25
25
  "Blue_Withdraw",
26
26
  "Blue_WithdrawCollateral",
27
+ "Blue_SetAuthorization",
27
28
  ];
28
29
  export const METAMORPHO_INPUT_OPERATIONS = [
29
30
  "MetaMorpho_Deposit",
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.1",
4
+ "version": "3.0.0-next.11",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -20,10 +20,10 @@
20
20
  ],
21
21
  "peerDependencies": {
22
22
  "viem": "^2.0.0",
23
- "@morpho-org/blue-sdk-viem": "^3.0.0-next.1",
24
- "@morpho-org/simulation-sdk": "^3.0.0-next.1",
25
- "@morpho-org/blue-sdk": "^3.0.0-next.3",
26
- "@morpho-org/morpho-ts": "^2.1.0"
23
+ "@morpho-org/blue-sdk": "^2.3.2",
24
+ "@morpho-org/simulation-sdk": "^3.0.0-next.5",
25
+ "@morpho-org/morpho-ts": "^2.2.0",
26
+ "@morpho-org/blue-sdk-viem": "^2.2.2"
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": "^3.0.0-next.3",
39
- "@morpho-org/blue-sdk-viem": "^3.0.0-next.1",
38
+ "@morpho-org/blue-sdk": "^2.3.2",
39
+ "@morpho-org/blue-sdk-viem": "^2.2.2",
40
40
  "@morpho-org/morpho-test": "^2.2.1",
41
- "@morpho-org/morpho-ts": "^2.1.0",
42
- "@morpho-org/simulation-sdk": "^3.0.0-next.1",
43
- "@morpho-org/simulation-sdk-wagmi": "^2.0.5",
44
- "@morpho-org/test": "^2.0.6",
45
- "@morpho-org/test-wagmi": "^2.0.4"
41
+ "@morpho-org/morpho-ts": "^2.2.0",
42
+ "@morpho-org/simulation-sdk": "^3.0.0-next.5",
43
+ "@morpho-org/test-wagmi": "^2.0.4",
44
+ "@morpho-org/test": "^2.1.0",
45
+ "@morpho-org/simulation-sdk-wagmi": "^2.0.5"
46
46
  },
47
47
  "scripts": {
48
48
  "prepublish": "$npm_execpath build",