@pufferfinance/puffer-sdk 1.0.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 (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +81 -0
  3. package/dist/ccip-Bv7jv7p7.cjs +2 -0
  4. package/dist/ccip-Bv7jv7p7.cjs.map +1 -0
  5. package/dist/ccip-n5cHM2-q.js +165 -0
  6. package/dist/ccip-n5cHM2-q.js.map +1 -0
  7. package/dist/lib/api/puffer-client-helpers.d.ts +6218 -0
  8. package/dist/lib/api/puffer-client-helpers.test.d.ts +1 -0
  9. package/dist/lib/api/puffer-client.d.ts +28 -0
  10. package/dist/lib/api/puffer-client.test.d.ts +1 -0
  11. package/dist/lib/chains/constants.d.ts +11 -0
  12. package/dist/lib/contracts/abis/abis.d.ts +4151 -0
  13. package/dist/lib/contracts/abis/anvil/PufferVaultV2.d.ts +1361 -0
  14. package/dist/lib/contracts/abis/holesky/PufferVaultV2.d.ts +1361 -0
  15. package/dist/lib/contracts/abis/mainnet/PufferVaultV2.d.ts +1421 -0
  16. package/dist/lib/contracts/addresses.d.ts +11 -0
  17. package/dist/lib/contracts/handlers/puffer-vault-handler.d.ts +79 -0
  18. package/dist/lib/contracts/handlers/puffer-vault-handler.test.d.ts +1 -0
  19. package/dist/lib/errors/base-error.d.ts +8 -0
  20. package/dist/lib/errors/types.d.ts +4 -0
  21. package/dist/lib/errors/validation-errors.d.ts +4 -0
  22. package/dist/lib/errors/validation-errors.test.d.ts +1 -0
  23. package/dist/lib/main.d.ts +3 -0
  24. package/dist/lib/utils/types.d.ts +4 -0
  25. package/dist/lib/utils/version.d.ts +1 -0
  26. package/dist/main-CiwlneBr.js +13444 -0
  27. package/dist/main-CiwlneBr.js.map +1 -0
  28. package/dist/main-DY0whdxp.cjs +39 -0
  29. package/dist/main-DY0whdxp.cjs.map +1 -0
  30. package/dist/main.cjs +2 -0
  31. package/dist/main.cjs.map +1 -0
  32. package/dist/main.js +8 -0
  33. package/dist/main.js.map +1 -0
  34. package/dist/test/mocks/mock-request.d.ts +5 -0
  35. package/dist/test/mocks/setup-mock-clients.d.ts +6455 -0
  36. package/package.json +60 -0
@@ -0,0 +1,11 @@
1
+ export declare const CHAIN_ADDRESSES: {
2
+ mainnet: {
3
+ PufferVault: string;
4
+ };
5
+ holesky: {
6
+ PufferVault: string;
7
+ };
8
+ anvil: {
9
+ PufferVault: string;
10
+ };
11
+ };
@@ -0,0 +1,79 @@
1
+ import { Address, PublicClient, WalletClient } from 'viem';
2
+ import { Chain } from '../../chains/constants';
3
+
4
+ /**
5
+ * Handler for the `PufferVaultV2` contract exposing methods to interact
6
+ * with the contract.
7
+ */
8
+ export declare class PufferVaultHandler {
9
+ private chain;
10
+ private walletClient;
11
+ private publicClient;
12
+ private viemChain;
13
+ /**
14
+ * Create the handler for the `PufferVaultV2` contract exposing
15
+ * methods to interact with the contract.
16
+ *
17
+ * @param chain Chain to use for the client.
18
+ * @param walletClient The wallet client to use for wallet
19
+ * interactions.
20
+ * @param publicClient The public client to use for public
21
+ * interactions.
22
+ */
23
+ constructor(chain: Chain, walletClient: WalletClient, publicClient: PublicClient);
24
+ private getContract;
25
+ /**
26
+ * Deposit ETH to the given wallet address. This doesn't make the
27
+ * transaction but returns two methods namely `transact` and
28
+ * `estimate`.
29
+ *
30
+ * @param walletAddress Wallet address to get the ETH from.
31
+ * @returns `transact: (value: bigint) => Promise<Address>` - Used to
32
+ * make the transaction with the given value.
33
+ *
34
+ * `estimate: () => Promise<bigint>` - Gas estimate of the
35
+ * transaction.
36
+ */
37
+ depositETH(walletAddress: Address): {
38
+ transact: (value: bigint) => Promise<`0x${string}`>;
39
+ estimate: () => Promise<bigint>;
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
+ /**
59
+ * Check the pufETH balance of the wallet.
60
+ *
61
+ * @param walletAddress Wallet address to check the balance of.
62
+ * @returns pufETH balance in wei.
63
+ */
64
+ balanceOf(walletAddress: Address): Promise<bigint>;
65
+ /**
66
+ * Get the rate of pufETH compared to ETH.
67
+ *
68
+ * @returns Rate of pufETH compared to 1 ETH.
69
+ */
70
+ getPufETHRate(): Promise<bigint>;
71
+ /**
72
+ * Get the allowance for the given owner and spender.
73
+ *
74
+ * @param ownerAddress Address of the owner.
75
+ * @param spenderAddress Address of the spender.
76
+ * @returns Allowance for the given owner and spender.
77
+ */
78
+ getAllowance(ownerAddress: Address, spenderAddress: Address): Promise<bigint>;
79
+ }
@@ -0,0 +1,8 @@
1
+ import { ErrorBaseParameters } from './types';
2
+
3
+ export declare abstract class BaseError<T extends {
4
+ [key: string]: string;
5
+ } = ErrorBaseParameters> extends Error {
6
+ constructor(message: string, params: T);
7
+ protected compileMessage(message: string, params: T): string;
8
+ }
@@ -0,0 +1,4 @@
1
+ export type ErrorBaseParameters = {
2
+ docsPath?: string;
3
+ fixMessage?: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ import { BaseError } from './base-error';
2
+
3
+ export declare class AccountError extends BaseError {
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './api/puffer-client';
2
+ export * from './api/puffer-client-helpers';
3
+ export * from './chains/constants';
@@ -0,0 +1,4 @@
1
+ export type ValueOf<T> = T[keyof T];
2
+ export type TransportProvider = {
3
+ request: (...args: any) => Promise<any>;
4
+ };
@@ -0,0 +1 @@
1
+ export declare const version: string;