@pufferfinance/puffer-sdk 1.5.3 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/api/puffer-client.cjs +1 -1
  2. package/dist/api/puffer-client.cjs.map +1 -1
  3. package/dist/api/puffer-client.d.ts +3 -0
  4. package/dist/api/puffer-client.js +43 -36
  5. package/dist/api/puffer-client.js.map +1 -1
  6. package/dist/contracts/abis/mainnet/PufferWithdrawalManager.cjs +2 -0
  7. package/dist/contracts/abis/mainnet/PufferWithdrawalManager.cjs.map +1 -0
  8. package/dist/contracts/abis/mainnet/PufferWithdrawalManager.d.ts +510 -0
  9. package/dist/contracts/abis/mainnet/PufferWithdrawalManager.js +665 -0
  10. package/dist/contracts/abis/mainnet/PufferWithdrawalManager.js.map +1 -0
  11. package/dist/contracts/abis/puffer-withdrawal-manager-abis.cjs +2 -0
  12. package/dist/contracts/abis/puffer-withdrawal-manager-abis.cjs.map +1 -0
  13. package/dist/contracts/abis/puffer-withdrawal-manager-abis.d.ts +514 -0
  14. package/dist/contracts/abis/puffer-withdrawal-manager-abis.js +10 -0
  15. package/dist/contracts/abis/puffer-withdrawal-manager-abis.js.map +1 -0
  16. package/dist/contracts/addresses.cjs +1 -1
  17. package/dist/contracts/addresses.cjs.map +1 -1
  18. package/dist/contracts/addresses.d.ts +1 -0
  19. package/dist/contracts/addresses.js +5 -1
  20. package/dist/contracts/addresses.js.map +1 -1
  21. package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
  22. package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
  23. package/dist/contracts/handlers/erc20-permit-handler.d.ts +1 -0
  24. package/dist/contracts/handlers/erc20-permit-handler.js +19 -14
  25. package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
  26. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +2 -0
  27. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs.map +1 -0
  28. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.d.ts +6697 -0
  29. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +116 -0
  30. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js.map +1 -0
  31. package/dist/contracts/tokens.cjs +1 -1
  32. package/dist/contracts/tokens.cjs.map +1 -1
  33. package/dist/contracts/tokens.d.ts +7 -2
  34. package/dist/contracts/tokens.js +11 -3
  35. package/dist/contracts/tokens.js.map +1 -1
  36. package/dist/main.cjs +1 -1
  37. package/dist/main.d.ts +1 -0
  38. package/dist/main.js +26 -23
  39. package/dist/main.js.map +1 -1
  40. package/dist/utils/version.cjs +1 -1
  41. package/dist/utils/version.js +1 -1
  42. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../constants-BvU-JhfL.cjs"),e=require("./mainnet/PufferWithdrawalManager.cjs"),r={[a.Chain.Mainnet]:{PufferWithdrawalManager:e.PufferWithdrawalManager},[a.Chain.Holesky]:{PufferWithdrawalManager:e.PufferWithdrawalManager}};exports.PUFFER_WITHDRAWAL_MANAGER_ABIS=r;
