@paxoslabs/amplify-sdk 0.5.2 → 1.0.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 (62) hide show
  1. package/dist/index.d.mts +3158 -725
  2. package/dist/index.d.ts +3158 -725
  3. package/dist/index.js +15013 -171
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +15067 -6
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +25 -86
  8. package/CHANGELOG.md +0 -320
  9. package/LICENSE +0 -28
  10. package/README.md +0 -119
  11. package/dist/chain-utils-BdJecHBA.d.mts +0 -334
  12. package/dist/chain-utils-BdJecHBA.d.ts +0 -334
  13. package/dist/chunk-5OK753GA.js +0 -1989
  14. package/dist/chunk-5OK753GA.js.map +0 -1
  15. package/dist/chunk-6CU533DM.mjs +0 -39
  16. package/dist/chunk-6CU533DM.mjs.map +0 -1
  17. package/dist/chunk-7JQQ2TH4.mjs +0 -1231
  18. package/dist/chunk-7JQQ2TH4.mjs.map +0 -1
  19. package/dist/chunk-HU5CTL4C.mjs +0 -1962
  20. package/dist/chunk-HU5CTL4C.mjs.map +0 -1
  21. package/dist/chunk-NNDY5TID.js +0 -1143
  22. package/dist/chunk-NNDY5TID.js.map +0 -1
  23. package/dist/chunk-Q5FXJU5Y.mjs +0 -1133
  24. package/dist/chunk-Q5FXJU5Y.mjs.map +0 -1
  25. package/dist/chunk-QZHI2T7O.mjs +0 -457
  26. package/dist/chunk-QZHI2T7O.mjs.map +0 -1
  27. package/dist/chunk-SWUG4PTB.js +0 -464
  28. package/dist/chunk-SWUG4PTB.js.map +0 -1
  29. package/dist/chunk-TNL23CO2.js +0 -45
  30. package/dist/chunk-TNL23CO2.js.map +0 -1
  31. package/dist/chunk-WK7EJRBB.mjs +0 -1482
  32. package/dist/chunk-WK7EJRBB.mjs.map +0 -1
  33. package/dist/chunk-WYBYBPX5.js +0 -1518
  34. package/dist/chunk-WYBYBPX5.js.map +0 -1
  35. package/dist/chunk-ZKDXRGI5.js +0 -1239
  36. package/dist/chunk-ZKDXRGI5.js.map +0 -1
  37. package/dist/core.d.mts +0 -152
  38. package/dist/core.d.ts +0 -152
  39. package/dist/core.js +0 -1220
  40. package/dist/core.js.map +0 -1
  41. package/dist/core.mjs +0 -1194
  42. package/dist/core.mjs.map +0 -1
  43. package/dist/display.d.mts +0 -263
  44. package/dist/display.d.ts +0 -263
  45. package/dist/display.js +0 -36
  46. package/dist/display.js.map +0 -1
  47. package/dist/display.mjs +0 -7
  48. package/dist/display.mjs.map +0 -1
  49. package/dist/index-DXXA8gEA.d.mts +0 -5026
  50. package/dist/index-aE5lTOUH.d.ts +0 -5026
  51. package/dist/utils.d.mts +0 -112
  52. package/dist/utils.d.ts +0 -112
  53. package/dist/utils.js +0 -67
  54. package/dist/utils.js.map +0 -1
  55. package/dist/utils.mjs +0 -25
  56. package/dist/utils.mjs.map +0 -1
  57. package/dist/vaults.d.mts +0 -4
  58. package/dist/vaults.d.ts +0 -4
  59. package/dist/vaults.js +0 -96
  60. package/dist/vaults.js.map +0 -1
  61. package/dist/vaults.mjs +0 -7
  62. package/dist/vaults.mjs.map +0 -1
