@paxoslabs/amplify-sdk 0.4.2 → 0.4.3-alpha.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 (52) hide show
  1. package/CHANGELOG.md +79 -64
  2. package/dist/{chain-utils-CRMbWzu7.d.mts → chain-utils-CbVFMjwR.d.mts} +13 -1
  3. package/dist/{chain-utils-CRMbWzu7.d.ts → chain-utils-CbVFMjwR.d.ts} +13 -1
  4. package/dist/{chunk-5CV25BTQ.js → chunk-4OEL42W2.mjs} +83 -4
  5. package/dist/chunk-4OEL42W2.mjs.map +1 -0
  6. package/dist/{chunk-RW7PZETN.mjs → chunk-7RAFG3NI.mjs} +167 -228
  7. package/dist/chunk-7RAFG3NI.mjs.map +1 -0
  8. package/dist/{chunk-CQZCGPZK.mjs → chunk-E2HBXOZY.js} +92 -3
  9. package/dist/chunk-E2HBXOZY.js.map +1 -0
  10. package/dist/{chunk-WZXCJAKM.js → chunk-EHRZFLWL.js} +12 -12
  11. package/dist/{chunk-WZXCJAKM.js.map → chunk-EHRZFLWL.js.map} +1 -1
  12. package/dist/{chunk-GMMBJB4B.mjs → chunk-GSYGURYO.mjs} +71 -46
  13. package/dist/chunk-GSYGURYO.mjs.map +1 -0
  14. package/dist/{chunk-VZED4E3L.mjs → chunk-HBFBGNRH.mjs} +3 -3
  15. package/dist/{chunk-VZED4E3L.mjs.map → chunk-HBFBGNRH.mjs.map} +1 -1
  16. package/dist/{chunk-TPU2HZAX.mjs → chunk-L3X5UBG6.mjs} +86 -169
  17. package/dist/chunk-L3X5UBG6.mjs.map +1 -0
  18. package/dist/{chunk-BQG3XKTU.js → chunk-R5G6F7RP.js} +168 -227
  19. package/dist/chunk-R5G6F7RP.js.map +1 -0
  20. package/dist/{chunk-OZJNKGW6.js → chunk-WHL5LQRP.js} +120 -95
  21. package/dist/chunk-WHL5LQRP.js.map +1 -0
  22. package/dist/{chunk-2YPKHXFJ.js → chunk-ZJBJFFBQ.js} +180 -263
  23. package/dist/chunk-ZJBJFFBQ.js.map +1 -0
  24. package/dist/core.d.mts +2 -2
  25. package/dist/core.d.ts +2 -2
  26. package/dist/core.js +16 -16
  27. package/dist/core.mjs +4 -4
  28. package/dist/display.d.mts +23 -11
  29. package/dist/display.d.ts +23 -11
  30. package/dist/display.js +10 -10
  31. package/dist/display.mjs +4 -4
  32. package/dist/index.d.mts +107 -7
  33. package/dist/index.d.ts +107 -7
  34. package/dist/index.js +75 -51
  35. package/dist/index.mjs +5 -5
  36. package/dist/utils.d.mts +1 -1
  37. package/dist/utils.d.ts +1 -1
  38. package/dist/utils.js +7 -7
  39. package/dist/utils.mjs +2 -2
  40. package/dist/vaults.d.mts +107 -94
  41. package/dist/vaults.d.ts +107 -94
  42. package/dist/vaults.js +25 -25
  43. package/dist/vaults.mjs +4 -4
  44. package/package.json +18 -11
  45. package/dist/chunk-2YPKHXFJ.js.map +0 -1
  46. package/dist/chunk-5CV25BTQ.js.map +0 -1
  47. package/dist/chunk-BQG3XKTU.js.map +0 -1
  48. package/dist/chunk-CQZCGPZK.mjs.map +0 -1
  49. package/dist/chunk-GMMBJB4B.mjs.map +0 -1
  50. package/dist/chunk-OZJNKGW6.js.map +0 -1
  51. package/dist/chunk-RW7PZETN.mjs.map +0 -1
  52. package/dist/chunk-TPU2HZAX.mjs.map +0 -1
package/dist/display.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Address } from 'viem';
2
- import { Y as YieldType, C as ChainId } from './chain-utils-CRMbWzu7.js';
2
+ import { C as ChainId } from './chain-utils-CbVFMjwR.js';
3
3
  import 'viem/chains';
4
4
 
