@gearbox-protocol/sdk 14.12.0-next.1 → 14.12.0-next.2
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/dist/cjs/abi/iZapper.js +62 -24
- package/dist/cjs/preview/parse/errors.js +5 -2
- package/dist/cjs/preview/parse/parseOperationCalldata.js +30 -1
- package/dist/cjs/preview/parse/parsePoolOperationCalldata.js +10 -2
- package/dist/cjs/preview/prerequisites/buildPrerequisites.js +34 -0
- package/dist/cjs/preview/simulate/errors.js +0 -7
- package/dist/cjs/preview/simulate/index.js +0 -3
- package/dist/cjs/preview/simulate/simulatePoolOperation.js +154 -29
- package/dist/cjs/sdk/MultichainSDK.js +1 -0
- package/dist/cjs/sdk/OnchainSDK.js +7 -3
- package/dist/cjs/sdk/market/MarketRegister.js +10 -5
- package/dist/cjs/sdk/market/ZapperRegister.js +54 -0
- package/dist/cjs/sdk/market/zapper/IERC20ZapperContract.js +3 -38
- package/dist/cjs/sdk/market/zapper/IETHZapperContract.js +3 -38
- package/dist/cjs/sdk/market/zapper/ZapperContract.js +109 -0
- package/dist/cjs/sdk/market/zapper/createZapper.js +12 -4
- package/dist/cjs/{preview/simulate/constants.js → sdk/market/zapper/errors.js} +15 -6
- package/dist/cjs/sdk/market/zapper/index.js +6 -2
- package/dist/cjs/sdk/market/zapper/types.js +16 -0
- package/dist/cjs/sdk/options.js +41 -17
- package/dist/esm/abi/iZapper.js +62 -24
- package/dist/esm/preview/parse/errors.js +3 -1
- package/dist/esm/preview/parse/parseOperationCalldata.js +32 -2
- package/dist/esm/preview/parse/parsePoolOperationCalldata.js +10 -2
- package/dist/esm/preview/prerequisites/buildPrerequisites.js +34 -0
- package/dist/esm/preview/simulate/errors.js +0 -6
- package/dist/esm/preview/simulate/index.js +0 -2
- package/dist/esm/preview/simulate/simulatePoolOperation.js +155 -30
- package/dist/esm/sdk/MultichainSDK.js +1 -0
- package/dist/esm/sdk/OnchainSDK.js +7 -3
- package/dist/esm/sdk/market/MarketRegister.js +10 -5
- package/dist/esm/sdk/market/ZapperRegister.js +54 -0
- package/dist/esm/sdk/market/zapper/IERC20ZapperContract.js +3 -38
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +3 -38
- package/dist/esm/sdk/market/zapper/ZapperContract.js +85 -0
- package/dist/esm/sdk/market/zapper/createZapper.js +12 -4
- package/dist/esm/sdk/market/zapper/errors.js +13 -0
- package/dist/esm/sdk/market/zapper/index.js +3 -1
- package/dist/esm/sdk/market/zapper/types.js +0 -0
- package/dist/esm/sdk/options.js +39 -15
- package/dist/types/abi/iERC20Zapper.d.ts +91 -23
- package/dist/types/abi/iETHZapper.d.ts +91 -23
- package/dist/types/abi/iZapper.d.ts +91 -23
- package/dist/types/preview/parse/errors.d.ts +1 -0
- package/dist/types/preview/parse/parseOperationCalldata.d.ts +3 -3
- package/dist/types/preview/parse/types-pools.d.ts +61 -1
- package/dist/types/preview/simulate/errors.d.ts +6 -12
- package/dist/types/preview/simulate/index.d.ts +0 -1
- package/dist/types/preview/simulate/simulatePoolOperation.d.ts +22 -4
- package/dist/types/preview/simulate/types.d.ts +3 -16
- package/dist/types/sdk/MultichainSDK.d.ts +5 -0
- package/dist/types/sdk/OnchainSDK.d.ts +4 -0
- package/dist/types/sdk/market/MarketRegister.d.ts +15 -6
- package/dist/types/sdk/market/ZapperRegister.d.ts +25 -4
- package/dist/types/sdk/market/zapper/IERC20ZapperContract.d.ts +93 -39
- package/dist/types/sdk/market/zapper/IETHZapperContract.d.ts +93 -39
- package/dist/types/sdk/market/zapper/ZapperContract.d.ts +35 -0
- package/dist/types/sdk/market/zapper/createZapper.d.ts +2 -4
- package/dist/types/sdk/market/zapper/errors.d.ts +10 -0
- package/dist/types/sdk/market/zapper/index.d.ts +3 -1
- package/dist/types/sdk/market/zapper/types.d.ts +64 -0
- package/dist/types/sdk/options.d.ts +10 -5
- package/dist/types/sdk/pools/types.d.ts +3 -3
- package/dist/types/sdk/types/state-human.d.ts +9 -0
- package/dist/types/sdk/types/state.d.ts +7 -0
- package/package.json +3 -3
- package/dist/cjs/preview/simulate/extractERC20Transfers.js +0 -47
- package/dist/cjs/preview/simulate/simulatePoolOpMulticall.js +0 -155
- package/dist/cjs/preview/simulate/simulatePoolOpV1.js +0 -106
- package/dist/cjs/sdk/market/zapper/Zapper.js +0 -47
- package/dist/esm/preview/simulate/constants.js +0 -4
- package/dist/esm/preview/simulate/extractERC20Transfers.js +0 -23
- package/dist/esm/preview/simulate/simulatePoolOpMulticall.js +0 -130
- package/dist/esm/preview/simulate/simulatePoolOpV1.js +0 -82
- package/dist/esm/sdk/market/zapper/Zapper.js +0 -23
- package/dist/types/preview/simulate/constants.d.ts +0 -6
- package/dist/types/preview/simulate/extractERC20Transfers.d.ts +0 -11
- package/dist/types/preview/simulate/simulatePoolOpMulticall.d.ts +0 -28
- package/dist/types/preview/simulate/simulatePoolOpV1.d.ts +0 -14
- package/dist/types/sdk/market/zapper/Zapper.d.ts +0 -13
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Address, Hex } from "viem";
|
|
2
|
-
import { BaseContract } from "../../base/index.js";
|
|
3
2
|
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
4
3
|
import type { RawTx } from "../../types/index.js";
|
|
5
4
|
import type { ZapperData } from "../types.js";
|
|
5
|
+
import { ZapperContract } from "./ZapperContract.js";
|
|
6
6
|
declare const abi: readonly [{
|
|
7
7
|
readonly type: "function";
|
|
8
8
|
readonly inputs: readonly [{
|
|
@@ -197,132 +197,195 @@ declare const abi: readonly [{
|
|
|
197
197
|
readonly stateMutability: "nonpayable";
|
|
198
198
|
}, {
|
|
199
199
|
readonly type: "function";
|
|
200
|
+
readonly name: "contractType";
|
|
200
201
|
readonly inputs: readonly [];
|
|
202
|
+
readonly outputs: readonly [{
|
|
203
|
+
readonly name: "";
|
|
204
|
+
readonly type: "bytes32";
|
|
205
|
+
readonly internalType: "bytes32";
|
|
206
|
+
}];
|
|
207
|
+
readonly stateMutability: "view";
|
|
208
|
+
}, {
|
|
209
|
+
readonly type: "function";
|
|
201
210
|
readonly name: "pool";
|
|
211
|
+
readonly inputs: readonly [];
|
|
202
212
|
readonly outputs: readonly [{
|
|
203
213
|
readonly name: "";
|
|
204
|
-
readonly internalType: "address";
|
|
205
214
|
readonly type: "address";
|
|
215
|
+
readonly internalType: "address";
|
|
206
216
|
}];
|
|
207
217
|
readonly stateMutability: "view";
|
|
208
218
|
}, {
|
|
209
219
|
readonly type: "function";
|
|
220
|
+
readonly name: "previewDeposit";
|
|
210
221
|
readonly inputs: readonly [{
|
|
211
222
|
readonly name: "tokenInAmount";
|
|
212
|
-
readonly internalType: "uint256";
|
|
213
223
|
readonly type: "uint256";
|
|
224
|
+
readonly internalType: "uint256";
|
|
214
225
|
}];
|
|
215
|
-
readonly name: "previewDeposit";
|
|
216
226
|
readonly outputs: readonly [{
|
|
217
227
|
readonly name: "tokenOutAmount";
|
|
218
|
-
readonly internalType: "uint256";
|
|
219
228
|
readonly type: "uint256";
|
|
229
|
+
readonly internalType: "uint256";
|
|
220
230
|
}];
|
|
221
231
|
readonly stateMutability: "view";
|
|
222
232
|
}, {
|
|
223
233
|
readonly type: "function";
|
|
234
|
+
readonly name: "previewRedeem";
|
|
224
235
|
readonly inputs: readonly [{
|
|
225
236
|
readonly name: "tokenOutAmount";
|
|
226
|
-
readonly internalType: "uint256";
|
|
227
237
|
readonly type: "uint256";
|
|
238
|
+
readonly internalType: "uint256";
|
|
228
239
|
}];
|
|
229
|
-
readonly name: "previewRedeem";
|
|
230
240
|
readonly outputs: readonly [{
|
|
231
241
|
readonly name: "tokenInAmount";
|
|
232
|
-
readonly internalType: "uint256";
|
|
233
242
|
readonly type: "uint256";
|
|
243
|
+
readonly internalType: "uint256";
|
|
234
244
|
}];
|
|
235
245
|
readonly stateMutability: "view";
|
|
236
246
|
}, {
|
|
237
247
|
readonly type: "function";
|
|
248
|
+
readonly name: "redeem";
|
|
238
249
|
readonly inputs: readonly [{
|
|
239
250
|
readonly name: "tokenOutAmount";
|
|
240
|
-
readonly internalType: "uint256";
|
|
241
251
|
readonly type: "uint256";
|
|
252
|
+
readonly internalType: "uint256";
|
|
242
253
|
}, {
|
|
243
254
|
readonly name: "receiver";
|
|
244
|
-
readonly internalType: "address";
|
|
245
255
|
readonly type: "address";
|
|
256
|
+
readonly internalType: "address";
|
|
246
257
|
}];
|
|
247
|
-
readonly name: "redeem";
|
|
248
258
|
readonly outputs: readonly [{
|
|
249
259
|
readonly name: "tokenInAmount";
|
|
250
|
-
readonly internalType: "uint256";
|
|
251
260
|
readonly type: "uint256";
|
|
261
|
+
readonly internalType: "uint256";
|
|
252
262
|
}];
|
|
253
263
|
readonly stateMutability: "nonpayable";
|
|
254
264
|
}, {
|
|
255
265
|
readonly type: "function";
|
|
266
|
+
readonly name: "redeemWithPermit";
|
|
256
267
|
readonly inputs: readonly [{
|
|
257
268
|
readonly name: "tokenOutAmount";
|
|
258
|
-
readonly internalType: "uint256";
|
|
259
269
|
readonly type: "uint256";
|
|
270
|
+
readonly internalType: "uint256";
|
|
260
271
|
}, {
|
|
261
272
|
readonly name: "receiver";
|
|
262
|
-
readonly internalType: "address";
|
|
263
273
|
readonly type: "address";
|
|
274
|
+
readonly internalType: "address";
|
|
264
275
|
}, {
|
|
265
276
|
readonly name: "deadline";
|
|
266
|
-
readonly internalType: "uint256";
|
|
267
277
|
readonly type: "uint256";
|
|
278
|
+
readonly internalType: "uint256";
|
|
268
279
|
}, {
|
|
269
280
|
readonly name: "v";
|
|
270
|
-
readonly internalType: "uint8";
|
|
271
281
|
readonly type: "uint8";
|
|
282
|
+
readonly internalType: "uint8";
|
|
272
283
|
}, {
|
|
273
284
|
readonly name: "r";
|
|
274
|
-
readonly internalType: "bytes32";
|
|
275
285
|
readonly type: "bytes32";
|
|
286
|
+
readonly internalType: "bytes32";
|
|
276
287
|
}, {
|
|
277
288
|
readonly name: "s";
|
|
278
|
-
readonly internalType: "bytes32";
|
|
279
289
|
readonly type: "bytes32";
|
|
290
|
+
readonly internalType: "bytes32";
|
|
280
291
|
}];
|
|
281
|
-
readonly name: "redeemWithPermit";
|
|
282
292
|
readonly outputs: readonly [{
|
|
283
293
|
readonly name: "tokenInAmount";
|
|
294
|
+
readonly type: "uint256";
|
|
284
295
|
readonly internalType: "uint256";
|
|
296
|
+
}];
|
|
297
|
+
readonly stateMutability: "nonpayable";
|
|
298
|
+
}, {
|
|
299
|
+
readonly type: "function";
|
|
300
|
+
readonly name: "redeemWithPermitAllowed";
|
|
301
|
+
readonly inputs: readonly [{
|
|
302
|
+
readonly name: "tokenOutAmount";
|
|
285
303
|
readonly type: "uint256";
|
|
304
|
+
readonly internalType: "uint256";
|
|
305
|
+
}, {
|
|
306
|
+
readonly name: "receiver";
|
|
307
|
+
readonly type: "address";
|
|
308
|
+
readonly internalType: "address";
|
|
309
|
+
}, {
|
|
310
|
+
readonly name: "nonce";
|
|
311
|
+
readonly type: "uint256";
|
|
312
|
+
readonly internalType: "uint256";
|
|
313
|
+
}, {
|
|
314
|
+
readonly name: "expiry";
|
|
315
|
+
readonly type: "uint256";
|
|
316
|
+
readonly internalType: "uint256";
|
|
317
|
+
}, {
|
|
318
|
+
readonly name: "v";
|
|
319
|
+
readonly type: "uint8";
|
|
320
|
+
readonly internalType: "uint8";
|
|
321
|
+
}, {
|
|
322
|
+
readonly name: "r";
|
|
323
|
+
readonly type: "bytes32";
|
|
324
|
+
readonly internalType: "bytes32";
|
|
325
|
+
}, {
|
|
326
|
+
readonly name: "s";
|
|
327
|
+
readonly type: "bytes32";
|
|
328
|
+
readonly internalType: "bytes32";
|
|
329
|
+
}];
|
|
330
|
+
readonly outputs: readonly [{
|
|
331
|
+
readonly name: "tokenInAmount";
|
|
332
|
+
readonly type: "uint256";
|
|
333
|
+
readonly internalType: "uint256";
|
|
286
334
|
}];
|
|
287
335
|
readonly stateMutability: "nonpayable";
|
|
288
336
|
}, {
|
|
289
337
|
readonly type: "function";
|
|
338
|
+
readonly name: "serialize";
|
|
290
339
|
readonly inputs: readonly [];
|
|
340
|
+
readonly outputs: readonly [{
|
|
341
|
+
readonly name: "serializedData";
|
|
342
|
+
readonly type: "bytes";
|
|
343
|
+
readonly internalType: "bytes";
|
|
344
|
+
}];
|
|
345
|
+
readonly stateMutability: "view";
|
|
346
|
+
}, {
|
|
347
|
+
readonly type: "function";
|
|
291
348
|
readonly name: "tokenIn";
|
|
349
|
+
readonly inputs: readonly [];
|
|
292
350
|
readonly outputs: readonly [{
|
|
293
351
|
readonly name: "";
|
|
294
|
-
readonly internalType: "address";
|
|
295
352
|
readonly type: "address";
|
|
353
|
+
readonly internalType: "address";
|
|
296
354
|
}];
|
|
297
355
|
readonly stateMutability: "view";
|
|
298
356
|
}, {
|
|
299
357
|
readonly type: "function";
|
|
300
|
-
readonly inputs: readonly [];
|
|
301
358
|
readonly name: "tokenOut";
|
|
359
|
+
readonly inputs: readonly [];
|
|
302
360
|
readonly outputs: readonly [{
|
|
303
361
|
readonly name: "";
|
|
304
|
-
readonly internalType: "address";
|
|
305
362
|
readonly type: "address";
|
|
363
|
+
readonly internalType: "address";
|
|
306
364
|
}];
|
|
307
365
|
readonly stateMutability: "view";
|
|
308
366
|
}, {
|
|
309
367
|
readonly type: "function";
|
|
310
|
-
readonly inputs: readonly [];
|
|
311
368
|
readonly name: "underlying";
|
|
369
|
+
readonly inputs: readonly [];
|
|
312
370
|
readonly outputs: readonly [{
|
|
313
371
|
readonly name: "";
|
|
314
|
-
readonly internalType: "address";
|
|
315
372
|
readonly type: "address";
|
|
373
|
+
readonly internalType: "address";
|
|
374
|
+
}];
|
|
375
|
+
readonly stateMutability: "view";
|
|
376
|
+
}, {
|
|
377
|
+
readonly type: "function";
|
|
378
|
+
readonly name: "version";
|
|
379
|
+
readonly inputs: readonly [];
|
|
380
|
+
readonly outputs: readonly [{
|
|
381
|
+
readonly name: "";
|
|
382
|
+
readonly type: "uint256";
|
|
383
|
+
readonly internalType: "uint256";
|
|
316
384
|
}];
|
|
317
385
|
readonly stateMutability: "view";
|
|
318
386
|
}];
|
|
319
387
|
type abi = typeof abi;
|
|
320
|
-
export declare class IERC20ZapperContract extends
|
|
321
|
-
readonly pool: ZapperData["pool"];
|
|
322
|
-
readonly type: ZapperData["type"];
|
|
323
|
-
readonly baseParams: ZapperData["baseParams"];
|
|
324
|
-
readonly tokenIn: ZapperData["tokenIn"];
|
|
325
|
-
readonly tokenOut: ZapperData["tokenOut"];
|
|
388
|
+
export declare class IERC20ZapperContract extends ZapperContract<abi> {
|
|
326
389
|
constructor(sdk: OnchainSDK, data: ZapperData);
|
|
327
390
|
/**
|
|
328
391
|
* Deposits ERC20 tokens into the pool via this zapper.
|
|
@@ -337,14 +400,5 @@ export declare class IERC20ZapperContract extends BaseContract<abi> implements Z
|
|
|
337
400
|
* EIP-2612 permit signature, skipping a separate approve transaction.
|
|
338
401
|
*/
|
|
339
402
|
depositWithReferralAndPermit(tokenInAmount: bigint, receiver: Address, referralCode: bigint, deadline: bigint, v: number, r: Hex, s: Hex): RawTx;
|
|
340
|
-
/**
|
|
341
|
-
* Redeems pool shares (diesel tokens) for the underlying asset via this zapper.
|
|
342
|
-
*/
|
|
343
|
-
redeem(tokenInAmount: bigint, receiver: Address): RawTx;
|
|
344
|
-
/**
|
|
345
|
-
* Redeems pool shares via this zapper with an EIP-2612 permit signature,
|
|
346
|
-
* skipping a separate approve transaction.
|
|
347
|
-
*/
|
|
348
|
-
redeemWithPermit(tokenInAmount: bigint, receiver: Address, deadline: bigint, v: number, r: Hex, s: Hex): RawTx;
|
|
349
403
|
}
|
|
350
404
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import { BaseContract } from "../../base/index.js";
|
|
3
2
|
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
4
3
|
import type { RawTx } from "../../types/index.js";
|
|
5
4
|
import type { ZapperData } from "../types.js";
|
|
5
|
+
import { ZapperContract } from "./ZapperContract.js";
|
|
6
6
|
declare const abi: readonly [{
|
|
7
7
|
readonly type: "function";
|
|
8
8
|
readonly inputs: readonly [{
|
|
@@ -37,132 +37,195 @@ declare const abi: readonly [{
|
|
|
37
37
|
readonly stateMutability: "payable";
|
|
38
38
|
}, {
|
|
39
39
|
readonly type: "function";
|
|
40
|
+
readonly name: "contractType";
|
|
40
41
|
readonly inputs: readonly [];
|
|
42
|
+
readonly outputs: readonly [{
|
|
43
|
+
readonly name: "";
|
|
44
|
+
readonly type: "bytes32";
|
|
45
|
+
readonly internalType: "bytes32";
|
|
46
|
+
}];
|
|
47
|
+
readonly stateMutability: "view";
|
|
48
|
+
}, {
|
|
49
|
+
readonly type: "function";
|
|
41
50
|
readonly name: "pool";
|
|
51
|
+
readonly inputs: readonly [];
|
|
42
52
|
readonly outputs: readonly [{
|
|
43
53
|
readonly name: "";
|
|
44
|
-
readonly internalType: "address";
|
|
45
54
|
readonly type: "address";
|
|
55
|
+
readonly internalType: "address";
|
|
46
56
|
}];
|
|
47
57
|
readonly stateMutability: "view";
|
|
48
58
|
}, {
|
|
49
59
|
readonly type: "function";
|
|
60
|
+
readonly name: "previewDeposit";
|
|
50
61
|
readonly inputs: readonly [{
|
|
51
62
|
readonly name: "tokenInAmount";
|
|
52
|
-
readonly internalType: "uint256";
|
|
53
63
|
readonly type: "uint256";
|
|
64
|
+
readonly internalType: "uint256";
|
|
54
65
|
}];
|
|
55
|
-
readonly name: "previewDeposit";
|
|
56
66
|
readonly outputs: readonly [{
|
|
57
67
|
readonly name: "tokenOutAmount";
|
|
58
|
-
readonly internalType: "uint256";
|
|
59
68
|
readonly type: "uint256";
|
|
69
|
+
readonly internalType: "uint256";
|
|
60
70
|
}];
|
|
61
71
|
readonly stateMutability: "view";
|
|
62
72
|
}, {
|
|
63
73
|
readonly type: "function";
|
|
74
|
+
readonly name: "previewRedeem";
|
|
64
75
|
readonly inputs: readonly [{
|
|
65
76
|
readonly name: "tokenOutAmount";
|
|
66
|
-
readonly internalType: "uint256";
|
|
67
77
|
readonly type: "uint256";
|
|
78
|
+
readonly internalType: "uint256";
|
|
68
79
|
}];
|
|
69
|
-
readonly name: "previewRedeem";
|
|
70
80
|
readonly outputs: readonly [{
|
|
71
81
|
readonly name: "tokenInAmount";
|
|
72
|
-
readonly internalType: "uint256";
|
|
73
82
|
readonly type: "uint256";
|
|
83
|
+
readonly internalType: "uint256";
|
|
74
84
|
}];
|
|
75
85
|
readonly stateMutability: "view";
|
|
76
86
|
}, {
|
|
77
87
|
readonly type: "function";
|
|
88
|
+
readonly name: "redeem";
|
|
78
89
|
readonly inputs: readonly [{
|
|
79
90
|
readonly name: "tokenOutAmount";
|
|
80
|
-
readonly internalType: "uint256";
|
|
81
91
|
readonly type: "uint256";
|
|
92
|
+
readonly internalType: "uint256";
|
|
82
93
|
}, {
|
|
83
94
|
readonly name: "receiver";
|
|
84
|
-
readonly internalType: "address";
|
|
85
95
|
readonly type: "address";
|
|
96
|
+
readonly internalType: "address";
|
|
86
97
|
}];
|
|
87
|
-
readonly name: "redeem";
|
|
88
98
|
readonly outputs: readonly [{
|
|
89
99
|
readonly name: "tokenInAmount";
|
|
90
|
-
readonly internalType: "uint256";
|
|
91
100
|
readonly type: "uint256";
|
|
101
|
+
readonly internalType: "uint256";
|
|
92
102
|
}];
|
|
93
103
|
readonly stateMutability: "nonpayable";
|
|
94
104
|
}, {
|
|
95
105
|
readonly type: "function";
|
|
106
|
+
readonly name: "redeemWithPermit";
|
|
96
107
|
readonly inputs: readonly [{
|
|
97
108
|
readonly name: "tokenOutAmount";
|
|
98
|
-
readonly internalType: "uint256";
|
|
99
109
|
readonly type: "uint256";
|
|
110
|
+
readonly internalType: "uint256";
|
|
100
111
|
}, {
|
|
101
112
|
readonly name: "receiver";
|
|
102
|
-
readonly internalType: "address";
|
|
103
113
|
readonly type: "address";
|
|
114
|
+
readonly internalType: "address";
|
|
104
115
|
}, {
|
|
105
116
|
readonly name: "deadline";
|
|
106
|
-
readonly internalType: "uint256";
|
|
107
117
|
readonly type: "uint256";
|
|
118
|
+
readonly internalType: "uint256";
|
|
108
119
|
}, {
|
|
109
120
|
readonly name: "v";
|
|
110
|
-
readonly internalType: "uint8";
|
|
111
121
|
readonly type: "uint8";
|
|
122
|
+
readonly internalType: "uint8";
|
|
112
123
|
}, {
|
|
113
124
|
readonly name: "r";
|
|
114
|
-
readonly internalType: "bytes32";
|
|
115
125
|
readonly type: "bytes32";
|
|
126
|
+
readonly internalType: "bytes32";
|
|
116
127
|
}, {
|
|
117
128
|
readonly name: "s";
|
|
118
|
-
readonly internalType: "bytes32";
|
|
119
129
|
readonly type: "bytes32";
|
|
130
|
+
readonly internalType: "bytes32";
|
|
120
131
|
}];
|
|
121
|
-
readonly name: "redeemWithPermit";
|
|
122
132
|
readonly outputs: readonly [{
|
|
123
133
|
readonly name: "tokenInAmount";
|
|
134
|
+
readonly type: "uint256";
|
|
124
135
|
readonly internalType: "uint256";
|
|
136
|
+
}];
|
|
137
|
+
readonly stateMutability: "nonpayable";
|
|
138
|
+
}, {
|
|
139
|
+
readonly type: "function";
|
|
140
|
+
readonly name: "redeemWithPermitAllowed";
|
|
141
|
+
readonly inputs: readonly [{
|
|
142
|
+
readonly name: "tokenOutAmount";
|
|
125
143
|
readonly type: "uint256";
|
|
144
|
+
readonly internalType: "uint256";
|
|
145
|
+
}, {
|
|
146
|
+
readonly name: "receiver";
|
|
147
|
+
readonly type: "address";
|
|
148
|
+
readonly internalType: "address";
|
|
149
|
+
}, {
|
|
150
|
+
readonly name: "nonce";
|
|
151
|
+
readonly type: "uint256";
|
|
152
|
+
readonly internalType: "uint256";
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "expiry";
|
|
155
|
+
readonly type: "uint256";
|
|
156
|
+
readonly internalType: "uint256";
|
|
157
|
+
}, {
|
|
158
|
+
readonly name: "v";
|
|
159
|
+
readonly type: "uint8";
|
|
160
|
+
readonly internalType: "uint8";
|
|
161
|
+
}, {
|
|
162
|
+
readonly name: "r";
|
|
163
|
+
readonly type: "bytes32";
|
|
164
|
+
readonly internalType: "bytes32";
|
|
165
|
+
}, {
|
|
166
|
+
readonly name: "s";
|
|
167
|
+
readonly type: "bytes32";
|
|
168
|
+
readonly internalType: "bytes32";
|
|
169
|
+
}];
|
|
170
|
+
readonly outputs: readonly [{
|
|
171
|
+
readonly name: "tokenInAmount";
|
|
172
|
+
readonly type: "uint256";
|
|
173
|
+
readonly internalType: "uint256";
|
|
126
174
|
}];
|
|
127
175
|
readonly stateMutability: "nonpayable";
|
|
128
176
|
}, {
|
|
129
177
|
readonly type: "function";
|
|
178
|
+
readonly name: "serialize";
|
|
130
179
|
readonly inputs: readonly [];
|
|
180
|
+
readonly outputs: readonly [{
|
|
181
|
+
readonly name: "serializedData";
|
|
182
|
+
readonly type: "bytes";
|
|
183
|
+
readonly internalType: "bytes";
|
|
184
|
+
}];
|
|
185
|
+
readonly stateMutability: "view";
|
|
186
|
+
}, {
|
|
187
|
+
readonly type: "function";
|
|
131
188
|
readonly name: "tokenIn";
|
|
189
|
+
readonly inputs: readonly [];
|
|
132
190
|
readonly outputs: readonly [{
|
|
133
191
|
readonly name: "";
|
|
134
|
-
readonly internalType: "address";
|
|
135
192
|
readonly type: "address";
|
|
193
|
+
readonly internalType: "address";
|
|
136
194
|
}];
|
|
137
195
|
readonly stateMutability: "view";
|
|
138
196
|
}, {
|
|
139
197
|
readonly type: "function";
|
|
140
|
-
readonly inputs: readonly [];
|
|
141
198
|
readonly name: "tokenOut";
|
|
199
|
+
readonly inputs: readonly [];
|
|
142
200
|
readonly outputs: readonly [{
|
|
143
201
|
readonly name: "";
|
|
144
|
-
readonly internalType: "address";
|
|
145
202
|
readonly type: "address";
|
|
203
|
+
readonly internalType: "address";
|
|
146
204
|
}];
|
|
147
205
|
readonly stateMutability: "view";
|
|
148
206
|
}, {
|
|
149
207
|
readonly type: "function";
|
|
150
|
-
readonly inputs: readonly [];
|
|
151
208
|
readonly name: "underlying";
|
|
209
|
+
readonly inputs: readonly [];
|
|
152
210
|
readonly outputs: readonly [{
|
|
153
211
|
readonly name: "";
|
|
154
|
-
readonly internalType: "address";
|
|
155
212
|
readonly type: "address";
|
|
213
|
+
readonly internalType: "address";
|
|
214
|
+
}];
|
|
215
|
+
readonly stateMutability: "view";
|
|
216
|
+
}, {
|
|
217
|
+
readonly type: "function";
|
|
218
|
+
readonly name: "version";
|
|
219
|
+
readonly inputs: readonly [];
|
|
220
|
+
readonly outputs: readonly [{
|
|
221
|
+
readonly name: "";
|
|
222
|
+
readonly type: "uint256";
|
|
223
|
+
readonly internalType: "uint256";
|
|
156
224
|
}];
|
|
157
225
|
readonly stateMutability: "view";
|
|
158
226
|
}];
|
|
159
227
|
type abi = typeof abi;
|
|
160
|
-
export declare class IETHZapperContract extends
|
|
161
|
-
readonly pool: ZapperData["pool"];
|
|
162
|
-
readonly type: ZapperData["type"];
|
|
163
|
-
readonly baseParams: ZapperData["baseParams"];
|
|
164
|
-
readonly tokenIn: ZapperData["tokenIn"];
|
|
165
|
-
readonly tokenOut: ZapperData["tokenOut"];
|
|
228
|
+
export declare class IETHZapperContract extends ZapperContract<abi> {
|
|
166
229
|
constructor(sdk: OnchainSDK, data: ZapperData);
|
|
167
230
|
/**
|
|
168
231
|
* Deposits native ETH into the pool via this zapper.
|
|
@@ -173,14 +236,5 @@ export declare class IETHZapperContract extends BaseContract<abi> implements Zap
|
|
|
173
236
|
* The caller must attach the deposit amount as msg.value.
|
|
174
237
|
*/
|
|
175
238
|
depositWithReferral(receiver: Address, referralCode: bigint): RawTx;
|
|
176
|
-
/**
|
|
177
|
-
* Redeems pool shares (diesel tokens) for the underlying asset via this zapper.
|
|
178
|
-
*/
|
|
179
|
-
redeem(tokenInAmount: bigint, receiver: Address): RawTx;
|
|
180
|
-
/**
|
|
181
|
-
* Redeems pool shares via this zapper with an EIP-2612 permit signature,
|
|
182
|
-
* skipping a separate approve transaction.
|
|
183
|
-
*/
|
|
184
|
-
redeemWithPermit(tokenInAmount: bigint, receiver: Address, deadline: bigint, v: number, r: Address, s: Address): RawTx;
|
|
185
239
|
}
|
|
186
240
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Abi, Address, Hex } from "viem";
|
|
2
|
+
import { BaseContract } from "../../base/index.js";
|
|
3
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
4
|
+
import type { RawTx } from "../../types/index.js";
|
|
5
|
+
import type { ZapperData } from "../types.js";
|
|
6
|
+
import type { IZapperContract, ParsedZapperOperation } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Base contract for every Gearbox zapper. Specialized zappers (e.g.
|
|
9
|
+
* {@link IERC20ZapperContract}, {@link IETHZapperContract}) extend this and add
|
|
10
|
+
* their type-specific deposit helpers; unknown zapper types are represented by
|
|
11
|
+
* this class directly, decoding against the common {@link iZapperAbi}.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ZapperContract<A extends Abi = Abi> extends BaseContract<A> implements IZapperContract {
|
|
14
|
+
readonly sdk: OnchainSDK;
|
|
15
|
+
readonly pool: ZapperData["pool"];
|
|
16
|
+
readonly type: ZapperData["type"];
|
|
17
|
+
readonly baseParams: ZapperData["baseParams"];
|
|
18
|
+
readonly tokenIn: ZapperData["tokenIn"];
|
|
19
|
+
readonly tokenOut: ZapperData["tokenOut"];
|
|
20
|
+
constructor(sdk: OnchainSDK, data: ZapperData, abi?: A, namePrefix?: string);
|
|
21
|
+
/**
|
|
22
|
+
* Decodes zapper calldata into {@link ParsedZapperOperation}.
|
|
23
|
+
* Throws {@link UnsupportedZapperFunctionError} for unknown selectors.
|
|
24
|
+
*/
|
|
25
|
+
parseOperation(calldata: Hex, value?: bigint): ParsedZapperOperation;
|
|
26
|
+
/**
|
|
27
|
+
* Redeems pool shares (diesel tokens) for the underlying asset via this zapper.
|
|
28
|
+
*/
|
|
29
|
+
redeem(tokenInAmount: bigint, receiver: Address): RawTx;
|
|
30
|
+
/**
|
|
31
|
+
* Redeems pool shares via this zapper with an EIP-2612 permit signature,
|
|
32
|
+
* skipping a separate approve transaction.
|
|
33
|
+
*/
|
|
34
|
+
redeemWithPermit(tokenInAmount: bigint, receiver: Address, deadline: bigint, v: number, r: Hex, s: Hex): RawTx;
|
|
35
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
2
2
|
import type { ZapperData } from "../types.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { Zapper } from "./Zapper.js";
|
|
6
|
-
export declare function createZapper(sdk: OnchainSDK, data: ZapperData): Zapper | IETHZapperContract | IERC20ZapperContract;
|
|
3
|
+
import type { IZapperContract } from "./types.js";
|
|
4
|
+
export declare function createZapper(sdk: OnchainSDK, data: ZapperData): IZapperContract;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when a zapper call uses a function other than a known
|
|
4
|
+
* `deposit`/`redeem` variant.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnsupportedZapperFunctionError extends Error {
|
|
7
|
+
readonly zapper: Address;
|
|
8
|
+
readonly functionName: string;
|
|
9
|
+
constructor(zapper: Address, functionName: string);
|
|
10
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
import type { IBaseContract } from "../../base/index.js";
|
|
3
|
+
import type { RawTx } from "../../types/index.js";
|
|
4
|
+
import type { ZapperData } from "../types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Deposit decoded from a zapper call
|
|
7
|
+
*/
|
|
8
|
+
export interface ParsedZapperDeposit {
|
|
9
|
+
operation: "Deposit";
|
|
10
|
+
/** Destination pool the zapper deposits into. */
|
|
11
|
+
pool: Address;
|
|
12
|
+
/** Zapper contract the call is sent to. */
|
|
13
|
+
zapper: Address;
|
|
14
|
+
receiver: Address;
|
|
15
|
+
/** Amount of `token` supplied to the zapper. */
|
|
16
|
+
assets: bigint;
|
|
17
|
+
/** Token actually deposited into the zapper (the zapper's `tokenIn`). */
|
|
18
|
+
token: Address;
|
|
19
|
+
/** Underlying token of the destination pool. */
|
|
20
|
+
underlying: Address;
|
|
21
|
+
/** Referral code, present only for `depositWithReferral(...)` calls. */
|
|
22
|
+
referralCode?: bigint;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Redeem decoded from a zapper call. The zapper burns pool shares and returns
|
|
26
|
+
* `token` to the receiver.
|
|
27
|
+
*/
|
|
28
|
+
export interface ParsedZapperRedeem {
|
|
29
|
+
operation: "Redeem";
|
|
30
|
+
/** Source pool the zapper redeems from. */
|
|
31
|
+
pool: Address;
|
|
32
|
+
/** Zapper contract the call is sent to. */
|
|
33
|
+
zapper: Address;
|
|
34
|
+
receiver: Address;
|
|
35
|
+
/** Pool shares (diesel) burned. */
|
|
36
|
+
shares: bigint;
|
|
37
|
+
/** Token returned to the receiver (the zapper's `tokenIn`). */
|
|
38
|
+
token: Address;
|
|
39
|
+
/** Underlying token of the source pool. */
|
|
40
|
+
underlying: Address;
|
|
41
|
+
}
|
|
42
|
+
export type ParsedZapperOperation = ParsedZapperDeposit | ParsedZapperRedeem;
|
|
43
|
+
/**
|
|
44
|
+
* Public interface for any Gearbox zapper contract wrapper.
|
|
45
|
+
*
|
|
46
|
+
* Based on contracts/interfaces/zappers/IZapper.sol in intergrations-v3 repo
|
|
47
|
+
*/
|
|
48
|
+
export interface IZapperContract extends IBaseContract, ZapperData {
|
|
49
|
+
/**
|
|
50
|
+
* Decodes zapper calldata into a {@link ParsedZapperOperation}.
|
|
51
|
+
* @param calldata - Raw ABI-encoded calldata sent to the zapper.
|
|
52
|
+
* @param value - Transaction `msg.value`, used for native-token deposits.
|
|
53
|
+
*/
|
|
54
|
+
parseOperation(calldata: Hex, value?: bigint): ParsedZapperOperation;
|
|
55
|
+
/**
|
|
56
|
+
* Redeems pool shares (diesel tokens) for the underlying asset via this zapper.
|
|
57
|
+
*/
|
|
58
|
+
redeem(tokenInAmount: bigint, receiver: Address): RawTx;
|
|
59
|
+
/**
|
|
60
|
+
* Redeems pool shares via this zapper with an EIP-2612 permit signature,
|
|
61
|
+
* skipping a separate approve transaction.
|
|
62
|
+
*/
|
|
63
|
+
redeemWithPermit(tokenInAmount: bigint, receiver: Address, deadline: bigint, v: number, r: Hex, s: Hex): RawTx;
|
|
64
|
+
}
|
|
@@ -4,7 +4,7 @@ import type { ILogger } from "./types/index.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Zod schema for validating {@link OnchainSDKOptions} at runtime.
|
|
6
6
|
**/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const onchainSDKOptionsSchema: z.ZodObject<{
|
|
8
8
|
strictContractTypes: z.ZodOptional<z.ZodBoolean>;
|
|
9
9
|
plugins: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
10
10
|
logger: z.ZodAny;
|
|
@@ -13,7 +13,7 @@ export declare const OnchainSDKOptionsSchema: z.ZodObject<{
|
|
|
13
13
|
/**
|
|
14
14
|
* Zod schema for validating {@link AttachOptions} at runtime.
|
|
15
15
|
**/
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const attachOptionsSchema: z.ZodObject<{
|
|
17
17
|
addressProvider: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
18
18
|
marketConfigurators: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
19
19
|
rwaFactories: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
@@ -33,15 +33,20 @@ export declare const AttachOptionsSchema: z.ZodObject<{
|
|
|
33
33
|
cacheTTL: z.ZodOptional<z.ZodNumber>;
|
|
34
34
|
failOnMissingFeeds: z.ZodOptional<z.ZodBoolean>;
|
|
35
35
|
}, z.core.$strip>>;
|
|
36
|
+
loadZappers: z.ZodOptional<z.ZodBoolean>;
|
|
36
37
|
}, z.core.$strip>;
|
|
37
38
|
/**
|
|
38
39
|
* SDK constructor options type.
|
|
39
40
|
*
|
|
40
41
|
* @typeParam Plugins - Map of plugin names to plugin instances.
|
|
41
42
|
**/
|
|
42
|
-
export type SDKOptions<Plugins extends PluginsMap> = Omit<z.infer<typeof
|
|
43
|
-
/**
|
|
43
|
+
export type SDKOptions<Plugins extends PluginsMap> = Omit<z.infer<typeof onchainSDKOptionsSchema>, "logger" | "plugins"> & {
|
|
44
|
+
/**
|
|
45
|
+
* Plugins that extend SDK functionality.
|
|
46
|
+
**/
|
|
44
47
|
plugins?: Plugins;
|
|
45
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Custom logger implementation.
|
|
50
|
+
**/
|
|
46
51
|
logger?: ILogger;
|
|
47
52
|
};
|