@paxoslabs/amplify-sdk 0.2.4 → 0.3.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 +109 -0
- package/README.md +2 -2
- package/dist/{amplify-sdk-api-Biol0OIp.d.mts → chain-utils-D5g_eJkP.d.mts} +53 -12
- package/dist/{amplify-sdk-api-DGRgEybp.d.ts → chain-utils-D5g_eJkP.d.ts} +53 -12
- package/dist/{chunk-NZDHFDPQ.mjs → chunk-34FW3NJ5.mjs} +34 -38
- package/dist/chunk-34FW3NJ5.mjs.map +1 -0
- package/dist/{chunk-7RWWVUHP.mjs → chunk-7VCTSEQ3.mjs} +12 -4
- package/dist/chunk-7VCTSEQ3.mjs.map +1 -0
- package/dist/chunk-BGYNOLJS.js +1658 -0
- package/dist/chunk-BGYNOLJS.js.map +1 -0
- package/dist/chunk-KE2XITEL.mjs +1639 -0
- package/dist/chunk-KE2XITEL.mjs.map +1 -0
- package/dist/{chunk-4ZYCWOFI.js → chunk-L3OBHAJ3.js} +20 -10
- package/dist/chunk-L3OBHAJ3.js.map +1 -0
- package/dist/{chunk-CK3BIPWI.js → chunk-MXV5XR2A.js} +33 -37
- package/dist/chunk-MXV5XR2A.js.map +1 -0
- package/dist/{chunk-3I3PYX2F.js → chunk-PUEN4T6I.js} +12 -3
- package/dist/chunk-PUEN4T6I.js.map +1 -0
- package/dist/{chunk-VZ3D7CNR.mjs → chunk-VRULJTDE.mjs} +13 -5
- package/dist/chunk-VRULJTDE.mjs.map +1 -0
- package/dist/core.d.mts +4 -4
- package/dist/core.d.ts +4 -4
- package/dist/core.js +54 -28
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +44 -7
- package/dist/core.mjs.map +1 -1
- package/dist/index.d.mts +113 -3458
- package/dist/index.d.ts +113 -3458
- package/dist/index.js +82 -1499
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -1472
- package/dist/index.mjs.map +1 -1
- package/dist/utils.d.mts +3 -16
- package/dist/utils.d.ts +3 -16
- package/dist/utils.js +17 -14
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +2 -3
- package/dist/utils.mjs.map +1 -1
- package/dist/vaults.d.mts +3853 -4
- package/dist/vaults.d.ts +3853 -4
- package/dist/vaults.js +66 -4
- package/dist/vaults.mjs +4 -2
- package/package.json +9 -15
- package/dist/chunk-3I3PYX2F.js.map +0 -1
- package/dist/chunk-4ZYCWOFI.js.map +0 -1
- package/dist/chunk-7RWWVUHP.mjs.map +0 -1
- package/dist/chunk-AQFFMJX7.mjs +0 -11
- package/dist/chunk-AQFFMJX7.mjs.map +0 -1
- package/dist/chunk-B55AAGKF.mjs +0 -233
- package/dist/chunk-B55AAGKF.mjs.map +0 -1
- package/dist/chunk-CK3BIPWI.js.map +0 -1
- package/dist/chunk-E3JM2RCC.mjs +0 -13
- package/dist/chunk-E3JM2RCC.mjs.map +0 -1
- package/dist/chunk-GRRN4KON.js +0 -238
- package/dist/chunk-GRRN4KON.js.map +0 -1
- package/dist/chunk-ICKDAKVS.js +0 -16
- package/dist/chunk-ICKDAKVS.js.map +0 -1
- package/dist/chunk-J3662HYT.mjs +0 -29
- package/dist/chunk-J3662HYT.mjs.map +0 -1
- package/dist/chunk-NZDHFDPQ.mjs.map +0 -1
- package/dist/chunk-OJOKPBK7.js +0 -14
- package/dist/chunk-OJOKPBK7.js.map +0 -1
- package/dist/chunk-R663BFAZ.mjs +0 -14
- package/dist/chunk-R663BFAZ.mjs.map +0 -1
- package/dist/chunk-RSQQMUEQ.js +0 -15
- package/dist/chunk-RSQQMUEQ.js.map +0 -1
- package/dist/chunk-RUIAH5HY.js +0 -32
- package/dist/chunk-RUIAH5HY.js.map +0 -1
- package/dist/chunk-RZN7S23Z.mjs +0 -46
- package/dist/chunk-RZN7S23Z.mjs.map +0 -1
- package/dist/chunk-VZ3D7CNR.mjs.map +0 -1
- package/dist/chunk-ZRI7KBQ6.js +0 -49
- package/dist/chunk-ZRI7KBQ6.js.map +0 -1
- package/dist/config-B-u3VqEX.d.mts +0 -21
- package/dist/config-B-u3VqEX.d.ts +0 -21
- package/dist/config-BQynVNDC.d.mts +0 -101
- package/dist/config-BQynVNDC.d.ts +0 -101
- package/dist/display.d.mts +0 -25
- package/dist/display.d.ts +0 -25
- package/dist/display.js +0 -124
- package/dist/display.js.map +0 -1
- package/dist/display.mjs +0 -105
- package/dist/display.mjs.map +0 -1
- package/dist/exchange-rate-DCB2CY9v.d.mts +0 -70
- package/dist/exchange-rate-DOmoqut9.d.ts +0 -70
- package/dist/vault-config-BNzhv3QV.d.ts +0 -15
- package/dist/vault-config-BjSE7oL8.d.mts +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,115 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
<!-- auto-changelog-above -->
|
|
9
9
|
|
|
10
|
+
## [0.3.0-beta.0] - 2025-01-30
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- **deposit:** Parameter names changed in deposit functions ([82fb867](https://github.com/Ion-Protocol/amplify-sdk/commit/82fb867))
|
|
15
|
+
- `depositToken` → `depositAsset`
|
|
16
|
+
- `recipientAddress` → `to`
|
|
17
|
+
- **core:** Minimum Node.js requirement bumped from 20 to 22 ([d96f256](https://github.com/Ion-Protocol/amplify-sdk/commit/d96f256))
|
|
18
|
+
- **constants:** Yield type references migrated from PRIME/TBILL/LENDING to CORE/TREASURY/FRONTIER ([6068f1d](https://github.com/Ion-Protocol/amplify-sdk/commit/6068f1d))
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- **deposit:** improve TypeScript inference and add `eth_signTypedData_v4` helper for wallet compatibility ([7feb7b6](https://github.com/Ion-Protocol/amplify-sdk/commit/7feb7b6))
|
|
23
|
+
- **core:** bump minimum Node.js requirement from 20 to 22 ([d96f256](https://github.com/Ion-Protocol/amplify-sdk/commit/d96f256))
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
- **errors:** ensure `instanceof` checks work in transpiled code by adding `Object.setPrototypeOf` for `APIError` and `WithdrawError` classes ([9167032](https://github.com/Ion-Protocol/amplify-sdk/commit/9167032))
|
|
28
|
+
|
|
29
|
+
### Code Refactoring
|
|
30
|
+
|
|
31
|
+
- **deposit:** standardize parameter naming across deposit APIs ([82fb867](https://github.com/Ion-Protocol/amplify-sdk/commit/82fb867))
|
|
32
|
+
- `depositToken` → `depositAsset` (matches contract terminology)
|
|
33
|
+
- `recipientAddress` → `to` (matches common contract patterns)
|
|
34
|
+
- **display:** remove display module and bridge functionality (deprecated) ([522d62f](https://github.com/Ion-Protocol/amplify-sdk/commit/522d62f))
|
|
35
|
+
- **vaults:** use explicit exports for tree-shaking optimization ([47aae50](https://github.com/Ion-Protocol/amplify-sdk/commit/47aae50))
|
|
36
|
+
- **constants:** migrate yield type references from PRIME/TBILL/LENDING to CORE/TREASURY/FRONTIER ([6068f1d](https://github.com/Ion-Protocol/amplify-sdk/commit/6068f1d))
|
|
37
|
+
- **ci:** remove automatic prerelease publishing on dev/staging branches ([3efbe3a](https://github.com/Ion-Protocol/amplify-sdk/commit/3efbe3a))
|
|
38
|
+
|
|
39
|
+
### Styles
|
|
40
|
+
|
|
41
|
+
- apply biome formatting and import organization ([22bc599](https://github.com/Ion-Protocol/amplify-sdk/commit/22bc599))
|
|
42
|
+
|
|
43
|
+
### Documentation
|
|
44
|
+
|
|
45
|
+
- add SDK architecture best practices alignment plan ([3e1eb4e](https://github.com/Ion-Protocol/amplify-sdk/commit/3e1eb4e))
|
|
46
|
+
- add CONTRIBUTING.md with development guidelines ([8f0227e](https://github.com/Ion-Protocol/amplify-sdk/commit/8f0227e))
|
|
47
|
+
- streamline AGENTS.md for improved clarity and readability ([704b037](https://github.com/Ion-Protocol/amplify-sdk/commit/704b037))
|
|
48
|
+
|
|
49
|
+
### Chores
|
|
50
|
+
|
|
51
|
+
- use YieldType enum in tests and fix doc dates ([dc04a99](https://github.com/Ion-Protocol/amplify-sdk/commit/dc04a99))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [0.2.3-beta.2] - 2025-01-15
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
- **deposit:** use correct spender address and decimals for permit flow ([172a636](https://github.com/Ion-Protocol/amplify-sdk/commit/172a636))
|
|
59
|
+
- **deposit:** use cache-based lookup for token address resolution ([36eeb42](https://github.com/Ion-Protocol/amplify-sdk/commit/36eeb42))
|
|
60
|
+
- **types:** align EIP712Domain with viem's TypedDataDomain ([aa87bc7](https://github.com/Ion-Protocol/amplify-sdk/commit/aa87bc7))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## [0.2.0-beta.4] - 2025-01-10
|
|
64
|
+
|
|
65
|
+
### Bug Fixes
|
|
66
|
+
|
|
67
|
+
- **ci:** use non-interactive test command in release hooks ([f08408e](https://github.com/Ion-Protocol/amplify-sdk/commit/f08408e))
|
|
68
|
+
- **deps:** resolve preact JSON VNode Injection vulnerability ([ff6b60e](https://github.com/Ion-Protocol/amplify-sdk/commit/ff6b60e))
|
|
69
|
+
- **deposit:** use CommunityCodeDepositor as approval spender ([84cffe5](https://github.com/Ion-Protocol/amplify-sdk/commit/84cffe5))
|
|
70
|
+
- **withdraw:** align slippage defaults to DEFAULT_SLIPPAGE_BPS (50 bps) ([1a6eb8a](https://github.com/Ion-Protocol/amplify-sdk/commit/1a6eb8a))
|
|
71
|
+
|
|
72
|
+
### Documentation
|
|
73
|
+
|
|
74
|
+
- **readme:** complete Quick Start deposit example ([451efa7](https://github.com/Ion-Protocol/amplify-sdk/commit/451efa7))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## [0.2.0-beta.0] - 2025-01-05
|
|
78
|
+
|
|
79
|
+
### Code Refactoring
|
|
80
|
+
|
|
81
|
+
- **types:** convert LogLevel enum to `as const` pattern ([7cf1580](https://github.com/Ion-Protocol/amplify-sdk/commit/7cf1580))
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## [0.2.0-alpha.0] - 2025-01-01
|
|
85
|
+
|
|
86
|
+
### Features
|
|
87
|
+
|
|
88
|
+
- **deposit:** add unified deposit wrapper functions (`prepareDeposit`, `prepareDepositAuthorization`) ([b0d3a99](https://github.com/Ion-Protocol/amplify-sdk/commit/b0d3a99))
|
|
89
|
+
- **observability:** add logging and telemetry infrastructure ([ea4a3ac](https://github.com/Ion-Protocol/amplify-sdk/commit/ea4a3ac))
|
|
90
|
+
- **erc20:** add getTokenPermitInfoWithAllowance with unified multicall ([bed1126](https://github.com/Ion-Protocol/amplify-sdk/commit/bed1126))
|
|
91
|
+
- **erc20:** enhance token permit info with name and version ([3af2f9d](https://github.com/Ion-Protocol/amplify-sdk/commit/3af2f9d))
|
|
92
|
+
|
|
93
|
+
### Bug Fixes
|
|
94
|
+
|
|
95
|
+
- **chain:** update Sei chain ID from 713715 to 1329 ([4b0fafb](https://github.com/Ion-Protocol/amplify-sdk/commit/4b0fafb))
|
|
96
|
+
- **test:** add missing multicall mock to deposit-with-permit tests ([8fe2d41](https://github.com/Ion-Protocol/amplify-sdk/commit/8fe2d41))
|
|
97
|
+
- **telemetry:** prevent duplicate buffer-full warning messages ([29c6513](https://github.com/Ion-Protocol/amplify-sdk/commit/29c6513))
|
|
98
|
+
|
|
99
|
+
### Code Refactoring
|
|
100
|
+
|
|
101
|
+
- **deposit:** convert DepositAuthMethod enum to `as const` pattern ([8af9ac8](https://github.com/Ion-Protocol/amplify-sdk/commit/8af9ac8))
|
|
102
|
+
- **approvals:** use unified multicall for isDepositSpendApproved ([a9aaadc](https://github.com/Ion-Protocol/amplify-sdk/commit/a9aaadc))
|
|
103
|
+
- **deposit:** use multicall for permit signature token reads ([016666c](https://github.com/Ion-Protocol/amplify-sdk/commit/016666c))
|
|
104
|
+
- **api:** centralize API_BASE_URL constant ([a0b9a9b](https://github.com/Ion-Protocol/amplify-sdk/commit/a0b9a9b))
|
|
105
|
+
|
|
106
|
+
### Tests
|
|
107
|
+
|
|
108
|
+
- **deposit:** add unit tests for unified deposit wrapper functions ([7a9d4ff](https://github.com/Ion-Protocol/amplify-sdk/commit/7a9d4ff))
|
|
109
|
+
- **utils:** add comprehensive tests for address and time utilities ([5f46bf4](https://github.com/Ion-Protocol/amplify-sdk/commit/5f46bf4))
|
|
110
|
+
|
|
111
|
+
### Documentation
|
|
112
|
+
|
|
113
|
+
- add llms.txt and improve API documentation ([e4755d8](https://github.com/Ion-Protocol/amplify-sdk/commit/e4755d8))
|
|
114
|
+
- update AGENTS.md for unified deposit API, logging, and telemetry ([0e43447](https://github.com/Ion-Protocol/amplify-sdk/commit/0e43447))
|
|
115
|
+
- fix isDepositSpendApproved usage and function naming in docs ([e48315f](https://github.com/Ion-Protocol/amplify-sdk/commit/e48315f))
|
|
116
|
+
- clarify YieldType dual export pattern ([120ef43](https://github.com/Ion-Protocol/amplify-sdk/commit/120ef43))
|
|
117
|
+
- update slippage default to 0.5% and document partnerCode param ([573bc3b](https://github.com/Ion-Protocol/amplify-sdk/commit/573bc3b))
|
|
118
|
+
|
|
10
119
|
|
|
11
120
|
## [0.2.4](///compare/v0.2.3-beta.2...v0.2.4) (2026-01-20)
|
|
12
121
|
## [0.2.2](///compare/v0.2.3-beta.2...v0.2.4) (2026-01-09)
|
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ await initAmplifySDK("pxl_your_api_key");
|
|
|
56
56
|
|
|
57
57
|
// Prepare deposit authorization (auto-detects permit vs approval)
|
|
58
58
|
const auth = await prepareDepositAuthorization({
|
|
59
|
-
yieldType: "
|
|
59
|
+
yieldType: "CORE",
|
|
60
60
|
depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
|
|
61
61
|
depositAmount: "1000.0",
|
|
62
62
|
recipientAddress: userAddress,
|
|
@@ -65,7 +65,7 @@ const auth = await prepareDepositAuthorization({
|
|
|
65
65
|
|
|
66
66
|
// Shared deposit parameters
|
|
67
67
|
const depositParams = {
|
|
68
|
-
yieldType: "
|
|
68
|
+
yieldType: "CORE",
|
|
69
69
|
depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
70
70
|
depositAmount: "1000.0",
|
|
71
71
|
recipientAddress: userAddress,
|
|
@@ -1,5 +1,26 @@
|
|
|
1
|
+
import { Chain } from 'viem/chains';
|
|
1
2
|
import { Address } from 'viem';
|
|
2
|
-
|
|
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
|
+
readonly PRIME: "PRIME";
|
|
22
|
+
};
|
|
23
|
+
type YieldType = (typeof YieldType)[keyof typeof YieldType];
|
|
3
24
|
|
|
4
25
|
/**
|
|
5
26
|
* Type definitions for Amplify SDK API integration
|
|
@@ -42,9 +63,9 @@ interface VaultContracts {
|
|
|
42
63
|
* @example
|
|
43
64
|
* ```typescript
|
|
44
65
|
* const vault: AmplifyVault = {
|
|
45
|
-
* id: "config-eth-
|
|
66
|
+
* id: "config-eth-core-001",
|
|
46
67
|
* chainId: 1,
|
|
47
|
-
* yieldType: "
|
|
68
|
+
* yieldType: "CORE",
|
|
48
69
|
* vault: {
|
|
49
70
|
* boringVaultAddress: "0x8a5Fb0Eb3E1a90AF81C5DFF9f2e5D0e7b8D4E5F6",
|
|
50
71
|
* tellerAddress: "0x7B8C9D0E1F2A3B4C5D6E7F8A9B0C1D2E3F4A5B6C",
|
|
@@ -126,10 +147,10 @@ interface SupportedAsset {
|
|
|
126
147
|
*
|
|
127
148
|
* @example
|
|
128
149
|
* ```typescript
|
|
129
|
-
* // Get all
|
|
150
|
+
* // Get all CORE vaults on Ethereum
|
|
130
151
|
* const options: VaultFilterOptions = {
|
|
131
152
|
* chainId: 1,
|
|
132
|
-
* yieldType: "
|
|
153
|
+
* yieldType: "CORE"
|
|
133
154
|
* };
|
|
134
155
|
*
|
|
135
156
|
* // Get all vaults accepting USDC
|
|
@@ -162,9 +183,9 @@ interface VaultFilterOptions {
|
|
|
162
183
|
* chains: [1, 8453]
|
|
163
184
|
* };
|
|
164
185
|
*
|
|
165
|
-
* // Get
|
|
166
|
-
* const
|
|
167
|
-
* yieldType: "
|
|
186
|
+
* // Get CORE yield type assets (API call)
|
|
187
|
+
* const coreOptions: AssetFilterOptions = {
|
|
188
|
+
* yieldType: "CORE"
|
|
168
189
|
* };
|
|
169
190
|
*
|
|
170
191
|
* // Filter by address (cache-only)
|
|
@@ -181,7 +202,7 @@ interface VaultFilterOptions {
|
|
|
181
202
|
interface AssetFilterOptions {
|
|
182
203
|
/** Filter by chain IDs (API + cache: assets with these chains in chains array) */
|
|
183
204
|
chains?: number[];
|
|
184
|
-
/** Filter by yield type (API + cache:
|
|
205
|
+
/** Filter by yield type (API + cache: CORE, TREASURY, or FRONTIER) */
|
|
185
206
|
yieldType?: YieldType;
|
|
186
207
|
/** Filter by token address (cache-only: exact address match) */
|
|
187
208
|
address?: string;
|
|
@@ -233,8 +254,8 @@ declare class APIError extends Error {
|
|
|
233
254
|
* symbol: "USDC",
|
|
234
255
|
* decimals: 6,
|
|
235
256
|
* vaults: [
|
|
236
|
-
* { id: "
|
|
237
|
-
* { id: "
|
|
257
|
+
* { id: "core-usdc-eth", yieldType: "CORE", chainId: 1, vaultId: "..." },
|
|
258
|
+
* { id: "core-usdc-boba", yieldType: "CORE", chainId: 288, vaultId: "..." },
|
|
238
259
|
* ],
|
|
239
260
|
* };
|
|
240
261
|
* ```
|
|
@@ -255,4 +276,24 @@ interface WithdrawSupportedAsset {
|
|
|
255
276
|
}>;
|
|
256
277
|
}
|
|
257
278
|
|
|
258
|
-
|
|
279
|
+
/**
|
|
280
|
+
* Flexible chain ID type that accepts both number and string
|
|
281
|
+
*/
|
|
282
|
+
type ChainId = number | `${number}`;
|
|
283
|
+
/**
|
|
284
|
+
* Normalizes a ChainId to a number
|
|
285
|
+
*/
|
|
286
|
+
declare function toChainId(value: ChainId): number;
|
|
287
|
+
/**
|
|
288
|
+
* Gets a chain object from the vault config response
|
|
289
|
+
* @param chainId The chain ID to look up
|
|
290
|
+
* @param config Optional config object. If not provided, will fetch from API
|
|
291
|
+
* @returns Promise<Chain>
|
|
292
|
+
*/
|
|
293
|
+
declare function getChainFromConfig(chainId: number, config?: AmplifyVault[]): Promise<Chain>;
|
|
294
|
+
/**
|
|
295
|
+
* Clears the chains cache
|
|
296
|
+
*/
|
|
297
|
+
declare function clearChainsCache(): void;
|
|
298
|
+
|
|
299
|
+
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, getChainFromConfig as g, toChainId as t };
|
|
@@ -1,5 +1,26 @@
|
|
|
1
|
+
import { Chain } from 'viem/chains';
|
|
1
2
|
import { Address } from 'viem';
|
|
2
|
-
|
|
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
|
+
readonly PRIME: "PRIME";
|
|
22
|
+
};
|
|
23
|
+
type YieldType = (typeof YieldType)[keyof typeof YieldType];
|
|
3
24
|
|
|
4
25
|
/**
|
|
5
26
|
* Type definitions for Amplify SDK API integration
|
|
@@ -42,9 +63,9 @@ interface VaultContracts {
|
|
|
42
63
|
* @example
|
|
43
64
|
* ```typescript
|
|
44
65
|
* const vault: AmplifyVault = {
|
|
45
|
-
* id: "config-eth-
|
|
66
|
+
* id: "config-eth-core-001",
|
|
46
67
|
* chainId: 1,
|
|
47
|
-
* yieldType: "
|
|
68
|
+
* yieldType: "CORE",
|
|
48
69
|
* vault: {
|
|
49
70
|
* boringVaultAddress: "0x8a5Fb0Eb3E1a90AF81C5DFF9f2e5D0e7b8D4E5F6",
|
|
50
71
|
* tellerAddress: "0x7B8C9D0E1F2A3B4C5D6E7F8A9B0C1D2E3F4A5B6C",
|
|
@@ -126,10 +147,10 @@ interface SupportedAsset {
|
|
|
126
147
|
*
|
|
127
148
|
* @example
|
|
128
149
|
* ```typescript
|
|
129
|
-
* // Get all
|
|
150
|
+
* // Get all CORE vaults on Ethereum
|
|
130
151
|
* const options: VaultFilterOptions = {
|
|
131
152
|
* chainId: 1,
|
|
132
|
-
* yieldType: "
|
|
153
|
+
* yieldType: "CORE"
|
|
133
154
|
* };
|
|
134
155
|
*
|
|
135
156
|
* // Get all vaults accepting USDC
|
|
@@ -162,9 +183,9 @@ interface VaultFilterOptions {
|
|
|
162
183
|
* chains: [1, 8453]
|
|
163
184
|
* };
|
|
164
185
|
*
|
|
165
|
-
* // Get
|
|
166
|
-
* const
|
|
167
|
-
* yieldType: "
|
|
186
|
+
* // Get CORE yield type assets (API call)
|
|
187
|
+
* const coreOptions: AssetFilterOptions = {
|
|
188
|
+
* yieldType: "CORE"
|
|
168
189
|
* };
|
|
169
190
|
*
|
|
170
191
|
* // Filter by address (cache-only)
|
|
@@ -181,7 +202,7 @@ interface VaultFilterOptions {
|
|
|
181
202
|
interface AssetFilterOptions {
|
|
182
203
|
/** Filter by chain IDs (API + cache: assets with these chains in chains array) */
|
|
183
204
|
chains?: number[];
|
|
184
|
-
/** Filter by yield type (API + cache:
|
|
205
|
+
/** Filter by yield type (API + cache: CORE, TREASURY, or FRONTIER) */
|
|
185
206
|
yieldType?: YieldType;
|
|
186
207
|
/** Filter by token address (cache-only: exact address match) */
|
|
187
208
|
address?: string;
|
|
@@ -233,8 +254,8 @@ declare class APIError extends Error {
|
|
|
233
254
|
* symbol: "USDC",
|
|
234
255
|
* decimals: 6,
|
|
235
256
|
* vaults: [
|
|
236
|
-
* { id: "
|
|
237
|
-
* { id: "
|
|
257
|
+
* { id: "core-usdc-eth", yieldType: "CORE", chainId: 1, vaultId: "..." },
|
|
258
|
+
* { id: "core-usdc-boba", yieldType: "CORE", chainId: 288, vaultId: "..." },
|
|
238
259
|
* ],
|
|
239
260
|
* };
|
|
240
261
|
* ```
|
|
@@ -255,4 +276,24 @@ interface WithdrawSupportedAsset {
|
|
|
255
276
|
}>;
|
|
256
277
|
}
|
|
257
278
|
|
|
258
|
-
|
|
279
|
+
/**
|
|
280
|
+
* Flexible chain ID type that accepts both number and string
|
|
281
|
+
*/
|
|
282
|
+
type ChainId = number | `${number}`;
|
|
283
|
+
/**
|
|
284
|
+
* Normalizes a ChainId to a number
|
|
285
|
+
*/
|
|
286
|
+
declare function toChainId(value: ChainId): number;
|
|
287
|
+
/**
|
|
288
|
+
* Gets a chain object from the vault config response
|
|
289
|
+
* @param chainId The chain ID to look up
|
|
290
|
+
* @param config Optional config object. If not provided, will fetch from API
|
|
291
|
+
* @returns Promise<Chain>
|
|
292
|
+
*/
|
|
293
|
+
declare function getChainFromConfig(chainId: number, config?: AmplifyVault[]): Promise<Chain>;
|
|
294
|
+
/**
|
|
295
|
+
* Clears the chains cache
|
|
296
|
+
*/
|
|
297
|
+
declare function clearChainsCache(): void;
|
|
298
|
+
|
|
299
|
+
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, getChainFromConfig as g, toChainId as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineChain } from 'viem';
|
|
2
|
-
import {
|
|
2
|
+
import { mainnet } from 'viem/chains';
|
|
3
3
|
|
|
4
4
|
// src/types/telemetry.ts
|
|
5
5
|
var LogLevel = {
|
|
@@ -81,7 +81,6 @@ function setLogLevel(level) {
|
|
|
81
81
|
// src/constants/index.ts
|
|
82
82
|
var ATOMIC_QUEUE_CONTRACT_ADDRESS = "0x228c44bb4885c6633f4b6c83f14622f37d5112e5";
|
|
83
83
|
var DEFAULT_DEADLINE = 3;
|
|
84
|
-
var NATIVE_TOKEN_FOR_BRIDGE_FEE = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
85
84
|
var CHAINLINK_ADDRESS = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
86
85
|
var DEFAULT_APPROVAL_AMOUNT = BigInt(2) ** BigInt(256) - BigInt(1);
|
|
87
86
|
var API_BASE_URL = "https://api.paxoslabs.com";
|
|
@@ -269,7 +268,7 @@ function validateVaultFilterOptions(options) {
|
|
|
269
268
|
}
|
|
270
269
|
if (options.yieldType !== void 0 && !isValidYieldType(options.yieldType)) {
|
|
271
270
|
throw new APIError(
|
|
272
|
-
`Invalid yieldType: ${options.yieldType}. Must be one of:
|
|
271
|
+
`Invalid yieldType: ${options.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
|
|
273
272
|
{ endpoint: "/v1/earn-sdk/vaults" }
|
|
274
273
|
);
|
|
275
274
|
}
|
|
@@ -300,7 +299,7 @@ function validateAssetFilterOptions(options) {
|
|
|
300
299
|
}
|
|
301
300
|
if (options.yieldType !== void 0 && !isValidYieldType(options.yieldType)) {
|
|
302
301
|
throw new APIError(
|
|
303
|
-
`Invalid yieldType: ${options.yieldType}. Must be one of:
|
|
302
|
+
`Invalid yieldType: ${options.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
|
|
304
303
|
{ endpoint: "/v1/earn-sdk/supported-assets-by-chains" }
|
|
305
304
|
);
|
|
306
305
|
}
|
|
@@ -599,7 +598,7 @@ async function findVaultByConfig(params) {
|
|
|
599
598
|
}
|
|
600
599
|
if (!isValidYieldType(params.yieldType)) {
|
|
601
600
|
throw new APIError(
|
|
602
|
-
`Invalid yieldType: ${params.yieldType}. Must be one of:
|
|
601
|
+
`Invalid yieldType: ${params.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
|
|
603
602
|
{ endpoint: "findVaultByConfig" }
|
|
604
603
|
);
|
|
605
604
|
}
|
|
@@ -960,6 +959,7 @@ var APIError = class _APIError extends Error {
|
|
|
960
959
|
this.statusCode = options?.statusCode;
|
|
961
960
|
this.endpoint = options?.endpoint;
|
|
962
961
|
this.cause = options?.cause;
|
|
962
|
+
Object.setPrototypeOf(this, _APIError.prototype);
|
|
963
963
|
if (Error.captureStackTrace) {
|
|
964
964
|
Error.captureStackTrace(this, _APIError);
|
|
965
965
|
}
|
|
@@ -973,7 +973,7 @@ var APIError = class _APIError extends Error {
|
|
|
973
973
|
}
|
|
974
974
|
};
|
|
975
975
|
function isValidYieldType(value) {
|
|
976
|
-
return typeof value === "string" && (value === "
|
|
976
|
+
return typeof value === "string" && (value === "CORE" || value === "TREASURY" || value === "FRONTIER" || value === "PRIME");
|
|
977
977
|
}
|
|
978
978
|
function isValidAddress(value) {
|
|
979
979
|
return typeof value === "string" && /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
@@ -981,68 +981,64 @@ function isValidAddress(value) {
|
|
|
981
981
|
function isValidChainId(value) {
|
|
982
982
|
return typeof value === "number" && value > 0 && Number.isInteger(value);
|
|
983
983
|
}
|
|
984
|
-
var
|
|
985
|
-
id:
|
|
986
|
-
name: "
|
|
984
|
+
var hyperEvm = defineChain({
|
|
985
|
+
id: 999,
|
|
986
|
+
name: "HyperEVM",
|
|
987
987
|
nativeCurrency: {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
988
|
+
decimals: 18,
|
|
989
|
+
name: "Hyperliquid",
|
|
990
|
+
symbol: "HYPE"
|
|
991
991
|
},
|
|
992
992
|
rpcUrls: {
|
|
993
993
|
default: {
|
|
994
|
-
http: ["https://
|
|
995
|
-
webSocket: ["wss://
|
|
994
|
+
http: ["https://rpc.hyperliquid.xyz/evm"],
|
|
995
|
+
webSocket: ["wss://hyperliquid.drpc.org"]
|
|
996
996
|
}
|
|
997
997
|
},
|
|
998
998
|
blockExplorers: {
|
|
999
|
-
default: {
|
|
1000
|
-
name: "Rari Explorer",
|
|
1001
|
-
url: "https://mainnet.explorer.rarichain.org"
|
|
1002
|
-
}
|
|
999
|
+
default: { name: "Explorer", url: "https://purrsec.com/" }
|
|
1003
1000
|
},
|
|
1004
1001
|
contracts: {
|
|
1005
1002
|
multicall3: {
|
|
1006
|
-
address: "
|
|
1003
|
+
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
1004
|
+
blockCreated: 13051
|
|
1007
1005
|
}
|
|
1008
1006
|
}
|
|
1009
1007
|
});
|
|
1010
|
-
var
|
|
1011
|
-
id:
|
|
1012
|
-
name: "
|
|
1008
|
+
var stableTestnet = defineChain({
|
|
1009
|
+
id: 2201,
|
|
1010
|
+
name: "Stable Testnet",
|
|
1013
1011
|
nativeCurrency: {
|
|
1014
1012
|
decimals: 18,
|
|
1015
|
-
name: "
|
|
1016
|
-
symbol: "
|
|
1013
|
+
name: "Ether",
|
|
1014
|
+
symbol: "ETH"
|
|
1017
1015
|
},
|
|
1018
1016
|
rpcUrls: {
|
|
1019
1017
|
default: {
|
|
1020
|
-
http: ["https://rpc.
|
|
1021
|
-
webSocket: ["wss://hyperliquid.drpc.org"]
|
|
1018
|
+
http: ["https://rpc.testnet.stable.xyz"]
|
|
1022
1019
|
}
|
|
1023
1020
|
},
|
|
1024
1021
|
blockExplorers: {
|
|
1025
|
-
default: { name: "
|
|
1022
|
+
default: { name: "Stablescan", url: "https://testnet.stablescan.xyz" }
|
|
1026
1023
|
},
|
|
1027
1024
|
contracts: {
|
|
1028
1025
|
multicall3: {
|
|
1029
1026
|
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
1030
|
-
blockCreated:
|
|
1027
|
+
blockCreated: 0
|
|
1031
1028
|
}
|
|
1032
|
-
}
|
|
1029
|
+
},
|
|
1030
|
+
testnet: true
|
|
1033
1031
|
});
|
|
1034
1032
|
var CHAIN_ID_TO_CHAIN_MAP = {
|
|
1035
1033
|
[mainnet.id]: mainnet,
|
|
1036
|
-
[boba.id]: boba,
|
|
1037
|
-
[form.id]: form,
|
|
1038
1034
|
[hyperEvm.id]: hyperEvm,
|
|
1039
|
-
[
|
|
1040
|
-
[rari.id]: rari,
|
|
1041
|
-
[sei.id]: sei,
|
|
1042
|
-
[swellchain.id]: swellchain
|
|
1035
|
+
[stableTestnet.id]: stableTestnet
|
|
1043
1036
|
};
|
|
1044
1037
|
|
|
1045
1038
|
// src/utils/chain-utils.ts
|
|
1039
|
+
function toChainId(value) {
|
|
1040
|
+
return typeof value === "number" ? value : Number(value);
|
|
1041
|
+
}
|
|
1046
1042
|
var chainsCache = null;
|
|
1047
1043
|
async function getChainFromConfig(chainId, config) {
|
|
1048
1044
|
if (chainsCache && !config) {
|
|
@@ -1083,6 +1079,6 @@ function clearChainsCache() {
|
|
|
1083
1079
|
chainsCache = null;
|
|
1084
1080
|
}
|
|
1085
1081
|
|
|
1086
|
-
export { APIError, API_BASE_URL, ATOMIC_QUEUE_CONTRACT_ADDRESS, CHAINLINK_ADDRESS, DEFAULT_APPROVAL_AMOUNT, DEFAULT_DEADLINE, LogLevel,
|
|
1087
|
-
//# sourceMappingURL=chunk-
|
|
1088
|
-
//# sourceMappingURL=chunk-
|
|
1082
|
+
export { APIError, API_BASE_URL, ATOMIC_QUEUE_CONTRACT_ADDRESS, CHAINLINK_ADDRESS, DEFAULT_APPROVAL_AMOUNT, DEFAULT_DEADLINE, LogLevel, clearChainsCache, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getChainFromConfig, getLogger, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, refreshVaultCache, setLogLevel, setLogger, toChainId };
|
|
1083
|
+
//# sourceMappingURL=chunk-34FW3NJ5.mjs.map
|
|
1084
|
+
//# sourceMappingURL=chunk-34FW3NJ5.mjs.map
|