@paxoslabs/amplify-sdk 0.4.3-alpha.0 → 0.5.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.
- package/CHANGELOG.md +36 -0
- package/dist/{chain-utils-CbVFMjwR.d.mts → chain-utils-CpOJcWig.d.mts} +36 -29
- package/dist/{chain-utils-CbVFMjwR.d.ts → chain-utils-CpOJcWig.d.ts} +36 -29
- package/dist/{chunk-R5G6F7RP.js → chunk-2ZJWWK6D.js} +96 -51
- package/dist/chunk-2ZJWWK6D.js.map +1 -0
- package/dist/{chunk-L3X5UBG6.mjs → chunk-B5BII2XH.mjs} +8 -8
- package/dist/{chunk-L3X5UBG6.mjs.map → chunk-B5BII2XH.mjs.map} +1 -1
- package/dist/{chunk-EHRZFLWL.js → chunk-D7EMZAOQ.js} +12 -12
- package/dist/{chunk-EHRZFLWL.js.map → chunk-D7EMZAOQ.js.map} +1 -1
- package/dist/{chunk-GSYGURYO.mjs → chunk-GJPTAY5T.mjs} +5 -5
- package/dist/{chunk-GSYGURYO.mjs.map → chunk-GJPTAY5T.mjs.map} +1 -1
- package/dist/{chunk-ZJBJFFBQ.js → chunk-KTLGSVD6.js} +111 -111
- package/dist/{chunk-ZJBJFFBQ.js.map → chunk-KTLGSVD6.js.map} +1 -1
- package/dist/{chunk-7RAFG3NI.mjs → chunk-MPCRFKSD.mjs} +95 -50
- package/dist/chunk-MPCRFKSD.mjs.map +1 -0
- package/dist/{chunk-WHL5LQRP.js → chunk-N5UKVLSS.js} +62 -62
- package/dist/{chunk-WHL5LQRP.js.map → chunk-N5UKVLSS.js.map} +1 -1
- package/dist/{chunk-HBFBGNRH.mjs → chunk-SXIBMN7X.mjs} +3 -3
- package/dist/{chunk-HBFBGNRH.mjs.map → chunk-SXIBMN7X.mjs.map} +1 -1
- package/dist/{chunk-4OEL42W2.mjs → chunk-XA653JS3.mjs} +9 -5
- package/dist/chunk-XA653JS3.mjs.map +1 -0
- package/dist/{chunk-E2HBXOZY.js → chunk-XS4SELWC.js} +16 -12
- package/dist/chunk-XS4SELWC.js.map +1 -0
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +16 -16
- package/dist/core.mjs +4 -4
- package/dist/display.d.mts +1 -1
- package/dist/display.d.ts +1 -1
- package/dist/display.js +10 -10
- package/dist/display.mjs +4 -4
- package/dist/index.d.mts +21 -20
- package/dist/index.d.ts +21 -20
- package/dist/index.js +63 -63
- package/dist/index.mjs +5 -5
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +7 -7
- package/dist/utils.mjs +2 -2
- package/dist/vaults.d.mts +1 -1
- package/dist/vaults.d.ts +1 -1
- package/dist/vaults.js +25 -25
- package/dist/vaults.mjs +4 -4
- package/package.json +1 -1
- package/dist/chunk-4OEL42W2.mjs.map +0 -1
- package/dist/chunk-7RAFG3NI.mjs.map +0 -1
- package/dist/chunk-E2HBXOZY.js.map +0 -1
- package/dist/chunk-R5G6F7RP.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
<!-- auto-changelog-above -->
|
|
9
9
|
|
|
10
|
+
|
|
11
|
+
## [0.5.0](https://github.com/paxoslabs/paxos-labs-monorepo/compare/v0.4.3-alpha.1...v0.5.0) (2026-03-19)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* Add Amplify SDK config management UI ([ce383ce](https://github.com/paxoslabs/paxos-labs-monorepo/commit/ce383cedcf1e0f7f520a0fa92b6573eb0ad0aa7c))
|
|
16
|
+
* adding initial docs changes for new SDK version and changes ([be45fa6](https://github.com/paxoslabs/paxos-labs-monorepo/commit/be45fa6a6be4013ea4a7c58be40b9b130b3d5e69))
|
|
17
|
+
* integrate TanStack Form with client-side validation and fix shadcn audit issues ([a5ec00c](https://github.com/paxoslabs/paxos-labs-monorepo/commit/a5ec00c5db1b5afb4a4e2b6c5601dbe4ed4ad47f))
|
|
18
|
+
* Parametrize BASE_URL in SDK using env var replaced at build time by tsup ([#41](https://github.com/paxoslabs/paxos-labs-monorepo/issues/41)) ([a20e3a6](https://github.com/paxoslabs/paxos-labs-monorepo/commit/a20e3a69d76c30fef2e7f53d543ab47b323c77c4))
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* address PR review feedback — server errors, select a11y, startBlock validation ([d28669b](https://github.com/paxoslabs/paxos-labs-monorepo/commit/d28669b7d6d45743aef558a93364a45fc975d410))
|
|
23
|
+
* address PR review feedback from CodeRabbit ([1567716](https://github.com/paxoslabs/paxos-labs-monorepo/commit/156771673510fa3bbd9f3e57f8dcdf401b777c5c))
|
|
24
|
+
* **address-book-admin:** fix content overflow when sidebar is open ([61f3e61](https://github.com/paxoslabs/paxos-labs-monorepo/commit/61f3e61fe09b96bc80aed493867c269a69efb7c2))
|
|
25
|
+
* **address-book-admin:** handle organizations query error explicitly ([a0e2163](https://github.com/paxoslabs/paxos-labs-monorepo/commit/a0e216393f314cb7abb627c1986b17d254205482))
|
|
26
|
+
* **address-book-admin:** resolve tables not rendering due to client/server boundary violation ([c9b0006](https://github.com/paxoslabs/paxos-labs-monorepo/commit/c9b00062f833edd5f9d401fae038167eef15a1d1))
|
|
27
|
+
* **backend-v2:** query org member by record id instead of userId in remove/update ([26bb1d0](https://github.com/paxoslabs/paxos-labs-monorepo/commit/26bb1d0fd72e1492e36b25015d57c4fbf547dcf0))
|
|
28
|
+
* bound socket.io-parser override to ^4.2.6 to prevent unintended major upgrades ([c0f94ce](https://github.com/paxoslabs/paxos-labs-monorepo/commit/c0f94cefd24b0d1e1a11b2d372f971dcd063c390))
|
|
29
|
+
* optimistic update to continue showing new role after update succeeds ([d174c41](https://github.com/paxoslabs/paxos-labs-monorepo/commit/d174c419941d95f858d75d20aab7f9ac362374a1))
|
|
30
|
+
* override socket.io-parser to >=4.2.6 to resolve GHSA-677m-j7p3-52f9 ([47406ea](https://github.com/paxoslabs/paxos-labs-monorepo/commit/47406ea41690428f91d72a723145c9d5d0190893))
|
|
31
|
+
* Prevent adding deleted vault ([#35](https://github.com/paxoslabs/paxos-labs-monorepo/issues/35)) ([34b8b20](https://github.com/paxoslabs/paxos-labs-monorepo/commit/34b8b202a1b058b35ef70e8832ad751c30d4794b))
|
|
32
|
+
* remove duplicate toast ([93fb035](https://github.com/paxoslabs/paxos-labs-monorepo/commit/93fb035ae98cc6db96c2b67fafe70975f61ee528))
|
|
33
|
+
* use viem isAddress for validation and fix TanStack Form error handling ([177bc3f](https://github.com/paxoslabs/paxos-labs-monorepo/commit/177bc3f264daddb955187c873d9f408fff30514b))
|
|
34
|
+
* Vault deletion not working from the UI ([#34](https://github.com/paxoslabs/paxos-labs-monorepo/issues/34)) ([3328cca](https://github.com/paxoslabs/paxos-labs-monorepo/commit/3328cca120299ff256f358303a86295b5a4c0ea0))
|
|
35
|
+
|
|
36
|
+
### Documentation
|
|
37
|
+
|
|
38
|
+
* **sdk:** replace deprecated getAssetsFromCache with getSupportedAssets in troubleshooting snippet ([6616961](https://github.com/paxoslabs/paxos-labs-monorepo/commit/66169611affd73f5807d66e0580c57df13d5c7bf))
|
|
39
|
+
|
|
40
|
+
### Code Refactoring
|
|
41
|
+
|
|
42
|
+
* **address-book-admin:** replace Chain select with number input for Chain ID ([45fce7b](https://github.com/paxoslabs/paxos-labs-monorepo/commit/45fce7b71c1ffd97400f09573491d78577bf389f))
|
|
43
|
+
* Extract shared utilities and simplify SDK config state ([ae23b66](https://github.com/paxoslabs/paxos-labs-monorepo/commit/ae23b6686cbd261ffef2cb7f5835e1974d59a03f))
|
|
44
|
+
* **sdk:** rename fetchVaults/fetchSupportedAssets to getVaults/getSupportedAssets ([8e65846](https://github.com/paxoslabs/paxos-labs-monorepo/commit/8e6584609eb0a184c6ffe9d4a42d36fe63f81b5a))
|
|
45
|
+
|
|
10
46
|
## [0.4.3-alpha.1] (2026-03-13)
|
|
11
47
|
|
|
12
48
|
### ⚠ BREAKING CHANGES
|
|
@@ -39,7 +39,7 @@ type YieldType = (typeof YieldType)[keyof typeof YieldType];
|
|
|
39
39
|
* - accountantAddress: Manages accounting logic
|
|
40
40
|
* - managerAddress: Controls strategy execution
|
|
41
41
|
* - rolesAuthorityAddress: Enforces role-based access
|
|
42
|
-
* - baseTokenAddress:
|
|
42
|
+
* - baseTokenAddress: Primary deposit token address
|
|
43
43
|
* - baseTokenStandIn: Optional stand-in token
|
|
44
44
|
* - communityCodeDepositorAddress: Optional community depositor contract
|
|
45
45
|
*/
|
|
@@ -54,11 +54,31 @@ interface VaultContracts {
|
|
|
54
54
|
communityCodeDepositorAddress?: Address;
|
|
55
55
|
withdrawQueueAddress?: Address;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* A single depositable/withdrawable asset supported by a vault.
|
|
59
|
+
*/
|
|
60
|
+
interface VaultSupportedAsset {
|
|
61
|
+
/** Token contract address */
|
|
62
|
+
address: Address;
|
|
63
|
+
/** Token symbol (e.g., USDC, USDT) */
|
|
64
|
+
symbol: string;
|
|
65
|
+
/** Full token name (e.g., USD Coin) */
|
|
66
|
+
name: string;
|
|
67
|
+
/** Number of decimal places (e.g., 6 for USDC, 18 for DAI) */
|
|
68
|
+
decimals: number;
|
|
69
|
+
/** CoinGecko token identifier for price lookups */
|
|
70
|
+
coinGeckoTokenId?: string;
|
|
71
|
+
/** Whether deposits are currently enabled for this vault-asset pair */
|
|
72
|
+
depositable?: boolean;
|
|
73
|
+
/** Whether withdrawals are currently enabled for this vault-asset pair */
|
|
74
|
+
withdrawable?: boolean;
|
|
75
|
+
}
|
|
57
76
|
/**
|
|
58
77
|
* Amplify vault configuration
|
|
59
78
|
*
|
|
60
|
-
* Represents a single vault with contract addresses, yield type, and supported deposit
|
|
79
|
+
* Represents a single vault with contract addresses, yield type, and supported deposit assets.
|
|
61
80
|
* Multiple vaults can share the same baseTokenAddress (different chains/yield types).
|
|
81
|
+
* A single vault can support multiple depositable assets.
|
|
62
82
|
*
|
|
63
83
|
* @example
|
|
64
84
|
* ```typescript
|
|
@@ -74,13 +94,15 @@ interface VaultContracts {
|
|
|
74
94
|
* rolesAuthorityAddress: "0x4A5B6C7D8E9F0A1B2C3D4E5F6A7B8C9D0E1F2A3B",
|
|
75
95
|
* baseTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
76
96
|
* },
|
|
77
|
-
* supportedAssets:
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
97
|
+
* supportedAssets: [
|
|
98
|
+
* {
|
|
99
|
+
* address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
100
|
+
* symbol: "USDC",
|
|
101
|
+
* name: "USD Coin",
|
|
102
|
+
* decimals: 6,
|
|
103
|
+
* coinGeckoTokenId: "usd-coin"
|
|
104
|
+
* }
|
|
105
|
+
* ]
|
|
84
106
|
* };
|
|
85
107
|
* ```
|
|
86
108
|
*/
|
|
@@ -101,29 +123,14 @@ interface AmplifyVault {
|
|
|
101
123
|
vault: VaultContracts;
|
|
102
124
|
/** SLA data from VaultSLAs table */
|
|
103
125
|
sla?: VaultSLA;
|
|
104
|
-
/** Supported deposit
|
|
105
|
-
supportedAssets:
|
|
106
|
-
/** Token contract address */
|
|
107
|
-
address: Address;
|
|
108
|
-
/** Token symbol (e.g., USDC, USDT) */
|
|
109
|
-
symbol: string;
|
|
110
|
-
/** Full token name (e.g., USD Coin) */
|
|
111
|
-
name: string;
|
|
112
|
-
/** Number of decimal places (e.g., 6 for USDC, 18 for DAI) */
|
|
113
|
-
decimals: number;
|
|
114
|
-
/** CoinGecko token identifier for price lookups */
|
|
115
|
-
coinGeckoTokenId?: string;
|
|
116
|
-
/** Whether deposits are currently enabled for this vault-asset pair */
|
|
117
|
-
depositable?: boolean;
|
|
118
|
-
/** Whether withdrawals are currently enabled for this vault-asset pair */
|
|
119
|
-
withdrawable?: boolean;
|
|
120
|
-
};
|
|
126
|
+
/** Supported deposit assets for this vault */
|
|
127
|
+
supportedAssets: VaultSupportedAsset[];
|
|
121
128
|
}
|
|
122
129
|
/**
|
|
123
130
|
* Supported asset (token) metadata
|
|
124
131
|
*
|
|
125
132
|
* Represents a cryptocurrency token with metadata and chain support.
|
|
126
|
-
*
|
|
133
|
+
* Can be correlated with AmplifyVault via the vault's supportedAssets array.
|
|
127
134
|
*
|
|
128
135
|
* @example
|
|
129
136
|
* ```typescript
|
|
@@ -138,7 +145,7 @@ interface AmplifyVault {
|
|
|
138
145
|
* ```
|
|
139
146
|
*/
|
|
140
147
|
interface SupportedAsset {
|
|
141
|
-
/** Token contract address
|
|
148
|
+
/** Token contract address */
|
|
142
149
|
address: Address;
|
|
143
150
|
/** Token symbol (e.g., USDC, USDT) */
|
|
144
151
|
symbol: string;
|
|
@@ -312,4 +319,4 @@ declare function getChainFromConfig(chainId: number, config?: AmplifyVault[]): P
|
|
|
312
319
|
*/
|
|
313
320
|
declare function clearChainsCache(): void;
|
|
314
321
|
|
|
315
|
-
export { type AmplifyVault as A, type ChainId as C, 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, getChainFromConfig as g, toChainId as t };
|
|
322
|
+
export { type AmplifyVault as A, type ChainId as C, 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 };
|
|
@@ -39,7 +39,7 @@ type YieldType = (typeof YieldType)[keyof typeof YieldType];
|
|
|
39
39
|
* - accountantAddress: Manages accounting logic
|
|
40
40
|
* - managerAddress: Controls strategy execution
|
|
41
41
|
* - rolesAuthorityAddress: Enforces role-based access
|
|
42
|
-
* - baseTokenAddress:
|
|
42
|
+
* - baseTokenAddress: Primary deposit token address
|
|
43
43
|
* - baseTokenStandIn: Optional stand-in token
|
|
44
44
|
* - communityCodeDepositorAddress: Optional community depositor contract
|
|
45
45
|
*/
|
|
@@ -54,11 +54,31 @@ interface VaultContracts {
|
|
|
54
54
|
communityCodeDepositorAddress?: Address;
|
|
55
55
|
withdrawQueueAddress?: Address;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* A single depositable/withdrawable asset supported by a vault.
|
|
59
|
+
*/
|
|
60
|
+
interface VaultSupportedAsset {
|
|
61
|
+
/** Token contract address */
|
|
62
|
+
address: Address;
|
|
63
|
+
/** Token symbol (e.g., USDC, USDT) */
|
|
64
|
+
symbol: string;
|
|
65
|
+
/** Full token name (e.g., USD Coin) */
|
|
66
|
+
name: string;
|
|
67
|
+
/** Number of decimal places (e.g., 6 for USDC, 18 for DAI) */
|
|
68
|
+
decimals: number;
|
|
69
|
+
/** CoinGecko token identifier for price lookups */
|
|
70
|
+
coinGeckoTokenId?: string;
|
|
71
|
+
/** Whether deposits are currently enabled for this vault-asset pair */
|
|
72
|
+
depositable?: boolean;
|
|
73
|
+
/** Whether withdrawals are currently enabled for this vault-asset pair */
|
|
74
|
+
withdrawable?: boolean;
|
|
75
|
+
}
|
|
57
76
|
/**
|
|
58
77
|
* Amplify vault configuration
|
|
59
78
|
*
|
|
60
|
-
* Represents a single vault with contract addresses, yield type, and supported deposit
|
|
79
|
+
* Represents a single vault with contract addresses, yield type, and supported deposit assets.
|
|
61
80
|
* Multiple vaults can share the same baseTokenAddress (different chains/yield types).
|
|
81
|
+
* A single vault can support multiple depositable assets.
|
|
62
82
|
*
|
|
63
83
|
* @example
|
|
64
84
|
* ```typescript
|
|
@@ -74,13 +94,15 @@ interface VaultContracts {
|
|
|
74
94
|
* rolesAuthorityAddress: "0x4A5B6C7D8E9F0A1B2C3D4E5F6A7B8C9D0E1F2A3B",
|
|
75
95
|
* baseTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
76
96
|
* },
|
|
77
|
-
* supportedAssets:
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
97
|
+
* supportedAssets: [
|
|
98
|
+
* {
|
|
99
|
+
* address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
100
|
+
* symbol: "USDC",
|
|
101
|
+
* name: "USD Coin",
|
|
102
|
+
* decimals: 6,
|
|
103
|
+
* coinGeckoTokenId: "usd-coin"
|
|
104
|
+
* }
|
|
105
|
+
* ]
|
|
84
106
|
* };
|
|
85
107
|
* ```
|
|
86
108
|
*/
|
|
@@ -101,29 +123,14 @@ interface AmplifyVault {
|
|
|
101
123
|
vault: VaultContracts;
|
|
102
124
|
/** SLA data from VaultSLAs table */
|
|
103
125
|
sla?: VaultSLA;
|
|
104
|
-
/** Supported deposit
|
|
105
|
-
supportedAssets:
|
|
106
|
-
/** Token contract address */
|
|
107
|
-
address: Address;
|
|
108
|
-
/** Token symbol (e.g., USDC, USDT) */
|
|
109
|
-
symbol: string;
|
|
110
|
-
/** Full token name (e.g., USD Coin) */
|
|
111
|
-
name: string;
|
|
112
|
-
/** Number of decimal places (e.g., 6 for USDC, 18 for DAI) */
|
|
113
|
-
decimals: number;
|
|
114
|
-
/** CoinGecko token identifier for price lookups */
|
|
115
|
-
coinGeckoTokenId?: string;
|
|
116
|
-
/** Whether deposits are currently enabled for this vault-asset pair */
|
|
117
|
-
depositable?: boolean;
|
|
118
|
-
/** Whether withdrawals are currently enabled for this vault-asset pair */
|
|
119
|
-
withdrawable?: boolean;
|
|
120
|
-
};
|
|
126
|
+
/** Supported deposit assets for this vault */
|
|
127
|
+
supportedAssets: VaultSupportedAsset[];
|
|
121
128
|
}
|
|
122
129
|
/**
|
|
123
130
|
* Supported asset (token) metadata
|
|
124
131
|
*
|
|
125
132
|
* Represents a cryptocurrency token with metadata and chain support.
|
|
126
|
-
*
|
|
133
|
+
* Can be correlated with AmplifyVault via the vault's supportedAssets array.
|
|
127
134
|
*
|
|
128
135
|
* @example
|
|
129
136
|
* ```typescript
|
|
@@ -138,7 +145,7 @@ interface AmplifyVault {
|
|
|
138
145
|
* ```
|
|
139
146
|
*/
|
|
140
147
|
interface SupportedAsset {
|
|
141
|
-
/** Token contract address
|
|
148
|
+
/** Token contract address */
|
|
142
149
|
address: Address;
|
|
143
150
|
/** Token symbol (e.g., USDC, USDT) */
|
|
144
151
|
symbol: string;
|
|
@@ -312,4 +319,4 @@ declare function getChainFromConfig(chainId: number, config?: AmplifyVault[]): P
|
|
|
312
319
|
*/
|
|
313
320
|
declare function clearChainsCache(): void;
|
|
314
321
|
|
|
315
|
-
export { type AmplifyVault as A, type ChainId as C, 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, getChainFromConfig as g, toChainId as t };
|
|
322
|
+
export { type AmplifyVault as A, type ChainId as C, 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 };
|
|
@@ -89,7 +89,7 @@ function setLogLevel(level) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// src/constants/environment.ts
|
|
92
|
-
var BASE_URL = "https://
|
|
92
|
+
var BASE_URL = "https://api.paxoslabs.com";
|
|
93
93
|
function getGraphQLEndpoint() {
|
|
94
94
|
return `${BASE_URL}/graphql`;
|
|
95
95
|
}
|
|
@@ -161,9 +161,15 @@ var VaultCache = class {
|
|
|
161
161
|
* @returns Array of all AmplifyVault objects
|
|
162
162
|
*/
|
|
163
163
|
getAllVaults() {
|
|
164
|
+
const seen = /* @__PURE__ */ new Set();
|
|
164
165
|
const allVaults = [];
|
|
165
166
|
for (const vaultArray of this.vaults.values()) {
|
|
166
|
-
|
|
167
|
+
for (const vault of vaultArray) {
|
|
168
|
+
if (!seen.has(vault.id)) {
|
|
169
|
+
seen.add(vault.id);
|
|
170
|
+
allVaults.push(vault);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
167
173
|
}
|
|
168
174
|
return allVaults;
|
|
169
175
|
}
|
|
@@ -243,12 +249,16 @@ var VaultCache = class {
|
|
|
243
249
|
this.vaultsByAddress.clear();
|
|
244
250
|
this.vaultsByName.clear();
|
|
245
251
|
for (const vault of vaults) {
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
existing
|
|
250
|
-
|
|
251
|
-
|
|
252
|
+
for (const asset of vault.supportedAssets) {
|
|
253
|
+
const tokenAddress = asset.address;
|
|
254
|
+
const existing = this.vaults.get(tokenAddress);
|
|
255
|
+
if (existing) {
|
|
256
|
+
if (!existing.includes(vault)) {
|
|
257
|
+
existing.push(vault);
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
this.vaults.set(tokenAddress, [vault]);
|
|
261
|
+
}
|
|
252
262
|
}
|
|
253
263
|
this.vaultsByAddress.set(
|
|
254
264
|
vault.vault.boringVaultAddress.toLowerCase(),
|
|
@@ -538,6 +548,15 @@ var VAULT_FIELDS = `
|
|
|
538
548
|
externalWithdrawalQueueDelaySLA
|
|
539
549
|
externalAccountantRateUpdateSLA
|
|
540
550
|
}
|
|
551
|
+
supportedAssets {
|
|
552
|
+
address
|
|
553
|
+
chainId
|
|
554
|
+
depositable
|
|
555
|
+
withdrawable
|
|
556
|
+
symbol
|
|
557
|
+
tokenName
|
|
558
|
+
decimals
|
|
559
|
+
}
|
|
541
560
|
`;
|
|
542
561
|
var DEPOSIT_TOKEN_FIELDS = `
|
|
543
562
|
id
|
|
@@ -714,6 +733,25 @@ function mapGraphQLConfigToVault(config) {
|
|
|
714
733
|
return null;
|
|
715
734
|
}
|
|
716
735
|
const { vault, depositTokenAddress } = config;
|
|
736
|
+
const indexerAssets = vault.supportedAssets && vault.supportedAssets.length > 0 ? vault.supportedAssets.map((a) => ({
|
|
737
|
+
address: a.address,
|
|
738
|
+
symbol: a.symbol ?? a.address,
|
|
739
|
+
name: a.tokenName ?? a.symbol ?? a.address,
|
|
740
|
+
decimals: a.decimals ?? 0,
|
|
741
|
+
depositable: a.depositable,
|
|
742
|
+
withdrawable: a.withdrawable
|
|
743
|
+
})) : [
|
|
744
|
+
{
|
|
745
|
+
address: depositTokenAddress.address,
|
|
746
|
+
symbol: config.tokenMetadata?.symbol ?? depositTokenAddress.name,
|
|
747
|
+
name: config.tokenMetadata?.tokenName ?? depositTokenAddress.name,
|
|
748
|
+
decimals: config.tokenMetadata?.decimals ?? 0,
|
|
749
|
+
...config.vaultAssetFlags && {
|
|
750
|
+
depositable: config.vaultAssetFlags.depositable,
|
|
751
|
+
withdrawable: config.vaultAssetFlags.withdrawable
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
];
|
|
717
755
|
return {
|
|
718
756
|
id: config.id,
|
|
719
757
|
chainId: config.chainId,
|
|
@@ -730,22 +768,25 @@ function mapGraphQLConfigToVault(config) {
|
|
|
730
768
|
withdrawQueueAddress: vault.withdrawQueueModuleId ? vault.withdrawQueueModuleId : void 0,
|
|
731
769
|
communityCodeDepositorAddress: vault.communityCodeDepositorModuleId ? vault.communityCodeDepositorModuleId : void 0
|
|
732
770
|
},
|
|
733
|
-
supportedAssets:
|
|
734
|
-
address: depositTokenAddress.address,
|
|
735
|
-
symbol: config.tokenMetadata?.symbol ?? depositTokenAddress.name,
|
|
736
|
-
name: config.tokenMetadata?.tokenName ?? depositTokenAddress.name,
|
|
737
|
-
decimals: config.tokenMetadata?.decimals ?? 0,
|
|
738
|
-
...config.vaultAssetFlags && {
|
|
739
|
-
depositable: config.vaultAssetFlags.depositable,
|
|
740
|
-
withdrawable: config.vaultAssetFlags.withdrawable
|
|
741
|
-
}
|
|
742
|
-
},
|
|
771
|
+
supportedAssets: indexerAssets,
|
|
743
772
|
sla: vault.withdrawalSla && vault.withdrawalSla.length > 0 ? {
|
|
744
773
|
externalWithdrawalQueueDelaySLA: vault.withdrawalSla[0].externalWithdrawalQueueDelaySLA,
|
|
745
774
|
externalAccountantRateUpdateSLA: vault.withdrawalSla[0].externalAccountantRateUpdateSLA
|
|
746
775
|
} : void 0
|
|
747
776
|
};
|
|
748
777
|
}
|
|
778
|
+
function aggregateVaultConfigs(configs) {
|
|
779
|
+
const vaultMap = /* @__PURE__ */ new Map();
|
|
780
|
+
for (const config of configs) {
|
|
781
|
+
if (!config.vault || !config.depositTokenAddress) continue;
|
|
782
|
+
if (vaultMap.has(config.vaultId)) continue;
|
|
783
|
+
const mapped = mapGraphQLConfigToVault(config);
|
|
784
|
+
if (mapped) {
|
|
785
|
+
vaultMap.set(config.vaultId, mapped);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return Array.from(vaultMap.values());
|
|
789
|
+
}
|
|
749
790
|
function extractSupportedAssetsFromConfigs(configs) {
|
|
750
791
|
const assetMap = /* @__PURE__ */ new Map();
|
|
751
792
|
for (const config of configs) {
|
|
@@ -840,16 +881,7 @@ async function fetchVaultDataFromGraphQL() {
|
|
|
840
881
|
const endpoint = getGraphQLEndpoint();
|
|
841
882
|
const response = await fetchAmplifySdkConfigs(endpoint);
|
|
842
883
|
const configs = response.amplifySdkConfigs;
|
|
843
|
-
const vaults =
|
|
844
|
-
const seenVaultIds = /* @__PURE__ */ new Set();
|
|
845
|
-
for (const config of configs) {
|
|
846
|
-
if (seenVaultIds.has(config.vaultId)) continue;
|
|
847
|
-
const vault = mapGraphQLConfigToVault(config);
|
|
848
|
-
if (vault) {
|
|
849
|
-
seenVaultIds.add(config.vaultId);
|
|
850
|
-
vaults.push(vault);
|
|
851
|
-
}
|
|
852
|
-
}
|
|
884
|
+
const vaults = aggregateVaultConfigs(configs);
|
|
853
885
|
const assets = extractSupportedAssetsFromConfigs(configs);
|
|
854
886
|
return { vaults, assets };
|
|
855
887
|
}
|
|
@@ -863,8 +895,11 @@ function applyVaultFilters(vaults, options) {
|
|
|
863
895
|
filtered = filtered.filter((v) => v.yieldType === options.yieldType);
|
|
864
896
|
}
|
|
865
897
|
if (options.depositTokenAddress) {
|
|
898
|
+
const normalized = options.depositTokenAddress.toLowerCase();
|
|
866
899
|
filtered = filtered.filter(
|
|
867
|
-
(v) => v.
|
|
900
|
+
(v) => v.supportedAssets.some(
|
|
901
|
+
(a) => a.address.toLowerCase() === normalized
|
|
902
|
+
)
|
|
868
903
|
);
|
|
869
904
|
}
|
|
870
905
|
return filtered;
|
|
@@ -888,7 +923,7 @@ function applyAssetFilters(assets, options) {
|
|
|
888
923
|
}
|
|
889
924
|
return filtered;
|
|
890
925
|
}
|
|
891
|
-
async function
|
|
926
|
+
async function getVaults(options) {
|
|
892
927
|
validateVaultFilterOptions(options);
|
|
893
928
|
const cache = getCache();
|
|
894
929
|
if (cache.isEmpty() || cache.isExpired()) {
|
|
@@ -896,7 +931,7 @@ async function fetchVaults(options) {
|
|
|
896
931
|
}
|
|
897
932
|
return applyVaultFilters(cache.getAllVaults(), options);
|
|
898
933
|
}
|
|
899
|
-
async function
|
|
934
|
+
async function getSupportedAssets(options) {
|
|
900
935
|
validateAssetFilterOptions(options);
|
|
901
936
|
const cache = getCache();
|
|
902
937
|
if (cache.isEmpty() || cache.isExpired()) {
|
|
@@ -924,7 +959,7 @@ function clearCache() {
|
|
|
924
959
|
cache.clear();
|
|
925
960
|
}
|
|
926
961
|
async function getAssetsFromCache(options) {
|
|
927
|
-
return
|
|
962
|
+
return getSupportedAssets(options);
|
|
928
963
|
}
|
|
929
964
|
async function findVaultByConfig(params) {
|
|
930
965
|
if (!isValidAddress(params.assetAddress)) {
|
|
@@ -957,7 +992,9 @@ async function findVaultByConfig(params) {
|
|
|
957
992
|
if (!vaultsByToken) {
|
|
958
993
|
const allVaults = cache.getAllVaults();
|
|
959
994
|
const matchingVaults = allVaults.filter(
|
|
960
|
-
(vault) => vault.
|
|
995
|
+
(vault) => vault.supportedAssets.some(
|
|
996
|
+
(a) => a.address.toLowerCase() === normalizedAddress
|
|
997
|
+
)
|
|
961
998
|
);
|
|
962
999
|
vaultsByToken = matchingVaults.length > 0 ? matchingVaults : void 0;
|
|
963
1000
|
}
|
|
@@ -1002,7 +1039,9 @@ async function getVaultsByConfig(params) {
|
|
|
1002
1039
|
}
|
|
1003
1040
|
const normalized = params.depositAssetAddress.toLowerCase();
|
|
1004
1041
|
vaults = vaults.filter(
|
|
1005
|
-
(v) => v.
|
|
1042
|
+
(v) => v.supportedAssets.some(
|
|
1043
|
+
(a) => a.address.toLowerCase() === normalized
|
|
1044
|
+
)
|
|
1006
1045
|
);
|
|
1007
1046
|
}
|
|
1008
1047
|
if (params?.withdrawAssetAddress) {
|
|
@@ -1014,7 +1053,9 @@ async function getVaultsByConfig(params) {
|
|
|
1014
1053
|
}
|
|
1015
1054
|
const normalized = params.withdrawAssetAddress.toLowerCase();
|
|
1016
1055
|
vaults = vaults.filter(
|
|
1017
|
-
(v) => v.supportedAssets.
|
|
1056
|
+
(v) => v.supportedAssets.some(
|
|
1057
|
+
(a) => a.withdrawable !== false && a.address.toLowerCase() === normalized
|
|
1058
|
+
)
|
|
1018
1059
|
);
|
|
1019
1060
|
}
|
|
1020
1061
|
if (params?.settlementAssetAddress) {
|
|
@@ -1026,7 +1067,9 @@ async function getVaultsByConfig(params) {
|
|
|
1026
1067
|
}
|
|
1027
1068
|
const normalized = params.settlementAssetAddress.toLowerCase();
|
|
1028
1069
|
vaults = vaults.filter(
|
|
1029
|
-
(v) => v.
|
|
1070
|
+
(v) => v.supportedAssets.some(
|
|
1071
|
+
(a) => a.address.toLowerCase() === normalized
|
|
1072
|
+
)
|
|
1030
1073
|
);
|
|
1031
1074
|
}
|
|
1032
1075
|
return vaults;
|
|
@@ -1045,16 +1088,18 @@ async function getWithdrawSupportedAssets() {
|
|
|
1045
1088
|
}
|
|
1046
1089
|
const assetVaultMap = /* @__PURE__ */ new Map();
|
|
1047
1090
|
for (const vault of vaults) {
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1050
|
-
assetVaultMap.
|
|
1091
|
+
for (const asset of vault.supportedAssets) {
|
|
1092
|
+
const assetAddress = asset.address.toLowerCase();
|
|
1093
|
+
if (!assetVaultMap.has(assetAddress)) {
|
|
1094
|
+
assetVaultMap.set(assetAddress, []);
|
|
1095
|
+
}
|
|
1096
|
+
assetVaultMap.get(assetAddress)?.push({
|
|
1097
|
+
id: vault.id,
|
|
1098
|
+
yieldType: vault.yieldType,
|
|
1099
|
+
chainId: vault.chainId,
|
|
1100
|
+
vaultId: vault.id
|
|
1101
|
+
});
|
|
1051
1102
|
}
|
|
1052
|
-
assetVaultMap.get(assetAddress)?.push({
|
|
1053
|
-
id: vault.id,
|
|
1054
|
-
yieldType: vault.yieldType,
|
|
1055
|
-
chainId: vault.chainId,
|
|
1056
|
-
vaultId: vault.id
|
|
1057
|
-
});
|
|
1058
1103
|
}
|
|
1059
1104
|
for (const [assetAddress, vaultsData] of assetVaultMap.entries()) {
|
|
1060
1105
|
const asset = assetMap.get(assetAddress);
|
|
@@ -1136,7 +1181,7 @@ async function getChainFromConfig(chainId, config) {
|
|
|
1136
1181
|
return chain2;
|
|
1137
1182
|
}
|
|
1138
1183
|
}
|
|
1139
|
-
const vaults = config ?? await
|
|
1184
|
+
const vaults = config ?? await getVaults();
|
|
1140
1185
|
const vault = vaults.find((v) => v.chainId === chainId);
|
|
1141
1186
|
if (!vault) {
|
|
1142
1187
|
throw new Error(`Vault not found for ID: ${chainId}`);
|
|
@@ -1179,7 +1224,7 @@ var getClient = async (chainId) => {
|
|
|
1179
1224
|
if (!clients.has(numericChainId)) {
|
|
1180
1225
|
const chain = await getChainFromConfig(
|
|
1181
1226
|
numericChainId,
|
|
1182
|
-
await
|
|
1227
|
+
await getVaults()
|
|
1183
1228
|
);
|
|
1184
1229
|
const customRpcUrl = getRpcUrls()[numericChainId];
|
|
1185
1230
|
if (!customRpcUrl && !warnedChains.has(numericChainId)) {
|
|
@@ -1397,8 +1442,6 @@ exports.LogLevel = LogLevel;
|
|
|
1397
1442
|
exports.YieldType = YieldType;
|
|
1398
1443
|
exports.clearChainsCache = clearChainsCache;
|
|
1399
1444
|
exports.createTimeoutSignal = createTimeoutSignal;
|
|
1400
|
-
exports.fetchSupportedAssets = fetchSupportedAssets;
|
|
1401
|
-
exports.fetchVaults = fetchVaults;
|
|
1402
1445
|
exports.findVaultByConfig = findVaultByConfig;
|
|
1403
1446
|
exports.getAssetsFromCache = getAssetsFromCache;
|
|
1404
1447
|
exports.getCache = getCache;
|
|
@@ -1407,6 +1450,8 @@ exports.getClient = getClient;
|
|
|
1407
1450
|
exports.getLogger = getLogger;
|
|
1408
1451
|
exports.getRequestHeaders = getRequestHeaders;
|
|
1409
1452
|
exports.getRestV2BaseURL = getRestV2BaseURL;
|
|
1453
|
+
exports.getSupportedAssets = getSupportedAssets;
|
|
1454
|
+
exports.getVaults = getVaults;
|
|
1410
1455
|
exports.getVaultsByConfig = getVaultsByConfig;
|
|
1411
1456
|
exports.getWithdrawSupportedAssets = getWithdrawSupportedAssets;
|
|
1412
1457
|
exports.initAmplifySDK = initAmplifySDK;
|
|
@@ -1419,5 +1464,5 @@ exports.setLogLevel = setLogLevel;
|
|
|
1419
1464
|
exports.setLogger = setLogger;
|
|
1420
1465
|
exports.toChainId = toChainId;
|
|
1421
1466
|
exports.waitForCacheReady = waitForCacheReady;
|
|
1422
|
-
//# sourceMappingURL=chunk-
|
|
1423
|
-
//# sourceMappingURL=chunk-
|
|
1467
|
+
//# sourceMappingURL=chunk-2ZJWWK6D.js.map
|
|
1468
|
+
//# sourceMappingURL=chunk-2ZJWWK6D.js.map
|