@augustdigital/sdk 8.5.0 → 8.6.1
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/README.md +207 -117
- package/lib/adapters/evm/index.d.ts +4 -4
- package/lib/adapters/evm/index.js +2 -0
- package/lib/adapters/solana/constants.d.ts +1 -1
- package/lib/adapters/solana/getters.d.ts +1 -1
- package/lib/adapters/solana/index.d.ts +4 -4
- package/lib/adapters/solana/index.js +4 -0
- package/lib/adapters/solana/types.d.ts +1 -1
- package/lib/adapters/solana/utils.d.ts +3 -3
- package/lib/adapters/solana/vault.actions.d.ts +4 -4
- package/lib/adapters/stellar/actions.d.ts +1 -1
- package/lib/adapters/stellar/index.d.ts +24 -2
- package/lib/adapters/stellar/index.js +25 -2
- package/lib/adapters/stellar/soroban.d.ts +1 -1
- package/lib/adapters/stellar/soroban.js +1 -1
- package/lib/adapters/stellar/submit.d.ts +20 -3
- package/lib/adapters/stellar/submit.js +74 -8
- package/lib/adapters/sui/getters.d.ts +1 -1
- package/lib/adapters/sui/index.d.ts +1 -1
- package/lib/adapters/sui/index.js +2 -0
- package/lib/adapters/sui/transformer.d.ts +2 -2
- package/lib/adapters/sui/transformer.js +1 -0
- package/lib/adapters/sui/types.d.ts +1 -1
- package/lib/core/analytics/instrumentation.js +7 -11
- package/lib/core/analytics/sentry-runtime.js +1 -1
- package/lib/core/analytics/sentry.d.ts +3 -3
- package/lib/core/analytics/sentry.js +31 -5
- package/lib/core/analytics/types.d.ts +1 -1
- package/lib/core/analytics/user-identity.d.ts +2 -2
- package/lib/core/analytics/user-identity.js +1 -1
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/base.class.d.ts +3 -3
- package/lib/core/base.class.js +10 -4
- package/lib/core/constants/adapters.d.ts +1 -1
- package/lib/core/constants/core.d.ts +2 -0
- package/lib/core/constants/core.js +6 -0
- package/lib/core/constants/swap-router.d.ts +37 -1
- package/lib/core/constants/swap-router.js +41 -1
- package/lib/core/constants/vaults.d.ts +1 -1
- package/lib/core/constants/web3.d.ts +1 -1
- package/lib/core/constants/web3.js +0 -3
- package/lib/core/errors/index.d.ts +2 -2
- package/lib/core/errors/index.js +9 -0
- package/lib/core/fetcher.d.ts +39 -39
- package/lib/core/fetcher.js +75 -57
- package/lib/core/helpers/adapters.d.ts +1 -1
- package/lib/core/helpers/chain-error.d.ts +66 -0
- package/lib/core/helpers/chain-error.js +174 -0
- package/lib/core/helpers/core.d.ts +21 -18
- package/lib/core/helpers/core.js +22 -20
- package/lib/core/helpers/explorer-link.d.ts +1 -1
- package/lib/core/helpers/signer.d.ts +1 -1
- package/lib/core/helpers/swap-router.d.ts +1 -1
- package/lib/core/helpers/vault-version.d.ts +1 -1
- package/lib/core/helpers/vaults.d.ts +1 -1
- package/lib/core/helpers/web3.d.ts +2 -2
- package/lib/core/helpers/web3.js +9 -9
- package/lib/core/index.d.ts +1 -0
- package/lib/core/index.js +1 -0
- package/lib/core/vault-metadata.d.ts +1 -1
- package/lib/core/version-check.js +1 -1
- package/lib/evm/methods/crossChainVault.js +1 -1
- package/lib/evm/types/crossChain.js +1 -1
- package/lib/main.d.ts +1 -1
- package/lib/main.js +7 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +2 -2
- package/lib/modules/sub-accounts/main.d.ts +2 -2
- package/lib/modules/sub-accounts/main.js +1 -1
- package/lib/modules/sub-accounts/utils.d.ts +1 -1
- package/lib/modules/vaults/adapter.helpers.d.ts +3 -3
- package/lib/modules/vaults/fetcher.d.ts +25 -0
- package/lib/modules/vaults/fetcher.js +51 -1
- package/lib/modules/vaults/getters.d.ts +50 -50
- package/lib/modules/vaults/getters.js +68 -67
- package/lib/modules/vaults/main.js +3 -1
- package/lib/modules/vaults/read.actions.d.ts +2 -2
- package/lib/modules/vaults/read.actions.js +26 -12
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +1 -1
- package/lib/modules/vaults/utils.d.ts +19 -3
- package/lib/modules/vaults/utils.js +39 -6
- package/lib/modules/vaults/write.actions.js +73 -7
- package/lib/polyfills.js +3 -3
- package/lib/sdk.d.ts +1409 -1198
- package/lib/services/coingecko/fetcher.d.ts +10 -9
- package/lib/services/coingecko/fetcher.js +22 -18
- package/lib/services/debank/fetcher.d.ts +1 -1
- package/lib/services/debank/utils.d.ts +1 -1
- package/lib/services/debank/utils.js +1 -1
- package/lib/services/layerzero/deposits.d.ts +1 -1
- package/lib/services/layerzero/redeems.d.ts +1 -1
- package/lib/services/octavfi/fetcher.d.ts +1 -1
- package/lib/services/octavfi/types.d.ts +1 -1
- package/lib/services/octavfi/utils.d.ts +2 -2
- package/lib/services/subgraph/fetcher.js +1 -1
- package/lib/services/subgraph/vaults.js +86 -3
- package/lib/services/swap-quotes/index.d.ts +9 -0
- package/lib/services/swap-quotes/index.js +2 -1
- package/lib/services/swap-quotes/paraswap.d.ts +8 -0
- package/lib/services/swap-quotes/paraswap.js +8 -0
- package/lib/types/pools.d.ts +2 -2
- package/lib/types/staking.d.ts +1 -1
- package/lib/types/sub-accounts.d.ts +1 -1
- package/lib/types/subgraph.d.ts +10 -1
- package/lib/types/vaults.d.ts +26 -0
- package/lib/types/web3.d.ts +1 -1
- package/lib/types/webserver.d.ts +2 -2
- package/package.json +1 -1
|
@@ -19,10 +19,10 @@ import type { IVaultBaseOptions } from './types';
|
|
|
19
19
|
* Fetch comprehensive vault data including on-chain state and backend metadata.
|
|
20
20
|
* Routes to appropriate chain adapter (EVM v1/v2, Solana, or Stellar) based on vault version.
|
|
21
21
|
* Optionally enriches with loan and allocation data.
|
|
22
|
-
* @param vault Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
|
|
23
|
-
* @param loans Include active loan data
|
|
24
|
-
* @param allocations Include DeFi/CeFi allocation breakdowns
|
|
25
|
-
* @param options RPC and service configuration
|
|
22
|
+
* @param vault - Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
|
|
23
|
+
* @param loans - Include active loan data
|
|
24
|
+
* @param allocations - Include DeFi/CeFi allocation breakdowns
|
|
25
|
+
* @param options - RPC and service configuration
|
|
26
26
|
* @returns Complete vault object with optional enrichments
|
|
27
27
|
*/
|
|
28
28
|
export declare function getVault({ vault, loans, allocations, options, loadSubaccounts, loadSnapshots, }: {
|
|
@@ -48,8 +48,8 @@ export declare function getVaultSubaccountLoans(vault: VaultAddress | IVault, op
|
|
|
48
48
|
* Fetch comprehensive vault asset allocation breakdown.
|
|
49
49
|
* Includes DeFi protocols (via DeBank), CeFi balances, OTC positions, and loans.
|
|
50
50
|
* Categorizes exposures by borrowing, supplying, lending, and wallet holdings.
|
|
51
|
-
* @param vault Vault address
|
|
52
|
-
* @param options RPC configuration
|
|
51
|
+
* @param vault - Vault address
|
|
52
|
+
* @param options - RPC configuration
|
|
53
53
|
* @returns Detailed allocation data with exposure categorization
|
|
54
54
|
*/
|
|
55
55
|
export declare function getVaultAllocations(vault: IAddress, options: IVaultBaseOptions): Promise<IVaultAllocations>;
|
|
@@ -117,8 +117,8 @@ export declare function getVaultTvl({ vault, options, historical, }: {
|
|
|
117
117
|
* `health_factor: undefined` so callers can render an explicit empty state
|
|
118
118
|
* rather than a perpetual loading skeleton.
|
|
119
119
|
*
|
|
120
|
-
* @param vault Vault address to scope the fetch to.
|
|
121
|
-
* @param options Standard vault options — `rpcUrl` must point at `vault`'s chain.
|
|
120
|
+
* @param vault - Vault address to scope the fetch to.
|
|
121
|
+
* @param options - Standard vault options — `rpcUrl` must point at `vault`'s chain.
|
|
122
122
|
* @returns Array of `IVaultBorrowerHealthFactor`, one entry per active loan.
|
|
123
123
|
*/
|
|
124
124
|
export declare function getVaultBorrowerHealthFactor({ vault, options, }: {
|
|
@@ -141,8 +141,8 @@ export declare function getVaultBorrowerHealthFactor({ vault, options, }: {
|
|
|
141
141
|
* look up entries without worrying about EIP-55 checksum casing in either the
|
|
142
142
|
* backend response or the caller's input.
|
|
143
143
|
*
|
|
144
|
-
* @param options Standard vault options — `rpcUrl` should match `vault`'s chain.
|
|
145
|
-
* @param vault Optional vault address to scope the fetch to.
|
|
144
|
+
* @param options - Standard vault options — `rpcUrl` should match `vault`'s chain.
|
|
145
|
+
* @param vault - Optional vault address to scope the fetch to.
|
|
146
146
|
* @returns Map of lowercased vault address → array of borrower-health-factor rows.
|
|
147
147
|
*/
|
|
148
148
|
export declare function getHealthFactorOfBorrowersByVault({ options, vault, }: {
|
|
@@ -152,8 +152,8 @@ export declare function getHealthFactorOfBorrowersByVault({ options, vault, }: {
|
|
|
152
152
|
/**
|
|
153
153
|
* Fetch user points from the backend API endpoint.
|
|
154
154
|
* This replaces client-side points calculation with server-side processing.
|
|
155
|
-
* @param userAddress User wallet address (EVM or Solana)
|
|
156
|
-
* @param options Request options including headers
|
|
155
|
+
* @param userAddress - User wallet address (EVM or Solana)
|
|
156
|
+
* @param options - Request options including headers
|
|
157
157
|
* @returns Points data from the backend API
|
|
158
158
|
*/
|
|
159
159
|
export declare function getUserPoints({ userAddress, options, }: {
|
|
@@ -180,24 +180,24 @@ export declare function getUserPoints({ userAddress, options, }: {
|
|
|
180
180
|
* expires: {expiry}
|
|
181
181
|
* ```
|
|
182
182
|
*
|
|
183
|
-
* @param userAddress EVM wallet address being registered. Must match the
|
|
183
|
+
* @param userAddress - EVM wallet address being registered. Must match the
|
|
184
184
|
* signer that produced `signature`. Lowercased before being embedded in
|
|
185
185
|
* the canonical message.
|
|
186
|
-
* @param referrerAddress Optional EVM address that referred this user.
|
|
186
|
+
* @param referrerAddress - Optional EVM address that referred this user.
|
|
187
187
|
* Lowercased when embedded; the literal string `"none"` is used when
|
|
188
188
|
* absent. Tampering with this field after signing produces 401.
|
|
189
|
-
* @param chainId Chain on which the wallet signed. For smart-contract wallets
|
|
189
|
+
* @param chainId - Chain on which the wallet signed. For smart-contract wallets
|
|
190
190
|
* (Safe etc.) this is the chain whose RPC the backend will use to run the
|
|
191
191
|
* EIP-1271 `isValidSignature` check; for EOAs it still pins the signature
|
|
192
192
|
* to a chain so it can't be replayed cross-chain. Must be one of the chains
|
|
193
193
|
* Upshift supports (see backend `SUPPORTED_REGISTRATION_CHAINS`).
|
|
194
|
-
* @param signature `0x`-prefixed hex of the personal_sign signature over
|
|
194
|
+
* @param signature - `0x`-prefixed hex of the personal_sign signature over
|
|
195
195
|
* the canonical message. Single-use: replays within ~10 min are rejected.
|
|
196
|
-
* @param nonce Caller-generated random string (8–128 chars). Pair with
|
|
196
|
+
* @param nonce - Caller-generated random string (8–128 chars). Pair with
|
|
197
197
|
* `userAddress` to form the single-use key in the backend's nonce store.
|
|
198
|
-
* @param expiry Unix timestamp (seconds). Must be in the future and within
|
|
198
|
+
* @param expiry - Unix timestamp (seconds). Must be in the future and within
|
|
199
199
|
* the backend's TTL window (currently 10 min).
|
|
200
|
-
* @param options Request options (headers).
|
|
200
|
+
* @param options - Request options (headers).
|
|
201
201
|
* @returns Raw `Response` from the backend. 200 on success, 401 for
|
|
202
202
|
* expired / replayed / mismatched-signer / tampered-referrer, 422 for an
|
|
203
203
|
* unsupported `chainId`.
|
|
@@ -227,8 +227,8 @@ export declare function registerUserForPoints({ userAddress, referrerAddress, ch
|
|
|
227
227
|
}): Promise<Response>;
|
|
228
228
|
/**
|
|
229
229
|
* Fetch the points leaderboard data.
|
|
230
|
-
* @param params Optional parameters for pagination and sorting
|
|
231
|
-
* @param options Request options including headers
|
|
230
|
+
* @param params - Optional parameters for pagination and sorting
|
|
231
|
+
* @param options - Request options including headers
|
|
232
232
|
* @returns Leaderboard response data
|
|
233
233
|
*/
|
|
234
234
|
export declare function fetchPointsLeaderboard({ params, options, }: {
|
|
@@ -242,8 +242,8 @@ export declare function fetchPointsLeaderboard({ params, options, }: {
|
|
|
242
242
|
/**
|
|
243
243
|
* Fetch the timestamp when yield was last realized for a vault.
|
|
244
244
|
* Returns the assetsUpdatedOn timestamp from the vault contract.
|
|
245
|
-
* @param vault Vault contract address
|
|
246
|
-
* @param options RPC configuration
|
|
245
|
+
* @param vault - Vault contract address
|
|
246
|
+
* @param options - RPC configuration
|
|
247
247
|
* @returns Timestamp (Unix timestamp in seconds) when yield was last realized
|
|
248
248
|
*/
|
|
249
249
|
export declare function getYieldLastRealizedOn({ vault, options, }: {
|
|
@@ -258,9 +258,9 @@ export declare function getYieldLastRealizedOn({ vault, options, }: {
|
|
|
258
258
|
* 2. Fetch user's current assets (balanceOf * sharePrice via convertToAssets)
|
|
259
259
|
* 3. Calculate PnL = assets withdrawn + current assets - assets deposited
|
|
260
260
|
*
|
|
261
|
-
* @param vault Vault contract address
|
|
262
|
-
* @param wallet User wallet address
|
|
263
|
-
* @param options RPC configuration and service options
|
|
261
|
+
* @param vault - Vault contract address
|
|
262
|
+
* @param wallet - User wallet address
|
|
263
|
+
* @param options - RPC configuration and service options
|
|
264
264
|
* @returns Lifetime PnL data in both native token and USD
|
|
265
265
|
*/
|
|
266
266
|
export declare function getVaultUserLifetimePnl({ vault, wallet, options, }: {
|
|
@@ -273,8 +273,8 @@ export declare function getVaultUserLifetimePnl({ vault, wallet, options, }: {
|
|
|
273
273
|
* Calculate PnL for a vault (vault-level, not user-specific).
|
|
274
274
|
* Returns the vault's overall profit and loss across all users.
|
|
275
275
|
*
|
|
276
|
-
* @param vault Vault contract address
|
|
277
|
-
* @param options RPC configuration and service options
|
|
276
|
+
* @param vault - Vault contract address
|
|
277
|
+
* @param options - RPC configuration and service options
|
|
278
278
|
* @returns Vault PnL in USD and notional value
|
|
279
279
|
*/
|
|
280
280
|
export declare function getVaultPnl({ vault, options, }: {
|
|
@@ -295,8 +295,8 @@ export declare function getVaultHistoricalTimeseries({ vault, nDays, options, }:
|
|
|
295
295
|
* These fields will be removed on 2026-01-01.
|
|
296
296
|
* Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
|
|
297
297
|
*
|
|
298
|
-
* @param vault Vault contract address
|
|
299
|
-
* @param options Request options including headers
|
|
298
|
+
* @param vault - Vault contract address
|
|
299
|
+
* @param options - Request options including headers
|
|
300
300
|
* @returns Annualized APY data including liquidity APY
|
|
301
301
|
*/
|
|
302
302
|
export declare function getVaultAnnualizedApy({ vault, options, }: {
|
|
@@ -305,8 +305,8 @@ export declare function getVaultAnnualizedApy({ vault, options, }: {
|
|
|
305
305
|
}): Promise<IVaultAnnualizedApy>;
|
|
306
306
|
/**
|
|
307
307
|
* Fetch summary data for a vault (name, type, chain, recent returns).
|
|
308
|
-
* @param vault Vault contract address
|
|
309
|
-
* @param options Request options including headers
|
|
308
|
+
* @param vault - Vault contract address
|
|
309
|
+
* @param options - Request options including headers
|
|
310
310
|
* @returns Vault summary data
|
|
311
311
|
*/
|
|
312
312
|
export declare function getVaultSummary({ vault, options, }: {
|
|
@@ -315,9 +315,9 @@ export declare function getVaultSummary({ vault, options, }: {
|
|
|
315
315
|
}): Promise<IVaultSummary>;
|
|
316
316
|
/**
|
|
317
317
|
* Fetch withdrawal summary and pending queue for a vault.
|
|
318
|
-
* @param vault Vault contract address
|
|
319
|
-
* @param chain Chain identifier (e.g., chain ID as string)
|
|
320
|
-
* @param options Request options including headers
|
|
318
|
+
* @param vault - Vault contract address
|
|
319
|
+
* @param chain - Chain identifier (e.g., chain ID as string)
|
|
320
|
+
* @param options - Request options including headers
|
|
321
321
|
* @returns Withdrawal summary and pending queue
|
|
322
322
|
*/
|
|
323
323
|
export declare function getVaultWithdrawals({ vault, chain, options, }: {
|
|
@@ -327,10 +327,10 @@ export declare function getVaultWithdrawals({ vault, chain, options, }: {
|
|
|
327
327
|
}): Promise<IVaultWithdrawals>;
|
|
328
328
|
/**
|
|
329
329
|
* Fetch pending redemptions for a vault with liquidity analysis.
|
|
330
|
-
* @param vault Vault contract address
|
|
331
|
-
* @param pastDays Number of past days to include (default 7, min 1, max 30)
|
|
332
|
-
* @param futureDays Number of future days to include (default 14, min 1, max 30)
|
|
333
|
-
* @param options Request options including headers
|
|
330
|
+
* @param vault - Vault contract address
|
|
331
|
+
* @param pastDays - Number of past days to include (default 7, min 1, max 30)
|
|
332
|
+
* @param futureDays - Number of future days to include (default 14, min 1, max 30)
|
|
333
|
+
* @param options - Request options including headers
|
|
334
334
|
* @returns Pending redemptions grouped by date with liquidity summary
|
|
335
335
|
*/
|
|
336
336
|
export declare function getVaultPendingRedemptions({ vault, pastDays, futureDays, options, }: {
|
|
@@ -341,10 +341,10 @@ export declare function getVaultPendingRedemptions({ vault, pastDays, futureDays
|
|
|
341
341
|
}): Promise<IVaultPendingRedemptions>;
|
|
342
342
|
/**
|
|
343
343
|
* Preview the amount of assets that would be received for redeeming shares (queued redemption).
|
|
344
|
-
* @param vault Vault contract address
|
|
345
|
-
* @param sharesAmount Amount of shares to redeem (human-readable, raw bigint, or string)
|
|
346
|
-
* @param options RPC configuration
|
|
347
|
-
* @returns The amount of assets as INormalizedNumber
|
|
344
|
+
* @param vault - Vault contract address
|
|
345
|
+
* @param sharesAmount - Amount of shares to redeem (human-readable, raw bigint, or string)
|
|
346
|
+
* @param options - RPC configuration
|
|
347
|
+
* @returns The amount of assets as an INormalizedNumber with `normalized` and `raw` fields
|
|
348
348
|
*/
|
|
349
349
|
export declare function getPreviewRedemption({ vault, sharesAmount, options, }: {
|
|
350
350
|
vault: IAddress;
|
|
@@ -409,13 +409,13 @@ export interface WithdrawalRequestStatus {
|
|
|
409
409
|
* - `'ready_to_claim'` — Claimable date has passed (within the lookback window) but no processed event found.
|
|
410
410
|
* - `'pending'` — Claimable date is still in the future.
|
|
411
411
|
*
|
|
412
|
-
* @param params - Query parameters
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
412
|
+
* @param params - Query parameters:
|
|
413
|
+
* - `vault` — Vault address to query.
|
|
414
|
+
* - `receiver` — (Optional) Filter by receiver address.
|
|
415
|
+
* - `lookbackBlocks` — (Optional) On-chain log lookback window in blocks.
|
|
416
|
+
* Defaults to a chain-specific value (e.g. 150,000 for Ethereum, 3,456,000 for Monad).
|
|
417
|
+
* Increasing this scans more history but requires more RPC calls.
|
|
418
|
+
* - `options` — Standard vault query options (provider, RPC URL, etc.).
|
|
419
419
|
* @returns Array of withdrawal requests with status and claimable dates
|
|
420
420
|
*
|
|
421
421
|
* @example
|
|
@@ -103,10 +103,10 @@ const redeems_1 = require("../../services/layerzero/redeems");
|
|
|
103
103
|
* Fetch comprehensive vault data including on-chain state and backend metadata.
|
|
104
104
|
* Routes to appropriate chain adapter (EVM v1/v2, Solana, or Stellar) based on vault version.
|
|
105
105
|
* Optionally enriches with loan and allocation data.
|
|
106
|
-
* @param vault Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
|
|
107
|
-
* @param loans Include active loan data
|
|
108
|
-
* @param allocations Include DeFi/CeFi allocation breakdowns
|
|
109
|
-
* @param options RPC and service configuration
|
|
106
|
+
* @param vault - Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
|
|
107
|
+
* @param loans - Include active loan data
|
|
108
|
+
* @param allocations - Include DeFi/CeFi allocation breakdowns
|
|
109
|
+
* @param options - RPC and service configuration
|
|
110
110
|
* @returns Complete vault object with optional enrichments
|
|
111
111
|
*/
|
|
112
112
|
async function getVault({ vault, loans = false, allocations = false, options, loadSubaccounts, loadSnapshots, }) {
|
|
@@ -355,8 +355,8 @@ async function getVaultSubaccountLoans(vault, options) {
|
|
|
355
355
|
* Fetch comprehensive vault asset allocation breakdown.
|
|
356
356
|
* Includes DeFi protocols (via DeBank), CeFi balances, OTC positions, and loans.
|
|
357
357
|
* Categorizes exposures by borrowing, supplying, lending, and wallet holdings.
|
|
358
|
-
* @param vault Vault address
|
|
359
|
-
* @param options RPC configuration
|
|
358
|
+
* @param vault - Vault address
|
|
359
|
+
* @param options - RPC configuration
|
|
360
360
|
* @returns Detailed allocation data with exposure categorization
|
|
361
361
|
*/
|
|
362
362
|
async function getVaultAllocations(vault, options) {
|
|
@@ -604,9 +604,9 @@ async function getVaultAvailableRedemptions({ vault, wallet, options, }) {
|
|
|
604
604
|
core_1.Logger.log.warn('getVaultAvailableRedemptions', `Skipping invalid event: ${ev}`);
|
|
605
605
|
continue;
|
|
606
606
|
}
|
|
607
|
-
let month;
|
|
608
|
-
let day;
|
|
609
|
-
let year;
|
|
607
|
+
let month = 0;
|
|
608
|
+
let day = 0;
|
|
609
|
+
let year = 0;
|
|
610
610
|
if (version === 'evm-2') {
|
|
611
611
|
// Use UTC-based computeClaimableDate to mirror contract logic exactly
|
|
612
612
|
const claimable = (0, date_utils_1.computeClaimableDate)(Number(ev.timestamp_), lagDuration);
|
|
@@ -931,11 +931,12 @@ async function getVaultRedemptionHistory({ vault, wallet, lookbackBlocks, option
|
|
|
931
931
|
if (isV2 && logs.length > 0) {
|
|
932
932
|
const uniqueBlocks = [...new Set(logs.map((l) => l.blockNumber))];
|
|
933
933
|
const blockResults = await Promise.all(uniqueBlocks.map((bn) => provider.getBlock(bn)));
|
|
934
|
-
|
|
934
|
+
const timestamps = new Map();
|
|
935
935
|
blockResults.forEach((block) => {
|
|
936
936
|
if (block)
|
|
937
|
-
|
|
937
|
+
timestamps.set(block.number, block.timestamp);
|
|
938
938
|
});
|
|
939
|
+
blockTimestamps = timestamps;
|
|
939
940
|
}
|
|
940
941
|
// format — iterate logs directly to preserve transactionHash
|
|
941
942
|
const redemptions = [];
|
|
@@ -1190,7 +1191,7 @@ async function getVaultApy({ vault, options, historical, }) {
|
|
|
1190
1191
|
const query = urlParams.toString();
|
|
1191
1192
|
if (!query)
|
|
1192
1193
|
return '';
|
|
1193
|
-
return baseUrl
|
|
1194
|
+
return baseUrl?.includes('?') ? `&${query}` : `?${query}`;
|
|
1194
1195
|
}
|
|
1195
1196
|
const baseUrl = core_1.WEBSERVER_ENDPOINTS.public.tokenizedVault.historicalApy(vault);
|
|
1196
1197
|
const historicalApy = await (0, core_1.fetchAugustPublic)(`${baseUrl}${paramBuilder(historical, baseUrl)}`, {
|
|
@@ -1357,15 +1358,15 @@ async function getVaultTvl({ vault, options, historical, }) {
|
|
|
1357
1358
|
case 'evm-2': {
|
|
1358
1359
|
const receiptTokenAddress = await (0, core_1.getReceiptTokenAddress)(provider, vault);
|
|
1359
1360
|
const receiptTokenDecimals = await (0, core_1.getDecimals)(provider, receiptTokenAddress, false);
|
|
1360
|
-
const
|
|
1361
|
-
address:
|
|
1362
|
-
abi:
|
|
1361
|
+
const vaultContract = (0, core_1.createContract)({
|
|
1362
|
+
address: vault,
|
|
1363
|
+
abi: TokenizedVaultV2_1.ABI_TOKENIZED_VAULT_V2,
|
|
1363
1364
|
provider,
|
|
1364
1365
|
});
|
|
1365
|
-
const
|
|
1366
|
+
const totalAssets = await vaultContract.getTotalAssets();
|
|
1366
1367
|
return [
|
|
1367
1368
|
{
|
|
1368
|
-
value: (0, core_1.toNormalizedBn)(
|
|
1369
|
+
value: (0, core_1.toNormalizedBn)(totalAssets, receiptTokenDecimals),
|
|
1369
1370
|
timestamp: new Date().toISOString(),
|
|
1370
1371
|
},
|
|
1371
1372
|
];
|
|
@@ -1377,10 +1378,10 @@ async function getVaultTvl({ vault, options, historical, }) {
|
|
|
1377
1378
|
provider,
|
|
1378
1379
|
});
|
|
1379
1380
|
const decimals = await (0, core_1.getDecimals)(provider, vault);
|
|
1380
|
-
const
|
|
1381
|
+
const totalAssets = await vaultContract.totalAssets();
|
|
1381
1382
|
return [
|
|
1382
1383
|
{
|
|
1383
|
-
value: (0, core_1.toNormalizedBn)(
|
|
1384
|
+
value: (0, core_1.toNormalizedBn)(totalAssets, decimals),
|
|
1384
1385
|
timestamp: new Date().toISOString(),
|
|
1385
1386
|
},
|
|
1386
1387
|
];
|
|
@@ -1495,8 +1496,8 @@ async function getVaultTvl({ vault, options, historical, }) {
|
|
|
1495
1496
|
* `health_factor: undefined` so callers can render an explicit empty state
|
|
1496
1497
|
* rather than a perpetual loading skeleton.
|
|
1497
1498
|
*
|
|
1498
|
-
* @param vault Vault address to scope the fetch to.
|
|
1499
|
-
* @param options Standard vault options — `rpcUrl` must point at `vault`'s chain.
|
|
1499
|
+
* @param vault - Vault address to scope the fetch to.
|
|
1500
|
+
* @param options - Standard vault options — `rpcUrl` must point at `vault`'s chain.
|
|
1500
1501
|
* @returns Array of `IVaultBorrowerHealthFactor`, one entry per active loan.
|
|
1501
1502
|
*/
|
|
1502
1503
|
async function getVaultBorrowerHealthFactor({ vault, options, }) {
|
|
@@ -1588,8 +1589,8 @@ async function getVaultBorrowerHealthFactor({ vault, options, }) {
|
|
|
1588
1589
|
* look up entries without worrying about EIP-55 checksum casing in either the
|
|
1589
1590
|
* backend response or the caller's input.
|
|
1590
1591
|
*
|
|
1591
|
-
* @param options Standard vault options — `rpcUrl` should match `vault`'s chain.
|
|
1592
|
-
* @param vault Optional vault address to scope the fetch to.
|
|
1592
|
+
* @param options - Standard vault options — `rpcUrl` should match `vault`'s chain.
|
|
1593
|
+
* @param vault - Optional vault address to scope the fetch to.
|
|
1593
1594
|
* @returns Map of lowercased vault address → array of borrower-health-factor rows.
|
|
1594
1595
|
*/
|
|
1595
1596
|
async function getHealthFactorOfBorrowersByVault({ options, vault, }) {
|
|
@@ -1620,8 +1621,8 @@ async function getHealthFactorOfBorrowersByVault({ options, vault, }) {
|
|
|
1620
1621
|
/**
|
|
1621
1622
|
* Fetch user points from the backend API endpoint.
|
|
1622
1623
|
* This replaces client-side points calculation with server-side processing.
|
|
1623
|
-
* @param userAddress User wallet address (EVM or Solana)
|
|
1624
|
-
* @param options Request options including headers
|
|
1624
|
+
* @param userAddress - User wallet address (EVM or Solana)
|
|
1625
|
+
* @param options - Request options including headers
|
|
1625
1626
|
* @returns Points data from the backend API
|
|
1626
1627
|
*/
|
|
1627
1628
|
async function getUserPoints({ userAddress, options, }) {
|
|
@@ -1665,24 +1666,24 @@ async function getUserPoints({ userAddress, options, }) {
|
|
|
1665
1666
|
* expires: {expiry}
|
|
1666
1667
|
* ```
|
|
1667
1668
|
*
|
|
1668
|
-
* @param userAddress EVM wallet address being registered. Must match the
|
|
1669
|
+
* @param userAddress - EVM wallet address being registered. Must match the
|
|
1669
1670
|
* signer that produced `signature`. Lowercased before being embedded in
|
|
1670
1671
|
* the canonical message.
|
|
1671
|
-
* @param referrerAddress Optional EVM address that referred this user.
|
|
1672
|
+
* @param referrerAddress - Optional EVM address that referred this user.
|
|
1672
1673
|
* Lowercased when embedded; the literal string `"none"` is used when
|
|
1673
1674
|
* absent. Tampering with this field after signing produces 401.
|
|
1674
|
-
* @param chainId Chain on which the wallet signed. For smart-contract wallets
|
|
1675
|
+
* @param chainId - Chain on which the wallet signed. For smart-contract wallets
|
|
1675
1676
|
* (Safe etc.) this is the chain whose RPC the backend will use to run the
|
|
1676
1677
|
* EIP-1271 `isValidSignature` check; for EOAs it still pins the signature
|
|
1677
1678
|
* to a chain so it can't be replayed cross-chain. Must be one of the chains
|
|
1678
1679
|
* Upshift supports (see backend `SUPPORTED_REGISTRATION_CHAINS`).
|
|
1679
|
-
* @param signature `0x`-prefixed hex of the personal_sign signature over
|
|
1680
|
+
* @param signature - `0x`-prefixed hex of the personal_sign signature over
|
|
1680
1681
|
* the canonical message. Single-use: replays within ~10 min are rejected.
|
|
1681
|
-
* @param nonce Caller-generated random string (8–128 chars). Pair with
|
|
1682
|
+
* @param nonce - Caller-generated random string (8–128 chars). Pair with
|
|
1682
1683
|
* `userAddress` to form the single-use key in the backend's nonce store.
|
|
1683
|
-
* @param expiry Unix timestamp (seconds). Must be in the future and within
|
|
1684
|
+
* @param expiry - Unix timestamp (seconds). Must be in the future and within
|
|
1684
1685
|
* the backend's TTL window (currently 10 min).
|
|
1685
|
-
* @param options Request options (headers).
|
|
1686
|
+
* @param options - Request options (headers).
|
|
1686
1687
|
* @returns Raw `Response` from the backend. 200 on success, 401 for
|
|
1687
1688
|
* expired / replayed / mismatched-signer / tampered-referrer, 422 for an
|
|
1688
1689
|
* unsupported `chainId`.
|
|
@@ -1735,8 +1736,8 @@ async function registerUserForPoints({ userAddress, referrerAddress, chainId, si
|
|
|
1735
1736
|
}
|
|
1736
1737
|
/**
|
|
1737
1738
|
* Fetch the points leaderboard data.
|
|
1738
|
-
* @param params Optional parameters for pagination and sorting
|
|
1739
|
-
* @param options Request options including headers
|
|
1739
|
+
* @param params - Optional parameters for pagination and sorting
|
|
1740
|
+
* @param options - Request options including headers
|
|
1740
1741
|
* @returns Leaderboard response data
|
|
1741
1742
|
*/
|
|
1742
1743
|
async function fetchPointsLeaderboard({ params, options, }) {
|
|
@@ -1764,8 +1765,8 @@ async function fetchPointsLeaderboard({ params, options, }) {
|
|
|
1764
1765
|
/**
|
|
1765
1766
|
* Fetch the timestamp when yield was last realized for a vault.
|
|
1766
1767
|
* Returns the assetsUpdatedOn timestamp from the vault contract.
|
|
1767
|
-
* @param vault Vault contract address
|
|
1768
|
-
* @param options RPC configuration
|
|
1768
|
+
* @param vault - Vault contract address
|
|
1769
|
+
* @param options - RPC configuration
|
|
1769
1770
|
* @returns Timestamp (Unix timestamp in seconds) when yield was last realized
|
|
1770
1771
|
*/
|
|
1771
1772
|
async function getYieldLastRealizedOn({ vault, options, }) {
|
|
@@ -1822,9 +1823,9 @@ async function getYieldLastRealizedOn({ vault, options, }) {
|
|
|
1822
1823
|
* 2. Fetch user's current assets (balanceOf * sharePrice via convertToAssets)
|
|
1823
1824
|
* 3. Calculate PnL = assets withdrawn + current assets - assets deposited
|
|
1824
1825
|
*
|
|
1825
|
-
* @param vault Vault contract address
|
|
1826
|
-
* @param wallet User wallet address
|
|
1827
|
-
* @param options RPC configuration and service options
|
|
1826
|
+
* @param vault - Vault contract address
|
|
1827
|
+
* @param wallet - User wallet address
|
|
1828
|
+
* @param options - RPC configuration and service options
|
|
1828
1829
|
* @returns Lifetime PnL data in both native token and USD
|
|
1829
1830
|
*/
|
|
1830
1831
|
async function getVaultUserLifetimePnl({ vault, wallet, options, }) {
|
|
@@ -2196,8 +2197,8 @@ async function getVaultUserLifetimePnl({ vault, wallet, options, }) {
|
|
|
2196
2197
|
* Calculate PnL for a vault (vault-level, not user-specific).
|
|
2197
2198
|
* Returns the vault's overall profit and loss across all users.
|
|
2198
2199
|
*
|
|
2199
|
-
* @param vault Vault contract address
|
|
2200
|
-
* @param options RPC configuration and service options
|
|
2200
|
+
* @param vault - Vault contract address
|
|
2201
|
+
* @param options - RPC configuration and service options
|
|
2201
2202
|
* @returns Vault PnL in USD and notional value
|
|
2202
2203
|
*/
|
|
2203
2204
|
async function getVaultPnl({ vault, options, }) {
|
|
@@ -2254,7 +2255,7 @@ async function getVaultPnl({ vault, options, }) {
|
|
|
2254
2255
|
const dateKey = dayDate.toISOString().split('T')[0];
|
|
2255
2256
|
// Find matching snapshot for this date
|
|
2256
2257
|
const snapshot = snapshotsByDate.get(dateKey);
|
|
2257
|
-
if (!snapshot
|
|
2258
|
+
if (!snapshot?.total_shares) {
|
|
2258
2259
|
core_1.Logger.log.warn('getVaultPnl:snapshotNotFound', `No snapshot found for date ${dateKey}`);
|
|
2259
2260
|
return;
|
|
2260
2261
|
}
|
|
@@ -2301,9 +2302,9 @@ async function getVaultPnl({ vault, options, }) {
|
|
|
2301
2302
|
/*
|
|
2302
2303
|
* Fetch historical timeseries data for a vault.
|
|
2303
2304
|
* Returns TVL, APY, PnL, share price, and other metrics over time.
|
|
2304
|
-
* @param vault Vault contract address
|
|
2305
|
-
* @param nDays Number of days of historical data (default 30, min 1)
|
|
2306
|
-
* @param options Request options including headers
|
|
2305
|
+
* @param vault - Vault contract address
|
|
2306
|
+
* @param nDays - Number of days of historical data (default 30, min 1)
|
|
2307
|
+
* @param options - Request options including headers
|
|
2307
2308
|
* @returns Historical timeseries data with date string keys
|
|
2308
2309
|
*/
|
|
2309
2310
|
async function getVaultHistoricalTimeseries({ vault, nDays, options, }) {
|
|
@@ -2328,8 +2329,8 @@ async function getVaultHistoricalTimeseries({ vault, nDays, options, }) {
|
|
|
2328
2329
|
* These fields will be removed on 2026-01-01.
|
|
2329
2330
|
* Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
|
|
2330
2331
|
*
|
|
2331
|
-
* @param vault Vault contract address
|
|
2332
|
-
* @param options Request options including headers
|
|
2332
|
+
* @param vault - Vault contract address
|
|
2333
|
+
* @param options - Request options including headers
|
|
2333
2334
|
* @returns Annualized APY data including liquidity APY
|
|
2334
2335
|
*/
|
|
2335
2336
|
async function getVaultAnnualizedApy({ vault, options, }) {
|
|
@@ -2358,8 +2359,8 @@ async function getVaultAnnualizedApy({ vault, options, }) {
|
|
|
2358
2359
|
}
|
|
2359
2360
|
/**
|
|
2360
2361
|
* Fetch summary data for a vault (name, type, chain, recent returns).
|
|
2361
|
-
* @param vault Vault contract address
|
|
2362
|
-
* @param options Request options including headers
|
|
2362
|
+
* @param vault - Vault contract address
|
|
2363
|
+
* @param options - Request options including headers
|
|
2363
2364
|
* @returns Vault summary data
|
|
2364
2365
|
*/
|
|
2365
2366
|
async function getVaultSummary({ vault, options, }) {
|
|
@@ -2389,9 +2390,9 @@ async function getVaultSummary({ vault, options, }) {
|
|
|
2389
2390
|
}
|
|
2390
2391
|
/**
|
|
2391
2392
|
* Fetch withdrawal summary and pending queue for a vault.
|
|
2392
|
-
* @param vault Vault contract address
|
|
2393
|
-
* @param chain Chain identifier (e.g., chain ID as string)
|
|
2394
|
-
* @param options Request options including headers
|
|
2393
|
+
* @param vault - Vault contract address
|
|
2394
|
+
* @param chain - Chain identifier (e.g., chain ID as string)
|
|
2395
|
+
* @param options - Request options including headers
|
|
2395
2396
|
* @returns Withdrawal summary and pending queue
|
|
2396
2397
|
*/
|
|
2397
2398
|
async function getVaultWithdrawals({ vault, chain, options, }) {
|
|
@@ -2424,10 +2425,10 @@ async function getVaultWithdrawals({ vault, chain, options, }) {
|
|
|
2424
2425
|
}
|
|
2425
2426
|
/**
|
|
2426
2427
|
* Fetch pending redemptions for a vault with liquidity analysis.
|
|
2427
|
-
* @param vault Vault contract address
|
|
2428
|
-
* @param pastDays Number of past days to include (default 7, min 1, max 30)
|
|
2429
|
-
* @param futureDays Number of future days to include (default 14, min 1, max 30)
|
|
2430
|
-
* @param options Request options including headers
|
|
2428
|
+
* @param vault - Vault contract address
|
|
2429
|
+
* @param pastDays - Number of past days to include (default 7, min 1, max 30)
|
|
2430
|
+
* @param futureDays - Number of future days to include (default 14, min 1, max 30)
|
|
2431
|
+
* @param options - Request options including headers
|
|
2431
2432
|
* @returns Pending redemptions grouped by date with liquidity summary
|
|
2432
2433
|
*/
|
|
2433
2434
|
async function getVaultPendingRedemptions({ vault, pastDays, futureDays, options, }) {
|
|
@@ -2499,10 +2500,10 @@ async function getVaultPendingRedemptions({ vault, pastDays, futureDays, options
|
|
|
2499
2500
|
}
|
|
2500
2501
|
/**
|
|
2501
2502
|
* Preview the amount of assets that would be received for redeeming shares (queued redemption).
|
|
2502
|
-
* @param vault Vault contract address
|
|
2503
|
-
* @param sharesAmount Amount of shares to redeem (human-readable, raw bigint, or string)
|
|
2504
|
-
* @param options RPC configuration
|
|
2505
|
-
* @returns The amount of assets as INormalizedNumber
|
|
2503
|
+
* @param vault - Vault contract address
|
|
2504
|
+
* @param sharesAmount - Amount of shares to redeem (human-readable, raw bigint, or string)
|
|
2505
|
+
* @param options - RPC configuration
|
|
2506
|
+
* @returns The amount of assets as an INormalizedNumber with `normalized` and `raw` fields
|
|
2506
2507
|
*/
|
|
2507
2508
|
async function getPreviewRedemption({ vault, sharesAmount, options, }) {
|
|
2508
2509
|
try {
|
|
@@ -2599,13 +2600,13 @@ async function decodeProcessingTransaction(txHash, provider, iface) {
|
|
|
2599
2600
|
* - `'ready_to_claim'` — Claimable date has passed (within the lookback window) but no processed event found.
|
|
2600
2601
|
* - `'pending'` — Claimable date is still in the future.
|
|
2601
2602
|
*
|
|
2602
|
-
* @param params - Query parameters
|
|
2603
|
-
*
|
|
2604
|
-
*
|
|
2605
|
-
*
|
|
2606
|
-
*
|
|
2607
|
-
*
|
|
2608
|
-
*
|
|
2603
|
+
* @param params - Query parameters:
|
|
2604
|
+
* - `vault` — Vault address to query.
|
|
2605
|
+
* - `receiver` — (Optional) Filter by receiver address.
|
|
2606
|
+
* - `lookbackBlocks` — (Optional) On-chain log lookback window in blocks.
|
|
2607
|
+
* Defaults to a chain-specific value (e.g. 150,000 for Ethereum, 3,456,000 for Monad).
|
|
2608
|
+
* Increasing this scans more history but requires more RPC calls.
|
|
2609
|
+
* - `options` — Standard vault query options (provider, RPC URL, etc.).
|
|
2609
2610
|
* @returns Array of withdrawal requests with status and claimable dates
|
|
2610
2611
|
*
|
|
2611
2612
|
* @example
|
|
@@ -71,9 +71,11 @@ const read_actions_1 = require("./read.actions");
|
|
|
71
71
|
* Supports both EVM and Solana vaults with unified interface.
|
|
72
72
|
*/
|
|
73
73
|
class AugustVaults extends core_1.AugustBase {
|
|
74
|
+
solanaService;
|
|
75
|
+
suiService;
|
|
76
|
+
headers = null;
|
|
74
77
|
constructor(baseConfig, solana, sui) {
|
|
75
78
|
super(baseConfig);
|
|
76
|
-
this.headers = null;
|
|
77
79
|
this.solanaService = solana;
|
|
78
80
|
this.suiService = sui || new sui_1.default();
|
|
79
81
|
this.headers = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IAddress, IContractRunner, INormalizedNumber } from '../../types';
|
|
2
|
-
import { IContractWriteOptions } from './write.actions';
|
|
1
|
+
import type { IAddress, IContractRunner, INormalizedNumber } from '../../types';
|
|
2
|
+
import type { IContractWriteOptions } from './write.actions';
|
|
3
3
|
/**
|
|
4
4
|
* Function to fetch instant redemption fee
|
|
5
5
|
* @param signer - signer / provider object
|