2
+ //# sourceMappingURL=puffer-withdrawal-manager-abis.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"puffer-withdrawal-manager-abis.cjs","sources":["../../../lib/contracts/abis/puffer-withdrawal-manager-abis.ts"],"sourcesContent":["import { Chain } from '../../chains/constants';\nimport { PufferWithdrawalManager } from './mainnet/PufferWithdrawalManager';\n\nexport const PUFFER_WITHDRAWAL_MANAGER_ABIS = {\n [Chain.Mainnet]: { PufferWithdrawalManager },\n [Chain.Holesky]: { PufferWithdrawalManager },\n};\n"],"names":["PUFFER_WITHDRAWAL_MANAGER_ABIS","Chain","PufferWithdrawalManager"],"mappings":"mLAGaA,EAAiC,CAC5C,CAACC,EAAA,MAAM,OAAO,EAAG,CAAA,wBAAEC,yBAAwB,EAC3C,CAACD,EAAA,MAAM,OAAO,EAAG,CAAA,wBAAEC,yBAAwB,CAC7C"}
@@ -0,0 +1,514 @@
1
+ export declare const PUFFER_WITHDRAWAL_MANAGER_ABIS: {
2
+ [x: number]: {
3
+ PufferWithdrawalManager: readonly [{
4
+ readonly type: "constructor";
5
+ readonly inputs: readonly [{
6
+ readonly name: "batchSize";
7
+ readonly type: "uint256";
8
+ readonly internalType: "uint256";
9
+ }, {
10
+ readonly name: "pufferVault";
11
+ readonly type: "address";
12
+ readonly internalType: "contract PufferVaultV3";
13
+ }, {
14
+ readonly name: "weth";
15
+ readonly type: "address";
16
+ readonly internalType: "contract IWETH";
17
+ }];
18
+ readonly stateMutability: "nonpayable";
19
+ }, {
20
+ readonly type: "receive";
21
+ readonly stateMutability: "payable";
22
+ }, {
23
+ readonly type: "function";
24
+ readonly name: "BATCH_SIZE";
25
+ readonly inputs: readonly [];
26
+ readonly outputs: readonly [{
27
+ readonly name: "";
28
+ readonly type: "uint256";
29
+ readonly internalType: "uint256";
30
+ }];
31
+ readonly stateMutability: "view";
32
+ }, {
33
+ readonly type: "function";
34
+ readonly name: "MIN_WITHDRAWAL_AMOUNT";
35
+ readonly inputs: readonly [];
36
+ readonly outputs: readonly [{
37
+ readonly name: "";
38
+ readonly type: "uint256";
39
+ readonly internalType: "uint256";
40
+ }];
41
+ readonly stateMutability: "view";
42
+ }, {
43
+ readonly type: "function";
44
+ readonly name: "PUFFER_VAULT";
45
+ readonly inputs: readonly [];
46
+ readonly outputs: readonly [{
47
+ readonly name: "";
48
+ readonly type: "address";
49
+ readonly internalType: "contract PufferVaultV3";
50
+ }];
51
+ readonly stateMutability: "view";
52
+ }, {
53
+ readonly type: "function";
54
+ readonly name: "UPGRADE_INTERFACE_VERSION";
55
+ readonly inputs: readonly [];
56
+ readonly outputs: readonly [{
57
+ readonly name: "";
58
+ readonly type: "string";
59
+ readonly internalType: "string";
60
+ }];
61
+ readonly stateMutability: "view";
62
+ }, {
63
+ readonly type: "function";
64
+ readonly name: "WETH";
65
+ readonly inputs: readonly [];
66
+ readonly outputs: readonly [{
67
+ readonly name: "";
68
+ readonly type: "address";
69
+ readonly internalType: "contract IWETH";
70
+ }];
71
+ readonly stateMutability: "view";
72
+ }, {
73
+ readonly type: "function";
74
+ readonly name: "authority";
75
+ readonly inputs: readonly [];
76
+ readonly outputs: readonly [{
77
+ readonly name: "";
78
+ readonly type: "address";
79
+ readonly internalType: "address";
80
+ }];
81
+ readonly stateMutability: "view";
82
+ }, {
83
+ readonly type: "function";
84
+ readonly name: "changeMaxWithdrawalAmount";
85
+ readonly inputs: readonly [{
86
+ readonly name: "newMaxWithdrawalAmount";
87
+ readonly type: "uint256";
88
+ readonly internalType: "uint256";
89
+ }];
90
+ readonly outputs: readonly [];
91
+ readonly stateMutability: "nonpayable";
92
+ }, {
93
+ readonly type: "function";
94
+ readonly name: "completeQueuedWithdrawal";
95
+ readonly inputs: readonly [{
96
+ readonly name: "withdrawalIdx";
97
+ readonly type: "uint256";
98
+ readonly internalType: "uint256";
99
+ }];
100
+ readonly outputs: readonly [];
101
+ readonly stateMutability: "nonpayable";
102
+ }, {
103
+ readonly type: "function";
104
+ readonly name: "finalizeWithdrawals";
105
+ readonly inputs: readonly [{
106
+ readonly name: "withdrawalBatchIndex";
107
+ readonly type: "uint256";
108
+ readonly internalType: "uint256";
109
+ }];
110
+ readonly outputs: readonly [];
111
+ readonly stateMutability: "nonpayable";
112
+ }, {
113
+ readonly type: "function";
114
+ readonly name: "getFinalizedWithdrawalBatch";
115
+ readonly inputs: readonly [];
116
+ readonly outputs: readonly [{
117
+ readonly name: "";
118
+ readonly type: "uint256";
119
+ readonly internalType: "uint256";
120
+ }];
121
+ readonly stateMutability: "view";
122
+ }, {
123
+ readonly type: "function";
124
+ readonly name: "getMaxWithdrawalAmount";
125
+ readonly inputs: readonly [];
126
+ readonly outputs: readonly [{
127
+ readonly name: "";
128
+ readonly type: "uint256";
129
+ readonly internalType: "uint256";
130
+ }];
131
+ readonly stateMutability: "view";
132
+ }, {
133
+ readonly type: "function";
134
+ readonly name: "getWithdrawal";
135
+ readonly inputs: readonly [{
136
+ readonly name: "withdrawalIdx";
137
+ readonly type: "uint256";
138
+ readonly internalType: "uint256";
139
+ }];
140
+ readonly outputs: readonly [{
141
+ readonly name: "";
142
+ readonly type: "tuple";
143
+ readonly internalType: "struct PufferWithdrawalManagerStorage.Withdrawal";
144
+ readonly components: readonly [{
145
+ readonly name: "pufETHAmount";
146
+ readonly type: "uint128";
147
+ readonly internalType: "uint128";
148
+ }, {
149
+ readonly name: "pufETHToETHExchangeRate";
150
+ readonly type: "uint128";
151
+ readonly internalType: "uint128";
152
+ }, {
153
+ readonly name: "recipient";
154
+ readonly type: "address";
155
+ readonly internalType: "address";
156
+ }];
157
+ }];
158
+ readonly stateMutability: "view";
159
+ }, {
160
+ readonly type: "function";
161
+ readonly name: "getWithdrawalsLength";
162
+ readonly inputs: readonly [];
163
+ readonly outputs: readonly [{
164
+ readonly name: "";
165
+ readonly type: "uint256";
166
+ readonly internalType: "uint256";
167
+ }];
168
+ readonly stateMutability: "view";
169
+ }, {
170
+ readonly type: "function";
171
+ readonly name: "initialize";
172
+ readonly inputs: readonly [{
173
+ readonly name: "accessManager";
174
+ readonly type: "address";
175
+ readonly internalType: "address";
176
+ }];
177
+ readonly outputs: readonly [];
178
+ readonly stateMutability: "nonpayable";
179
+ }, {
180
+ readonly type: "function";
181
+ readonly name: "isConsumingScheduledOp";
182
+ readonly inputs: readonly [];
183
+ readonly outputs: readonly [{
184
+ readonly name: "";
185
+ readonly type: "bytes4";
186
+ readonly internalType: "bytes4";
187
+ }];
188
+ readonly stateMutability: "view";
189
+ }, {
190
+ readonly type: "function";
191
+ readonly name: "proxiableUUID";
192
+ readonly inputs: readonly [];
193
+ readonly outputs: readonly [{
194
+ readonly name: "";
195
+ readonly type: "bytes32";
196
+ readonly internalType: "bytes32";
197
+ }];
198
+ readonly stateMutability: "view";
199
+ }, {
200
+ readonly type: "function";
201
+ readonly name: "requestWithdrawal";
202
+ readonly inputs: readonly [{
203
+ readonly name: "pufETHAmount";
204
+ readonly type: "uint128";
205
+ readonly internalType: "uint128";
206
+ }, {
207
+ readonly name: "recipient";
208
+ readonly type: "address";
209
+ readonly internalType: "address";
210
+ }];
211
+ readonly outputs: readonly [];
212
+ readonly stateMutability: "nonpayable";
213
+ }, {
214
+ readonly type: "function";
215
+ readonly name: "requestWithdrawalWithPermit";
216
+ readonly inputs: readonly [{
217
+ readonly name: "permitData";
218
+ readonly type: "tuple";
219
+ readonly internalType: "struct Permit";
220
+ readonly components: readonly [{
221
+ readonly name: "deadline";
222
+ readonly type: "uint256";
223
+ readonly internalType: "uint256";
224
+ }, {
225
+ readonly name: "amount";
226
+ readonly type: "uint256";
227
+ readonly internalType: "uint256";
228
+ }, {
229
+ readonly name: "v";
230
+ readonly type: "uint8";
231
+ readonly internalType: "uint8";
232
+ }, {
233
+ readonly name: "r";
234
+ readonly type: "bytes32";
235
+ readonly internalType: "bytes32";
236
+ }, {
237
+ readonly name: "s";
238
+ readonly type: "bytes32";
239
+ readonly internalType: "bytes32";
240
+ }];
241
+ }, {
242
+ readonly name: "recipient";
243
+ readonly type: "address";
244
+ readonly internalType: "address";
245
+ }];
246
+ readonly outputs: readonly [];
247
+ readonly stateMutability: "nonpayable";
248
+ }, {
249
+ readonly type: "function";
250
+ readonly name: "setAuthority";
251
+ readonly inputs: readonly [{
252
+ readonly name: "newAuthority";
253
+ readonly type: "address";
254
+ readonly internalType: "address";
255
+ }];
256
+ readonly outputs: readonly [];
257
+ readonly stateMutability: "nonpayable";
258
+ }, {
259
+ readonly type: "function";
260
+ readonly name: "upgradeToAndCall";
261
+ readonly inputs: readonly [{
262
+ readonly name: "newImplementation";
263
+ readonly type: "address";
264
+ readonly internalType: "address";
265
+ }, {
266
+ readonly name: "data";
267
+ readonly type: "bytes";
268
+ readonly internalType: "bytes";
269
+ }];
270
+ readonly outputs: readonly [];
271
+ readonly stateMutability: "payable";
272
+ }, {
273
+ readonly type: "event";
274
+ readonly name: "AuthorityUpdated";
275
+ readonly inputs: readonly [{
276
+ readonly name: "authority";
277
+ readonly type: "address";
278
+ readonly indexed: false;
279
+ readonly internalType: "address";
280
+ }];
281
+ readonly anonymous: false;
282
+ }, {
283
+ readonly type: "event";
284
+ readonly name: "BatchFinalized";
285
+ readonly inputs: readonly [{
286
+ readonly name: "batchIdx";
287
+ readonly type: "uint256";
288
+ readonly indexed: true;
289
+ readonly internalType: "uint256";
290
+ }, {
291
+ readonly name: "expectedETHAmount";
292
+ readonly type: "uint256";
293
+ readonly indexed: false;
294
+ readonly internalType: "uint256";
295
+ }, {
296
+ readonly name: "actualEthAmount";
297
+ readonly type: "uint256";
298
+ readonly indexed: false;
299
+ readonly internalType: "uint256";
300
+ }, {
301
+ readonly name: "pufETHBurnAmount";
302
+ readonly type: "uint256";
303
+ readonly indexed: false;
304
+ readonly internalType: "uint256";
305
+ }];
306
+ readonly anonymous: false;
307
+ }, {
308
+ readonly type: "event";
309
+ readonly name: "Initialized";
310
+ readonly inputs: readonly [{
311
+ readonly name: "version";
312
+ readonly type: "uint64";
313
+ readonly indexed: false;
314
+ readonly internalType: "uint64";
315
+ }];
316
+ readonly anonymous: false;
317
+ }, {
318
+ readonly type: "event";
319
+ readonly name: "MaxWithdrawalAmountChanged";
320
+ readonly inputs: readonly [{
321
+ readonly name: "oldMaxWithdrawalAmount";
322
+ readonly type: "uint256";
323
+ readonly indexed: false;
324
+ readonly internalType: "uint256";
325
+ }, {
326
+ readonly name: "newMaxWithdrawalAmount";
327
+ readonly type: "uint256";
328
+ readonly indexed: false;
329
+ readonly internalType: "uint256";
330
+ }];
331
+ readonly anonymous: false;
332
+ }, {
333
+ readonly type: "event";
334
+ readonly name: "Upgraded";
335
+ readonly inputs: readonly [{
336
+ readonly name: "implementation";
337
+ readonly type: "address";
338
+ readonly indexed: true;
339
+ readonly internalType: "address";
340
+ }];
341
+ readonly anonymous: false;
342
+ }, {
343
+ readonly type: "event";
344
+ readonly name: "WithdrawalCompleted";
345
+ readonly inputs: readonly [{
346
+ readonly name: "withdrawalIdx";
347
+ readonly type: "uint256";
348
+ readonly indexed: true;
349
+ readonly internalType: "uint256";
350
+ }, {
351
+ readonly name: "ethPayoutAmount";
352
+ readonly type: "uint256";
353
+ readonly indexed: false;
354
+ readonly internalType: "uint256";
355
+ }, {
356
+ readonly name: "payoutExchangeRate";
357
+ readonly type: "uint256";
358
+ readonly indexed: false;
359
+ readonly internalType: "uint256";
360
+ }, {
361
+ readonly name: "recipient";
362
+ readonly type: "address";
363
+ readonly indexed: true;
364
+ readonly internalType: "address";
365
+ }];
366
+ readonly anonymous: false;
367
+ }, {
368
+ readonly type: "event";
369
+ readonly name: "WithdrawalRequested";
370
+ readonly inputs: readonly [{
371
+ readonly name: "withdrawalIdx";
372
+ readonly type: "uint256";
373
+ readonly indexed: true;
374
+ readonly internalType: "uint256";
375
+ }, {
376
+ readonly name: "batchIdx";
377
+ readonly type: "uint256";
378
+ readonly indexed: true;
379
+ readonly internalType: "uint256";
380
+ }, {
381
+ readonly name: "pufETHAmount";
382
+ readonly type: "uint256";
383
+ readonly indexed: false;
384
+ readonly internalType: "uint256";
385
+ }, {
386
+ readonly name: "recipient";
387
+ readonly type: "address";
388
+ readonly indexed: true;
389
+ readonly internalType: "address";
390
+ }];
391
+ readonly anonymous: false;
392
+ }, {
393
+ readonly type: "error";
394
+ readonly name: "AccessManagedInvalidAuthority";
395
+ readonly inputs: readonly [{
396
+ readonly name: "authority";
397
+ readonly type: "address";
398
+ readonly internalType: "address";
399
+ }];
400
+ }, {
401
+ readonly type: "error";
402
+ readonly name: "AccessManagedRequiredDelay";
403
+ readonly inputs: readonly [{
404
+ readonly name: "caller";
405
+ readonly type: "address";
406
+ readonly internalType: "address";
407
+ }, {
408
+ readonly name: "delay";
409
+ readonly type: "uint32";
410
+ readonly internalType: "uint32";
411
+ }];
412
+ }, {
413
+ readonly type: "error";
414
+ readonly name: "AccessManagedUnauthorized";
415
+ readonly inputs: readonly [{
416
+ readonly name: "caller";
417
+ readonly type: "address";
418
+ readonly internalType: "address";
419
+ }];
420
+ }, {
421
+ readonly type: "error";
422
+ readonly name: "AddressEmptyCode";
423
+ readonly inputs: readonly [{
424
+ readonly name: "target";
425
+ readonly type: "address";
426
+ readonly internalType: "address";
427
+ }];
428
+ }, {
429
+ readonly type: "error";
430
+ readonly name: "BatchAlreadyFinalized";
431
+ readonly inputs: readonly [{
432
+ readonly name: "batchIndex";
433
+ readonly type: "uint256";
434
+ readonly internalType: "uint256";
435
+ }];
436
+ }, {
437
+ readonly type: "error";
438
+ readonly name: "BatchSizeCannotChange";
439
+ readonly inputs: readonly [];
440
+ }, {
441
+ readonly type: "error";
442
+ readonly name: "BatchesAreNotFull";
443
+ readonly inputs: readonly [];
444
+ }, {
445
+ readonly type: "error";
446
+ readonly name: "ERC1967InvalidImplementation";
447
+ readonly inputs: readonly [{
448
+ readonly name: "implementation";
449
+ readonly type: "address";
450
+ readonly internalType: "address";
451
+ }];
452
+ }, {
453
+ readonly type: "error";
454
+ readonly name: "ERC1967NonPayable";
455
+ readonly inputs: readonly [];
456
+ }, {
457
+ readonly type: "error";
458
+ readonly name: "FailedInnerCall";
459
+ readonly inputs: readonly [];
460
+ }, {
461
+ readonly type: "error";
462
+ readonly name: "InvalidInitialization";
463
+ readonly inputs: readonly [];
464
+ }, {
465
+ readonly type: "error";
466
+ readonly name: "MultipleWithdrawalsAreForbidden";
467
+ readonly inputs: readonly [];
468
+ }, {
469
+ readonly type: "error";
470
+ readonly name: "NotFinalized";
471
+ readonly inputs: readonly [];
472
+ }, {
473
+ readonly type: "error";
474
+ readonly name: "NotInitializing";
475
+ readonly inputs: readonly [];
476
+ }, {
477
+ readonly type: "error";
478
+ readonly name: "SafeCastOverflowedUintDowncast";
479
+ readonly inputs: readonly [{
480
+ readonly name: "bits";
481
+ readonly type: "uint8";
482
+ readonly internalType: "uint8";
483
+ }, {
484
+ readonly name: "value";
485
+ readonly type: "uint256";
486
+ readonly internalType: "uint256";
487
+ }];
488
+ }, {
489
+ readonly type: "error";
490
+ readonly name: "UUPSUnauthorizedCallContext";
491
+ readonly inputs: readonly [];
492
+ }, {
493
+ readonly type: "error";
494
+ readonly name: "UUPSUnsupportedProxiableUUID";
495
+ readonly inputs: readonly [{
496
+ readonly name: "slot";
497
+ readonly type: "bytes32";
498
+ readonly internalType: "bytes32";
499
+ }];
500
+ }, {
501
+ readonly type: "error";
502
+ readonly name: "WithdrawalAlreadyCompleted";
503
+ readonly inputs: readonly [];
504
+ }, {
505
+ readonly type: "error";
506
+ readonly name: "WithdrawalAmountTooHigh";
507
+ readonly inputs: readonly [];
508
+ }, {
509
+ readonly type: "error";
510
+ readonly name: "WithdrawalAmountTooLow";
511
+ readonly inputs: readonly [];
512
+ }];
513
+ };
514
+ };
@@ -0,0 +1,10 @@
1
+ import { C as r } from "../../constants-rWWWhxR_.js";
2
+ import { PufferWithdrawalManager as a } from "./mainnet/PufferWithdrawalManager.js";
3
+ const e = {
4
+ [r.Mainnet]: { PufferWithdrawalManager: a },
5
+ [r.Holesky]: { PufferWithdrawalManager: a }
6
+ };
7
+ export {
8
+ e as PUFFER_WITHDRAWAL_MANAGER_ABIS
9
+ };
10
+ //# sourceMappingURL=puffer-withdrawal-manager-abis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"puffer-withdrawal-manager-abis.js","sources":["../../../lib/contracts/abis/puffer-withdrawal-manager-abis.ts"],"sourcesContent":["import { Chain } from '../../chains/constants';\nimport { PufferWithdrawalManager } from './mainnet/PufferWithdrawalManager';\n\nexport const PUFFER_WITHDRAWAL_MANAGER_ABIS = {\n [Chain.Mainnet]: { PufferWithdrawalManager },\n [Chain.Holesky]: { PufferWithdrawalManager },\n};\n"],"names":["PUFFER_WITHDRAWAL_MANAGER_ABIS","Chain","PufferWithdrawalManager"],"mappings":";;AAGO,MAAMA,IAAiC;AAAA,EAC5C,CAACC,EAAM,OAAO,GAAG,EAAE,yBAAAC,EAAwB;AAAA,EAC3C,CAACD,EAAM,OAAO,GAAG,EAAE,yBAAAC,EAAwB;AAC7C;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../constants-BvU-JhfL.cjs"),a={[e.Chain.Mainnet]:{PufferVault:"0xD9A442856C234a39a81a089C06451EBAa4306a72",PufferDepositor:"0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff",PufferL2Depositor:"0x3436E0B85cd929929F5802e792CFE282166E0259",PufLocker:"0x48e8dE138C246c14248C94d2D616a2F9eb4590D2",L2RewardManager:"0xb4dBcf934558d7b647A7FB21bbcd6b8370318A5c",L1RewardManager:"0x5A0B37ce6c5b90B634B2AD32E3d909B545De8BB7"},[e.Chain.Holesky]:{PufferVault:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9",PufferDepositor:"0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c",PufferL2Depositor:"0x0af6998e4828ad8ef8f79a9288d0a861890f791d",PufLocker:"0xa58983ad0899a452b7420bc57228e329d7ba92b6",L1RewardManager:"0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12",L2RewardManager:"0x58C046794f69A8830b0BE737022a45b4acd01dE5"}};exports.CONTRACT_ADDRESSES=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../constants-BvU-JhfL.cjs"),e={[a.Chain.Mainnet]:{PufferVault:"0xD9A442856C234a39a81a089C06451EBAa4306a72",PufferDepositor:"0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff",PufferL2Depositor:"0x3436E0B85cd929929F5802e792CFE282166E0259",PufLocker:"0x48e8dE138C246c14248C94d2D616a2F9eb4590D2",PufferWithdrawalManager:"0x8a253974f1de9f64d79f1eaaf850faf406802fce",L2RewardManager:"0xb4dBcf934558d7b647A7FB21bbcd6b8370318A5c",L1RewardManager:"0x5A0B37ce6c5b90B634B2AD32E3d909B545De8BB7"},[a.Chain.Holesky]:{PufferVault:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9",PufferDepositor:"0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c",PufferL2Depositor:"0x0af6998e4828ad8ef8f79a9288d0a861890f791d",PufLocker:"0xa58983ad0899a452b7420bc57228e329d7ba92b6",L1RewardManager:"0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12",L2RewardManager:"0x58C046794f69A8830b0BE737022a45b4acd01dE5",PufferWithdrawalManager:"0xd3978c299A430a49D838429A4E50b1b5AE2aAa2f"}};exports.CONTRACT_ADDRESSES=e;
2
2
  //# sourceMappingURL=addresses.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"addresses.cjs","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n [Chain.Mainnet]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n L2RewardManager: '0xb4dBcf934558d7b647A7FB21bbcd6b8370318A5c',\n L1RewardManager: '0x5A0B37ce6c5b90B634B2AD32E3d909B545De8BB7',\n },\n [Chain.Holesky]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n // These are deployed on a fork at the moment:\n // https://rpc.tenderly.co/fork/f7fd7621-7280-47e5-8521-81b24142814f\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain"],"mappings":"6HAIaA,EAAqB,CAChC,CAACC,EAAAA,MAAM,OAAO,EAAG,CACf,YAAa,6CACb,gBAAiB,6CACjB,kBAAmB,6CACnB,UAAW,6CACX,gBAAiB,6CACjB,gBAAiB,4CACnB,EACA,CAACA,EAAAA,MAAM,OAAO,EAAG,CACf,YAAa,6CACb,gBAAiB,6CACjB,kBAAmB,6CACnB,UAAW,6CAGX,gBAAiB,6CACjB,gBAAiB,4CACnB,CACF"}