package/dist/display.d.ts DELETED
@@ -1,263 +0,0 @@
1
- import { Address } from 'viem';
2
- import { C as ChainId } from './chain-utils-BdJecHBA.js';
3
- import 'viem/chains';
4
-
5
- /**
6
- * @file Display module type definitions
7
- * @module display/types
8
- */
9
-
10
- /** Status of a withdrawal request */
11
- type WithdrawalRequestStatus = 'PENDING' | 'COMPLETE' | 'PENDING_REFUND' | 'REFUNDED';
12
- /** A withdrawal request returned from the backend API */
13
- interface WithdrawalRequest {
14
- id: string;
15
- vaultAddress: Address;
16
- chainId: number;
17
- wantAssetAddress: Address;
18
- status: WithdrawalRequestStatus;
19
- createdAt: string;
20
- userAddress: Address;
21
- receiverAddress: Address;
22
- refundReceiverAddress: Address;
23
- orderAmount: string;
24
- orderIndex: number;
25
- isSubmittedViaSignature: boolean;
26
- isForceProcessed: boolean;
27
- isMarkedForRefund: boolean;
28
- isMarkedForRefundByUser: boolean;
29
- didOrderFailTransfer: boolean;
30
- }
31
- /** Parameters for getWithdrawalRequests */
32
- interface GetWithdrawalRequestsParams {
33
- userAddress: Address;
34
- chainId?: number;
35
- vaultAddress?: Address;
36
- vaultName?: string;
37
- status?: WithdrawalRequestStatus;
38
- pageSize?: number;
39
- pageToken?: string;
40
- }
41
- /** Return type for getWithdrawalRequests */
42
- interface WithdrawalRequestsResult {
43
- withdrawalRequests: WithdrawalRequest[];
44
- nextPageToken: string | null;
45
- }
46
- /** Parameters for getWithdrawalFee */
47
- interface GetWithdrawalFeeParams {
48
- /** Human-readable vault name (e.g. "Amplify USDC Core") */
49
- vaultName: string;
50
- /** Chain ID where the vault is deployed. Must match the vault's chain. */
51
- chainId: ChainId;
52
- /** Token contract address used to validate the vault (should match the vault's supported asset) */
53
- assetAddress: Address;
54
- amount: string;
55
- offerAsset: Address;
56
- wantAsset: Address;
57
- receiver: Address;
58
- }
59
- /** Return type for getWithdrawalFee */
60
- interface WithdrawalFeeResult {
61
- feeAmount: bigint;
62
- feePercentage: bigint;
63
- }
64
- /** Parameters for getMinimumWithdrawalOrderSize */
65
- interface GetMinimumWithdrawalOrderSizeParams {
66
- /** Human-readable vault name (e.g. "Amplify USDC Core") */
67
- vaultName: string;
68
- /** Chain ID where the vault is deployed. Must match the vault's chain. */
69
- chainId: ChainId;
70
- /** Token contract address used to validate the vault (should match the vault's supported asset) */
71
- assetAddress: Address;
72
- }
73
- /** Return type for getMinimumWithdrawalOrderSize */
74
- interface MinimumWithdrawalOrderSizeResult {
75
- minimumOrderSize: bigint;
76
- shareDecimals: number;
77
- }
78
- /** Parameters for getMinimumMint */
79
- interface GetMinimumMintParams {
80
- /** Human-readable vault name (e.g. "Amplify USDC Core") */
81
- vaultName: string;
82
- /** Chain ID where the vault is deployed. Must match the vault's chain. */
83
- chainId: ChainId;
84
- /** Token contract address to deposit. Must match the vault's supported asset. */
85
- depositAssetAddress: Address;
86
- depositAmount: string;
87
- }
88
- /** Return type for getMinimumMint */
89
- interface MinimumMintResult {
90
- expectedShares: bigint;
91
- exchangeRate: bigint;
92
- shareDecimals: number;
93
- assetDecimals: number;
94
- }
95
- /** Parameters for getVaultAPY */
96
- interface GetVaultAPYParams {
97
- vaultAddress?: Address;
98
- vaultName?: string;
99
- chainId?: number;
100
- }
101
- /** Return type for getVaultAPY */
102
- interface VaultAPYResult {
103
- apy: number;
104
- apyFormatted: string;
105
- vaultAddress: Address;
106
- timestamp: string;
107
- }
108
- /** Parameters for getVaultTVL */
109
- interface GetVaultTVLParams {
110
- vaultAddress?: Address;
111
- vaultName?: string;
112
- chainId?: number;
113
- }
114
- /** Return type for getVaultTVL */
115
- interface VaultTVLResult {
116
- tvl: string;
117
- tvlAsset: string;
118
- vaultAddress: Address;
119
- chainId: number;
120
- timestamp: string;
121
- }
122
-
123
- /**
124
- * @file Deposit display helpers
125
- * @module display/deposit-display
126
- */
127
-
128
- /**
129
- * Calculates the expected vault shares a user will receive for a deposit
130
- *
131
- * Uses the on-chain exchange rate from the Accountant contract to calculate
132
- * how many vault shares will be minted for a given deposit amount.
133
- *
134
- * @param params - Deposit parameters
135
- * @returns Expected shares, exchange rate, and decimal info
136
- * @throws {APIError} If vault not found or contract read fails
137
- *
138
- * @example
139
- * ```typescript
140
- * const result = await getMinimumMint({
141
- * vaultName: "Amplify USDC Core",
142
- * chainId: 1,
143
- * depositAssetAddress: "0xA0b8...", // USDC
144
- * depositAmount: "1000.0",
145
- * });
146
- * console.log(result.expectedShares);
147
- * ```
148
- */
149
- declare function getMinimumMint(params: GetMinimumMintParams): Promise<MinimumMintResult>;
150
-
151
- /**
152
- * @file Vault display helpers
153
- * @module display/vault-display
154
- */
155
-
156
- /**
157
- * Fetches the latest APY for a vault from the backend API
158
- *
159
- * Requests the most recent APY data point by using
160
- * orderByTimestamp=desc with pageSize=1.
161
- *
162
- * @param params - Vault identifier parameters (vaultAddress, vaultName, or both)
163
- * @returns Latest APY value and metadata
164
- * @throws {APIError} If the API request fails or no data found
165
- *
166
- * @example
167
- * ```typescript
168
- * const result = await getVaultAPY({
169
- * vaultAddress: "0x1234...",
170
- * });
171
- * console.log(result.apyFormatted); // "4.50%"
172
- * ```
173
- */
174
- declare function getVaultAPY(params: GetVaultAPYParams): Promise<VaultAPYResult>;
175
- /**
176
- * Fetches the current TVL for a vault from the backend API
177
- *
178
- * Requests the most recent TVL data point by using
179
- * includeCurrent=true, orderByTimestamp=desc with pageSize=1.
180
- *
181
- * @param params - Vault identifier parameters (vaultAddress, vaultName, or both)
182
- * @returns Current TVL value and metadata
183
- * @throws {APIError} If the API request fails or no data found
184
- *
185
- * @example
186
- * ```typescript
187
- * const result = await getVaultTVL({
188
- * vaultAddress: "0x1234...",
189
- * });
190
- * console.log(result.tvl, result.tvlAsset);
191
- * ```
192
- */
193
- declare function getVaultTVL(params: GetVaultTVLParams): Promise<VaultTVLResult>;
194
-
195
- /**
196
- * @file Withdrawal display helpers
197
- * @module display/withdrawal-display
198
- */
199
-
200
- /**
201
- * Fetches a user's withdrawal requests from the backend API
202
- *
203
- * @param params - Filter parameters for withdrawal requests
204
- * @returns Paginated list of withdrawal requests
205
- * @throws {APIError} If the API request fails or parameters are invalid
206
- *
207
- * @example
208
- * ```typescript
209
- * const result = await getWithdrawalRequests({
210
- * userAddress: "0x1234...",
211
- * status: "PENDING",
212
- * chainId: 1,
213
- * });
214
- * console.log(result.withdrawalRequests);
215
- * ```
216
- */
217
- declare function getWithdrawalRequests(params: GetWithdrawalRequestsParams): Promise<WithdrawalRequestsResult>;
218
- /**
219
- * Reads the withdrawal fee from the on-chain FeeModule contract
220
- *
221
- * Performs two sequential RPC calls:
222
- * 1. Reads the FeeModule address from WithdrawQueue.feeModule()
223
- * 2. Multicalls calculateOfferFees + offerFeePercentage on the FeeModule
224
- *
225
- * @param params - Parameters for fee calculation
226
- * @returns Fee amount and fee percentage
227
- * @throws {APIError} If vault not found or contract read fails
228
- *
229
- * @example
230
- * ```typescript
231
- * const fee = await getWithdrawalFee({
232
- * vaultName: "Amplify USDC Core",
233
- * chainId: 1,
234
- * assetAddress: "0xA0b8...", // USDC
235
- * amount: "1.0",
236
- * offerAsset: "0x1234...", // vault shares
237
- * wantAsset: "0xA0b8...", // USDC
238
- * receiver: "0x5678...",
239
- * });
240
- * console.log(fee.feeAmount, fee.feePercentage);
241
- * ```
242
- */
243
- declare function getWithdrawalFee(params: GetWithdrawalFeeParams): Promise<WithdrawalFeeResult>;
244
- /**
245
- * Reads the minimum withdrawal order size from the WithdrawQueue contract
246
- *
247
- * @param params - Parameters to identify the vault
248
- * @returns Minimum order size in vault shares and share decimals
249
- * @throws {APIError} If vault not found or contract read fails
250
- *
251
- * @example
252
- * ```typescript
253
- * const result = await getMinimumWithdrawalOrderSize({
254
- * vaultName: "Amplify USDC Core",
255
- * chainId: 1,
256
- * assetAddress: "0xA0b8...",
257
- * });
258
- * console.log(result.minimumOrderSize, result.shareDecimals);
259
- * ```
260
- */
261
- declare function getMinimumWithdrawalOrderSize(params: GetMinimumWithdrawalOrderSizeParams): Promise<MinimumWithdrawalOrderSizeResult>;
262
-
263
- export { type GetMinimumMintParams, type GetMinimumWithdrawalOrderSizeParams, type GetVaultAPYParams, type GetVaultTVLParams, type GetWithdrawalFeeParams, type GetWithdrawalRequestsParams, type MinimumMintResult, type MinimumWithdrawalOrderSizeResult, type VaultAPYResult, type VaultTVLResult, type WithdrawalFeeResult, type WithdrawalRequest, type WithdrawalRequestStatus, type WithdrawalRequestsResult, getMinimumMint, getMinimumWithdrawalOrderSize, getVaultAPY, getVaultTVL, getWithdrawalFee, getWithdrawalRequests };
package/dist/display.js DELETED
@@ -1,36 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkSWUG4PTB_js = require('./chunk-SWUG4PTB.js');
4
- require('./chunk-ZKDXRGI5.js');
5
- require('./chunk-NNDY5TID.js');
6
- require('./chunk-TNL23CO2.js');
7
- require('./chunk-WYBYBPX5.js');
8
-
9
-
10
-
11
- Object.defineProperty(exports, "getMinimumMint", {
12
- enumerable: true,
13
- get: function () { return chunkSWUG4PTB_js.getMinimumMint; }
14
- });
15
- Object.defineProperty(exports, "getMinimumWithdrawalOrderSize", {
16
- enumerable: true,
17
- get: function () { return chunkSWUG4PTB_js.getMinimumWithdrawalOrderSize; }
18
- });
19
- Object.defineProperty(exports, "getVaultAPY", {
20
- enumerable: true,
21
- get: function () { return chunkSWUG4PTB_js.getVaultAPY; }
22
- });
23
- Object.defineProperty(exports, "getVaultTVL", {
24
- enumerable: true,
25
- get: function () { return chunkSWUG4PTB_js.getVaultTVL; }
26
- });
27
- Object.defineProperty(exports, "getWithdrawalFee", {
28
- enumerable: true,
29
- get: function () { return chunkSWUG4PTB_js.getWithdrawalFee; }
30
- });
31
- Object.defineProperty(exports, "getWithdrawalRequests", {
32
- enumerable: true,
33
- get: function () { return chunkSWUG4PTB_js.getWithdrawalRequests; }
34
- });
35
- //# sourceMappingURL=display.js.map
36
- //# sourceMappingURL=display.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"display.js"}
package/dist/display.mjs DELETED
@@ -1,7 +0,0 @@
1
- export { getMinimumMint, getMinimumWithdrawalOrderSize, getVaultAPY, getVaultTVL, getWithdrawalFee, getWithdrawalRequests } from './chunk-QZHI2T7O.mjs';
2
- import './chunk-7JQQ2TH4.mjs';
3
- import './chunk-Q5FXJU5Y.mjs';
4
- import './chunk-6CU533DM.mjs';
5
- import './chunk-WK7EJRBB.mjs';
6
- //# sourceMappingURL=display.mjs.map
7
- //# sourceMappingURL=display.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"display.mjs"}