@pufferfinance/puffer-sdk 1.0.2 → 1.1.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 (38) hide show
  1. package/README.md +7 -6
  2. package/dist/api/puffer-client.d.ts +4 -0
  3. package/dist/ccip-BERTKE3h.js +158 -0
  4. package/dist/ccip-BERTKE3h.js.map +1 -0
  5. package/dist/ccip-CsTi3xD2.cjs +2 -0
  6. package/dist/ccip-CsTi3xD2.cjs.map +1 -0
  7. package/dist/chains/constants.d.ts +2 -3
  8. package/dist/contracts/abis/holesky/PufferDepositor.d.ts +283 -0
  9. package/dist/contracts/abis/mainnet/ERC20Permit.d.ts +396 -0
  10. package/dist/contracts/abis/mainnet/PufferDepositor.d.ts +283 -0
  11. package/dist/contracts/abis/puffer-depositor-abis.d.ts +287 -0
  12. package/dist/contracts/abis/{abis.d.ts → puffer-vault-abis.d.ts} +3 -1367
  13. package/dist/contracts/abis/tokens-abis.d.ts +396 -0
  14. package/dist/contracts/addresses.d.ts +2 -7
  15. package/dist/contracts/handlers/puffer-depositor-handler.d.ts +61 -0
  16. package/dist/contracts/handlers/puffer-vault-handler.d.ts +1 -18
  17. package/dist/contracts/handlers/tokens-handler.d.ts +46 -0
  18. package/dist/contracts/tokens.d.ts +14 -0
  19. package/dist/main-C4aA8dQe.cjs +41 -0
  20. package/dist/main-C4aA8dQe.cjs.map +1 -0
  21. package/dist/{main-CiwlneBr.js → main-CjjW4BLK.js} +3683 -3352
  22. package/dist/main-CjjW4BLK.js.map +1 -0
  23. package/dist/main.cjs +1 -1
  24. package/dist/main.d.ts +1 -0
  25. package/dist/main.js +7 -5
  26. package/dist/utils/time.d.ts +1 -0
  27. package/package.json +12 -10
  28. package/dist/ccip-Bv7jv7p7.cjs +0 -2
  29. package/dist/ccip-Bv7jv7p7.cjs.map +0 -1
  30. package/dist/ccip-n5cHM2-q.js +0 -165
  31. package/dist/ccip-n5cHM2-q.js.map +0 -1
  32. package/dist/contracts/abis/anvil/PufferVaultV2.d.ts +0 -1361
  33. package/dist/errors/validation-errors.test.d.ts +0 -1
  34. package/dist/main-CiwlneBr.js.map +0 -1
  35. package/dist/main-DY0whdxp.cjs +0 -39
  36. package/dist/main-DY0whdxp.cjs.map +0 -1
  37. /package/dist/{api/puffer-client-helpers.test.d.ts → contracts/handlers/puffer-depositor-handler.test.d.ts} +0 -0
  38. /package/dist/{api/puffer-client.test.d.ts → contracts/handlers/tokens-handler.test.d.ts} +0 -0