1
+ {"version":3,"file":"addresses.cjs","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n [Chain.Mainnet]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n PufferWithdrawalManager: '0x8a253974f1de9f64d79f1eaaf850faf406802fce',\n L2RewardManager: '0xb4dBcf934558d7b647A7FB21bbcd6b8370318A5c',\n L1RewardManager: '0x5A0B37ce6c5b90B634B2AD32E3d909B545De8BB7',\n },\n [Chain.Holesky]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n // These are deployed on a fork at the moment:\n // https://rpc.tenderly.co/fork/f7fd7621-7280-47e5-8521-81b24142814f\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n // This is deployed on a fork at the moment:\n // https://rpc.tenderly.co/fork/f7fd7621-7280-47e5-8521-81b24142814f\n PufferWithdrawalManager: '0xd3978c299A430a49D838429A4E50b1b5AE2aAa2f',\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain"],"mappings":"6HAIaA,EAAqB,CAChC,CAACC,EAAAA,MAAM,OAAO,EAAG,CACf,YAAa,6CACb,gBAAiB,6CACjB,kBAAmB,6CACnB,UAAW,6CACX,wBAAyB,6CACzB,gBAAiB,6CACjB,gBAAiB,4CACnB,EACA,CAACA,EAAAA,MAAM,OAAO,EAAG,CACf,YAAa,6CACb,gBAAiB,6CACjB,kBAAmB,6CACnB,UAAW,6CAGX,gBAAiB,6CACjB,gBAAiB,6CAGjB,wBAAyB,4CAC3B,CACF"}
@@ -4,6 +4,7 @@ export declare const CONTRACT_ADDRESSES: {
4
4
  PufferDepositor: string;
5
5
  PufferL2Depositor: string;
6
6
  PufLocker: string;
7
+ PufferWithdrawalManager: string;
7
8
  L2RewardManager: string;
8
9
  L1RewardManager: string;
9
10
  };
