@morpho-org/bundler-sdk-viem 4.2.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{BundlerAction.js → cjs/BundlerAction.js} +2 -2
- package/lib/{actions.js → cjs/actions.js} +3 -15
- package/lib/cjs/package.json +1 -0
- package/lib/esm/ActionBundle.d.ts +37 -0
- package/lib/esm/ActionBundle.js +35 -0
- package/lib/esm/BundlerAction.d.ts +470 -0
- package/lib/esm/BundlerAction.js +1657 -0
- package/lib/esm/abis.d.ts +3014 -0
- package/lib/esm/abis.js +2047 -0
- package/lib/esm/actions.d.ts +10 -0
- package/lib/esm/actions.js +781 -0
- package/lib/esm/bundle.d.ts +12 -0
- package/lib/esm/bundle.js +11 -0
- package/lib/esm/errors.d.ts +30 -0
- package/lib/esm/errors.js +54 -0
- package/lib/esm/index.d.ts +8 -0
- package/lib/esm/index.js +8 -0
- package/lib/esm/operations.d.ts +78 -0
- package/lib/esm/operations.js +800 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/types/actions.d.ts +355 -0
- package/lib/esm/types/actions.js +1 -0
- package/lib/esm/types/index.d.ts +2 -0
- package/lib/esm/types/index.js +2 -0
- package/lib/esm/types/operations.d.ts +86 -0
- package/lib/esm/types/operations.js +55 -0
- package/package.json +25 -16
- package/src/index.ts +8 -0
- /package/lib/{ActionBundle.d.ts → cjs/ActionBundle.d.ts} +0 -0
- /package/lib/{ActionBundle.js → cjs/ActionBundle.js} +0 -0
- /package/lib/{BundlerAction.d.ts → cjs/BundlerAction.d.ts} +0 -0
- /package/lib/{abis.d.ts → cjs/abis.d.ts} +0 -0
- /package/lib/{abis.js → cjs/abis.js} +0 -0
- /package/lib/{actions.d.ts → cjs/actions.d.ts} +0 -0
- /package/lib/{bundle.d.ts → cjs/bundle.d.ts} +0 -0
- /package/lib/{bundle.js → cjs/bundle.js} +0 -0
- /package/lib/{errors.d.ts → cjs/errors.d.ts} +0 -0
- /package/lib/{errors.js → cjs/errors.js} +0 -0
- /package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/lib/{index.js → cjs/index.js} +0 -0
- /package/lib/{operations.d.ts → cjs/operations.d.ts} +0 -0
- /package/lib/{operations.js → cjs/operations.js} +0 -0
- /package/lib/{types → cjs/types}/actions.d.ts +0 -0
- /package/lib/{types → cjs/types}/actions.js +0 -0
- /package/lib/{types → cjs/types}/index.d.ts +0 -0
- /package/lib/{types → cjs/types}/index.js +0 -0
- /package/lib/{types → cjs/types}/operations.d.ts +0 -0
- /package/lib/{types → cjs/types}/operations.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import type { Account, Chain, Client, Hex, TransactionRequest, Transport } from "viem";
|
|
2
|
+
import type { Address, InputMarketParams } from "@morpho-org/blue-sdk";
|
|
3
|
+
import type { ParaswapOffsets } from "@morpho-org/simulation-sdk";
|
|
4
|
+
export interface Authorization {
|
|
5
|
+
authorizer: Address;
|
|
6
|
+
authorized: Address;
|
|
7
|
+
isAuthorized: boolean;
|
|
8
|
+
nonce: bigint;
|
|
9
|
+
deadline: bigint;
|
|
10
|
+
}
|
|
11
|
+
export interface InputReallocation {
|
|
12
|
+
marketParams: InputMarketParams;
|
|
13
|
+
amount: bigint;
|
|
14
|
+
}
|
|
15
|
+
export interface Permit2PermitSingleDetails {
|
|
16
|
+
token: Address;
|
|
17
|
+
amount: bigint;
|
|
18
|
+
expiration: number;
|
|
19
|
+
nonce: number;
|
|
20
|
+
}
|
|
21
|
+
export interface Permit2PermitSingle {
|
|
22
|
+
details: Permit2PermitSingleDetails;
|
|
23
|
+
sigDeadline: bigint;
|
|
24
|
+
}
|
|
25
|
+
export interface ActionArgs {
|
|
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
|
+
];
|
|
45
|
+
erc20WrapperDepositFor: [
|
|
46
|
+
wrapper: Address,
|
|
47
|
+
underlying: Address,
|
|
48
|
+
amount: bigint,
|
|
49
|
+
skipRevert?: boolean
|
|
50
|
+
];
|
|
51
|
+
erc20WrapperWithdrawTo: [
|
|
52
|
+
wrapper: Address,
|
|
53
|
+
receiver: Address,
|
|
54
|
+
amount: bigint,
|
|
55
|
+
skipRevert?: boolean
|
|
56
|
+
];
|
|
57
|
+
permit: [
|
|
58
|
+
owner: Address,
|
|
59
|
+
asset: Address,
|
|
60
|
+
amount: bigint,
|
|
61
|
+
deadline: bigint,
|
|
62
|
+
signature: Hex | null,
|
|
63
|
+
skipRevert?: boolean
|
|
64
|
+
];
|
|
65
|
+
permitDai: [
|
|
66
|
+
owner: Address,
|
|
67
|
+
nonce: bigint,
|
|
68
|
+
expiry: bigint,
|
|
69
|
+
allowed: boolean,
|
|
70
|
+
signature: Hex | null,
|
|
71
|
+
skipRevert?: boolean
|
|
72
|
+
];
|
|
73
|
+
approve2: [
|
|
74
|
+
owner: Address,
|
|
75
|
+
permitSingle: Permit2PermitSingle,
|
|
76
|
+
signature: Hex | null,
|
|
77
|
+
skipRevert?: boolean
|
|
78
|
+
];
|
|
79
|
+
transferFrom2: [
|
|
80
|
+
asset: Address,
|
|
81
|
+
amount: bigint,
|
|
82
|
+
recipient: Address,
|
|
83
|
+
skipRevert?: boolean
|
|
84
|
+
];
|
|
85
|
+
erc4626Mint: [
|
|
86
|
+
erc4626: Address,
|
|
87
|
+
shares: bigint,
|
|
88
|
+
maxSharePrice: bigint,
|
|
89
|
+
receiver: Address,
|
|
90
|
+
skipRevert?: boolean
|
|
91
|
+
];
|
|
92
|
+
erc4626Deposit: [
|
|
93
|
+
erc4626: Address,
|
|
94
|
+
assets: bigint,
|
|
95
|
+
maxSharePrice: bigint,
|
|
96
|
+
receiver: Address,
|
|
97
|
+
skipRevert?: boolean
|
|
98
|
+
];
|
|
99
|
+
erc4626Withdraw: [
|
|
100
|
+
erc4626: Address,
|
|
101
|
+
assets: bigint,
|
|
102
|
+
minSharePrice: bigint,
|
|
103
|
+
receiver: Address,
|
|
104
|
+
owner: Address,
|
|
105
|
+
skipRevert?: boolean
|
|
106
|
+
];
|
|
107
|
+
erc4626Redeem: [
|
|
108
|
+
erc4626: Address,
|
|
109
|
+
shares: bigint,
|
|
110
|
+
minSharePrice: bigint,
|
|
111
|
+
receiver: Address,
|
|
112
|
+
owner: Address,
|
|
113
|
+
skipRevert?: boolean
|
|
114
|
+
];
|
|
115
|
+
morphoSetAuthorizationWithSig: [
|
|
116
|
+
authorization: Authorization,
|
|
117
|
+
signature: Hex | null,
|
|
118
|
+
skipRevert?: boolean
|
|
119
|
+
];
|
|
120
|
+
morphoSupply: [
|
|
121
|
+
market: InputMarketParams,
|
|
122
|
+
assets: bigint,
|
|
123
|
+
shares: bigint,
|
|
124
|
+
slippageAmount: bigint,
|
|
125
|
+
onBehalf: Address,
|
|
126
|
+
onMorphoSupply: Action[],
|
|
127
|
+
skipRevert?: boolean
|
|
128
|
+
];
|
|
129
|
+
morphoSupplyCollateral: [
|
|
130
|
+
market: InputMarketParams,
|
|
131
|
+
assets: bigint,
|
|
132
|
+
onBehalf: Address,
|
|
133
|
+
onMorphoSupplyCollateral: Action[],
|
|
134
|
+
skipRevert?: boolean
|
|
135
|
+
];
|
|
136
|
+
morphoBorrow: [
|
|
137
|
+
market: InputMarketParams,
|
|
138
|
+
assets: bigint,
|
|
139
|
+
shares: bigint,
|
|
140
|
+
slippageAmount: bigint,
|
|
141
|
+
receiver: Address,
|
|
142
|
+
skipRevert?: boolean
|
|
143
|
+
];
|
|
144
|
+
morphoRepay: [
|
|
145
|
+
market: InputMarketParams,
|
|
146
|
+
assets: bigint,
|
|
147
|
+
shares: bigint,
|
|
148
|
+
slippageAmount: bigint,
|
|
149
|
+
onBehalf: Address,
|
|
150
|
+
onMorphoRepay: Action[],
|
|
151
|
+
skipRevert?: boolean
|
|
152
|
+
];
|
|
153
|
+
morphoWithdraw: [
|
|
154
|
+
market: InputMarketParams,
|
|
155
|
+
assets: bigint,
|
|
156
|
+
shares: bigint,
|
|
157
|
+
slippageAmount: bigint,
|
|
158
|
+
receiver: Address,
|
|
159
|
+
skipRevert?: boolean
|
|
160
|
+
];
|
|
161
|
+
morphoWithdrawCollateral: [
|
|
162
|
+
market: InputMarketParams,
|
|
163
|
+
assets: bigint,
|
|
164
|
+
receiver: Address,
|
|
165
|
+
skipRevert?: boolean
|
|
166
|
+
];
|
|
167
|
+
morphoFlashLoan: [
|
|
168
|
+
token: Address,
|
|
169
|
+
assets: bigint,
|
|
170
|
+
onMorphoFlashLoan: Action[],
|
|
171
|
+
skipRevert?: boolean
|
|
172
|
+
];
|
|
173
|
+
reallocateTo: [
|
|
174
|
+
vault: Address,
|
|
175
|
+
fee: bigint,
|
|
176
|
+
withdrawals: InputReallocation[],
|
|
177
|
+
supplyMarket: InputMarketParams,
|
|
178
|
+
skipRevert?: boolean
|
|
179
|
+
];
|
|
180
|
+
paraswapBuy: [
|
|
181
|
+
augustus: Address,
|
|
182
|
+
callData: Hex,
|
|
183
|
+
srcToken: Address,
|
|
184
|
+
dstToken: Address,
|
|
185
|
+
offsets: ParaswapOffsets,
|
|
186
|
+
receiver: Address,
|
|
187
|
+
skipRevert?: boolean
|
|
188
|
+
];
|
|
189
|
+
paraswapSell: [
|
|
190
|
+
augustus: Address,
|
|
191
|
+
callData: Hex,
|
|
192
|
+
srcToken: Address,
|
|
193
|
+
dstToken: Address,
|
|
194
|
+
sellEntireBalance: boolean,
|
|
195
|
+
offsets: ParaswapOffsets,
|
|
196
|
+
receiver: Address,
|
|
197
|
+
skipRevert?: boolean
|
|
198
|
+
];
|
|
199
|
+
paraswapBuyMorphoDebt: [
|
|
200
|
+
augustus: Address,
|
|
201
|
+
callData: Hex,
|
|
202
|
+
srcToken: Address,
|
|
203
|
+
marketParams: InputMarketParams,
|
|
204
|
+
offsets: ParaswapOffsets,
|
|
205
|
+
onBehalf: Address,
|
|
206
|
+
receiver: Address,
|
|
207
|
+
skipRevert?: boolean
|
|
208
|
+
];
|
|
209
|
+
urdClaim: [
|
|
210
|
+
distributor: Address,
|
|
211
|
+
account: Address,
|
|
212
|
+
reward: Address,
|
|
213
|
+
amount: bigint,
|
|
214
|
+
proof: Hex[],
|
|
215
|
+
skipRevert?: boolean
|
|
216
|
+
];
|
|
217
|
+
wrapNative: [amount: bigint, recipient: Address, skipRevert?: boolean];
|
|
218
|
+
unwrapNative: [amount: bigint, recipient: Address, skipRevert?: boolean];
|
|
219
|
+
stakeEth: [
|
|
220
|
+
amount: bigint,
|
|
221
|
+
minShares: bigint,
|
|
222
|
+
referral: Address,
|
|
223
|
+
recipient: Address,
|
|
224
|
+
skipRevert?: boolean
|
|
225
|
+
];
|
|
226
|
+
wrapStEth: [amount: bigint, recipient: Address, skipRevert?: boolean];
|
|
227
|
+
unwrapStEth: [amount: bigint, recipient: Address, skipRevert?: boolean];
|
|
228
|
+
aaveV2Repay: [
|
|
229
|
+
asset: Address,
|
|
230
|
+
amount: bigint,
|
|
231
|
+
onBehalf: Address,
|
|
232
|
+
rateMode?: bigint,
|
|
233
|
+
skipRevert?: boolean
|
|
234
|
+
];
|
|
235
|
+
aaveV2Withdraw: [
|
|
236
|
+
asset: Address,
|
|
237
|
+
amount: bigint,
|
|
238
|
+
recipient: Address,
|
|
239
|
+
skipRevert?: boolean
|
|
240
|
+
];
|
|
241
|
+
aaveV3Repay: [
|
|
242
|
+
asset: Address,
|
|
243
|
+
amount: bigint,
|
|
244
|
+
onBehalf: Address,
|
|
245
|
+
rateMode?: bigint,
|
|
246
|
+
skipRevert?: boolean
|
|
247
|
+
];
|
|
248
|
+
aaveV3Withdraw: [
|
|
249
|
+
asset: Address,
|
|
250
|
+
amount: bigint,
|
|
251
|
+
recipient: Address,
|
|
252
|
+
skipRevert?: boolean
|
|
253
|
+
];
|
|
254
|
+
aaveV3OptimizerRepay: [
|
|
255
|
+
underlying: Address,
|
|
256
|
+
amount: bigint,
|
|
257
|
+
onBehalf: Address,
|
|
258
|
+
skipRevert?: boolean
|
|
259
|
+
];
|
|
260
|
+
aaveV3OptimizerWithdraw: [
|
|
261
|
+
underlying: Address,
|
|
262
|
+
amount: bigint,
|
|
263
|
+
maxIterations: bigint,
|
|
264
|
+
recipient: Address,
|
|
265
|
+
skipRevert?: boolean
|
|
266
|
+
];
|
|
267
|
+
aaveV3OptimizerWithdrawCollateral: [
|
|
268
|
+
underlying: Address,
|
|
269
|
+
amount: bigint,
|
|
270
|
+
recipient: Address,
|
|
271
|
+
skipRevert?: boolean
|
|
272
|
+
];
|
|
273
|
+
aaveV3OptimizerApproveManagerWithSig: [
|
|
274
|
+
aaveV3Optimizer: Address,
|
|
275
|
+
owner: Address,
|
|
276
|
+
isApproved: boolean,
|
|
277
|
+
nonce: bigint,
|
|
278
|
+
deadline: bigint,
|
|
279
|
+
signature: Hex | null,
|
|
280
|
+
skipRevert?: boolean
|
|
281
|
+
];
|
|
282
|
+
compoundV2Repay: [
|
|
283
|
+
cToken: Address,
|
|
284
|
+
amount: bigint,
|
|
285
|
+
isEth: boolean,
|
|
286
|
+
onBehalf: Address,
|
|
287
|
+
skipRevert?: boolean
|
|
288
|
+
];
|
|
289
|
+
compoundV2Redeem: [
|
|
290
|
+
cToken: Address,
|
|
291
|
+
amount: bigint,
|
|
292
|
+
isEth: boolean,
|
|
293
|
+
recipient: Address,
|
|
294
|
+
skipRevert?: boolean
|
|
295
|
+
];
|
|
296
|
+
compoundV3Repay: [
|
|
297
|
+
instance: Address,
|
|
298
|
+
amount: bigint,
|
|
299
|
+
onBehalf: Address,
|
|
300
|
+
skipRevert?: boolean
|
|
301
|
+
];
|
|
302
|
+
compoundV3WithdrawFrom: [
|
|
303
|
+
instance: Address,
|
|
304
|
+
asset: Address,
|
|
305
|
+
amount: bigint,
|
|
306
|
+
recipient: Address,
|
|
307
|
+
skipRevert?: boolean
|
|
308
|
+
];
|
|
309
|
+
compoundV3AllowBySig: [
|
|
310
|
+
instance: Address,
|
|
311
|
+
owner: Address,
|
|
312
|
+
isAllowed: boolean,
|
|
313
|
+
nonce: bigint,
|
|
314
|
+
expiry: bigint,
|
|
315
|
+
signature: Hex | null,
|
|
316
|
+
skipRevert?: boolean
|
|
317
|
+
];
|
|
318
|
+
morphoWrapperDepositFor: [
|
|
319
|
+
recipient: Address,
|
|
320
|
+
amount: bigint,
|
|
321
|
+
skipRevert?: boolean
|
|
322
|
+
];
|
|
323
|
+
}
|
|
324
|
+
export type ActionType = keyof ActionArgs;
|
|
325
|
+
export type Actions = {
|
|
326
|
+
[T in ActionType]: {
|
|
327
|
+
type: T;
|
|
328
|
+
args: ActionArgs[T];
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
export type Action = Actions[ActionType];
|
|
332
|
+
export interface TransactionRequirementArgs {
|
|
333
|
+
erc20Approve: [asset: Address, recipient: Address, amount: bigint];
|
|
334
|
+
morphoSetAuthorization: [authorized: Address, isAuthorized: boolean];
|
|
335
|
+
}
|
|
336
|
+
export type TransactionRequirementType = keyof TransactionRequirementArgs;
|
|
337
|
+
export type Requirements = {
|
|
338
|
+
[T in TransactionRequirementType]: {
|
|
339
|
+
type: T;
|
|
340
|
+
args: TransactionRequirementArgs[T];
|
|
341
|
+
tx: TransactionRequest & {
|
|
342
|
+
to: Address;
|
|
343
|
+
data: Hex;
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
export type TransactionRequirement = Requirements[TransactionRequirementType];
|
|
348
|
+
export interface SignatureRequirementFunction {
|
|
349
|
+
(client: Client<Transport, Chain | undefined, Account>): Promise<Hex>;
|
|
350
|
+
(client: Client, account: Account): Promise<Hex>;
|
|
351
|
+
}
|
|
352
|
+
export interface SignatureRequirement {
|
|
353
|
+
action: Action;
|
|
354
|
+
sign: SignatureRequirementFunction;
|
|
355
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type BlueOperationArgs, CALLBACK_OPERATIONS, type CallbackOperationType, type Erc20OperationArgs, type MetaMorphoOperationArgs, type OperationArgs, type OperationType, type ParaswapOperationArgs, type WithOperationArgs } from "@morpho-org/simulation-sdk";
|
|
2
|
+
import type { UnionOmit } from "viem";
|
|
3
|
+
export declare const BLUE_BUNDLER_OPERATIONS: readonly ["Blue_SetAuthorization", "Blue_Borrow", "Blue_Repay", "Blue_Supply", "Blue_SupplyCollateral", "Blue_Withdraw", "Blue_WithdrawCollateral", "Blue_FlashLoan", "Blue_Paraswap_BuyDebt"];
|
|
4
|
+
export type BlueBundlerOperationType = (typeof BLUE_BUNDLER_OPERATIONS)[number];
|
|
5
|
+
export type BlueBundlerOperationArgs = Omit<BlueOperationArgs, (typeof CALLBACK_OPERATIONS)[number]> & {
|
|
6
|
+
[OperationType in CallbackOperationType]: Omit<BlueOperationArgs[OperationType], "callback"> & {
|
|
7
|
+
/**
|
|
8
|
+
* Inside a callback, the sender is forced to be the generalAdapter1.
|
|
9
|
+
*/
|
|
10
|
+
callback?: UnionOmit<BundlerOperation, "sender">[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type BlueBundlerOperations = {
|
|
14
|
+
[OperationType in BlueBundlerOperationType]: Omit<WithOperationArgs<OperationType, BlueBundlerOperationArgs>, "address">;
|
|
15
|
+
};
|
|
16
|
+
export type BlueBundlerOperation = BlueBundlerOperations[BlueBundlerOperationType];
|
|
17
|
+
export declare const METAMORPHO_BUNDLER_OPERATIONS: readonly ["MetaMorpho_Deposit", "MetaMorpho_Withdraw", "MetaMorpho_PublicReallocate"];
|
|
18
|
+
export type MetaMorphoBundlerOperationType = (typeof METAMORPHO_BUNDLER_OPERATIONS)[number];
|
|
19
|
+
export type MetaMorphoBundlerOperations = {
|
|
20
|
+
[OperationType in MetaMorphoBundlerOperationType]: WithOperationArgs<OperationType, MetaMorphoOperationArgs>;
|
|
21
|
+
};
|
|
22
|
+
export type MetaMorphoBundlerOperation = MetaMorphoBundlerOperations[MetaMorphoBundlerOperationType];
|
|
23
|
+
export declare const PARASWAP_BUNDLER_OPERATIONS: readonly ["Paraswap_Buy", "Paraswap_Sell"];
|
|
24
|
+
export type ParaswapBundlerOperationType = (typeof PARASWAP_BUNDLER_OPERATIONS)[number];
|
|
25
|
+
export type ParaswapBundlerOperations = {
|
|
26
|
+
[OperationType in ParaswapBundlerOperationType]: WithOperationArgs<OperationType, ParaswapOperationArgs>;
|
|
27
|
+
};
|
|
28
|
+
export type ParaswapBundlerOperation = ParaswapBundlerOperations[ParaswapBundlerOperationType];
|
|
29
|
+
export declare const ERC20_BUNDLER_OPERATIONS: readonly ["Erc20_Approve", "Erc20_Permit", "Erc20_Permit2", "Erc20_Transfer", "Erc20_Transfer2", "Erc20_Wrap", "Erc20_Unwrap"];
|
|
30
|
+
export type Erc20BundlerOperationType = (typeof ERC20_BUNDLER_OPERATIONS)[number];
|
|
31
|
+
export type Erc20BundlerOperations = {
|
|
32
|
+
[OperationType in Erc20BundlerOperationType]: WithOperationArgs<OperationType, Erc20OperationArgs>;
|
|
33
|
+
};
|
|
34
|
+
export type Erc20BundlerOperation = Erc20BundlerOperations[Erc20BundlerOperationType];
|
|
35
|
+
export interface BundlerOperationArgs extends BlueOperationArgs, MetaMorphoOperationArgs, ParaswapOperationArgs, Erc20OperationArgs {
|
|
36
|
+
}
|
|
37
|
+
export type BundlerOperations = BlueBundlerOperations & MetaMorphoBundlerOperations & ParaswapBundlerOperations & Erc20BundlerOperations;
|
|
38
|
+
export type BundlerOperationType = BlueBundlerOperationType | MetaMorphoBundlerOperationType | ParaswapBundlerOperationType | Erc20BundlerOperationType;
|
|
39
|
+
export type BundlerOperation = BlueBundlerOperation | MetaMorphoBundlerOperation | ParaswapBundlerOperation | Erc20BundlerOperation;
|
|
40
|
+
export declare const BUNDLER_OPERATIONS: readonly ["Blue_SetAuthorization", "Blue_Borrow", "Blue_Repay", "Blue_Supply", "Blue_SupplyCollateral", "Blue_Withdraw", "Blue_WithdrawCollateral", "Blue_FlashLoan", "Blue_Paraswap_BuyDebt", "MetaMorpho_Deposit", "MetaMorpho_Withdraw", "MetaMorpho_PublicReallocate", "Erc20_Approve", "Erc20_Permit", "Erc20_Permit2", "Erc20_Transfer", "Erc20_Transfer2", "Erc20_Wrap", "Erc20_Unwrap"];
|
|
41
|
+
export type CallbackBundlerOperationType = (typeof CALLBACK_OPERATIONS)[number];
|
|
42
|
+
export type CallbackBundlerOperations = Pick<BundlerOperations, CallbackBundlerOperationType>;
|
|
43
|
+
export type CallbackBundlerOperation = CallbackBundlerOperations[CallbackBundlerOperationType];
|
|
44
|
+
export declare const isBlueBundlerOperation: (operation: BundlerOperation) => operation is BlueBundlerOperation;
|
|
45
|
+
export declare const isMetaMorphoBundlerOperation: (operation: BundlerOperation) => operation is MetaMorphoBundlerOperation;
|
|
46
|
+
export declare const isErc20BundlerOperation: (operation: BundlerOperation) => operation is Erc20BundlerOperation;
|
|
47
|
+
export declare const isCallbackBundlerOperation: (operation: BundlerOperation) => operation is CallbackBundlerOperation;
|
|
48
|
+
export declare const BLUE_INPUT_OPERATIONS: readonly ["Blue_SetAuthorization", "Blue_Borrow", "Blue_Repay", "Blue_Supply", "Blue_SupplyCollateral", "Blue_Withdraw", "Blue_WithdrawCollateral", "Blue_FlashLoan", "Blue_Paraswap_BuyDebt"];
|
|
49
|
+
export type BlueInputBundlerOperationType = (typeof BLUE_INPUT_OPERATIONS)[number];
|
|
50
|
+
export type BlueInputBundlerOperationArgs = Omit<OperationArgs, (typeof CALLBACK_OPERATIONS)[number]> & {
|
|
51
|
+
[OperationType in CallbackOperationType]: Omit<OperationArgs[OperationType], "callback"> & {
|
|
52
|
+
/**
|
|
53
|
+
* Inside a callback, the sender is forced to be the generalAdapter1.
|
|
54
|
+
*/
|
|
55
|
+
callback?: UnionOmit<InputBundlerOperation, "sender">[];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export type BlueInputBundlerOperations = {
|
|
59
|
+
[OperationType in BlueInputBundlerOperationType]: Omit<WithOperationArgs<OperationType, BlueInputBundlerOperationArgs>, "address">;
|
|
60
|
+
};
|
|
61
|
+
export type BlueInputBundlerOperation = BlueInputBundlerOperations[BlueInputBundlerOperationType];
|
|
62
|
+
export declare const METAMORPHO_INPUT_OPERATIONS: readonly ["MetaMorpho_Deposit", "MetaMorpho_Withdraw"];
|
|
63
|
+
export type MetaMorphoInputBundlerOperationType = (typeof METAMORPHO_INPUT_OPERATIONS)[number];
|
|
64
|
+
export type MetaMorphoInputBundlerOperation = MetaMorphoBundlerOperations[MetaMorphoInputBundlerOperationType];
|
|
65
|
+
export declare const PARASWAP_INPUT_OPERATIONS: readonly ["Paraswap_Buy", "Paraswap_Sell"];
|
|
66
|
+
export type ParaswapInputBundlerOperationType = (typeof PARASWAP_INPUT_OPERATIONS)[number];
|
|
67
|
+
export type ParaswapInputBundlerOperation = BundlerOperations[ParaswapInputBundlerOperationType];
|
|
68
|
+
export declare const ERC20_INPUT_OPERATIONS: readonly ["Erc20_Approve", "Erc20_Permit", "Erc20_Permit2", "Erc20_Transfer", "Erc20_Transfer2", "Erc20_Wrap", "Erc20_Unwrap"];
|
|
69
|
+
export type Erc20InputBundlerOperationType = (typeof ERC20_INPUT_OPERATIONS)[number];
|
|
70
|
+
export type Erc20InputBundlerOperation = Erc20BundlerOperations[Erc20InputBundlerOperationType];
|
|
71
|
+
export interface InputBundlerOperationArgs extends BlueOperationArgs, MetaMorphoOperationArgs, ParaswapOperationArgs, Erc20OperationArgs {
|
|
72
|
+
}
|
|
73
|
+
export type InputBundlerOperationType = BlueInputBundlerOperationType | MetaMorphoInputBundlerOperationType | ParaswapInputBundlerOperationType | Erc20InputBundlerOperationType;
|
|
74
|
+
export type InputBundlerOperation = BlueInputBundlerOperation | MetaMorphoInputBundlerOperation | ParaswapInputBundlerOperation | Erc20InputBundlerOperation;
|
|
75
|
+
export declare const isBlueInputBundlerOperation: (operation: {
|
|
76
|
+
type: OperationType;
|
|
77
|
+
}) => operation is BlueInputBundlerOperation;
|
|
78
|
+
export declare const isMetaMorphoInputBundlerOperation: (operation: {
|
|
79
|
+
type: OperationType;
|
|
80
|
+
}) => operation is MetaMorphoInputBundlerOperation;
|
|
81
|
+
export declare const isErc20InputBundlerOperation: (operation: {
|
|
82
|
+
type: OperationType;
|
|
83
|
+
}) => operation is Erc20InputBundlerOperation;
|
|
84
|
+
export declare const isParaswapInputBundlerOperation: (operation: {
|
|
85
|
+
type: OperationType;
|
|
86
|
+
}) => operation is ParaswapInputBundlerOperation;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CALLBACK_OPERATIONS, ERC20_OPERATIONS, PARASWAP_OPERATIONS, } from "@morpho-org/simulation-sdk";
|
|
2
|
+
export const BLUE_BUNDLER_OPERATIONS = [
|
|
3
|
+
"Blue_SetAuthorization",
|
|
4
|
+
"Blue_Borrow",
|
|
5
|
+
"Blue_Repay",
|
|
6
|
+
"Blue_Supply",
|
|
7
|
+
"Blue_SupplyCollateral",
|
|
8
|
+
"Blue_Withdraw",
|
|
9
|
+
"Blue_WithdrawCollateral",
|
|
10
|
+
"Blue_FlashLoan",
|
|
11
|
+
"Blue_Paraswap_BuyDebt",
|
|
12
|
+
];
|
|
13
|
+
export const METAMORPHO_BUNDLER_OPERATIONS = [
|
|
14
|
+
"MetaMorpho_Deposit",
|
|
15
|
+
"MetaMorpho_Withdraw",
|
|
16
|
+
"MetaMorpho_PublicReallocate",
|
|
17
|
+
];
|
|
18
|
+
export const PARASWAP_BUNDLER_OPERATIONS = PARASWAP_OPERATIONS;
|
|
19
|
+
export const ERC20_BUNDLER_OPERATIONS = ERC20_OPERATIONS;
|
|
20
|
+
export const BUNDLER_OPERATIONS = [
|
|
21
|
+
...BLUE_BUNDLER_OPERATIONS,
|
|
22
|
+
...METAMORPHO_BUNDLER_OPERATIONS,
|
|
23
|
+
...ERC20_BUNDLER_OPERATIONS,
|
|
24
|
+
];
|
|
25
|
+
export const isBlueBundlerOperation = (operation) => {
|
|
26
|
+
return BLUE_BUNDLER_OPERATIONS.includes(operation.type);
|
|
27
|
+
};
|
|
28
|
+
export const isMetaMorphoBundlerOperation = (operation) => {
|
|
29
|
+
return METAMORPHO_BUNDLER_OPERATIONS.includes(operation.type);
|
|
30
|
+
};
|
|
31
|
+
export const isErc20BundlerOperation = (operation) => {
|
|
32
|
+
return ERC20_BUNDLER_OPERATIONS.includes(operation.type);
|
|
33
|
+
};
|
|
34
|
+
export const isCallbackBundlerOperation = (operation) => {
|
|
35
|
+
return CALLBACK_OPERATIONS.includes(operation.type);
|
|
36
|
+
};
|
|
37
|
+
export const BLUE_INPUT_OPERATIONS = BLUE_BUNDLER_OPERATIONS;
|
|
38
|
+
export const METAMORPHO_INPUT_OPERATIONS = [
|
|
39
|
+
"MetaMorpho_Deposit",
|
|
40
|
+
"MetaMorpho_Withdraw",
|
|
41
|
+
];
|
|
42
|
+
export const PARASWAP_INPUT_OPERATIONS = PARASWAP_BUNDLER_OPERATIONS;
|
|
43
|
+
export const ERC20_INPUT_OPERATIONS = ERC20_BUNDLER_OPERATIONS;
|
|
44
|
+
export const isBlueInputBundlerOperation = (operation) => {
|
|
45
|
+
return BLUE_INPUT_OPERATIONS.includes(operation.type);
|
|
46
|
+
};
|
|
47
|
+
export const isMetaMorphoInputBundlerOperation = (operation) => {
|
|
48
|
+
return METAMORPHO_INPUT_OPERATIONS.includes(operation.type);
|
|
49
|
+
};
|
|
50
|
+
export const isErc20InputBundlerOperation = (operation) => {
|
|
51
|
+
return ERC20_INPUT_OPERATIONS.includes(operation.type);
|
|
52
|
+
};
|
|
53
|
+
export const isParaswapInputBundlerOperation = (operation) => {
|
|
54
|
+
return PARASWAP_INPUT_OPERATIONS.includes(operation.type);
|
|
55
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/bundler-sdk-viem",
|
|
3
3
|
"description": "Viem-based extension of `@morpho-org/simulation-sdk` that exports utilities to transform simple interactions on Morpho (such as `Blue_Borrow`) and Morpho Vaults (such as `MetaMorpho_Deposit`) into the required bundles (with ERC20 approvals, transfers, etc) to submit to the bundler onchain.",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.3.1",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Rubilmax <rmilon@gmail.com>"
|
|
@@ -13,16 +13,17 @@
|
|
|
13
13
|
"email": "contact@morpho.org"
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "src/index.ts",
|
|
17
18
|
"files": [
|
|
18
19
|
"lib"
|
|
19
20
|
],
|
|
20
21
|
"peerDependencies": {
|
|
21
22
|
"viem": "^2.0.0",
|
|
22
|
-
"@morpho-org/
|
|
23
|
-
"@morpho-org/blue-sdk": "^5.
|
|
24
|
-
"@morpho-org/
|
|
25
|
-
"@morpho-org/
|
|
23
|
+
"@morpho-org/blue-sdk": "^5.17.0",
|
|
24
|
+
"@morpho-org/blue-sdk-viem": "^4.5.0",
|
|
25
|
+
"@morpho-org/simulation-sdk": "^3.4.0",
|
|
26
|
+
"@morpho-org/morpho-ts": "^2.5.0"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@tanstack/query-core": "^5.62.16",
|
|
@@ -34,18 +35,26 @@
|
|
|
34
35
|
"typescript": "^5.9.3",
|
|
35
36
|
"viem": "^2.41.2",
|
|
36
37
|
"vitest": "^4.0.15",
|
|
37
|
-
"@morpho-org/blue-sdk": "^5.
|
|
38
|
-
"@morpho-org/blue-sdk-viem": "^4.
|
|
39
|
-
"@morpho-org/morpho-ts": "^2.
|
|
40
|
-
"@morpho-org/
|
|
41
|
-
"@morpho-org/
|
|
42
|
-
"@morpho-org/test": "^2.
|
|
43
|
-
"@morpho-org/
|
|
44
|
-
"@morpho-org/
|
|
38
|
+
"@morpho-org/blue-sdk": "^5.17.0",
|
|
39
|
+
"@morpho-org/blue-sdk-viem": "^4.5.0",
|
|
40
|
+
"@morpho-org/morpho-ts": "^2.5.0",
|
|
41
|
+
"@morpho-org/simulation-sdk": "^3.4.0",
|
|
42
|
+
"@morpho-org/morpho-test": "^2.5.0",
|
|
43
|
+
"@morpho-org/test": "^2.7.0",
|
|
44
|
+
"@morpho-org/test-wagmi": "^2.1.0",
|
|
45
|
+
"@morpho-org/simulation-sdk-wagmi": "^3.3.0"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|
|
47
48
|
"prepublish": "$npm_execpath build",
|
|
48
|
-
"build": "
|
|
49
|
+
"build": "$npm_execpath build:cjs && $npm_execpath build:esm",
|
|
50
|
+
"build:cjs": "tsc --build tsconfig.build.cjs.json && echo '{\"type\":\"commonjs\"}' > lib/cjs/package.json",
|
|
51
|
+
"build:esm": "tsc --build tsconfig.build.esm.json && echo '{\"type\":\"module\"}' > lib/esm/package.json"
|
|
49
52
|
},
|
|
50
|
-
"
|
|
53
|
+
"exports": {
|
|
54
|
+
".": {
|
|
55
|
+
"types": "./lib/esm/index.d.ts",
|
|
56
|
+
"import": "./lib/esm/index.js",
|
|
57
|
+
"require": "./lib/cjs/index.js"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
51
60
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./actions.js";
|
|
2
|
+
export * from "./operations.js";
|
|
3
|
+
export * from "./errors.js";
|
|
4
|
+
export * from "./types/index.js";
|
|
5
|
+
export * from "./BundlerAction.js";
|
|
6
|
+
export * from "./bundle.js";
|
|
7
|
+
export * from "./ActionBundle.js";
|
|
8
|
+
export * from "./abis.js";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|