5
5
  /**
@@ -33,6 +33,7 @@ interface GetWithdrawalRequestsParams {
33
33
  userAddress: Address;
34
34
  chainId?: number;
35
35
  vaultAddress?: Address;
36
+ vaultName?: string;
36
37
  status?: WithdrawalRequestStatus;
37
38
  pageSize?: number;
38
39
  pageToken?: string;
@@ -44,8 +45,11 @@ interface WithdrawalRequestsResult {
44
45
  }
45
46
  /** Parameters for getWithdrawalFee */
46
47
  interface GetWithdrawalFeeParams {
47
- yieldType: YieldType;
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. */
48
51
  chainId: ChainId;
52
+ /** Token contract address used to validate the vault (should match the vault's supported asset) */
49
53
  assetAddress: Address;
50
54
  amount: string;
51
55
  offerAsset: Address;
@@ -59,8 +63,11 @@ interface WithdrawalFeeResult {
59
63
  }
60
64
  /** Parameters for getMinimumWithdrawalOrderSize */
61
65
  interface GetMinimumWithdrawalOrderSizeParams {
62
- yieldType: YieldType;
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. */
63
69
  chainId: ChainId;
70
+ /** Token contract address used to validate the vault (should match the vault's supported asset) */
64
71
  assetAddress: Address;
65
72
  }
66
73
  /** Return type for getMinimumWithdrawalOrderSize */
@@ -70,8 +77,11 @@ interface MinimumWithdrawalOrderSizeResult {
70
77
  }
71
78
  /** Parameters for getMinimumMint */
72
79
  interface GetMinimumMintParams {
73
- yieldType: YieldType;
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. */
74
83
  chainId: ChainId;
84
+ /** Token contract address to deposit. Must match the vault's supported asset. */
75
85
  depositAssetAddress: Address;
76
86
  depositAmount: string;
77
87
  }
@@ -84,7 +94,8 @@ interface MinimumMintResult {
84
94
  }
85
95
  /** Parameters for getVaultAPY */
86
96
  interface GetVaultAPYParams {
87
- vaultAddress: Address;
97
+ vaultAddress?: Address;
98
+ vaultName?: string;
88
99
  chainId?: number;
89
100
  }
90
101
  /** Return type for getVaultAPY */
@@ -96,7 +107,8 @@ interface VaultAPYResult {
96
107
  }
97
108
  /** Parameters for getVaultTVL */
98
109
  interface GetVaultTVLParams {
99
- vaultAddress: Address;
110
+ vaultAddress?: Address;
111
+ vaultName?: string;
100
112
  chainId?: number;
101
113
  }
102
114
  /** Return type for getVaultTVL */
@@ -126,7 +138,7 @@ interface VaultTVLResult {
126
138
  * @example
127
139
  * ```typescript
128
140
  * const result = await getMinimumMint({
129
- * yieldType: "CORE",
141
+ * vaultName: "Amplify USDC Core",
130
142
  * chainId: 1,
131
143
  * depositAssetAddress: "0xA0b8...", // USDC
132
144
  * depositAmount: "1000.0",
@@ -147,7 +159,7 @@ declare function getMinimumMint(params: GetMinimumMintParams): Promise<MinimumMi
147
159
  * Requests the most recent APY data point by using
148
160
  * orderByTimestamp=desc with pageSize=1.
149
161
  *
150
- * @param params - Vault identifier parameters
162
+ * @param params - Vault identifier parameters (vaultAddress, vaultName, or both)
151
163
  * @returns Latest APY value and metadata
152
164
  * @throws {APIError} If the API request fails or no data found
153
165
  *
@@ -166,7 +178,7 @@ declare function getVaultAPY(params: GetVaultAPYParams): Promise<VaultAPYResult>
166
178
  * Requests the most recent TVL data point by using
167
179
  * includeCurrent=true, orderByTimestamp=desc with pageSize=1.
168
180
  *
169
- * @param params - Vault identifier parameters
181
+ * @param params - Vault identifier parameters (vaultAddress, vaultName, or both)
170
182
  * @returns Current TVL value and metadata
171
183
  * @throws {APIError} If the API request fails or no data found
172
184
  *
@@ -217,7 +229,7 @@ declare function getWithdrawalRequests(params: GetWithdrawalRequestsParams): Pro
217
229
  * @example
218
230
  * ```typescript
219
231
  * const fee = await getWithdrawalFee({
220
- * yieldType: "CORE",
232
+ * vaultName: "Amplify USDC Core",
221
233
  * chainId: 1,
222
234
  * assetAddress: "0xA0b8...", // USDC
223
235
  * amount: "1.0",
@@ -239,7 +251,7 @@ declare function getWithdrawalFee(params: GetWithdrawalFeeParams): Promise<Withd
239
251
  * @example
240
252
  * ```typescript
241
253
  * const result = await getMinimumWithdrawalOrderSize({
242
- * yieldType: "CORE",
254
+ * vaultName: "Amplify USDC Core",
243
255
  * chainId: 1,
244
256
  * assetAddress: "0xA0b8...",
245
257
  * });
package/dist/display.js CHANGED
@@ -1,36 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var chunkOZJNKGW6_js = require('./chunk-OZJNKGW6.js');
4
- require('./chunk-5CV25BTQ.js');
5
- require('./chunk-WZXCJAKM.js');
3
+ var chunkWHL5LQRP_js = require('./chunk-WHL5LQRP.js');
4
+ require('./chunk-E2HBXOZY.js');
5
+ require('./chunk-EHRZFLWL.js');
6
6
  require('./chunk-3I3PYX2F.js');
7
- require('./chunk-BQG3XKTU.js');
7
+ require('./chunk-R5G6F7RP.js');
8
8
 
9
9
 
10
10
 
11
11
  Object.defineProperty(exports, "getMinimumMint", {
12
12
  enumerable: true,
13
- get: function () { return chunkOZJNKGW6_js.getMinimumMint; }
13
+ get: function () { return chunkWHL5LQRP_js.getMinimumMint; }
14
14
  });
15
15
  Object.defineProperty(exports, "getMinimumWithdrawalOrderSize", {
16
16
  enumerable: true,
17
- get: function () { return chunkOZJNKGW6_js.getMinimumWithdrawalOrderSize; }
17
+ get: function () { return chunkWHL5LQRP_js.getMinimumWithdrawalOrderSize; }
18
18
  });
19
19
  Object.defineProperty(exports, "getVaultAPY", {
20
20
  enumerable: true,
21
- get: function () { return chunkOZJNKGW6_js.getVaultAPY; }
21
+ get: function () { return chunkWHL5LQRP_js.getVaultAPY; }
22
22
  });
23
23
  Object.defineProperty(exports, "getVaultTVL", {
24
24
  enumerable: true,
25
- get: function () { return chunkOZJNKGW6_js.getVaultTVL; }
25
+ get: function () { return chunkWHL5LQRP_js.getVaultTVL; }
26
26
  });
27
27
  Object.defineProperty(exports, "getWithdrawalFee", {
28
28
  enumerable: true,
29
- get: function () { return chunkOZJNKGW6_js.getWithdrawalFee; }
29
+ get: function () { return chunkWHL5LQRP_js.getWithdrawalFee; }
30
30
  });
31
31
  Object.defineProperty(exports, "getWithdrawalRequests", {
32
32
  enumerable: true,
33
- get: function () { return chunkOZJNKGW6_js.getWithdrawalRequests; }
33
+ get: function () { return chunkWHL5LQRP_js.getWithdrawalRequests; }
34
34
  });
35
35
  //# sourceMappingURL=display.js.map
36
36
  //# sourceMappingURL=display.js.map
package/dist/display.mjs CHANGED
@@ -1,7 +1,7 @@
1
- export { getMinimumMint, getMinimumWithdrawalOrderSize, getVaultAPY, getVaultTVL, getWithdrawalFee, getWithdrawalRequests } from './chunk-GMMBJB4B.mjs';
2
- import './chunk-CQZCGPZK.mjs';
3
- import './chunk-VZED4E3L.mjs';
1
+ export { getMinimumMint, getMinimumWithdrawalOrderSize, getVaultAPY, getVaultTVL, getWithdrawalFee, getWithdrawalRequests } from './chunk-GSYGURYO.mjs';
2
+ import './chunk-4OEL42W2.mjs';
3
+ import './chunk-HBFBGNRH.mjs';
4
4
  import './chunk-7RWWVUHP.mjs';
5
- import './chunk-RW7PZETN.mjs';
5
+ import './chunk-7RAFG3NI.mjs';
6
6
  //# sourceMappingURL=display.mjs.map
7
7
  //# sourceMappingURL=display.mjs.map
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { GetMinimumMintParams, GetMinimumWithdrawalOrderSizeParams, GetVaultAPYParams, GetVaultTVLParams, GetWithdrawalFeeParams, GetWithdrawalRequestsParams, MinimumMintResult, MinimumWithdrawalOrderSizeResult, VaultAPYResult, VaultTVLResult, WithdrawalFeeResult, WithdrawalRequest, WithdrawalRequestStatus, WithdrawalRequestsResult, getMinimumMint, getMinimumWithdrawalOrderSize, getVaultAPY, getVaultTVL, getWithdrawalFee, getWithdrawalRequests } from './display.mjs';
2
2
  import { Address } from 'viem';
3
- import { A as AmplifyVault, S as SupportedAsset, a as AssetFilterOptions, V as VaultFilterOptions, W as WithdrawSupportedAsset, Y as YieldType, C as ChainId } from './chain-utils-CRMbWzu7.mjs';
4
- export { b as APIError } from './chain-utils-CRMbWzu7.mjs';
3
+ import { A as AmplifyVault, S as SupportedAsset, Y as YieldType, a as AssetFilterOptions, V as VaultFilterOptions, W as WithdrawSupportedAsset, C as ChainId } from './chain-utils-CbVFMjwR.mjs';
4
+ export { b as APIError, d as VaultSLA } from './chain-utils-CbVFMjwR.mjs';
5
5
  export { AlreadyApprovedAuthorizationResult, ApprovalAuthorizationResult, ApproveDepositTokenTxData, ApproveWithdrawOrderTxData, CancelWithdrawOrderTxData, DepositAuthMethod, DepositAuthorizationResult, DepositTxData, EIP712Domain, PERMIT_TYPES, ParsedPermitSignature, PermitAuthorizationResult, PermitDepositResult, PermitSignatureData, PrepareCancelWithdrawOrderTxDataParams, PrepareDepositAuthorizationParams, PrepareDepositParams, PrepareDepositPermitSignatureParams, PrepareDepositResult, PrepareDepositWithPermitTxDataParams, PrepareWithdrawOrderTxDataParams, PrepareWithdrawalAuthorizationParams, PrepareWithdrawalParams, PrepareWithdrawalResult, StandardDepositResult, UnencodedDepositWithPermitData, WithdrawAlreadyApprovedAuthorizationResult, WithdrawApprovalAuthorizationResult, WithdrawAuthMethod, WithdrawAuthorizationResult, WithdrawOrderTxData, isAlreadyApprovedAuth, isApprovalAuth, isPermitAuth, isWithdrawAlreadyApprovedAuth, isWithdrawApprovalAuth, parsePermitSignature, prepareApproveDepositTokenTxData, prepareApproveWithdrawOrderTxData, prepareCancelWithdrawOrderTxData, prepareDeposit, prepareDepositAuthorization, prepareDepositPermitSignature, prepareDepositTxData, prepareDepositWithPermitTxData, prepareWithdrawOrderTxData, prepareWithdrawal, prepareWithdrawalAuthorization, toEthSignTypedDataV4 } from './vaults.mjs';
6
6
  import 'viem/chains';
7
7
 
@@ -54,6 +54,14 @@ declare class VaultCache {
54
54
  * Assets keyed by token address
55
55
  */
56
56
  private assets;
57
+ /**
58
+ * Vaults keyed by boringVaultAddress (lowercase, for case-insensitive lookup)
59
+ */
60
+ private vaultsByAddress;
61
+ /**
62
+ * Vaults keyed by vault name (lowercase, for case-insensitive lookup)
63
+ */
64
+ private vaultsByName;
57
65
  /**
58
66
  * Unix timestamp (milliseconds) of last successful fetch
59
67
  */
@@ -83,6 +91,16 @@ declare class VaultCache {
83
91
  * @returns Array of AmplifyVault objects, or undefined if not found
84
92
  */
85
93
  getVault(tokenAddress: string): AmplifyVault[] | undefined;
94
+ /**
95
+ * Gets a vault by its boringVaultAddress (on-chain vault contract).
96
+ * Case-insensitive lookup.
97
+ */
98
+ getVaultByAddress(address: string): AmplifyVault | undefined;
99
+ /**
100
+ * Gets a vault by its human-readable name.
101
+ * Case-insensitive lookup.
102
+ */
103
+ getVaultByName(name: string): AmplifyVault | undefined;
86
104
  /**
87
105
  * Gets asset by token address
88
106
  *
@@ -344,6 +362,24 @@ declare function findVaultByConfig(params: {
344
362
  yieldType: string;
345
363
  chainId: number;
346
364
  }): Promise<AmplifyVault | null>;
365
+ /**
366
+ * Filter options for getVaultsByConfig
367
+ */
368
+ interface GetVaultsByConfigParams {
369
+ yieldType?: YieldType;
370
+ chainId?: number;
371
+ depositAssetAddress?: Address;
372
+ withdrawAssetAddress?: Address;
373
+ settlementAssetAddress?: Address;
374
+ }
375
+ /**
376
+ * Returns vaults matching the provided configuration filters.
377
+ *
378
+ * Results are automatically scoped to the organization associated with
379
+ * the API key the SDK was initialized with (enterprise filtering is
380
+ * handled server-side by the amplifySdkConfigs resolver).
381
+ */
382
+ declare function getVaultsByConfig(params?: GetVaultsByConfigParams): Promise<AmplifyVault[]>;
347
383
  /**
348
384
  * Gets supported assets grouped by token with available vaults
349
385
  *
@@ -724,8 +760,59 @@ declare function waitForCacheReady(): Promise<void>;
724
760
  */
725
761
  declare function initAmplifySDK(apiKey: string, options?: SDKInitOptions): Promise<void>;
726
762
 
727
- declare const isDepositSpendApproved: ({ yieldType, chainId, depositAssetAddress, recipientAddress, }: {
728
- yieldType: YieldType;
763
+ /**
764
+ * Withdraw operation error types
765
+ *
766
+ * Defines all error classes and error scenarios specific to the withdraw flow.
767
+ * Provides type-safe error handling with clear error messages for different failure modes.
768
+ *
769
+ * @module types/withdraw-errors
770
+ */
771
+ /**
772
+ * Base class for all withdraw-related errors
773
+ *
774
+ * Extends Error with additional context information for better error handling
775
+ * and debugging in consuming applications.
776
+ */
777
+ declare class WithdrawError extends Error {
778
+ /**
779
+ * Error code for programmatic handling
780
+ * @example "VAULT_NOT_FOUND", "INVALID_ADDRESS", "INSUFFICIENT_BALANCE"
781
+ */
782
+ readonly code: string;
783
+ /**
784
+ * Additional context data for debugging
785
+ */
786
+ readonly context?: Record<string, unknown>;
787
+ constructor(message: string, code: string, context?: Record<string, unknown>);
788
+ }
789
+ declare class VaultNotFoundByAddressError extends WithdrawError {
790
+ constructor(message: string, context?: Record<string, unknown>);
791
+ }
792
+ declare class VaultNotFoundByNameError extends WithdrawError {
793
+ constructor(message: string, context?: Record<string, unknown>);
794
+ }
795
+ declare class UnauthorizedVaultAccessError extends WithdrawError {
796
+ constructor(message: string, context?: Record<string, unknown>);
797
+ }
798
+ declare function isVaultNotFoundByAddressError(error: unknown): error is VaultNotFoundByAddressError;
799
+ declare function isVaultNotFoundByNameError(error: unknown): error is VaultNotFoundByNameError;
800
+
801
+ /**
802
+ * Checks whether a deposit spend has been approved for the CommunityCodeDepositor contract.
803
+ *
804
+ * Resolves the vault by `vaultName` + `chainId` + `depositAssetAddress`, then reads the
805
+ * current ERC20 allowance and permit support via a single multicall.
806
+ *
807
+ * @param vaultName - Human-readable vault name
808
+ * @param chainId - Chain ID where the vault is deployed
809
+ * @param depositAssetAddress - Token contract address being deposited
810
+ * @param recipientAddress - Wallet address that owns the tokens (permit owner / approval sender)
811
+ * @returns Allowance, permit support info, and token metadata
812
+ * @throws {APIError} If vault not found, chain/asset mismatch, or contract read fails
813
+ */
814
+ declare const isDepositSpendApproved: ({ vaultName, chainId, depositAssetAddress, recipientAddress, }: {
815
+ vaultName: string;
729
816
  chainId: ChainId;
730
817
  depositAssetAddress: Address;
731
818
  recipientAddress: Address;
@@ -741,8 +828,21 @@ declare const isDepositSpendApproved: ({ yieldType, chainId, depositAssetAddress
741
828
  tokenVersion: string;
742
829
  error: null;
743
830
  }>;
744
- declare const isWithdrawalSpendApproved: ({ yieldType, chainId, wantAssetAddress, recipientAddress, }: {
745
- yieldType: YieldType;
831
+ /**
832
+ * Checks whether a withdrawal spend has been approved for the WithdrawQueue contract.
833
+ *
834
+ * Resolves the vault by `vaultName` + `chainId` + `wantAssetAddress`, then reads the
835
+ * current vault-share allowance via a multicall.
836
+ *
837
+ * @param vaultName - Human-readable vault name
838
+ * @param chainId - Chain ID where the vault is deployed
839
+ * @param wantAssetAddress - Token contract address the user wants to receive upon withdrawal
840
+ * @param recipientAddress - Wallet address that owns the vault shares
841
+ * @returns Allowance info
842
+ * @throws {APIError} If vault not found, chain/asset mismatch, or contract read fails
843
+ */
844
+ declare const isWithdrawalSpendApproved: ({ vaultName, chainId, wantAssetAddress, recipientAddress, }: {
845
+ vaultName: string;
746
846
  chainId: ChainId;
747
847
  wantAssetAddress: Address;
748
848
  recipientAddress: Address;
@@ -760,4 +860,4 @@ declare const isWithdrawalSpendApproved: ({ yieldType, chainId, wantAssetAddress
760
860
  error: null;
761
861
  }>;
762
862
 
763
- export { AmplifyVault, AssetFilterOptions, type InitErrorCode, LogLevel, type Logger, type RequestHeaders, type SDKConfig, type SDKInitOptions, SupportedAsset, VaultFilterOptions, WithdrawSupportedAsset, YieldType, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getLogger, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, isCacheReady, isDepositSpendApproved, isWithdrawalSpendApproved, refreshVaultCache, setLogLevel, setLogger, waitForCacheReady };
863
+ export { AmplifyVault, AssetFilterOptions, type GetVaultsByConfigParams, type InitErrorCode, LogLevel, type Logger, type RequestHeaders, type SDKConfig, type SDKInitOptions, SupportedAsset, UnauthorizedVaultAccessError, VaultFilterOptions, VaultNotFoundByAddressError, VaultNotFoundByNameError, WithdrawSupportedAsset, YieldType, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getLogger, getVaultsByConfig, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, isCacheReady, isDepositSpendApproved, isVaultNotFoundByAddressError, isVaultNotFoundByNameError, isWithdrawalSpendApproved, refreshVaultCache, setLogLevel, setLogger, waitForCacheReady };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { GetMinimumMintParams, GetMinimumWithdrawalOrderSizeParams, GetVaultAPYParams, GetVaultTVLParams, GetWithdrawalFeeParams, GetWithdrawalRequestsParams, MinimumMintResult, MinimumWithdrawalOrderSizeResult, VaultAPYResult, VaultTVLResult, WithdrawalFeeResult, WithdrawalRequest, WithdrawalRequestStatus, WithdrawalRequestsResult, getMinimumMint, getMinimumWithdrawalOrderSize, getVaultAPY, getVaultTVL, getWithdrawalFee, getWithdrawalRequests } from './display.js';
2
2
  import { Address } from 'viem';
3
- import { A as AmplifyVault, S as SupportedAsset, a as AssetFilterOptions, V as VaultFilterOptions, W as WithdrawSupportedAsset, Y as YieldType, C as ChainId } from './chain-utils-CRMbWzu7.js';
4
- export { b as APIError } from './chain-utils-CRMbWzu7.js';
3
+ import { A as AmplifyVault, S as SupportedAsset, Y as YieldType, a as AssetFilterOptions, V as VaultFilterOptions, W as WithdrawSupportedAsset, C as ChainId } from './chain-utils-CbVFMjwR.js';
4
+ export { b as APIError, d as VaultSLA } from './chain-utils-CbVFMjwR.js';
5
5
  export { AlreadyApprovedAuthorizationResult, ApprovalAuthorizationResult, ApproveDepositTokenTxData, ApproveWithdrawOrderTxData, CancelWithdrawOrderTxData, DepositAuthMethod, DepositAuthorizationResult, DepositTxData, EIP712Domain, PERMIT_TYPES, ParsedPermitSignature, PermitAuthorizationResult, PermitDepositResult, PermitSignatureData, PrepareCancelWithdrawOrderTxDataParams, PrepareDepositAuthorizationParams, PrepareDepositParams, PrepareDepositPermitSignatureParams, PrepareDepositResult, PrepareDepositWithPermitTxDataParams, PrepareWithdrawOrderTxDataParams, PrepareWithdrawalAuthorizationParams, PrepareWithdrawalParams, PrepareWithdrawalResult, StandardDepositResult, UnencodedDepositWithPermitData, WithdrawAlreadyApprovedAuthorizationResult, WithdrawApprovalAuthorizationResult, WithdrawAuthMethod, WithdrawAuthorizationResult, WithdrawOrderTxData, isAlreadyApprovedAuth, isApprovalAuth, isPermitAuth, isWithdrawAlreadyApprovedAuth, isWithdrawApprovalAuth, parsePermitSignature, prepareApproveDepositTokenTxData, prepareApproveWithdrawOrderTxData, prepareCancelWithdrawOrderTxData, prepareDeposit, prepareDepositAuthorization, prepareDepositPermitSignature, prepareDepositTxData, prepareDepositWithPermitTxData, prepareWithdrawOrderTxData, prepareWithdrawal, prepareWithdrawalAuthorization, toEthSignTypedDataV4 } from './vaults.js';
6
6
  import 'viem/chains';
7
7
 
@@ -54,6 +54,14 @@ declare class VaultCache {
54
54
  * Assets keyed by token address
55
55
  */
56
56
  private assets;
57
+ /**
58
+ * Vaults keyed by boringVaultAddress (lowercase, for case-insensitive lookup)
59
+ */
60
+ private vaultsByAddress;
61
+ /**
62
+ * Vaults keyed by vault name (lowercase, for case-insensitive lookup)
63
+ */
64
+ private vaultsByName;
57
65
  /**
58
66
  * Unix timestamp (milliseconds) of last successful fetch
59
67
  */
@@ -83,6 +91,16 @@ declare class VaultCache {
83
91
  * @returns Array of AmplifyVault objects, or undefined if not found
84
92
  */
85
93
  getVault(tokenAddress: string): AmplifyVault[] | undefined;
94
+ /**
95
+ * Gets a vault by its boringVaultAddress (on-chain vault contract).
96
+ * Case-insensitive lookup.
97
+ */
98
+ getVaultByAddress(address: string): AmplifyVault | undefined;
99
+ /**
100
+ * Gets a vault by its human-readable name.
101
+ * Case-insensitive lookup.
102
+ */
103
+ getVaultByName(name: string): AmplifyVault | undefined;
86
104
  /**
87
105
  * Gets asset by token address
88
106
  *
@@ -344,6 +362,24 @@ declare function findVaultByConfig(params: {
344
362
  yieldType: string;
345
363
  chainId: number;
346
364
  }): Promise<AmplifyVault | null>;
365
+ /**
366
+ * Filter options for getVaultsByConfig
367
+ */
368
+ interface GetVaultsByConfigParams {
369
+ yieldType?: YieldType;
370
+ chainId?: number;
371
+ depositAssetAddress?: Address;
372
+ withdrawAssetAddress?: Address;
373
+ settlementAssetAddress?: Address;
374
+ }
375
+ /**
376
+ * Returns vaults matching the provided configuration filters.
377
+ *
378
+ * Results are automatically scoped to the organization associated with
379
+ * the API key the SDK was initialized with (enterprise filtering is
380
+ * handled server-side by the amplifySdkConfigs resolver).
381
+ */
382
+ declare function getVaultsByConfig(params?: GetVaultsByConfigParams): Promise<AmplifyVault[]>;
347
383
  /**
348
384
  * Gets supported assets grouped by token with available vaults
349
385
  *
@@ -724,8 +760,59 @@ declare function waitForCacheReady(): Promise<void>;
724
760
  */
725
761
  declare function initAmplifySDK(apiKey: string, options?: SDKInitOptions): Promise<void>;
726
762
 
727
- declare const isDepositSpendApproved: ({ yieldType, chainId, depositAssetAddress, recipientAddress, }: {
728
- yieldType: YieldType;
763
+ /**
764
+ * Withdraw operation error types
765
+ *
766
+ * Defines all error classes and error scenarios specific to the withdraw flow.
767
+ * Provides type-safe error handling with clear error messages for different failure modes.
768
+ *
769
+ * @module types/withdraw-errors
770
+ */
771
+ /**
772
+ * Base class for all withdraw-related errors
773
+ *
774
+ * Extends Error with additional context information for better error handling
775
+ * and debugging in consuming applications.
776
+ */
777
+ declare class WithdrawError extends Error {
778
+ /**
779
+ * Error code for programmatic handling
780
+ * @example "VAULT_NOT_FOUND", "INVALID_ADDRESS", "INSUFFICIENT_BALANCE"
781
+ */
782
+ readonly code: string;
783
+ /**
784
+ * Additional context data for debugging
785
+ */
786
+ readonly context?: Record<string, unknown>;
787
+ constructor(message: string, code: string, context?: Record<string, unknown>);
788
+ }
789
+ declare class VaultNotFoundByAddressError extends WithdrawError {
790
+ constructor(message: string, context?: Record<string, unknown>);
791
+ }
792
+ declare class VaultNotFoundByNameError extends WithdrawError {
793
+ constructor(message: string, context?: Record<string, unknown>);
794
+ }
795
+ declare class UnauthorizedVaultAccessError extends WithdrawError {
796
+ constructor(message: string, context?: Record<string, unknown>);
797
+ }
798
+ declare function isVaultNotFoundByAddressError(error: unknown): error is VaultNotFoundByAddressError;
799
+ declare function isVaultNotFoundByNameError(error: unknown): error is VaultNotFoundByNameError;
800
+
801
+ /**
802
+ * Checks whether a deposit spend has been approved for the CommunityCodeDepositor contract.
803
+ *
804
+ * Resolves the vault by `vaultName` + `chainId` + `depositAssetAddress`, then reads the
805
+ * current ERC20 allowance and permit support via a single multicall.
806
+ *
807
+ * @param vaultName - Human-readable vault name
808
+ * @param chainId - Chain ID where the vault is deployed
809
+ * @param depositAssetAddress - Token contract address being deposited
810
+ * @param recipientAddress - Wallet address that owns the tokens (permit owner / approval sender)
811
+ * @returns Allowance, permit support info, and token metadata
812
+ * @throws {APIError} If vault not found, chain/asset mismatch, or contract read fails
813
+ */
814
+ declare const isDepositSpendApproved: ({ vaultName, chainId, depositAssetAddress, recipientAddress, }: {
815
+ vaultName: string;
729
816
  chainId: ChainId;
730
817
  depositAssetAddress: Address;
731
818
  recipientAddress: Address;
@@ -741,8 +828,21 @@ declare const isDepositSpendApproved: ({ yieldType, chainId, depositAssetAddress
741
828
  tokenVersion: string;
742
829
  error: null;
743
830
  }>;
744
- declare const isWithdrawalSpendApproved: ({ yieldType, chainId, wantAssetAddress, recipientAddress, }: {
745
- yieldType: YieldType;
831
+ /**
832
+ * Checks whether a withdrawal spend has been approved for the WithdrawQueue contract.
833
+ *
834
+ * Resolves the vault by `vaultName` + `chainId` + `wantAssetAddress`, then reads the
835
+ * current vault-share allowance via a multicall.
836
+ *
837
+ * @param vaultName - Human-readable vault name
838
+ * @param chainId - Chain ID where the vault is deployed
839
+ * @param wantAssetAddress - Token contract address the user wants to receive upon withdrawal
840
+ * @param recipientAddress - Wallet address that owns the vault shares
841
+ * @returns Allowance info
842
+ * @throws {APIError} If vault not found, chain/asset mismatch, or contract read fails
843
+ */
844
+ declare const isWithdrawalSpendApproved: ({ vaultName, chainId, wantAssetAddress, recipientAddress, }: {
845
+ vaultName: string;
746
846
  chainId: ChainId;
747
847
  wantAssetAddress: Address;
748
848
  recipientAddress: Address;
@@ -760,4 +860,4 @@ declare const isWithdrawalSpendApproved: ({ yieldType, chainId, wantAssetAddress
760
860
  error: null;
761
861
  }>;
762
862
 
763
- export { AmplifyVault, AssetFilterOptions, type InitErrorCode, LogLevel, type Logger, type RequestHeaders, type SDKConfig, type SDKInitOptions, SupportedAsset, VaultFilterOptions, WithdrawSupportedAsset, YieldType, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getLogger, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, isCacheReady, isDepositSpendApproved, isWithdrawalSpendApproved, refreshVaultCache, setLogLevel, setLogger, waitForCacheReady };
863
+ export { AmplifyVault, AssetFilterOptions, type GetVaultsByConfigParams, type InitErrorCode, LogLevel, type Logger, type RequestHeaders, type SDKConfig, type SDKInitOptions, SupportedAsset, UnauthorizedVaultAccessError, VaultFilterOptions, VaultNotFoundByAddressError, VaultNotFoundByNameError, WithdrawSupportedAsset, YieldType, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getLogger, getVaultsByConfig, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, isCacheReady, isDepositSpendApproved, isVaultNotFoundByAddressError, isVaultNotFoundByNameError, isWithdrawalSpendApproved, refreshVaultCache, setLogLevel, setLogger, waitForCacheReady };