@@ -5,6 +5,7 @@ const f = {
5
5
  PufferDepositor: "0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff",
6
6
  PufferL2Depositor: "0x3436E0B85cd929929F5802e792CFE282166E0259",
7
7
  PufLocker: "0x48e8dE138C246c14248C94d2D616a2F9eb4590D2",
8
+ PufferWithdrawalManager: "0x8a253974f1de9f64d79f1eaaf850faf406802fce",
8
9
  L2RewardManager: "0xb4dBcf934558d7b647A7FB21bbcd6b8370318A5c",
9
10
  L1RewardManager: "0x5A0B37ce6c5b90B634B2AD32E3d909B545De8BB7"
10
11
  },
@@ -16,7 +17,10 @@ const f = {
16
17
  // These are deployed on a fork at the moment:
17
18
  // https://rpc.tenderly.co/fork/f7fd7621-7280-47e5-8521-81b24142814f
18
19
  L1RewardManager: "0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12",
19
- L2RewardManager: "0x58C046794f69A8830b0BE737022a45b4acd01dE5"
20
+ L2RewardManager: "0x58C046794f69A8830b0BE737022a45b4acd01dE5",
21
+ // This is deployed on a fork at the moment:
22
+ // https://rpc.tenderly.co/fork/f7fd7621-7280-47e5-8521-81b24142814f
23
+ PufferWithdrawalManager: "0xd3978c299A430a49D838429A4E50b1b5AE2aAa2f"
20
24
  }
