@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
@@ -1,334 +0,0 @@
1
- import { Chain } from 'viem/chains';
2
- import { Address } from 'viem';
3
-
4
- /**
5
- * SDK Configuration Constants
6
- *
7
- * Global constants for supported chains, yield types, tokens, and defaults.
8
- * Centralized configuration for address book integration and permit deposits.
9
- */
10
-
11
- /**
12
- * Yield Type identifiers
13
- *
14
- * Use as const values: YieldType.CORE, YieldType.TREASURY, YieldType.FRONTIER
15
- * Use as type annotation: yieldType: YieldType
16
- */
17
- declare const YieldType: {
18
- readonly CORE: "CORE";
19
- readonly TREASURY: "TREASURY";
20
- readonly FRONTIER: "FRONTIER";
21
- };
22
- type YieldType = (typeof YieldType)[keyof typeof YieldType];
23
-
24
- /**
25
- * Type definitions for Amplify SDK API integration
26
- *
27
- * These types define the data structures returned by the Earn SDK backend API
28
- * and internal cache structures used by the SDK.
29
- *
30
- * @module types/amplify-sdk-api
31
- */
32
-
33
- /**
34
- * Vault smart contract configuration
35
- *
36
- * Contains all contract addresses required for vault operations:
37
- * - boringVaultAddress: Main vault contract
38
- * - tellerAddress: Handles deposits and withdrawals
39
- * - accountantAddress: Manages accounting logic
40
- * - managerAddress: Controls strategy execution
41
- * - rolesAuthorityAddress: Enforces role-based access
42
- * - baseTokenAddress: Primary deposit token address
43
- * - baseTokenStandIn: Optional stand-in token
44
- * - communityCodeDepositorAddress: Optional community depositor contract
45
- */
46
- interface VaultContracts {
47
- boringVaultAddress: Address;
48
- tellerAddress: Address;
49
- accountantAddress: Address;
50
- managerAddress: Address;
51
- rolesAuthorityAddress: Address;
52
- baseTokenAddress: Address;
53
- baseTokenStandIn?: Address;
54
- communityCodeDepositorAddress?: Address;
55
- withdrawQueueAddress?: Address;
56
- }
57
- /**
58
- * Enterprise customer configuration for compliance features (e.g. KYT).
59
- */
60
- interface EnterpriseConfig {
61
- predicatePolicyId: string | null;
62
- }
63
- /**
64
- * A single depositable/withdrawable asset supported by a vault.
65
- */
66
- interface VaultSupportedAsset {
67
- /** Token contract address */
68
- address: Address;
69
- /** Chain ID where this asset can be deposited/withdrawn (may differ from vault chain for cross-chain vaults) */
70
- chainId?: number;
71
- /** Token symbol (e.g., USDC, USDT) */
72
- symbol: string;
73
- /** Full token name (e.g., USD Coin) */
74
- name: string;
75
- /** Number of decimal places (e.g., 6 for USDC, 18 for DAI) */
76
- decimals: number;
77
- /** CoinGecko token identifier for price lookups */
78
- coinGeckoTokenId?: string;
79
- /** Whether deposits are currently enabled for this vault-asset pair */
80
- depositable?: boolean;
81
- /** Whether withdrawals are currently enabled for this vault-asset pair */
82
- withdrawable?: boolean;
83
- }
84
- /**
85
- * Amplify vault configuration
86
- *
87
- * Represents a single vault with contract addresses, yield type, and supported deposit assets.
88
- * Multiple vaults can share the same baseTokenAddress (different chains/yield types).
89
- * A single vault can support multiple depositable assets.
90
- *
91
- * @example
92
- * ```typescript
93
- * const vault: AmplifyVault = {
94
- * id: "config-eth-core-001",
95
- * chainId: 1,
96
- * yieldType: "CORE",
97
- * vault: {
98
- * boringVaultAddress: "0x8a5Fb0Eb3E1a90AF81C5DFF9f2e5D0e7b8D4E5F6",
99
- * tellerAddress: "0x7B8C9D0E1F2A3B4C5D6E7F8A9B0C1D2E3F4A5B6C",
100
- * accountantAddress: "0x6A7B8C9D0E1F2A3B4C5D6E7F8A9B0C1D2E3F4A5B",
101
- * managerAddress: "0x5A6B7C8D9E0F1A2B3C4D5E6F7A8B9C0D1E2F3A4B",
102
- * rolesAuthorityAddress: "0x4A5B6C7D8E9F0A1B2C3D4E5F6A7B8C9D0E1F2A3B",
103
- * baseTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
104
- * },
105
- * supportedAssets: [
106
- * {
107
- * address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
108
- * symbol: "USDC",
109
- * name: "USD Coin",
110
- * decimals: 6,
111
- * coinGeckoTokenId: "usd-coin"
112
- * }
113
- * ]
114
- * };
115
- * ```
116
- */
117
- interface VaultSLA {
118
- externalWithdrawalQueueDelaySLA: number;
119
- externalAccountantRateUpdateSLA: number;
120
- }
121
- interface AmplifyVault {
122
- /** Unique identifier for the vault configuration */
123
- id: string;
124
- /** Chain ID where the vault is deployed (e.g., 1 for Ethereum) */
125
- chainId: number;
126
- /** Yield strategy type */
127
- yieldType: YieldType;
128
- /** Human-readable vault name */
129
- name: string;
130
- /** Whether the vault is being deprecated */
131
- inDeprecation: boolean;
132
- /** Vault smart contract addresses */
133
- vault: VaultContracts;
134
- /** Enterprise customer configuration (compliance settings, e.g. KYT) */
135
- enterpriseConfig?: EnterpriseConfig;
136
- /** SLA data from VaultSLAs table */
137
- sla?: VaultSLA;
138
- /** Supported deposit assets for this vault */
139
- supportedAssets: VaultSupportedAsset[];
140
- }
141
- /**
142
- * Supported asset (token) metadata
143
- *
144
- * Represents a cryptocurrency token with metadata and chain support.
145
- * Can be correlated with AmplifyVault via the vault's supportedAssets array.
146
- *
147
- * @example
148
- * ```typescript
149
- * const asset: SupportedAsset = {
150
- * address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
151
- * symbol: "USDC",
152
- * name: "USD Coin",
153
- * decimals: 6,
154
- * coinGeckoTokenId: "usd-coin",
155
- * chains: [1, 137, 8453, 42161]
156
- * };
157
- * ```
158
- */
159
- interface SupportedAsset {
160
- /** Token contract address */
161
- address: Address;
162
- /** Token symbol (e.g., USDC, USDT) */
163
- symbol: string;
164
- /** Full token name (e.g., USD Coin) */
165
- name: string;
166
- /** Number of decimal places (e.g., 6 for USDC, 18 for DAI) */
167
- decimals: number;
168
- /** CoinGecko token identifier for price lookups */
169
- coinGeckoTokenId?: string;
170
- /** Array of chain IDs where this token is supported */
171
- chains: number[];
172
- }
173
- /**
174
- * Filter options for vault queries
175
- *
176
- * Used to filter vaults by chain, yield type, or deposit token.
177
- * All filters are optional and can be combined.
178
- *
179
- * @example
180
- * ```typescript
181
- * // Get all CORE vaults on Ethereum
182
- * const options: VaultFilterOptions = {
183
- * chainId: 1,
184
- * yieldType: "CORE"
185
- * };
186
- *
187
- * // Get all vaults accepting USDC
188
- * const usdcOptions: VaultFilterOptions = {
189
- * depositTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
190
- * };
191
- * ```
192
- */
193
- interface VaultFilterOptions {
194
- /** Filter by chain ID */
195
- chainId?: number;
196
- /** Filter by yield type */
197
- yieldType?: YieldType;
198
- /** Filter by deposit token address */
199
- depositTokenAddress?: Address;
200
- /** Filter by withdraw asset address */
201
- withdrawAssetAddress?: Address;
202
- /** Filter by settlement asset address */
203
- settlementAssetAddress?: Address;
204
- }
205
- /**
206
- * Filter options for asset queries
207
- *
208
- * Used to filter supported assets by chain IDs, yield type, address, or symbol.
209
- * All filters are optional and can be combined.
210
- *
211
- * Note: API endpoints only support `chains` and `yieldType` parameters.
212
- * The `address` and `symbol` filters are only applied in cache-layer filtering.
213
- *
214
- * @example
215
- * ```typescript
216
- * // Get all assets supported on Ethereum and Base (API call)
217
- * const options: AssetFilterOptions = {
218
- * chains: [1, 8453]
219
- * };
220
- *
221
- * // Get CORE yield type assets (API call)
222
- * const coreOptions: AssetFilterOptions = {
223
- * yieldType: "CORE"
224
- * };
225
- *
226
- * // Filter by address (cache-only)
227
- * const usdcOptions: AssetFilterOptions = {
228
- * address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
229
- * };
230
- *
231
- * // Filter by symbol (cache-only)
232
- * const symbolOptions: AssetFilterOptions = {
233
- * symbol: "USDC"
234
- * };
235
- * ```
236
- */
237
- interface AssetFilterOptions {
238
- /** Filter by chain IDs (API + cache: assets with these chains in chains array) */
239
- chains?: number[];
240
- /** Filter by yield type (API + cache: CORE, TREASURY, or FRONTIER) */
241
- yieldType?: YieldType;
242
- /** Filter by token address (cache-only: exact address match) */
243
- address?: string;
244
- /** Filter by token symbol (cache-only: exact symbol match) */
245
- symbol?: string;
246
- }
247
- /**
248
- * API error with descriptive messages
249
- *
250
- * Thrown when API requests fail due to network errors, server errors,
251
- * or malformed responses.
252
- *
253
- * @example
254
- * ```typescript
255
- * throw new APIError("Failed to fetch vaults: Network timeout", {
256
- * statusCode: 408,
257
- * endpoint: "/v1/earn-sdk/vaults"
258
- * });
259
- * ```
260
- */
261
- declare class APIError extends Error {
262
- /**
263
- * HTTP status code (if available)
264
- */
265
- statusCode?: number;
266
- /**
267
- * API endpoint that failed
268
- */
269
- endpoint?: string;
270
- /**
271
- * Original error cause
272
- */
273
- cause?: unknown;
274
- constructor(message: string, options?: {
275
- statusCode?: number;
276
- endpoint?: string;
277
- cause?: unknown;
278
- });
279
- }
280
- /**
281
- * Supported asset information for withdrawal
282
- *
283
- * Asset grouped with available vaults that support withdrawal of that asset.
284
- *
285
- * @example
286
- * ```typescript
287
- * const asset: WithdrawSupportedAsset = {
288
- * address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
289
- * symbol: "USDC",
290
- * decimals: 6,
291
- * vaults: [
292
- * { id: "core-usdc-eth", yieldType: "CORE", chainId: 1, vaultId: "..." },
293
- * { id: "core-usdc-boba", yieldType: "CORE", chainId: 288, vaultId: "..." },
294
- * ],
295
- * };
296
- * ```
297
- */
298
- interface WithdrawSupportedAsset {
299
- /** Token contract address */
300
- address: Address;
301
- /** Token symbol (e.g., "USDC", "ETH") */
302
- symbol: string;
303
- /** Number of decimal places for this token */
304
- decimals: number;
305
- /** Array of vaults that support withdrawals of this asset */
306
- vaults: Array<{
307
- id: string;
308
- yieldType: YieldType;
309
- chainId: number;
310
- vaultId: string;
311
- }>;
312
- }
313
-
314
- /**
315
- * Flexible chain ID type that accepts both number and string
316
- */
317
- type ChainId = number | `${number}`;
318
- /**
319
- * Normalizes a ChainId to a number
320
- */
321
- declare function toChainId(value: ChainId): number;
322
- /**
323
- * Gets a chain object from the vault config response
324
- * @param chainId The chain ID to look up
325
- * @param config Optional config object. If not provided, will fetch from API
326
- * @returns Promise<Chain>
327
- */
328
- declare function getChainFromConfig(chainId: number, config?: AmplifyVault[]): Promise<Chain>;
329
- /**
330
- * Clears the chains cache
331
- */
332
- declare function clearChainsCache(): void;
333
-
334
- export { type AmplifyVault as A, type ChainId as C, type EnterpriseConfig as E, type SupportedAsset as S, type VaultFilterOptions as V, type WithdrawSupportedAsset as W, YieldType as Y, type AssetFilterOptions as a, APIError as b, clearChainsCache as c, type VaultSLA as d, type VaultSupportedAsset as e, getChainFromConfig as g, toChainId as t };
@@ -1,334 +0,0 @@
1
- import { Chain } from 'viem/chains';
2
- import { Address } from 'viem';
3
-
4
- /**
5
- * SDK Configuration Constants
6
- *
7
- * Global constants for supported chains, yield types, tokens, and defaults.
8
- * Centralized configuration for address book integration and permit deposits.
9
- */
10
-
11
- /**
12
- * Yield Type identifiers
13
- *
14
- * Use as const values: YieldType.CORE, YieldType.TREASURY, YieldType.FRONTIER
15
- * Use as type annotation: yieldType: YieldType
16
- */
17
- declare const YieldType: {
18
- readonly CORE: "CORE";
19
- readonly TREASURY: "TREASURY";
20
- readonly FRONTIER: "FRONTIER";
21
- };
22
- type YieldType = (typeof YieldType)[keyof typeof YieldType];
23
-
24
- /**
25
- * Type definitions for Amplify SDK API integration
26
- *
27
- * These types define the data structures returned by the Earn SDK backend API
28
- * and internal cache structures used by the SDK.
29
- *
30
- * @module types/amplify-sdk-api
31
- */
32
-
33
- /**
34
- * Vault smart contract configuration
35
- *
36
- * Contains all contract addresses required for vault operations:
37
- * - boringVaultAddress: Main vault contract
38
- * - tellerAddress: Handles deposits and withdrawals
39
- * - accountantAddress: Manages accounting logic
40
- * - managerAddress: Controls strategy execution
41
- * - rolesAuthorityAddress: Enforces role-based access
42
- * - baseTokenAddress: Primary deposit token address
43
- * - baseTokenStandIn: Optional stand-in token
44
- * - communityCodeDepositorAddress: Optional community depositor contract
45
- */
46
- interface VaultContracts {
47
- boringVaultAddress: Address;
48
- tellerAddress: Address;
49
- accountantAddress: Address;
50
- managerAddress: Address;
51
- rolesAuthorityAddress: Address;
52
- baseTokenAddress: Address;
53
- baseTokenStandIn?: Address;
54
- communityCodeDepositorAddress?: Address;
55
- withdrawQueueAddress?: Address;
56
- }
57
- /**
58
- * Enterprise customer configuration for compliance features (e.g. KYT).
59
- */
60
- interface EnterpriseConfig {
61
- predicatePolicyId: string | null;
62
- }
63
- /**
64
- * A single depositable/withdrawable asset supported by a vault.
65
- */
66
- interface VaultSupportedAsset {
67
- /** Token contract address */
68
- address: Address;
69
- /** Chain ID where this asset can be deposited/withdrawn (may differ from vault chain for cross-chain vaults) */
70
- chainId?: number;
71
- /** Token symbol (e.g., USDC, USDT) */
72
- symbol: string;
73
- /** Full token name (e.g., USD Coin) */
74
- name: string;
75
- /** Number of decimal places (e.g., 6 for USDC, 18 for DAI) */
76
- decimals: number;
77
- /** CoinGecko token identifier for price lookups */
78
- coinGeckoTokenId?: string;
79
- /** Whether deposits are currently enabled for this vault-asset pair */
80
- depositable?: boolean;
81
- /** Whether withdrawals are currently enabled for this vault-asset pair */
82
- withdrawable?: boolean;
83
- }
84
- /**
85
- * Amplify vault configuration
86
- *
87
- * Represents a single vault with contract addresses, yield type, and supported deposit assets.
88
- * Multiple vaults can share the same baseTokenAddress (different chains/yield types).
89
- * A single vault can support multiple depositable assets.
90
- *
91
- * @example
92
- * ```typescript
93
- * const vault: AmplifyVault = {
94
- * id: "config-eth-core-001",
95
- * chainId: 1,
96
- * yieldType: "CORE",
97
- * vault: {
98
- * boringVaultAddress: "0x8a5Fb0Eb3E1a90AF81C5DFF9f2e5D0e7b8D4E5F6",
99
- * tellerAddress: "0x7B8C9D0E1F2A3B4C5D6E7F8A9B0C1D2E3F4A5B6C",
100
- * accountantAddress: "0x6A7B8C9D0E1F2A3B4C5D6E7F8A9B0C1D2E3F4A5B",
101
- * managerAddress: "0x5A6B7C8D9E0F1A2B3C4D5E6F7A8B9C0D1E2F3A4B",
102
- * rolesAuthorityAddress: "0x4A5B6C7D8E9F0A1B2C3D4E5F6A7B8C9D0E1F2A3B",
103
- * baseTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
104
- * },
105
- * supportedAssets: [
106
- * {
107
- * address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
108
- * symbol: "USDC",
109
- * name: "USD Coin",
110
- * decimals: 6,
111
- * coinGeckoTokenId: "usd-coin"
112
- * }
113
- * ]
114
- * };
115
- * ```
116
- */
117
- interface VaultSLA {
118
- externalWithdrawalQueueDelaySLA: number;
119
- externalAccountantRateUpdateSLA: number;
120
- }
121
- interface AmplifyVault {
122
- /** Unique identifier for the vault configuration */
123
- id: string;
124
- /** Chain ID where the vault is deployed (e.g., 1 for Ethereum) */
125
- chainId: number;
126
- /** Yield strategy type */
127
- yieldType: YieldType;
128
- /** Human-readable vault name */
129
- name: string;
130
- /** Whether the vault is being deprecated */
131
- inDeprecation: boolean;
132
- /** Vault smart contract addresses */
133
- vault: VaultContracts;
134
- /** Enterprise customer configuration (compliance settings, e.g. KYT) */
135
- enterpriseConfig?: EnterpriseConfig;
136
- /** SLA data from VaultSLAs table */
137
- sla?: VaultSLA;
138
- /** Supported deposit assets for this vault */
139
- supportedAssets: VaultSupportedAsset[];
140
- }
141
- /**
142
- * Supported asset (token) metadata
143
- *
144
- * Represents a cryptocurrency token with metadata and chain support.
145
- * Can be correlated with AmplifyVault via the vault's supportedAssets array.
146
- *
147
- * @example
148
- * ```typescript
149
- * const asset: SupportedAsset = {
150
- * address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
151
- * symbol: "USDC",
152
- * name: "USD Coin",
153
- * decimals: 6,
154
- * coinGeckoTokenId: "usd-coin",
155
- * chains: [1, 137, 8453, 42161]
156
- * };
157
- * ```
158
- */
159
- interface SupportedAsset {
160
- /** Token contract address */
161
- address: Address;
162
- /** Token symbol (e.g., USDC, USDT) */
163
- symbol: string;
164
- /** Full token name (e.g., USD Coin) */
165
- name: string;
166
- /** Number of decimal places (e.g., 6 for USDC, 18 for DAI) */
167
- decimals: number;
168
- /** CoinGecko token identifier for price lookups */
169
- coinGeckoTokenId?: string;
170
- /** Array of chain IDs where this token is supported */
171
- chains: number[];
172
- }
173
- /**
174
- * Filter options for vault queries
175
- *
176
- * Used to filter vaults by chain, yield type, or deposit token.
177
- * All filters are optional and can be combined.
178
- *
179
- * @example
180
- * ```typescript
181
- * // Get all CORE vaults on Ethereum
182
- * const options: VaultFilterOptions = {
183
- * chainId: 1,
184
- * yieldType: "CORE"
185
- * };
186
- *
187
- * // Get all vaults accepting USDC
188
- * const usdcOptions: VaultFilterOptions = {
189
- * depositTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
190
- * };
191
- * ```
192
- */
193
- interface VaultFilterOptions {
194
- /** Filter by chain ID */
195
- chainId?: number;
196
- /** Filter by yield type */
197
- yieldType?: YieldType;
198
- /** Filter by deposit token address */
199
- depositTokenAddress?: Address;
200
- /** Filter by withdraw asset address */
201
- withdrawAssetAddress?: Address;
202
- /** Filter by settlement asset address */
203
- settlementAssetAddress?: Address;
204
- }
205
- /**
206
- * Filter options for asset queries
207
- *
208
- * Used to filter supported assets by chain IDs, yield type, address, or symbol.
209
- * All filters are optional and can be combined.
210
- *
211
- * Note: API endpoints only support `chains` and `yieldType` parameters.
212
- * The `address` and `symbol` filters are only applied in cache-layer filtering.
213
- *
214
- * @example
215
- * ```typescript
216
- * // Get all assets supported on Ethereum and Base (API call)
217
- * const options: AssetFilterOptions = {
218
- * chains: [1, 8453]
219
- * };
220
- *
221
- * // Get CORE yield type assets (API call)
222
- * const coreOptions: AssetFilterOptions = {
223
- * yieldType: "CORE"
224
- * };
225
- *
226
- * // Filter by address (cache-only)
227
- * const usdcOptions: AssetFilterOptions = {
228
- * address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
229
- * };
230
- *
231
- * // Filter by symbol (cache-only)
232
- * const symbolOptions: AssetFilterOptions = {
233
- * symbol: "USDC"
234
- * };
235
- * ```
236
- */
237
- interface AssetFilterOptions {
238
- /** Filter by chain IDs (API + cache: assets with these chains in chains array) */
239
- chains?: number[];
240
- /** Filter by yield type (API + cache: CORE, TREASURY, or FRONTIER) */
241
- yieldType?: YieldType;
242
- /** Filter by token address (cache-only: exact address match) */
243
- address?: string;
244
- /** Filter by token symbol (cache-only: exact symbol match) */
245
- symbol?: string;
246
- }
247
- /**
248
- * API error with descriptive messages
249
- *
250
- * Thrown when API requests fail due to network errors, server errors,
251
- * or malformed responses.
252
- *
253
- * @example
254
- * ```typescript
255
- * throw new APIError("Failed to fetch vaults: Network timeout", {
256
- * statusCode: 408,
257
- * endpoint: "/v1/earn-sdk/vaults"
258
- * });
259
- * ```
260
- */
261
- declare class APIError extends Error {
262
- /**
263
- * HTTP status code (if available)
264
- */
265
- statusCode?: number;
266
- /**
267
- * API endpoint that failed
268
- */
269
- endpoint?: string;
270
- /**
271
- * Original error cause
272
- */
273
- cause?: unknown;
274
- constructor(message: string, options?: {
275
- statusCode?: number;
276
- endpoint?: string;
277
- cause?: unknown;
278
- });
279
- }
280
- /**
281
- * Supported asset information for withdrawal
282
- *
283
- * Asset grouped with available vaults that support withdrawal of that asset.
284
- *
285
- * @example
286
- * ```typescript
287
- * const asset: WithdrawSupportedAsset = {
288
- * address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
289
- * symbol: "USDC",
290
- * decimals: 6,
291
- * vaults: [
292
- * { id: "core-usdc-eth", yieldType: "CORE", chainId: 1, vaultId: "..." },
293
- * { id: "core-usdc-boba", yieldType: "CORE", chainId: 288, vaultId: "..." },
294
- * ],
295
- * };
296
- * ```
297
- */
298
- interface WithdrawSupportedAsset {
299
- /** Token contract address */
300
- address: Address;
301
- /** Token symbol (e.g., "USDC", "ETH") */
302
- symbol: string;
303
- /** Number of decimal places for this token */
304
- decimals: number;
305
- /** Array of vaults that support withdrawals of this asset */
306
- vaults: Array<{
307
- id: string;
308
- yieldType: YieldType;
309
- chainId: number;
310
- vaultId: string;
311
- }>;
312
- }
313
-
314
- /**
315
- * Flexible chain ID type that accepts both number and string
316
- */
317
- type ChainId = number | `${number}`;
318
- /**
319
- * Normalizes a ChainId to a number
320
- */
321
- declare function toChainId(value: ChainId): number;
322
- /**
323
- * Gets a chain object from the vault config response
324
- * @param chainId The chain ID to look up
325
- * @param config Optional config object. If not provided, will fetch from API
326
- * @returns Promise<Chain>
327
- */
328
- declare function getChainFromConfig(chainId: number, config?: AmplifyVault[]): Promise<Chain>;
329
- /**
330
- * Clears the chains cache
331
- */
332
- declare function clearChainsCache(): void;
333
-
334
- export { type AmplifyVault as A, type ChainId as C, type EnterpriseConfig as E, type SupportedAsset as S, type VaultFilterOptions as V, type WithdrawSupportedAsset as W, YieldType as Y, type AssetFilterOptions as a, APIError as b, clearChainsCache as c, type VaultSLA as d, type VaultSupportedAsset as e, getChainFromConfig as g, toChainId as t };