@augustdigital/sdk 8.3.1 → 8.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/lib/abis/ERC20_Bytes32.d.ts +4 -0
- package/lib/abis/ERC20_Bytes32.js +4 -0
- package/lib/abis/ERC4626.d.ts +1 -0
- package/lib/abis/ERC4626.js +1 -0
- package/lib/abis/ERC721.d.ts +1 -0
- package/lib/abis/ERC721.js +1 -0
- package/lib/abis/FeeOracle.js +1 -0
- package/lib/abis/LendingPool.js +1 -0
- package/lib/abis/LendingPoolV2.js +1 -0
- package/lib/abis/Multicall3.js +3 -0
- package/lib/abis/OFT.d.ts +20 -0
- package/lib/abis/OFT.js +20 -0
- package/lib/abis/SmartAccount.d.ts +1 -0
- package/lib/abis/SmartAccount.js +3 -0
- package/lib/abis/SwapRouter.d.ts +1 -0
- package/lib/abis/SwapRouter.js +1 -0
- package/lib/abis/UniversalSignatureValidator.js +3 -0
- package/lib/abis/index.d.ts +5 -0
- package/lib/abis/index.js +5 -0
- package/lib/adapters/evm/getters.d.ts +17 -2
- package/lib/adapters/evm/getters.js +35 -3
- package/lib/adapters/evm/index.d.ts +262 -0
- package/lib/adapters/evm/index.js +268 -1
- package/lib/adapters/evm/utils.d.ts +6 -0
- package/lib/adapters/evm/utils.js +7 -0
- package/lib/adapters/solana/constants.js +4 -1
- package/lib/adapters/solana/getters.d.ts +8 -0
- package/lib/adapters/solana/getters.js +21 -0
- package/lib/adapters/solana/idl/vault-idl.js +9 -0
- package/lib/adapters/solana/index.d.ts +55 -0
- package/lib/adapters/solana/index.js +57 -0
- package/lib/adapters/solana/utils.d.ts +28 -0
- package/lib/adapters/solana/utils.js +79 -4
- package/lib/adapters/solana/vault.actions.d.ts +19 -0
- package/lib/adapters/solana/vault.actions.js +47 -3
- package/lib/adapters/stellar/actions.d.ts +25 -0
- package/lib/adapters/stellar/actions.js +33 -0
- package/lib/adapters/stellar/constants.d.ts +26 -0
- package/lib/adapters/stellar/constants.js +29 -0
- package/lib/adapters/stellar/getters.d.ts +56 -0
- package/lib/adapters/stellar/getters.js +81 -0
- package/lib/adapters/stellar/index.d.ts +48 -0
- package/lib/adapters/stellar/index.js +48 -0
- package/lib/adapters/stellar/soroban.d.ts +20 -0
- package/lib/adapters/stellar/soroban.js +46 -0
- package/lib/adapters/stellar/submit.d.ts +12 -0
- package/lib/adapters/stellar/submit.js +19 -0
- package/lib/adapters/stellar/types.d.ts +27 -0
- package/lib/adapters/stellar/types.js +3 -0
- package/lib/adapters/stellar/utils.d.ts +10 -0
- package/lib/adapters/stellar/utils.js +10 -0
- package/lib/adapters/sui/getters.d.ts +6 -0
- package/lib/adapters/sui/getters.js +6 -0
- package/lib/adapters/sui/index.d.ts +15 -0
- package/lib/adapters/sui/index.js +15 -0
- package/lib/adapters/sui/transformer.d.ts +6 -0
- package/lib/adapters/sui/transformer.js +7 -0
- package/lib/adapters/sui/utils.d.ts +6 -0
- package/lib/adapters/sui/utils.js +6 -0
- package/lib/core/analytics/chain-name.d.ts +8 -0
- package/lib/core/analytics/chain-name.js +8 -0
- package/lib/core/analytics/constants.d.ts +4 -0
- package/lib/core/analytics/constants.js +4 -0
- package/lib/core/analytics/env.d.ts +25 -0
- package/lib/core/analytics/env.js +26 -0
- package/lib/core/analytics/index.d.ts +26 -0
- package/lib/core/analytics/index.js +35 -0
- package/lib/core/analytics/instrumentation.d.ts +26 -0
- package/lib/core/analytics/instrumentation.js +66 -2
- package/lib/core/analytics/method-taxonomy.d.ts +16 -0
- package/lib/core/analytics/method-taxonomy.js +18 -0
- package/lib/core/analytics/metrics.d.ts +23 -0
- package/lib/core/analytics/metrics.js +40 -0
- package/lib/core/analytics/sanitize.d.ts +38 -0
- package/lib/core/analytics/sanitize.js +46 -0
- package/lib/core/analytics/sentry-runtime.d.ts +11 -0
- package/lib/core/analytics/sentry-runtime.js +19 -0
- package/lib/core/analytics/sentry.d.ts +45 -0
- package/lib/core/analytics/sentry.js +115 -2
- package/lib/core/analytics/types.d.ts +27 -0
- package/lib/core/analytics/user-identity.d.ts +34 -0
- package/lib/core/analytics/user-identity.js +42 -0
- package/lib/core/analytics/version.d.ts +6 -1
- package/lib/core/analytics/version.js +6 -1
- package/lib/core/auth/verify.js +5 -0
- package/lib/core/base.class.d.ts +75 -0
- package/lib/core/base.class.js +56 -0
- package/lib/core/cache.d.ts +5 -0
- package/lib/core/cache.js +6 -0
- package/lib/core/constants/adapters.d.ts +15 -0
- package/lib/core/constants/adapters.js +28 -8
- package/lib/core/constants/core.d.ts +12 -1
- package/lib/core/constants/core.js +12 -0
- package/lib/core/constants/swap-router.d.ts +46 -0
- package/lib/core/constants/swap-router.js +50 -0
- package/lib/core/constants/vaults.d.ts +56 -0
- package/lib/core/constants/vaults.js +66 -1
- package/lib/core/constants/web3.d.ts +3 -0
- package/lib/core/constants/web3.js +18 -5
- package/lib/core/errors/index.d.ts +36 -0
- package/lib/core/errors/index.js +29 -0
- package/lib/core/fetcher.d.ts +134 -0
- package/lib/core/fetcher.js +191 -5
- package/lib/core/helpers/adapters.d.ts +9 -0
- package/lib/core/helpers/adapters.js +11 -0
- package/lib/core/helpers/chain-address.d.ts +10 -0
- package/lib/core/helpers/chain-address.js +11 -0
- package/lib/core/helpers/core.d.ts +42 -0
- package/lib/core/helpers/core.js +66 -1
- package/lib/core/helpers/explorer-link.d.ts +14 -0
- package/lib/core/helpers/explorer-link.js +14 -0
- package/lib/core/helpers/signer.d.ts +26 -0
- package/lib/core/helpers/signer.js +39 -0
- package/lib/core/helpers/swap-router.d.ts +32 -0
- package/lib/core/helpers/swap-router.js +32 -0
- package/lib/core/helpers/vault-version.d.ts +1 -0
- package/lib/core/helpers/vault-version.js +2 -0
- package/lib/core/helpers/vaults.d.ts +8 -0
- package/lib/core/helpers/vaults.js +22 -8
- package/lib/core/helpers/web3.d.ts +152 -0
- package/lib/core/helpers/web3.js +183 -6
- package/lib/core/logger/index.d.ts +55 -0
- package/lib/core/logger/index.js +19 -0
- package/lib/core/logger/slack.d.ts +3 -0
- package/lib/core/logger/slack.js +3 -0
- package/lib/core/vault-metadata.d.ts +6 -0
- package/lib/core/vault-metadata.js +6 -0
- package/lib/core/version-check.d.ts +52 -0
- package/lib/core/version-check.js +81 -0
- package/lib/evm/methods/crossChainVault.d.ts +90 -0
- package/lib/evm/methods/crossChainVault.js +186 -1
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +1 -0
- package/lib/evm/methods/index.js +1 -0
- package/lib/evm/types/crossChain.d.ts +202 -0
- package/lib/evm/types/crossChain.js +11 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +19 -0
- package/lib/main.d.ts +288 -5
- package/lib/main.js +305 -0
- package/lib/modules/api/index.d.ts +1 -0
- package/lib/modules/api/index.js +6 -0
- package/lib/modules/api/main.d.ts +52 -0
- package/lib/modules/api/main.js +130 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +15 -0
- package/lib/modules/sub-accounts/fetcher.js +15 -0
- package/lib/modules/sub-accounts/main.d.ts +33 -0
- package/lib/modules/sub-accounts/main.js +38 -0
- package/lib/modules/sub-accounts/utils.d.ts +3 -0
- package/lib/modules/sub-accounts/utils.js +3 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +18 -0
- package/lib/modules/vaults/adapter.helpers.js +34 -0
- package/lib/modules/vaults/fetcher.d.ts +20 -0
- package/lib/modules/vaults/fetcher.js +40 -3
- package/lib/modules/vaults/getters.d.ts +295 -0
- package/lib/modules/vaults/getters.js +552 -12
- package/lib/modules/vaults/index.d.ts +12 -0
- package/lib/modules/vaults/index.js +12 -0
- package/lib/modules/vaults/main.d.ts +292 -4
- package/lib/modules/vaults/main.js +379 -7
- package/lib/modules/vaults/read.actions.d.ts +168 -0
- package/lib/modules/vaults/read.actions.js +143 -0
- package/lib/modules/vaults/types.d.ts +34 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +47 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
- package/lib/modules/vaults/utils/date-utils.js +47 -1
- package/lib/modules/vaults/utils.d.ts +70 -0
- package/lib/modules/vaults/utils.js +108 -5
- package/lib/modules/vaults/write.actions.d.ts +363 -3
- package/lib/modules/vaults/write.actions.js +364 -2
- package/lib/polyfills.js +2 -0
- package/lib/sdk.d.ts +23705 -0
- package/lib/services/coingecko/fetcher.d.ts +13 -0
- package/lib/services/coingecko/fetcher.js +17 -0
- package/lib/services/debank/fetcher.d.ts +14 -0
- package/lib/services/debank/fetcher.js +12 -0
- package/lib/services/debank/utils.js +17 -0
- package/lib/services/layerzero/deposits.d.ts +11 -0
- package/lib/services/layerzero/deposits.js +34 -11
- package/lib/services/layerzero/redeems.d.ts +10 -0
- package/lib/services/layerzero/redeems.js +13 -0
- package/lib/services/layerzero/utils.d.ts +8 -0
- package/lib/services/layerzero/utils.js +11 -0
- package/lib/services/octavfi/fetcher.d.ts +7 -0
- package/lib/services/octavfi/fetcher.js +25 -0
- package/lib/services/octavfi/utils.d.ts +12 -0
- package/lib/services/octavfi/utils.js +44 -10
- package/lib/services/subgraph/fetcher.js +4 -2
- package/lib/services/subgraph/vaults.d.ts +12 -0
- package/lib/services/subgraph/vaults.js +43 -2
- package/lib/services/swap-quotes/index.d.ts +71 -0
- package/lib/services/swap-quotes/index.js +25 -0
- package/lib/services/swap-quotes/paraswap.d.ts +17 -0
- package/lib/services/swap-quotes/paraswap.js +14 -0
- package/lib/types/pools.d.ts +3 -0
- package/lib/types/typed-contract.d.ts +64 -0
- package/lib/types/vaults.d.ts +139 -2
- package/lib/types/vaults.js +10 -0
- package/lib/types/web3.d.ts +8 -0
- package/lib/types/web3.js +1 -0
- package/lib/types/webserver.d.ts +45 -0
- package/package.json +6 -5
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { type IAddress, type IHistoricalTimeseriesResponse, type INormalizedNumber, type ISubgraphWithdrawProccessed, type IVault, type IVaultAllocations, type IVaultAnnualizedApy, type IVaultAvailableRedemption, type IVaultLoan, type IVaultPosition, type IVaultRedemptionHistoryItem, type IVaultSummary, type IVaultWithdrawals, type IVaultPendingRedemptions, type IActiveStakingPosition, type IVaultHistoricalParams, type IVaultUserLifetimePnl, type IVaultBorrowerHealthFactor, type IVaultPnl, type VaultAddress } from '../../types';
|
|
2
2
|
import type { IVaultBaseOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Vault Data Getters
|
|
5
|
+
*
|
|
6
|
+
* Main query functions for vault data across chains:
|
|
7
|
+
* - getVault: Comprehensive vault details with loans/allocations
|
|
8
|
+
* - getVaultLoans: Active loan data with on-chain enrichment
|
|
9
|
+
* - getVaultAllocations: DeFi/CeFi/OTC allocation breakdowns
|
|
10
|
+
* - getVaultAvailableRedemptions: Claimable redemption requests
|
|
11
|
+
* - getVaultRedemptionHistory: Historical redemption data
|
|
12
|
+
* - getVaultPositions: User positions across vaults
|
|
13
|
+
* - getVaultApy: @deprecated Current and historical APY data
|
|
14
|
+
* - getRewardsStakingPositions: Staking positions and rewards
|
|
15
|
+
* - getVaultTvl: Current and historical TVL
|
|
16
|
+
* - getVaultHistoricalTimeseries: Time series data for vault metrics
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Fetch comprehensive vault data including on-chain state and backend metadata.
|
|
20
|
+
* Routes to appropriate chain adapter (EVM v1/v2, Solana, or Stellar) based on vault version.
|
|
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
|
|
26
|
+
* @returns Complete vault object with optional enrichments
|
|
27
|
+
*/
|
|
3
28
|
export declare function getVault({ vault, loans, allocations, options, loadSubaccounts, loadSnapshots, }: {
|
|
4
29
|
vault: IAddress;
|
|
5
30
|
loans?: boolean;
|
|
@@ -8,8 +33,25 @@ export declare function getVault({ vault, loans, allocations, options, loadSubac
|
|
|
8
33
|
loadSubaccounts?: boolean;
|
|
9
34
|
loadSnapshots?: boolean;
|
|
10
35
|
}): Promise<IVault>;
|
|
36
|
+
/**
|
|
37
|
+
* Vault Loans
|
|
38
|
+
*/
|
|
11
39
|
export declare function getVaultLoans(vault: VaultAddress | IVault, options: IVaultBaseOptions): Promise<IVaultLoan[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Vault Subaccount Loans
|
|
42
|
+
*/
|
|
12
43
|
export declare function getVaultSubaccountLoans(vault: VaultAddress | IVault, options: IVaultBaseOptions): Promise<IVaultLoan[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Vault Allocations
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* Fetch comprehensive vault asset allocation breakdown.
|
|
49
|
+
* Includes DeFi protocols (via DeBank), CeFi balances, OTC positions, and loans.
|
|
50
|
+
* Categorizes exposures by borrowing, supplying, lending, and wallet holdings.
|
|
51
|
+
* @param vault Vault address
|
|
52
|
+
* @param options RPC configuration
|
|
53
|
+
* @returns Detailed allocation data with exposure categorization
|
|
54
|
+
*/
|
|
13
55
|
export declare function getVaultAllocations(vault: IAddress, options: IVaultBaseOptions): Promise<IVaultAllocations>;
|
|
14
56
|
export declare function getVaultAvailableRedemptions({ vault, wallet, options, }: {
|
|
15
57
|
vault: IAddress;
|
|
@@ -29,6 +71,9 @@ export declare function getVaultRedemptionHistory({ vault, wallet, lookbackBlock
|
|
|
29
71
|
lookbackBlocks?: number;
|
|
30
72
|
options: IVaultBaseOptions;
|
|
31
73
|
}): Promise<IVaultRedemptionHistoryItem[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Vault Positions
|
|
76
|
+
*/
|
|
32
77
|
export declare function getVaultPositions({ vault, wallet, solanaWallet, stellarWallet, options, }: {
|
|
33
78
|
vault: IAddress;
|
|
34
79
|
wallet?: IAddress;
|
|
@@ -36,6 +81,9 @@ export declare function getVaultPositions({ vault, wallet, solanaWallet, stellar
|
|
|
36
81
|
stellarWallet?: string;
|
|
37
82
|
options: IVaultBaseOptions;
|
|
38
83
|
}): Promise<IVaultPosition[]>;
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated use getVaultHistoricalTimeseries instead
|
|
86
|
+
*/
|
|
39
87
|
export declare function getVaultApy({ vault, options, historical, }: {
|
|
40
88
|
vault: IAddress;
|
|
41
89
|
options?: IVaultBaseOptions;
|
|
@@ -57,18 +105,117 @@ export declare function getVaultTvl({ vault, options, historical, }: {
|
|
|
57
105
|
value: INormalizedNumber;
|
|
58
106
|
timestamp: string;
|
|
59
107
|
}[]>;
|
|
108
|
+
/**
|
|
109
|
+
* Build the per-loan borrower / health-factor list for a single vault.
|
|
110
|
+
*
|
|
111
|
+
* Resilience: individual loan reads (`loanState()`, `borrower()`) and the
|
|
112
|
+
* per-borrower August backend call are isolated with `Promise.allSettled` and
|
|
113
|
+
* try/catch so one bad loan — a test loan whose address isn't a real contract,
|
|
114
|
+
* a borrower the backend doesn't recognize, an intermittent RPC error — drops
|
|
115
|
+
* that single row from the result instead of rejecting the whole batch. Failed
|
|
116
|
+
* rows are logged via `Logger.log.warn`; the loan is still returned with
|
|
117
|
+
* `health_factor: undefined` so callers can render an explicit empty state
|
|
118
|
+
* rather than a perpetual loading skeleton.
|
|
119
|
+
*
|
|
120
|
+
* @param vault Vault address to scope the fetch to.
|
|
121
|
+
* @param options Standard vault options — `rpcUrl` must point at `vault`'s chain.
|
|
122
|
+
* @returns Array of `IVaultBorrowerHealthFactor`, one entry per active loan.
|
|
123
|
+
*/
|
|
60
124
|
export declare function getVaultBorrowerHealthFactor({ vault, options, }: {
|
|
61
125
|
vault: IAddress;
|
|
62
126
|
options: IVaultBaseOptions;
|
|
63
127
|
}): Promise<IVaultBorrowerHealthFactor[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Aggregate borrower-health-factor data, optionally scoped to a single vault.
|
|
130
|
+
*
|
|
131
|
+
* - When `vault` is provided, only that vault's tokenized record is fetched
|
|
132
|
+
* and only its loans are read. This is the path callers should use when
|
|
133
|
+
* they already know which vault they care about — it skips the cross-chain
|
|
134
|
+
* fanout entirely.
|
|
135
|
+
* - When `vault` is omitted, the function fetches every tokenized vault and
|
|
136
|
+
* builds health factors for each, preserving the legacy behavior. Per-vault
|
|
137
|
+
* failures are isolated with `Promise.allSettled` so one bad vault returns
|
|
138
|
+
* an empty array instead of rejecting the whole map.
|
|
139
|
+
*
|
|
140
|
+
* The returned map is keyed by **lowercased** vault address so callers can
|
|
141
|
+
* look up entries without worrying about EIP-55 checksum casing in either the
|
|
142
|
+
* backend response or the caller's input.
|
|
143
|
+
*
|
|
144
|
+
* @param options Standard vault options — `rpcUrl` should match `vault`'s chain.
|
|
145
|
+
* @param vault Optional vault address to scope the fetch to.
|
|
146
|
+
* @returns Map of lowercased vault address → array of borrower-health-factor rows.
|
|
147
|
+
*/
|
|
64
148
|
export declare function getHealthFactorOfBorrowersByVault({ options, vault, }: {
|
|
65
149
|
options: IVaultBaseOptions;
|
|
66
150
|
vault?: IAddress;
|
|
67
151
|
}): Promise<Record<string, IVaultBorrowerHealthFactor[]>>;
|
|
152
|
+
/**
|
|
153
|
+
* Fetch user points from the backend API endpoint.
|
|
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
|
|
157
|
+
* @returns Points data from the backend API
|
|
158
|
+
*/
|
|
68
159
|
export declare function getUserPoints({ userAddress, options, }: {
|
|
69
160
|
userAddress: IAddress;
|
|
70
161
|
options?: IVaultBaseOptions;
|
|
71
162
|
}): Promise<any>;
|
|
163
|
+
/**
|
|
164
|
+
* Register a user for the points program, authenticated by a wallet signature.
|
|
165
|
+
*
|
|
166
|
+
* The caller must obtain a personal_sign (EIP-191) signature over the
|
|
167
|
+
* canonical message template below — the backend reconstructs the same
|
|
168
|
+
* string from these fields and verifies the signature recovers to
|
|
169
|
+
* `userAddress`. Building the message client-side and server-side from the
|
|
170
|
+
* same primitives means a hostile client cannot show one message in the
|
|
171
|
+
* wallet prompt while submitting a different one for validation.
|
|
172
|
+
*
|
|
173
|
+
* Canonical message (`\n`-separated, no trailing newline):
|
|
174
|
+
*
|
|
175
|
+
* ```
|
|
176
|
+
* Upshift: register {userAddress.toLowerCase()}
|
|
177
|
+
* referrer: {referrerAddress.toLowerCase() || "none"}
|
|
178
|
+
* chain: {chainId}
|
|
179
|
+
* nonce: {nonce}
|
|
180
|
+
* expires: {expiry}
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* @param userAddress EVM wallet address being registered. Must match the
|
|
184
|
+
* signer that produced `signature`. Lowercased before being embedded in
|
|
185
|
+
* the canonical message.
|
|
186
|
+
* @param referrerAddress Optional EVM address that referred this user.
|
|
187
|
+
* Lowercased when embedded; the literal string `"none"` is used when
|
|
188
|
+
* absent. Tampering with this field after signing produces 401.
|
|
189
|
+
* @param chainId Chain on which the wallet signed. For smart-contract wallets
|
|
190
|
+
* (Safe etc.) this is the chain whose RPC the backend will use to run the
|
|
191
|
+
* EIP-1271 `isValidSignature` check; for EOAs it still pins the signature
|
|
192
|
+
* to a chain so it can't be replayed cross-chain. Must be one of the chains
|
|
193
|
+
* Upshift supports (see backend `SUPPORTED_REGISTRATION_CHAINS`).
|
|
194
|
+
* @param signature `0x`-prefixed hex of the personal_sign signature over
|
|
195
|
+
* the canonical message. Single-use: replays within ~10 min are rejected.
|
|
196
|
+
* @param nonce Caller-generated random string (8–128 chars). Pair with
|
|
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
|
|
199
|
+
* the backend's TTL window (currently 10 min).
|
|
200
|
+
* @param options Request options (headers).
|
|
201
|
+
* @returns Raw `Response` from the backend. 200 on success, 401 for
|
|
202
|
+
* expired / replayed / mismatched-signer / tampered-referrer, 422 for an
|
|
203
|
+
* unsupported `chainId`.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```ts
|
|
207
|
+
* const nonce = crypto.randomUUID().replace(/-/g, '');
|
|
208
|
+
* const expiry = Math.floor(Date.now() / 1000) + 300;
|
|
209
|
+
* const message =
|
|
210
|
+
* `Upshift: register ${address.toLowerCase()}\n` +
|
|
211
|
+
* `referrer: ${referrer?.toLowerCase() ?? 'none'}\n` +
|
|
212
|
+
* `chain: ${chainId}\n` +
|
|
213
|
+
* `nonce: ${nonce}\n` +
|
|
214
|
+
* `expires: ${expiry}`;
|
|
215
|
+
* const signature = await walletClient.signMessage({ account: address, message });
|
|
216
|
+
* await registerUserForPoints({ userAddress: address, referrerAddress: referrer, chainId, signature, nonce, expiry });
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
72
219
|
export declare function registerUserForPoints({ userAddress, referrerAddress, chainId, signature, nonce, expiry, options, }: {
|
|
73
220
|
userAddress: IAddress;
|
|
74
221
|
referrerAddress?: IAddress;
|
|
@@ -78,6 +225,12 @@ export declare function registerUserForPoints({ userAddress, referrerAddress, ch
|
|
|
78
225
|
expiry: number;
|
|
79
226
|
options?: IVaultBaseOptions;
|
|
80
227
|
}): Promise<Response>;
|
|
228
|
+
/**
|
|
229
|
+
* Fetch the points leaderboard data.
|
|
230
|
+
* @param params Optional parameters for pagination and sorting
|
|
231
|
+
* @param options Request options including headers
|
|
232
|
+
* @returns Leaderboard response data
|
|
233
|
+
*/
|
|
81
234
|
export declare function fetchPointsLeaderboard({ params, options, }: {
|
|
82
235
|
params?: {
|
|
83
236
|
page?: number;
|
|
@@ -86,16 +239,44 @@ export declare function fetchPointsLeaderboard({ params, options, }: {
|
|
|
86
239
|
};
|
|
87
240
|
options?: IVaultBaseOptions;
|
|
88
241
|
}): Promise<any>;
|
|
242
|
+
/**
|
|
243
|
+
* Fetch the timestamp when yield was last realized for a vault.
|
|
244
|
+
* Returns the assetsUpdatedOn timestamp from the vault contract.
|
|
245
|
+
* @param vault Vault contract address
|
|
246
|
+
* @param options RPC configuration
|
|
247
|
+
* @returns Timestamp (Unix timestamp in seconds) when yield was last realized
|
|
248
|
+
*/
|
|
89
249
|
export declare function getYieldLastRealizedOn({ vault, options, }: {
|
|
90
250
|
vault: IAddress;
|
|
91
251
|
options: IVaultBaseOptions;
|
|
92
252
|
}): Promise<number>;
|
|
253
|
+
/**
|
|
254
|
+
* Calculate lifetime PnL for a user in a specific vault.
|
|
255
|
+
*
|
|
256
|
+
* Basic logic:
|
|
257
|
+
* 1. Get user's list of deposits and withdrawals from subgraph
|
|
258
|
+
* 2. Fetch user's current assets (balanceOf * sharePrice via convertToAssets)
|
|
259
|
+
* 3. Calculate PnL = assets withdrawn + current assets - assets deposited
|
|
260
|
+
*
|
|
261
|
+
* @param vault Vault contract address
|
|
262
|
+
* @param wallet User wallet address
|
|
263
|
+
* @param options RPC configuration and service options
|
|
264
|
+
* @returns Lifetime PnL data in both native token and USD
|
|
265
|
+
*/
|
|
93
266
|
export declare function getVaultUserLifetimePnl({ vault, wallet, options, }: {
|
|
94
267
|
vault: IAddress;
|
|
95
268
|
wallet: IAddress;
|
|
96
269
|
options: IVaultBaseOptions;
|
|
97
270
|
coingeckoKey?: string;
|
|
98
271
|
}): Promise<IVaultUserLifetimePnl>;
|
|
272
|
+
/**
|
|
273
|
+
* Calculate PnL for a vault (vault-level, not user-specific).
|
|
274
|
+
* Returns the vault's overall profit and loss across all users.
|
|
275
|
+
*
|
|
276
|
+
* @param vault Vault contract address
|
|
277
|
+
* @param options RPC configuration and service options
|
|
278
|
+
* @returns Vault PnL in USD and notional value
|
|
279
|
+
*/
|
|
99
280
|
export declare function getVaultPnl({ vault, options, }: {
|
|
100
281
|
vault: IAddress;
|
|
101
282
|
options: IVaultBaseOptions;
|
|
@@ -105,45 +286,159 @@ export declare function getVaultHistoricalTimeseries({ vault, nDays, options, }:
|
|
|
105
286
|
nDays?: number;
|
|
106
287
|
options?: IVaultBaseOptions;
|
|
107
288
|
}): Promise<IHistoricalTimeseriesResponse>;
|
|
289
|
+
/**
|
|
290
|
+
* Fetch annualized APY metrics for a vault.
|
|
291
|
+
*
|
|
292
|
+
* Supported Vaults: cUSDO, tETH, wstETH, rsETH
|
|
293
|
+
*
|
|
294
|
+
* @deprecated The `hgETH30dLiquidAPY` and `hgETH7dLiquidAPY` response fields are deprecated.
|
|
295
|
+
* These fields will be removed on 2026-01-01.
|
|
296
|
+
* Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
|
|
297
|
+
*
|
|
298
|
+
* @param vault Vault contract address
|
|
299
|
+
* @param options Request options including headers
|
|
300
|
+
* @returns Annualized APY data including liquidity APY
|
|
301
|
+
*/
|
|
108
302
|
export declare function getVaultAnnualizedApy({ vault, options, }: {
|
|
109
303
|
vault: IAddress;
|
|
110
304
|
options?: IVaultBaseOptions;
|
|
111
305
|
}): Promise<IVaultAnnualizedApy>;
|
|
306
|
+
/**
|
|
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
|
|
310
|
+
* @returns Vault summary data
|
|
311
|
+
*/
|
|
112
312
|
export declare function getVaultSummary({ vault, options, }: {
|
|
113
313
|
vault: IAddress;
|
|
114
314
|
options?: IVaultBaseOptions;
|
|
115
315
|
}): Promise<IVaultSummary>;
|
|
316
|
+
/**
|
|
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
|
|
321
|
+
* @returns Withdrawal summary and pending queue
|
|
322
|
+
*/
|
|
116
323
|
export declare function getVaultWithdrawals({ vault, chain, options, }: {
|
|
117
324
|
vault: IAddress;
|
|
118
325
|
chain: string;
|
|
119
326
|
options?: IVaultBaseOptions;
|
|
120
327
|
}): Promise<IVaultWithdrawals>;
|
|
328
|
+
/**
|
|
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
|
|
334
|
+
* @returns Pending redemptions grouped by date with liquidity summary
|
|
335
|
+
*/
|
|
121
336
|
export declare function getVaultPendingRedemptions({ vault, pastDays, futureDays, options, }: {
|
|
122
337
|
vault: IAddress;
|
|
123
338
|
pastDays?: number;
|
|
124
339
|
futureDays?: number;
|
|
125
340
|
options?: IVaultBaseOptions;
|
|
126
341
|
}): Promise<IVaultPendingRedemptions>;
|
|
342
|
+
/**
|
|
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 { normalized, raw }
|
|
348
|
+
*/
|
|
127
349
|
export declare function getPreviewRedemption({ vault, sharesAmount, options, }: {
|
|
128
350
|
vault: IAddress;
|
|
129
351
|
sharesAmount: string | bigint | number;
|
|
130
352
|
options: IVaultBaseOptions;
|
|
131
353
|
}): Promise<INormalizedNumber>;
|
|
354
|
+
/**
|
|
355
|
+
* Withdrawal request with computed claimable date and current processing status.
|
|
356
|
+
* The unique identifier is (receiver, claimableDate).
|
|
357
|
+
*
|
|
358
|
+
* @interface WithdrawalRequestStatus
|
|
359
|
+
*/
|
|
132
360
|
export interface WithdrawalRequestStatus {
|
|
361
|
+
/** Transaction hash of the withdrawal request */
|
|
133
362
|
transactionHash: string;
|
|
363
|
+
/** Block timestamp when the withdrawal was requested (seconds, UTC) */
|
|
134
364
|
requestTimestamp: number;
|
|
365
|
+
/** Shares amount being redeemed */
|
|
135
366
|
shares: bigint;
|
|
367
|
+
/** Receiver address for the withdrawal */
|
|
136
368
|
receiver: string;
|
|
369
|
+
/** Computed claimable date in UTC (year, month, day) */
|
|
137
370
|
claimableDate: {
|
|
138
371
|
year: number;
|
|
139
372
|
month: number;
|
|
140
373
|
day: number;
|
|
141
374
|
};
|
|
375
|
+
/** Epoch timestamp when this withdrawal becomes claimable */
|
|
142
376
|
claimableEpoch: number;
|
|
377
|
+
/** Current status of the withdrawal */
|
|
143
378
|
status: 'pending' | 'ready_to_claim' | 'processed';
|
|
379
|
+
/** Transaction hash of the processing transaction (if processed) */
|
|
144
380
|
processedTransactionHash?: string;
|
|
381
|
+
/** Assets received (if processed) */
|
|
145
382
|
assetsReceived?: bigint;
|
|
146
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* Returns all withdrawal requests for a vault, enriched with computed claimable dates
|
|
386
|
+
* and current processing status.
|
|
387
|
+
*
|
|
388
|
+
* The unique identifier for matching requests to processed events is:
|
|
389
|
+
* (receiver, claimableDate.year, claimableDate.month, claimableDate.day)
|
|
390
|
+
*
|
|
391
|
+
* This is the primary method for integrators to reliably track withdrawal status
|
|
392
|
+
* when multiple requests are submitted by the same receiver.
|
|
393
|
+
*
|
|
394
|
+
* ## Data sources
|
|
395
|
+
* - **Withdrawal requests** come from the subgraph (all historical requests).
|
|
396
|
+
* - **Processed events** come from on-chain `WithdrawalProcessed` logs, which are
|
|
397
|
+
* limited to a finite lookback window determined by the chain's block parameters.
|
|
398
|
+
*
|
|
399
|
+
* ## Lookback window & filtering
|
|
400
|
+
* On-chain logs only cover a limited number of recent blocks (e.g. ~20 days on Monad,
|
|
401
|
+
* ~21 days on Ethereum). The `lookbackBlocks` parameter controls how far back to scan
|
|
402
|
+
* and is applied uniformly to both data sources: it bounds the `WithdrawalProcessed`
|
|
403
|
+
* log query *and* drops any withdrawal request whose submission timestamp falls outside
|
|
404
|
+
* the window — regardless of whether a matching processed event was found. Callers who
|
|
405
|
+
* need deeper history should widen `lookbackBlocks`.
|
|
406
|
+
*
|
|
407
|
+
* ## Status determination
|
|
408
|
+
* - `'processed'` — A matching `WithdrawalProcessed` event was found (by receiver + claimable date).
|
|
409
|
+
* - `'ready_to_claim'` — Claimable date has passed (within the lookback window) but no processed event found.
|
|
410
|
+
* - `'pending'` — Claimable date is still in the future.
|
|
411
|
+
*
|
|
412
|
+
* @param params - Query parameters
|
|
413
|
+
* @param params.vault - Vault address to query
|
|
414
|
+
* @param params.receiver - (Optional) Filter by receiver address
|
|
415
|
+
* @param params.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
|
+
* @param params.options - Standard vault query options (provider, RPC URL, etc.)
|
|
419
|
+
* @returns Array of withdrawal requests with status and claimable dates
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const requests = await getWithdrawalRequestsWithStatus({
|
|
424
|
+
* vault: '0xVault...',
|
|
425
|
+
* receiver: '0xReceiver...'
|
|
426
|
+
* });
|
|
427
|
+
*
|
|
428
|
+
* // Results show exact status + claimable date
|
|
429
|
+
* requests.forEach(req => {
|
|
430
|
+
* console.log(
|
|
431
|
+
* `${req.claimableDate.year}-${req.claimableDate.month}-${req.claimableDate.day}: ${req.status}`
|
|
432
|
+
* );
|
|
433
|
+
* });
|
|
434
|
+
*
|
|
435
|
+
* // With custom lookback window (e.g. 30 days on Ethereum ≈ 216,000 blocks)
|
|
436
|
+
* const moreResults = await getWithdrawalRequestsWithStatus({
|
|
437
|
+
* vault: '0xVault...',
|
|
438
|
+
* lookbackBlocks: 216_000,
|
|
439
|
+
* });
|
|
440
|
+
* ```
|
|
441
|
+
*/
|
|
147
442
|
export declare function getWithdrawalRequestsWithStatus(params: {
|
|
148
443
|
vault: IAddress;
|
|
149
444
|
receiver?: IAddress;
|