21
25
  };
22
26
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"addresses.js","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n [Chain.Mainnet]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n L2RewardManager: '0xb4dBcf934558d7b647A7FB21bbcd6b8370318A5c',\n L1RewardManager: '0x5A0B37ce6c5b90B634B2AD32E3d909B545De8BB7',\n },\n [Chain.Holesky]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n // These are deployed on a fork at the moment:\n // https://rpc.tenderly.co/fork/f7fd7621-7280-47e5-8521-81b24142814f\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain"],"mappings":";AAIO,MAAMA,IAAqB;AAAA,EAChC,CAACC,EAAM,OAAO,GAAG;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,EACnB;AAAA,EACA,CAACA,EAAM,OAAO,GAAG;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA;AAAA;AAAA,IAGX,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,EACnB;AACF;"}
1
+ {"version":3,"file":"addresses.js","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n [Chain.Mainnet]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n PufferWithdrawalManager: '0x8a253974f1de9f64d79f1eaaf850faf406802fce',\n L2RewardManager: '0xb4dBcf934558d7b647A7FB21bbcd6b8370318A5c',\n L1RewardManager: '0x5A0B37ce6c5b90B634B2AD32E3d909B545De8BB7',\n },\n [Chain.Holesky]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n // These are deployed on a fork at the moment:\n // https://rpc.tenderly.co/fork/f7fd7621-7280-47e5-8521-81b24142814f\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n // This is deployed on a fork at the moment:\n // https://rpc.tenderly.co/fork/f7fd7621-7280-47e5-8521-81b24142814f\n PufferWithdrawalManager: '0xd3978c299A430a49D838429A4E50b1b5AE2aAa2f',\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain"],"mappings":";AAIO,MAAMA,IAAqB;AAAA,EAChC,CAACC,EAAM,OAAO,GAAG;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,yBAAyB;AAAA,IACzB,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,EACnB;AAAA,EACA,CAACA,EAAM,OAAO,GAAG;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA;AAAA;AAAA,IAGX,iBAAiB;AAAA,IACjB,iBAAiB;AAAA;AAAA;AAAA,IAGjB,yBAAyB;AAAA,EAC3B;AACF;"}
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var d=(i,t,e)=>t in i?p(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var c=(i,t,e)=>d(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../constants-BvU-JhfL.cjs"),g=require("../abis/tokens-abis.cjs"),o=require("../tokens.cjs"),y=require("../../utils/time.cjs"),C=require("../../getContract-MrPLx6gp.cjs"),S=require("../../secp256k1-CFnFaJ0H.cjs");function E(i){const{r:t,s:e}=S.secp256k1.Signature.fromCompact(i.slice(2,130)),n=+`0x${i.slice(130)}`,[r,a]=(()=>{if(n===0||n===1)return[void 0,n];if(n===27)return[BigInt(n),0];if(n===28)return[BigInt(n),1];throw new Error("Invalid yParityOrV value")})();return typeof r<"u"?{r:s.numberToHex(t,{size:32}),s:s.numberToHex(e,{size:32}),v:r,yParity:a}:{r:s.numberToHex(t,{size:32}),s:s.numberToHex(e,{size:32}),yParity:a}}class T{constructor(t,e,n){c(this,"viemChain");c(this,"token");this.chain=t,this.walletClient=e,this.publicClient=n,this.viemChain=s.VIEM_CHAINS[t],this.token=o.Token.WETH}withToken(t){return this.token=t,this}getContract(){const t=o.TOKENS_ADDRESSES[this.token][this.chain],e=g.ERC20PERMIT_ABI,n={public:this.publicClient,wallet:this.walletClient};return C.getContract({address:t,abi:e,client:n})}async getPermitSignature(t,e,n){const r=this.getContract(),a=await r.read.nonces([t]),m={name:await r.read.name(),version:this.getPermitVersion(this.token),chainId:this.chain,verifyingContract:o.TOKENS_ADDRESSES[this.token][this.chain]},h={Permit:[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},u=BigInt(y.getTimestampInSeconds()+60*60*2),l=await this.walletClient.signTypedData({account:t,domain:m,types:h,primaryType:"Permit",message:{owner:t,spender:e,value:n,nonce:a,deadline:u}});return{...E(l),deadline:u}}getPermitVersion(t){return o.TOKENS_PERMIT_VERSION[t]}approve(t,e,n){return this.getContract().write.approve([e,n],{account:t,chain:this.viemChain})}}exports.ERC20PermitHandler=T;
1
+ "use strict";var p=Object.defineProperty;var d=(i,t,e)=>t in i?p(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var c=(i,t,e)=>d(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../constants-BvU-JhfL.cjs"),g=require("../abis/tokens-abis.cjs"),s=require("../tokens.cjs"),S=require("../../utils/time.cjs"),y=require("../../getContract-MrPLx6gp.cjs"),C=require("../../secp256k1-CFnFaJ0H.cjs");function T(i){const{r:t,s:e}=C.secp256k1.Signature.fromCompact(i.slice(2,130)),n=+`0x${i.slice(130)}`,[r,o]=(()=>{if(n===0||n===1)return[void 0,n];if(n===27)return[BigInt(n),0];if(n===28)return[BigInt(n),1];throw new Error("Invalid yParityOrV value")})();return typeof r<"u"?{r:a.numberToHex(t,{size:32}),s:a.numberToHex(e,{size:32}),v:r,yParity:o}:{r:a.numberToHex(t,{size:32}),s:a.numberToHex(e,{size:32}),yParity:o}}class E{constructor(t,e,n){c(this,"viemChain");c(this,"token");this.chain=t,this.walletClient=e,this.publicClient=n,this.viemChain=a.VIEM_CHAINS[t],this.token=s.Token.WETH}withToken(t){return this.token=t,this}getContract(){const t=s.TOKENS_ADDRESSES[this.token][this.chain],e=g.ERC20PERMIT_ABI,n={public:this.publicClient,wallet:this.walletClient};return y.getContract({address:t,abi:e,client:n})}async getPermitSignature(t,e,n){const r=this.getContract(),o=await r.read.nonces([t]),h={name:await r.read.name(),version:this.getPermitVersion(this.token),chainId:this.chain,verifyingContract:s.TOKENS_ADDRESSES[this.token][this.chain],salt:this.getPermitSalt(this.token)},m={Permit:[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},u=BigInt(S.getTimestampInSeconds()+60*60*2),l=await this.walletClient.signTypedData({account:t,domain:h,types:m,primaryType:"Permit",message:{owner:t,spender:e,value:n,nonce:o,deadline:u}});return{...T(l),deadline:u}}getPermitVersion(t){return s.TOKENS_PERMIT_VERSION[t]}approve(t,e,n){return this.getContract().write.approve([e,n],{account:t,chain:this.viemChain})}getPermitSalt(t){var e,n;return(n=(e=s.TOKENS_SALT)==null?void 0:e[t])==null?void 0:n[this.chain]}}exports.ERC20PermitHandler=E;
2
2
  //# sourceMappingURL=erc20-permit-handler.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"erc20-permit-handler.cjs","sources":["../../../node_modules/.pnpm/viem@2.18.8_typescript@5.5.4_zod@3.23.8/node_modules/viem/_esm/utils/signature/parseSignature.js","../../../lib/contracts/handlers/erc20-permit-handler.ts"],"sourcesContent":["import { secp256k1 } from '@noble/curves/secp256k1';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * @description Parses a hex formatted signature into a structured signature.\n *\n * @param signatureHex Signature in hex format.\n * @returns The structured signature.\n *\n * @example\n * parseSignature('0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c')\n * // { r: '0x...', s: '0x...', v: 28n }\n */\nexport function parseSignature(signatureHex) {\n const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));\n const yParityOrV = Number(`0x${signatureHex.slice(130)}`);\n const [v, yParity] = (() => {\n if (yParityOrV === 0 || yParityOrV === 1)\n return [undefined, yParityOrV];\n if (yParityOrV === 27)\n return [BigInt(yParityOrV), 0];\n if (yParityOrV === 28)\n return [BigInt(yParityOrV), 1];\n throw new Error('Invalid yParityOrV value');\n })();\n if (typeof v !== 'undefined')\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n v,\n yParity,\n };\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n yParity,\n };\n}\n//# sourceMappingURL=parseSignature.js.map","import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n parseSignature,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { ERC20PERMIT_ABI } from '../abis/tokens-abis';\nimport {\n AnyToken,\n TOKENS_ADDRESSES,\n TOKENS_PERMIT_VERSION,\n Token,\n} from '../tokens';\nimport { getTimestampInSeconds } from '../../utils/time';\n\n/**\n * Handler for performing operations for and with ERC20Permit tokens.\n */\nexport class ERC20PermitHandler {\n private viemChain: ViemChain;\n private token: AnyToken;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n this.token = Token.WETH;\n }\n\n /**\n * Set the token to use for executing transactions on the contract.\n *\n * @param token Token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: AnyToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = TOKENS_ADDRESSES[this.token][this.chain];\n const abi = ERC20PERMIT_ABI;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Process and get permit signature for the given token to perform\n * transactions through the `PufferDepositor` contract.\n *\n * @param ownerAddress Address of the token owner.\n * @param spenderAddress Address of the spender who needs the permit.\n * @param value Value of the transaction.\n * @returns Permit signature in the form `{ r, s, v?, yParity }`.\n */\n public async getPermitSignature(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n const contract = this.getContract();\n\n const permitNonces = await contract.read.nonces([ownerAddress]);\n const name = await contract.read.name();\n const domain = <const>{\n name,\n version: this.getPermitVersion(this.token),\n chainId: this.chain,\n verifyingContract: TOKENS_ADDRESSES[this.token][this.chain],\n };\n const types = <const>{\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n };\n // Valid for 2 hours.\n const deadline = BigInt(getTimestampInSeconds() + 60 * 60 * 2);\n\n const signature = await this.walletClient.signTypedData({\n account: ownerAddress,\n domain,\n types,\n primaryType: 'Permit',\n message: {\n owner: ownerAddress,\n spender: spenderAddress,\n value,\n nonce: permitNonces,\n deadline,\n },\n });\n\n return { ...parseSignature(signature), deadline };\n }\n\n private getPermitVersion(token: AnyToken): string {\n return TOKENS_PERMIT_VERSION[token];\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n}\n"],"names":["parseSignature","signatureHex","r","s","secp256k1","yParityOrV","v","yParity","numberToHex","ERC20PermitHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","Token","token","address","TOKENS_ADDRESSES","abi","ERC20PERMIT_ABI","client","getContract","ownerAddress","spenderAddress","value","contract","permitNonces","domain","types","deadline","getTimestampInSeconds","signature","TOKENS_PERMIT_VERSION"],"mappings":"4dAYO,SAASA,EAAeC,EAAc,CACzC,KAAM,CAAE,EAAAC,EAAG,EAAAC,CAAG,EAAGC,EAAS,UAAC,UAAU,YAAYH,EAAa,MAAM,EAAG,GAAG,CAAC,EACrEI,EAAa,CAAO,KAAKJ,EAAa,MAAM,GAAG,CAAC,GAChD,CAACK,EAAGC,CAAO,GAAK,IAAM,CACxB,GAAIF,IAAe,GAAKA,IAAe,EACnC,MAAO,CAAC,OAAWA,CAAU,EACjC,GAAIA,IAAe,GACf,MAAO,CAAC,OAAOA,CAAU,EAAG,CAAC,EACjC,GAAIA,IAAe,GACf,MAAO,CAAC,OAAOA,CAAU,EAAG,CAAC,EACjC,MAAM,IAAI,MAAM,0BAA0B,CAClD,KACI,OAAI,OAAOC,EAAM,IACN,CACH,EAAGE,EAAAA,YAAYN,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,EAAGM,EAAAA,YAAYL,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,EAAAG,EACA,QAAAC,CACZ,EACW,CACH,EAAGC,EAAAA,YAAYN,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,EAAGM,EAAAA,YAAYL,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,QAAAI,CACR,CACA,CCfO,MAAME,CAAmB,CAa9B,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBACAA,EAAA,cAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,EAClC,KAAK,MAAQK,EAAM,MAAA,IACrB,CAQO,UAAUC,EAAiB,CAChC,YAAK,MAAQA,EACN,IACT,CAQO,aAAc,CACnB,MAAMC,EAAUC,EAAAA,iBAAiB,KAAK,KAAK,EAAE,KAAK,KAAK,EACjDC,EAAMC,EAAAA,gBACNC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,cAEzD,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,CAAQ,CAAA,CAK7C,CAWA,MAAa,mBACXE,EACAC,EACAC,EACA,CACM,MAAAC,EAAW,KAAK,cAEhBC,EAAe,MAAMD,EAAS,KAAK,OAAO,CAACH,CAAY,CAAC,EAExDK,EAAgB,CACpB,KAFW,MAAMF,EAAS,KAAK,KAAK,EAGpC,QAAS,KAAK,iBAAiB,KAAK,KAAK,EACzC,QAAS,KAAK,MACd,kBAAmBR,EAAiB,iBAAA,KAAK,KAAK,EAAE,KAAK,KAAK,CAAA,EAEtDW,EAAe,CACnB,OAAQ,CACN,CAAE,KAAM,QAAS,KAAM,SAAU,EACjC,CAAE,KAAM,UAAW,KAAM,SAAU,EACnC,CAAE,KAAM,QAAS,KAAM,SAAU,EACjC,CAAE,KAAM,QAAS,KAAM,SAAU,EACjC,CAAE,KAAM,WAAY,KAAM,SAAU,CACtC,CAAA,EAGIC,EAAW,OAAOC,EAAA,sBAAA,EAA0B,GAAK,GAAK,CAAC,EAEvDC,EAAY,MAAM,KAAK,aAAa,cAAc,CACtD,QAAST,EACT,OAAAK,EACA,MAAAC,EACA,YAAa,SACb,QAAS,CACP,MAAON,EACP,QAASC,EACT,MAAAC,EACA,MAAOE,EACP,SAAAG,CACF,CAAA,CACD,EAED,MAAO,CAAE,GAAG9B,EAAegC,CAAS,EAAG,SAAAF,CAAS,CAClD,CAEQ,iBAAiBd,EAAyB,CAChD,OAAOiB,EAAAA,sBAAsBjB,CAAK,CACpC,CAUO,QACLO,EACAC,EACAC,EACA,CACO,OAAA,KAAK,cAAc,MAAM,QAAQ,CAACD,EAAgBC,CAAK,EAAG,CAC/D,QAASF,EACT,MAAO,KAAK,SAAA,CACb,CACH,CACF","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"erc20-permit-handler.cjs","sources":["../../../node_modules/.pnpm/viem@2.18.8_typescript@5.5.4_zod@3.23.8/node_modules/viem/_esm/utils/signature/parseSignature.js","../../../lib/contracts/handlers/erc20-permit-handler.ts"],"sourcesContent":["import { secp256k1 } from '@noble/curves/secp256k1';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * @description Parses a hex formatted signature into a structured signature.\n *\n * @param signatureHex Signature in hex format.\n * @returns The structured signature.\n *\n * @example\n * parseSignature('0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c')\n * // { r: '0x...', s: '0x...', v: 28n }\n */\nexport function parseSignature(signatureHex) {\n const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));\n const yParityOrV = Number(`0x${signatureHex.slice(130)}`);\n const [v, yParity] = (() => {\n if (yParityOrV === 0 || yParityOrV === 1)\n return [undefined, yParityOrV];\n if (yParityOrV === 27)\n return [BigInt(yParityOrV), 0];\n if (yParityOrV === 28)\n return [BigInt(yParityOrV), 1];\n throw new Error('Invalid yParityOrV value');\n })();\n if (typeof v !== 'undefined')\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n v,\n yParity,\n };\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n yParity,\n };\n}\n//# sourceMappingURL=parseSignature.js.map","import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n parseSignature,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { ERC20PERMIT_ABI } from '../abis/tokens-abis';\nimport {\n AnyToken,\n TOKENS_ADDRESSES,\n TOKENS_SALT,\n TOKENS_PERMIT_VERSION,\n Token,\n} from '../tokens';\nimport { getTimestampInSeconds } from '../../utils/time';\n\n/**\n * Handler for performing operations for and with ERC20Permit tokens.\n */\nexport class ERC20PermitHandler {\n private viemChain: ViemChain;\n private token: AnyToken;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n this.token = Token.WETH;\n }\n\n /**\n * Set the token to use for executing transactions on the contract.\n *\n * @param token Token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: AnyToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = TOKENS_ADDRESSES[this.token][this.chain];\n const abi = ERC20PERMIT_ABI;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Process and get permit signature for the given token to perform\n * transactions through the `PufferDepositor` contract.\n *\n * @param ownerAddress Address of the token owner.\n * @param spenderAddress Address of the spender who needs the permit.\n * @param value Value of the transaction.\n * @returns Permit signature in the form `{ r, s, v?, yParity }`.\n */\n public async getPermitSignature(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n const contract = this.getContract();\n\n const permitNonces = await contract.read.nonces([ownerAddress]);\n const name = await contract.read.name();\n const domain = <const>{\n name,\n version: this.getPermitVersion(this.token),\n chainId: this.chain,\n verifyingContract: TOKENS_ADDRESSES[this.token][this.chain],\n salt: this.getPermitSalt(this.token),\n };\n const types = <const>{\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n };\n // Valid for 2 hours.\n const deadline = BigInt(getTimestampInSeconds() + 60 * 60 * 2);\n\n const signature = await this.walletClient.signTypedData({\n account: ownerAddress,\n domain,\n types,\n primaryType: 'Permit',\n message: {\n owner: ownerAddress,\n spender: spenderAddress,\n value,\n nonce: permitNonces,\n deadline,\n },\n });\n\n return { ...parseSignature(signature), deadline };\n }\n\n private getPermitVersion(token: AnyToken): string {\n return TOKENS_PERMIT_VERSION[token];\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n\n private getPermitSalt(token: AnyToken) {\n return TOKENS_SALT?.[token]?.[this.chain];\n }\n}\n"],"names":["parseSignature","signatureHex","r","s","secp256k1","yParityOrV","v","yParity","numberToHex","ERC20PermitHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","Token","token","address","TOKENS_ADDRESSES","abi","ERC20PERMIT_ABI","client","getContract","ownerAddress","spenderAddress","value","contract","permitNonces","domain","types","deadline","getTimestampInSeconds","signature","TOKENS_PERMIT_VERSION","TOKENS_SALT"],"mappings":"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","x_google_ignoreList":[0]}