@@ -0,0 +1,396 @@
1
+ export declare const ERC20PERMIT_ABI: readonly [{
2
+ readonly type: "function";
3
+ readonly name: "DOMAIN_SEPARATOR";
4
+ readonly inputs: readonly [];
5
+ readonly outputs: readonly [{
6
+ readonly name: "";
7
+ readonly type: "bytes32";
8
+ readonly internalType: "bytes32";
9
+ }];
10
+ readonly stateMutability: "view";
11
+ }, {
12
+ readonly type: "function";
13
+ readonly name: "allowance";
14
+ readonly inputs: readonly [{
15
+ readonly name: "owner";
16
+ readonly type: "address";
17
+ readonly internalType: "address";
18
+ }, {
19
+ readonly name: "spender";
20
+ readonly type: "address";
21
+ readonly internalType: "address";
22
+ }];
23
+ readonly outputs: readonly [{
24
+ readonly name: "";
25
+ readonly type: "uint256";
26
+ readonly internalType: "uint256";
27
+ }];
28
+ readonly stateMutability: "view";
29
+ }, {
30
+ readonly type: "function";
31
+ readonly name: "approve";
32
+ readonly inputs: readonly [{
33
+ readonly name: "spender";
34
+ readonly type: "address";
35
+ readonly internalType: "address";
36
+ }, {
37
+ readonly name: "value";
38
+ readonly type: "uint256";
39
+ readonly internalType: "uint256";
40
+ }];
41
+ readonly outputs: readonly [{
42
+ readonly name: "";
43
+ readonly type: "bool";
44
+ readonly internalType: "bool";
45
+ }];
46
+ readonly stateMutability: "nonpayable";
47
+ }, {
48
+ readonly type: "function";
49
+ readonly name: "balanceOf";
50
+ readonly inputs: readonly [{
51
+ readonly name: "account";
52
+ readonly type: "address";
53
+ readonly internalType: "address";
54
+ }];
55
+ readonly outputs: readonly [{
56
+ readonly name: "";
57
+ readonly type: "uint256";
58
+ readonly internalType: "uint256";
59
+ }];
60
+ readonly stateMutability: "view";
61
+ }, {
62
+ readonly type: "function";
63
+ readonly name: "decimals";
64
+ readonly inputs: readonly [];
65
+ readonly outputs: readonly [{
66
+ readonly name: "";
67
+ readonly type: "uint8";
68
+ readonly internalType: "uint8";
69
+ }];
70
+ readonly stateMutability: "view";
71
+ }, {
72
+ readonly type: "function";
73
+ readonly name: "eip712Domain";
74
+ readonly inputs: readonly [];
75
+ readonly outputs: readonly [{
76
+ readonly name: "fields";
77
+ readonly type: "bytes1";
78
+ readonly internalType: "bytes1";
79
+ }, {
80
+ readonly name: "name";
81
+ readonly type: "string";
82
+ readonly internalType: "string";
83
+ }, {
84
+ readonly name: "version";
85
+ readonly type: "string";
86
+ readonly internalType: "string";
87
+ }, {
88
+ readonly name: "chainId";
89
+ readonly type: "uint256";
90
+ readonly internalType: "uint256";
91
+ }, {
92
+ readonly name: "verifyingContract";
93
+ readonly type: "address";
94
+ readonly internalType: "address";
95
+ }, {
96
+ readonly name: "salt";
97
+ readonly type: "bytes32";
98
+ readonly internalType: "bytes32";
99
+ }, {
100
+ readonly name: "extensions";
101
+ readonly type: "uint256[]";
102
+ readonly internalType: "uint256[]";
103
+ }];
104
+ readonly stateMutability: "view";
105
+ }, {
106
+ readonly type: "function";
107
+ readonly name: "name";
108
+ readonly inputs: readonly [];
109
+ readonly outputs: readonly [{
110
+ readonly name: "";
111
+ readonly type: "string";
112
+ readonly internalType: "string";
113
+ }];
114
+ readonly stateMutability: "view";
115
+ }, {
116
+ readonly type: "function";
117
+ readonly name: "nonces";
118
+ readonly inputs: readonly [{
119
+ readonly name: "owner";
120
+ readonly type: "address";
121
+ readonly internalType: "address";
122
+ }];
123
+ readonly outputs: readonly [{
124
+ readonly name: "";
125
+ readonly type: "uint256";
126
+ readonly internalType: "uint256";
127
+ }];
128
+ readonly stateMutability: "view";
129
+ }, {
130
+ readonly type: "function";
131
+ readonly name: "permit";
132
+ readonly inputs: readonly [{
133
+ readonly name: "owner";
134
+ readonly type: "address";
135
+ readonly internalType: "address";
136
+ }, {
137
+ readonly name: "spender";
138
+ readonly type: "address";
139
+ readonly internalType: "address";
140
+ }, {
141
+ readonly name: "value";
142
+ readonly type: "uint256";
143
+ readonly internalType: "uint256";
144
+ }, {
145
+ readonly name: "deadline";
146
+ readonly type: "uint256";
147
+ readonly internalType: "uint256";
148
+ }, {
149
+ readonly name: "v";
150
+ readonly type: "uint8";
151
+ readonly internalType: "uint8";
152
+ }, {
153
+ readonly name: "r";
154
+ readonly type: "bytes32";
155
+ readonly internalType: "bytes32";
156
+ }, {
157
+ readonly name: "s";
158
+ readonly type: "bytes32";
159
+ readonly internalType: "bytes32";
160
+ }];
161
+ readonly outputs: readonly [];
162
+ readonly stateMutability: "nonpayable";
163
+ }, {
164
+ readonly type: "function";
165
+ readonly name: "symbol";
166
+ readonly inputs: readonly [];
167
+ readonly outputs: readonly [{
168
+ readonly name: "";
169
+ readonly type: "string";
170
+ readonly internalType: "string";
171
+ }];
172
+ readonly stateMutability: "view";
173
+ }, {
174
+ readonly type: "function";
175
+ readonly name: "totalSupply";
176
+ readonly inputs: readonly [];
177
+ readonly outputs: readonly [{
178
+ readonly name: "";
179
+ readonly type: "uint256";
180
+ readonly internalType: "uint256";
181
+ }];
182
+ readonly stateMutability: "view";
183
+ }, {
184
+ readonly type: "function";
185
+ readonly name: "transfer";
186
+ readonly inputs: readonly [{
187
+ readonly name: "to";
188
+ readonly type: "address";
189
+ readonly internalType: "address";
190
+ }, {
191
+ readonly name: "value";
192
+ readonly type: "uint256";
193
+ readonly internalType: "uint256";
194
+ }];
195
+ readonly outputs: readonly [{
196
+ readonly name: "";
197
+ readonly type: "bool";
198
+ readonly internalType: "bool";
199
+ }];
200
+ readonly stateMutability: "nonpayable";
201
+ }, {
202
+ readonly type: "function";
203
+ readonly name: "transferFrom";
204
+ readonly inputs: readonly [{
205
+ readonly name: "from";
206
+ readonly type: "address";
207
+ readonly internalType: "address";
208
+ }, {
209
+ readonly name: "to";
210
+ readonly type: "address";
211
+ readonly internalType: "address";
212
+ }, {
213
+ readonly name: "value";
214
+ readonly type: "uint256";
215
+ readonly internalType: "uint256";
216
+ }];
217
+ readonly outputs: readonly [{
218
+ readonly name: "";
219
+ readonly type: "bool";
220
+ readonly internalType: "bool";
221
+ }];
222
+ readonly stateMutability: "nonpayable";
223
+ }, {
224
+ readonly type: "event";
225
+ readonly name: "Approval";
226
+ readonly inputs: readonly [{
227
+ readonly name: "owner";
228
+ readonly type: "address";
229
+ readonly indexed: true;
230
+ readonly internalType: "address";
231
+ }, {
232
+ readonly name: "spender";
233
+ readonly type: "address";
234
+ readonly indexed: true;
235
+ readonly internalType: "address";
236
+ }, {
237
+ readonly name: "value";
238
+ readonly type: "uint256";
239
+ readonly indexed: false;
240
+ readonly internalType: "uint256";
241
+ }];
242
+ readonly anonymous: false;
243
+ }, {
244
+ readonly type: "event";
245
+ readonly name: "EIP712DomainChanged";
246
+ readonly inputs: readonly [];
247
+ readonly anonymous: false;
248
+ }, {
249
+ readonly type: "event";
250
+ readonly name: "Transfer";
251
+ readonly inputs: readonly [{
252
+ readonly name: "from";
253
+ readonly type: "address";
254
+ readonly indexed: true;
255
+ readonly internalType: "address";
256
+ }, {
257
+ readonly name: "to";
258
+ readonly type: "address";
259
+ readonly indexed: true;
260
+ readonly internalType: "address";
261
+ }, {
262
+ readonly name: "value";
263
+ readonly type: "uint256";
264
+ readonly indexed: false;
265
+ readonly internalType: "uint256";
266
+ }];
267
+ readonly anonymous: false;
268
+ }, {
269
+ readonly type: "error";
270
+ readonly name: "ECDSAInvalidSignature";
271
+ readonly inputs: readonly [];
272
+ }, {
273
+ readonly type: "error";
274
+ readonly name: "ECDSAInvalidSignatureLength";
275
+ readonly inputs: readonly [{
276
+ readonly name: "length";
277
+ readonly type: "uint256";
278
+ readonly internalType: "uint256";
279
+ }];
280
+ }, {
281
+ readonly type: "error";
282
+ readonly name: "ECDSAInvalidSignatureS";
283
+ readonly inputs: readonly [{
284
+ readonly name: "s";
285
+ readonly type: "bytes32";
286
+ readonly internalType: "bytes32";
287
+ }];
288
+ }, {
289
+ readonly type: "error";
290
+ readonly name: "ERC20InsufficientAllowance";
291
+ readonly inputs: readonly [{
292
+ readonly name: "spender";
293
+ readonly type: "address";
294
+ readonly internalType: "address";
295
+ }, {
296
+ readonly name: "allowance";
297
+ readonly type: "uint256";
298
+ readonly internalType: "uint256";
299
+ }, {
300
+ readonly name: "needed";
301
+ readonly type: "uint256";
302
+ readonly internalType: "uint256";
303
+ }];
304
+ }, {
305
+ readonly type: "error";
306
+ readonly name: "ERC20InsufficientBalance";
307
+ readonly inputs: readonly [{
308
+ readonly name: "sender";
309
+ readonly type: "address";
310
+ readonly internalType: "address";
311
+ }, {
312
+ readonly name: "balance";
313
+ readonly type: "uint256";
314
+ readonly internalType: "uint256";
315
+ }, {
316
+ readonly name: "needed";
317
+ readonly type: "uint256";
318
+ readonly internalType: "uint256";
319
+ }];
320
+ }, {
321
+ readonly type: "error";
322
+ readonly name: "ERC20InvalidApprover";
323
+ readonly inputs: readonly [{
324
+ readonly name: "approver";
325
+ readonly type: "address";
326
+ readonly internalType: "address";
327
+ }];
328
+ }, {
329
+ readonly type: "error";
330
+ readonly name: "ERC20InvalidReceiver";
331
+ readonly inputs: readonly [{
332
+ readonly name: "receiver";
333
+ readonly type: "address";
334
+ readonly internalType: "address";
335
+ }];
336
+ }, {
337
+ readonly type: "error";
338
+ readonly name: "ERC20InvalidSender";
339
+ readonly inputs: readonly [{
340
+ readonly name: "sender";
341
+ readonly type: "address";
342
+ readonly internalType: "address";
343
+ }];
344
+ }, {
345
+ readonly type: "error";
346
+ readonly name: "ERC20InvalidSpender";
347
+ readonly inputs: readonly [{
348
+ readonly name: "spender";
349
+ readonly type: "address";
350
+ readonly internalType: "address";
351
+ }];
352
+ }, {
353
+ readonly type: "error";
354
+ readonly name: "ERC2612ExpiredSignature";
355
+ readonly inputs: readonly [{
356
+ readonly name: "deadline";
357
+ readonly type: "uint256";
358
+ readonly internalType: "uint256";
359
+ }];
360
+ }, {
361
+ readonly type: "error";
362
+ readonly name: "ERC2612InvalidSigner";
363
+ readonly inputs: readonly [{
364
+ readonly name: "signer";
365
+ readonly type: "address";
366
+ readonly internalType: "address";
367
+ }, {
368
+ readonly name: "owner";
369
+ readonly type: "address";
370
+ readonly internalType: "address";
371
+ }];
372
+ }, {
373
+ readonly type: "error";
374
+ readonly name: "InvalidAccountNonce";
375
+ readonly inputs: readonly [{
376
+ readonly name: "account";
377
+ readonly type: "address";
378
+ readonly internalType: "address";
379
+ }, {
380
+ readonly name: "currentNonce";
381
+ readonly type: "uint256";
382
+ readonly internalType: "uint256";
383
+ }];
384
+ }, {
385
+ readonly type: "error";
386
+ readonly name: "InvalidShortString";
387
+ readonly inputs: readonly [];
388
+ }, {
389
+ readonly type: "error";
390
+ readonly name: "StringTooLong";
391
+ readonly inputs: readonly [{
392
+ readonly name: "str";
393
+ readonly type: "string";
394
+ readonly internalType: "string";
395
+ }];
396
+ }];
@@ -1,11 +1,6 @@
1
1
  export declare const CHAIN_ADDRESSES: {
2
- mainnet: {
3
- PufferVault: string;
4
- };
5
- holesky: {
6
- PufferVault: string;
7
- };
8
- anvil: {
2
+ [x: number]: {
9
3
  PufferVault: string;
4
+ PufferDepositor: string;
10
5
  };
11
6
  };
@@ -0,0 +1,61 @@
1
+ import { Address, PublicClient, WalletClient } from 'viem';
2
+ import { Chain } from '../../chains/constants';
3
+ import { TokensHandler } from './tokens-handler';
4
+
5
+ /**
6
+ * Handler for the `PufferDepositor` contract exposing methods to
7
+ * interact with the contract.
8
+ */
9
+ export declare class PufferDepositorHandler {
10
+ private chain;
11
+ private walletClient;
12
+ private publicClient;
13
+ private viemChain;
14
+ tokensHandler: TokensHandler;
15
+ /**
16
+ * Create the handler for the `PufferDepositor` contract exposing
17
+ * methods to interact with the contract.
18
+ *
19
+ * @param chain Chain to use for the client.
20
+ * @param walletClient The wallet client to use for wallet
21
+ * interactions.
22
+ * @param publicClient The public client to use for public
23
+ * interactions.
24
+ */
25
+ constructor(chain: Chain, walletClient: WalletClient, publicClient: PublicClient);
26
+ private getContract;
27
+ /**
28
+ * Deposit stETH in exchange for pufETH. This doesn't make the
29
+ * transaction but returns two methods namely `transact` and
30
+ * `estimate`.
31
+ *
32
+ * @param walletAddress Wallet address to get the stETH from.
33
+ * @param value Value in wei of the stETH to deposit.
34
+ * @returns `transact: () => Promise<Address>` - Used to make the
35
+ * transaction.
36
+ *
37
+ * `estimate: () => Promise<bigint>` - Gas estimate of the
38
+ * transaction.
39
+ */
40
+ depositStETH(walletAddress: Address, value: bigint): Promise<{
41
+ transact: () => Promise<`0x${string}`>;
42
+ estimate: () => Promise<bigint>;
43
+ }>;
44
+ /**
45
+ * Deposit wstETH in exchange for pufETH. This doesn't make the
46
+ * transaction but returns two methods namely `transact` and
47
+ * `estimate`.
48
+ *
49
+ * @param walletAddress Wallet address to get the stETH from.
50
+ * @param value Value in wei of the wstETH to deposit.
51
+ * @returns `transact: () => Promise<Address>` - Used to make the
52
+ * transaction.
53
+ *
54
+ * `estimate: () => Promise<bigint>` - Gas estimate of the
55
+ * transaction.
56
+ */
57
+ depositWstETH(walletAddress: Address, value: bigint): Promise<{
58
+ transact: () => Promise<`0x${string}`>;
59
+ estimate: () => Promise<bigint>;
60
+ }>;
61
+ }
@@ -23,7 +23,7 @@ export declare class PufferVaultHandler {
23
23
  constructor(chain: Chain, walletClient: WalletClient, publicClient: PublicClient);
24
24
  private getContract;
25
25
  /**
26
- * Deposit ETH to the given wallet address. This doesn't make the
26
+ * Deposit ETH in exchange for pufETH. This doesn't make the
27
27
  * transaction but returns two methods namely `transact` and
28
28
  * `estimate`.
29
29
  *
@@ -38,23 +38,6 @@ export declare class PufferVaultHandler {
38
38
  transact: (value: bigint) => Promise<`0x${string}`>;
39
39
  estimate: () => Promise<bigint>;
40
40
  };
41
- /**
42
- * Deposit stETH to the given wallet address. This doesn't make the
43
- * transaction but returns two methods namely `transact` and
44
- * `estimate`.
45
- *
46
- * @param walletAddress Wallet address to get the ETH from.
47
- * @param value Value in wei of the stETH to deposit.
48
- * @returns `transact: () => Promise<Address>` - Used to make the
49
- * transaction with the given value.
50
- *
51
- * `estimate: () => Promise<bigint>` - Gas estimate of the
52
- * transaction.
53
- */
54
- depositStETH(walletAddress: Address, value: bigint): {
55
- transact: () => Promise<`0x${string}`>;
56
- estimate: () => Promise<bigint>;
57
- };
58
41
  /**
59
42
  * Check the pufETH balance of the wallet.
60
43
  *
@@ -0,0 +1,46 @@
1
+ import { WalletClient, PublicClient, Address } from 'viem';
2
+ import { Chain } from '../../chains/constants';
3
+ import { Token } from '../tokens';
4
+
5
+ /**
6
+ * Handler for performing operations for and with tokens.
7
+ */
8
+ export declare class TokensHandler {
9
+ private chain;
10
+ private walletClient;
11
+ private publicClient;
12
+ /**
13
+ * Create the handler for processing tokens.
14
+ *
15
+ * @param chain Chain to use for the client.
16
+ * @param walletClient The wallet client to use for wallet
17
+ * interactions.
18
+ * @param publicClient The public client to use for public
19
+ * interactions.
20
+ */
21
+ constructor(chain: Chain, walletClient: WalletClient, publicClient: PublicClient);
22
+ private getContract;
23
+ /**
24
+ * Process and get permit signature for the given token to perform
25
+ * transactions through the `PufferDepositor` contract.
26
+ *
27
+ * @param token Token for which to get the permit signature.
28
+ * @param walletAddress Wallet address making the transaction.
29
+ * @param value Value of the transaction.
30
+ * @returns Permit signature in the form `{ r, s, v?, yParity }`.
31
+ */
32
+ getPermitSignature(token: Token, walletAddress: Address, value: bigint): Promise<{
33
+ deadline: bigint;
34
+ r: `0x${string}`;
35
+ s: `0x${string}`;
36
+ v: bigint;
37
+ yParity: number;
38
+ } | {
39
+ deadline: bigint;
40
+ r: `0x${string}`;
41
+ s: `0x${string}`;
42
+ yParity: number;
43
+ v?: undefined;
44
+ }>;
45
+ private getPermitVersion;
46
+ }
@@ -0,0 +1,14 @@
1
+ import { Address } from 'viem';
2
+ import { Chain } from '../chains/constants';
3
+
4
+ export declare enum Token {
5
+ ETH = "ETH",
6
+ stETH = "stETH",
7
+ wstETH = "wstETH",
8
+ pufETH = "pufETH"
9
+ }
10
+ export declare const TOKENS_ADDRESSES: {
11
+ [key in Token]: {
12
+ [chain in Chain]: Address;
13
+ };
14
+ };