upshift-config 0.5.14
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/LICENSE +21 -0
- package/README.md +349 -0
- package/lib/abis/AddressResolver.d.ts +28 -0
- package/lib/abis/AddressResolver.js +23 -0
- package/lib/abis/ChainlinkV3.d.ts +87 -0
- package/lib/abis/ChainlinkV3.js +117 -0
- package/lib/abis/ERC20.d.ts +168 -0
- package/lib/abis/ERC20.js +226 -0
- package/lib/abis/ERC20_Bytes32.d.ts +139 -0
- package/lib/abis/ERC20_Bytes32.js +196 -0
- package/lib/abis/ERC4626.d.ts +364 -0
- package/lib/abis/ERC4626.js +507 -0
- package/lib/abis/ERC721.d.ts +231 -0
- package/lib/abis/ERC721.js +321 -0
- package/lib/abis/FeeOracle.d.ts +120 -0
- package/lib/abis/FeeOracle.js +162 -0
- package/lib/abis/LendingPool.d.ts +1393 -0
- package/lib/abis/LendingPool.js +1807 -0
- package/lib/abis/LendingPoolV2.d.ts +1413 -0
- package/lib/abis/LendingPoolV2.js +1833 -0
- package/lib/abis/LendingPoolV3.d.ts +1677 -0
- package/lib/abis/LendingPoolV3.js +1160 -0
- package/lib/abis/Loan.d.ts +837 -0
- package/lib/abis/Loan.js +1080 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
- package/lib/abis/Multicall3.d.ts +30 -0
- package/lib/abis/Multicall3.js +97 -0
- package/lib/abis/OFT.d.ts +116 -0
- package/lib/abis/OFT.js +85 -0
- package/lib/abis/PoolAdapter.d.ts +36 -0
- package/lib/abis/PoolAdapter.js +51 -0
- package/lib/abis/RewardDistributor.d.ts +267 -0
- package/lib/abis/RewardDistributor.js +352 -0
- package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
- package/lib/abis/RwaRedeemSubaccount.js +548 -0
- package/lib/abis/SmartAccount.d.ts +17 -0
- package/lib/abis/SmartAccount.js +19 -0
- package/lib/abis/SwapRouter.d.ts +1043 -0
- package/lib/abis/SwapRouter.js +740 -0
- package/lib/abis/TextResolver.d.ts +16 -0
- package/lib/abis/TextResolver.js +16 -0
- package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
- package/lib/abis/TokenizedVaultV2.js +1041 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
- package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
- package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
- package/lib/abis/UniversalResolverResolve.d.ts +69 -0
- package/lib/abis/UniversalResolverResolve.js +35 -0
- package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
- package/lib/abis/UniversalSignatureValidator.js +30 -0
- package/lib/abis/WrapperAdapter.d.ts +71 -0
- package/lib/abis/WrapperAdapter.js +77 -0
- package/lib/abis/index.d.ts +34 -0
- package/lib/abis/index.js +51 -0
- package/lib/adapters/evm/getters.d.ts +19 -0
- package/lib/adapters/evm/getters.js +209 -0
- package/lib/adapters/evm/index.d.ts +353 -0
- package/lib/adapters/evm/index.js +434 -0
- package/lib/adapters/evm/utils.d.ts +8 -0
- package/lib/adapters/evm/utils.js +51 -0
- package/lib/adapters/solana/constants.d.ts +33 -0
- package/lib/adapters/solana/constants.js +52 -0
- package/lib/adapters/solana/getters.d.ts +11 -0
- package/lib/adapters/solana/getters.js +165 -0
- package/lib/adapters/solana/idl/vault-idl.d.ts +272 -0
- package/lib/adapters/solana/idl/vault-idl.js +1084 -0
- package/lib/adapters/solana/index.d.ts +233 -0
- package/lib/adapters/solana/index.js +291 -0
- package/lib/adapters/solana/types.d.ts +67 -0
- package/lib/adapters/solana/types.js +3 -0
- package/lib/adapters/solana/utils.d.ts +141 -0
- package/lib/adapters/solana/utils.js +595 -0
- package/lib/adapters/solana/vault.actions.d.ts +57 -0
- package/lib/adapters/solana/vault.actions.js +379 -0
- package/lib/adapters/stellar/actions.d.ts +28 -0
- package/lib/adapters/stellar/actions.js +77 -0
- package/lib/adapters/stellar/constants.d.ts +43 -0
- package/lib/adapters/stellar/constants.js +53 -0
- package/lib/adapters/stellar/getters.d.ts +68 -0
- package/lib/adapters/stellar/getters.js +290 -0
- package/lib/adapters/stellar/index.d.ts +114 -0
- package/lib/adapters/stellar/index.js +175 -0
- package/lib/adapters/stellar/soroban.d.ts +123 -0
- package/lib/adapters/stellar/soroban.js +613 -0
- package/lib/adapters/stellar/submit.d.ts +34 -0
- package/lib/adapters/stellar/submit.js +149 -0
- package/lib/adapters/stellar/types.d.ts +58 -0
- package/lib/adapters/stellar/types.js +6 -0
- package/lib/adapters/stellar/utils.d.ts +24 -0
- package/lib/adapters/stellar/utils.js +34 -0
- package/lib/adapters/sui/constants.d.ts +14 -0
- package/lib/adapters/sui/constants.js +29 -0
- package/lib/adapters/sui/getters.d.ts +9 -0
- package/lib/adapters/sui/getters.js +60 -0
- package/lib/adapters/sui/index.d.ts +45 -0
- package/lib/adapters/sui/index.js +101 -0
- package/lib/adapters/sui/transformer.d.ts +10 -0
- package/lib/adapters/sui/transformer.js +107 -0
- package/lib/adapters/sui/types.d.ts +66 -0
- package/lib/adapters/sui/types.js +3 -0
- package/lib/adapters/sui/utils.d.ts +10 -0
- package/lib/adapters/sui/utils.js +29 -0
- package/lib/core/analytics/chain-name.d.ts +9 -0
- package/lib/core/analytics/chain-name.js +34 -0
- package/lib/core/analytics/constants.d.ts +5 -0
- package/lib/core/analytics/constants.js +9 -0
- package/lib/core/analytics/env.d.ts +29 -0
- package/lib/core/analytics/env.js +59 -0
- package/lib/core/analytics/index.d.ts +36 -0
- package/lib/core/analytics/index.js +79 -0
- package/lib/core/analytics/instrumentation.d.ts +29 -0
- package/lib/core/analytics/instrumentation.js +277 -0
- package/lib/core/analytics/method-taxonomy.d.ts +19 -0
- package/lib/core/analytics/method-taxonomy.js +128 -0
- package/lib/core/analytics/metrics.d.ts +33 -0
- package/lib/core/analytics/metrics.js +116 -0
- package/lib/core/analytics/sanitize.d.ts +44 -0
- package/lib/core/analytics/sanitize.js +260 -0
- package/lib/core/analytics/sentry-runtime.d.ts +15 -0
- package/lib/core/analytics/sentry-runtime.js +97 -0
- package/lib/core/analytics/sentry.d.ts +67 -0
- package/lib/core/analytics/sentry.js +613 -0
- package/lib/core/analytics/types.d.ts +48 -0
- package/lib/core/analytics/types.js +3 -0
- package/lib/core/analytics/user-identity.d.ts +41 -0
- package/lib/core/analytics/user-identity.js +141 -0
- package/lib/core/analytics/version.d.ts +6 -0
- package/lib/core/analytics/version.js +10 -0
- package/lib/core/attribution.d.ts +111 -0
- package/lib/core/attribution.js +142 -0
- package/lib/core/auth/index.d.ts +1 -0
- package/lib/core/auth/index.js +18 -0
- package/lib/core/auth/verify.d.ts +2 -0
- package/lib/core/auth/verify.js +31 -0
- package/lib/core/base.class.d.ts +152 -0
- package/lib/core/base.class.js +172 -0
- package/lib/core/cache.d.ts +9 -0
- package/lib/core/cache.js +31 -0
- package/lib/core/constants/adapters.d.ts +103 -0
- package/lib/core/constants/adapters.js +180 -0
- package/lib/core/constants/core.d.ts +133 -0
- package/lib/core/constants/core.js +209 -0
- package/lib/core/constants/swap-router.d.ts +150 -0
- package/lib/core/constants/swap-router.js +169 -0
- package/lib/core/constants/vaults.d.ts +93 -0
- package/lib/core/constants/vaults.js +273 -0
- package/lib/core/constants/web3.d.ts +91 -0
- package/lib/core/constants/web3.js +229 -0
- package/lib/core/errors/index.d.ts +114 -0
- package/lib/core/errors/index.js +183 -0
- package/lib/core/fetcher.d.ts +198 -0
- package/lib/core/fetcher.js +903 -0
- package/lib/core/helpers/adapters.d.ts +13 -0
- package/lib/core/helpers/adapters.js +39 -0
- package/lib/core/helpers/chain-address.d.ts +13 -0
- package/lib/core/helpers/chain-address.js +47 -0
- package/lib/core/helpers/chain-error.d.ts +207 -0
- package/lib/core/helpers/chain-error.js +682 -0
- package/lib/core/helpers/chain-support.d.ts +80 -0
- package/lib/core/helpers/chain-support.js +115 -0
- package/lib/core/helpers/core.d.ts +68 -0
- package/lib/core/helpers/core.js +285 -0
- package/lib/core/helpers/explorer-link.d.ts +16 -0
- package/lib/core/helpers/explorer-link.js +26 -0
- package/lib/core/helpers/multicall.d.ts +68 -0
- package/lib/core/helpers/multicall.js +103 -0
- package/lib/core/helpers/revert-decode.d.ts +248 -0
- package/lib/core/helpers/revert-decode.js +515 -0
- package/lib/core/helpers/signer.d.ts +52 -0
- package/lib/core/helpers/signer.js +145 -0
- package/lib/core/helpers/swap-router.d.ts +211 -0
- package/lib/core/helpers/swap-router.js +480 -0
- package/lib/core/helpers/vault-version.d.ts +23 -0
- package/lib/core/helpers/vault-version.js +75 -0
- package/lib/core/helpers/vaults.d.ts +89 -0
- package/lib/core/helpers/vaults.js +235 -0
- package/lib/core/helpers/web3.d.ts +353 -0
- package/lib/core/helpers/web3.js +992 -0
- package/lib/core/index.d.ts +23 -0
- package/lib/core/index.js +40 -0
- package/lib/core/logger/index.d.ts +98 -0
- package/lib/core/logger/index.js +144 -0
- package/lib/core/logger/slack.d.ts +16 -0
- package/lib/core/logger/slack.js +57 -0
- package/lib/core/vault-metadata.d.ts +12 -0
- package/lib/core/vault-metadata.js +42 -0
- package/lib/core/version-check.d.ts +58 -0
- package/lib/core/version-check.js +182 -0
- package/lib/evm/index.d.ts +2 -0
- package/lib/evm/index.js +19 -0
- package/lib/evm/methods/crossChainVault.d.ts +128 -0
- package/lib/evm/methods/crossChainVault.js +853 -0
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +2 -0
- package/lib/evm/methods/index.js +19 -0
- package/lib/evm/types/crossChain.d.ts +363 -0
- package/lib/evm/types/crossChain.js +20 -0
- package/lib/evm/types/index.d.ts +1 -0
- package/lib/evm/types/index.js +18 -0
- package/lib/index.d.ts +30 -0
- package/lib/index.js +52 -0
- package/lib/main.d.ts +527 -0
- package/lib/main.js +601 -0
- package/lib/modules/api/fetcher.d.ts +82 -0
- package/lib/modules/api/fetcher.js +150 -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 +313 -0
- package/lib/modules/api/main.js +479 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
- package/lib/modules/sub-accounts/fetcher.js +120 -0
- package/lib/modules/sub-accounts/index.d.ts +2 -0
- package/lib/modules/sub-accounts/index.js +19 -0
- package/lib/modules/sub-accounts/main.d.ts +243 -0
- package/lib/modules/sub-accounts/main.js +205 -0
- package/lib/modules/sub-accounts/utils.d.ts +106 -0
- package/lib/modules/sub-accounts/utils.js +112 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +64 -0
- package/lib/modules/vaults/adapter.helpers.js +184 -0
- package/lib/modules/vaults/fetcher.d.ts +147 -0
- package/lib/modules/vaults/fetcher.js +368 -0
- package/lib/modules/vaults/getters.d.ts +570 -0
- package/lib/modules/vaults/getters.js +3051 -0
- package/lib/modules/vaults/index.d.ts +20 -0
- package/lib/modules/vaults/index.js +44 -0
- package/lib/modules/vaults/main.d.ts +601 -0
- package/lib/modules/vaults/main.js +1623 -0
- package/lib/modules/vaults/prefetch.d.ts +65 -0
- package/lib/modules/vaults/prefetch.js +120 -0
- package/lib/modules/vaults/read.actions.d.ts +225 -0
- package/lib/modules/vaults/read.actions.js +596 -0
- package/lib/modules/vaults/types.d.ts +71 -0
- package/lib/modules/vaults/types.js +3 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
- package/lib/modules/vaults/utils/date-utils.js +84 -0
- package/lib/modules/vaults/utils.d.ts +140 -0
- package/lib/modules/vaults/utils.js +799 -0
- package/lib/modules/vaults/write.actions.d.ts +529 -0
- package/lib/modules/vaults/write.actions.js +1749 -0
- package/lib/polyfills.d.ts +1 -0
- package/lib/polyfills.js +12 -0
- package/lib/sdk.d.ts +26721 -0
- package/lib/services/coingecko/fetcher.d.ts +15 -0
- package/lib/services/coingecko/fetcher.js +67 -0
- package/lib/services/coingecko/index.d.ts +2 -0
- package/lib/services/coingecko/index.js +19 -0
- package/lib/services/coingecko/utils.d.ts +1 -0
- package/lib/services/coingecko/utils.js +24 -0
- package/lib/services/debank/fetcher.d.ts +126 -0
- package/lib/services/debank/fetcher.js +47 -0
- package/lib/services/debank/index.d.ts +2 -0
- package/lib/services/debank/index.js +19 -0
- package/lib/services/debank/utils.d.ts +38 -0
- package/lib/services/debank/utils.js +297 -0
- package/lib/services/layerzero/deposits.d.ts +49 -0
- package/lib/services/layerzero/deposits.js +166 -0
- package/lib/services/layerzero/redeems.d.ts +20 -0
- package/lib/services/layerzero/redeems.js +92 -0
- package/lib/services/layerzero/utils.d.ts +9 -0
- package/lib/services/layerzero/utils.js +22 -0
- package/lib/services/octavfi/fetcher.d.ts +9 -0
- package/lib/services/octavfi/fetcher.js +103 -0
- package/lib/services/octavfi/index.d.ts +3 -0
- package/lib/services/octavfi/index.js +20 -0
- package/lib/services/octavfi/types.d.ts +34 -0
- package/lib/services/octavfi/types.js +3 -0
- package/lib/services/octavfi/utils.d.ts +16 -0
- package/lib/services/octavfi/utils.js +212 -0
- package/lib/services/subgraph/fetcher.d.ts +2 -0
- package/lib/services/subgraph/fetcher.js +61 -0
- package/lib/services/subgraph/index.d.ts +2 -0
- package/lib/services/subgraph/index.js +19 -0
- package/lib/services/subgraph/schema.d.ts +45 -0
- package/lib/services/subgraph/schema.js +75 -0
- package/lib/services/subgraph/vaults.d.ts +25 -0
- package/lib/services/subgraph/vaults.js +1106 -0
- package/lib/services/swap-quotes/index.d.ts +105 -0
- package/lib/services/swap-quotes/index.js +77 -0
- package/lib/services/swap-quotes/paraswap.d.ts +51 -0
- package/lib/services/swap-quotes/paraswap.js +138 -0
- package/lib/types/api.d.ts +280 -0
- package/lib/types/api.js +3 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +28 -0
- package/lib/types/points.d.ts +28 -0
- package/lib/types/points.js +3 -0
- package/lib/types/pools.d.ts +144 -0
- package/lib/types/pools.js +3 -0
- package/lib/types/staking.d.ts +28 -0
- package/lib/types/staking.js +3 -0
- package/lib/types/sub-accounts.d.ts +140 -0
- package/lib/types/sub-accounts.js +3 -0
- package/lib/types/subgraph.d.ts +74 -0
- package/lib/types/subgraph.js +3 -0
- package/lib/types/typed-contract.d.ts +102 -0
- package/lib/types/typed-contract.js +3 -0
- package/lib/types/user.d.ts +1 -0
- package/lib/types/user.js +3 -0
- package/lib/types/vaults.d.ts +714 -0
- package/lib/types/vaults.js +24 -0
- package/lib/types/web3.d.ts +51 -0
- package/lib/types/web3.js +14 -0
- package/lib/types/webserver.d.ts +698 -0
- package/lib/types/webserver.js +3 -0
- package/package.json +78 -0
|
@@ -0,0 +1,570 @@
|
|
|
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
|
+
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
|
+
*/
|
|
28
|
+
export declare function getVault({ vault, loans, allocations, options, loadSubaccounts, loadSnapshots, }: {
|
|
29
|
+
vault: IAddress;
|
|
30
|
+
loans?: boolean;
|
|
31
|
+
allocations?: boolean;
|
|
32
|
+
options: IVaultBaseOptions;
|
|
33
|
+
loadSubaccounts?: boolean;
|
|
34
|
+
loadSnapshots?: boolean;
|
|
35
|
+
}): Promise<IVault>;
|
|
36
|
+
/**
|
|
37
|
+
* Vault Loans
|
|
38
|
+
*/
|
|
39
|
+
export declare function getVaultLoans(vault: VaultAddress | IVault, options: IVaultBaseOptions): Promise<IVaultLoan[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Vault Subaccount Loans
|
|
42
|
+
*/
|
|
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
|
+
*/
|
|
55
|
+
export declare function getVaultAllocations(vault: IAddress, options: IVaultBaseOptions): Promise<IVaultAllocations>;
|
|
56
|
+
export declare function getVaultAvailableRedemptions({ vault, wallet, options, prefetchedReads, }: {
|
|
57
|
+
vault: IAddress;
|
|
58
|
+
wallet?: IAddress;
|
|
59
|
+
options: IVaultBaseOptions & {
|
|
60
|
+
verbose?: boolean;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Values already read via a Multicall3 batch (see
|
|
64
|
+
* `modules/vaults/prefetch.ts`). When `lagDuration` is present the
|
|
65
|
+
* per-vault `lagDuration()` RPC is skipped; when omitted, behavior is
|
|
66
|
+
* exactly the pre-batching per-call path.
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
prefetchedReads?: {
|
|
70
|
+
lagDuration?: number;
|
|
71
|
+
};
|
|
72
|
+
}): Promise<{
|
|
73
|
+
processedWithdrawals: ISubgraphWithdrawProccessed[];
|
|
74
|
+
requestedWithdrawals: import("../../types").ISubgraphWithdrawRequest[];
|
|
75
|
+
availableRedemptions: IVaultAvailableRedemption[];
|
|
76
|
+
pendingRedemptions: IVaultAvailableRedemption[];
|
|
77
|
+
}>;
|
|
78
|
+
export declare function getVaultRedemptionHistory({ vault, wallet, lookbackBlocks, options, }: {
|
|
79
|
+
vault: IAddress;
|
|
80
|
+
wallet?: IAddress;
|
|
81
|
+
lookbackBlocks?: number;
|
|
82
|
+
options: IVaultBaseOptions;
|
|
83
|
+
}): Promise<IVaultRedemptionHistoryItem[]>;
|
|
84
|
+
export { getSwapRouterDepositResult } from '../../core/helpers/swap-router';
|
|
85
|
+
/**
|
|
86
|
+
* Vault Positions
|
|
87
|
+
*/
|
|
88
|
+
export declare function getVaultPositions({ vault, wallet, solanaWallet, stellarWallet, options, prefetchedReads, }: {
|
|
89
|
+
vault: IAddress;
|
|
90
|
+
wallet?: IAddress;
|
|
91
|
+
solanaWallet?: string;
|
|
92
|
+
stellarWallet?: string;
|
|
93
|
+
options: IVaultBaseOptions;
|
|
94
|
+
/**
|
|
95
|
+
* Per-vault values already read via a Multicall3 batch at the fan-out call
|
|
96
|
+
* sites (see `modules/vaults/prefetch.ts`). Supplied fields skip the
|
|
97
|
+
* corresponding `balanceOf` / `lagDuration` RPC for the vault matching the
|
|
98
|
+
* `vault` parameter; when omitted, behavior is exactly the pre-batching
|
|
99
|
+
* per-call path.
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
prefetchedReads?: {
|
|
103
|
+
balance?: bigint;
|
|
104
|
+
lagDuration?: number;
|
|
105
|
+
};
|
|
106
|
+
}): Promise<IVaultPosition[]>;
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated use getVaultHistoricalTimeseries instead
|
|
109
|
+
*/
|
|
110
|
+
export declare function getVaultApy({ vault, options, historical, }: {
|
|
111
|
+
vault: IAddress;
|
|
112
|
+
options?: IVaultBaseOptions;
|
|
113
|
+
historical?: IVaultHistoricalParams;
|
|
114
|
+
}): Promise<{
|
|
115
|
+
value: number;
|
|
116
|
+
timestamp: string;
|
|
117
|
+
}[]>;
|
|
118
|
+
export declare function getRewardsStakingPositions({ rpcUrl, wallet, coinGeckoKey, }: {
|
|
119
|
+
wallet?: IAddress;
|
|
120
|
+
rpcUrl: string;
|
|
121
|
+
coinGeckoKey?: string;
|
|
122
|
+
}): Promise<IActiveStakingPosition[]>;
|
|
123
|
+
export declare function getVaultTvl({ vault, options, historical, }: {
|
|
124
|
+
vault: IAddress;
|
|
125
|
+
options: IVaultBaseOptions;
|
|
126
|
+
historical?: IVaultHistoricalParams;
|
|
127
|
+
}): Promise<{
|
|
128
|
+
value: INormalizedNumber;
|
|
129
|
+
timestamp: string;
|
|
130
|
+
}[]>;
|
|
131
|
+
/**
|
|
132
|
+
* Build the per-loan borrower / health-factor list for a single vault.
|
|
133
|
+
*
|
|
134
|
+
* Resilience: individual loan reads (`loanState()`, `borrower()`) and the
|
|
135
|
+
* per-borrower August backend call are isolated with `Promise.allSettled` and
|
|
136
|
+
* try/catch so one bad loan — a test loan whose address isn't a real contract,
|
|
137
|
+
* a borrower the backend doesn't recognize, an intermittent RPC error — drops
|
|
138
|
+
* that single row from the result instead of rejecting the whole batch. Failed
|
|
139
|
+
* rows are logged via `Logger.log.warn`; the loan is still returned with
|
|
140
|
+
* `health_factor: undefined` so callers can render an explicit empty state
|
|
141
|
+
* rather than a perpetual loading skeleton.
|
|
142
|
+
*
|
|
143
|
+
* @param vault - Vault address to scope the fetch to.
|
|
144
|
+
* @param options - Standard vault options — `rpcUrl` must point at `vault`'s chain.
|
|
145
|
+
* @returns Array of `IVaultBorrowerHealthFactor`, one entry per active loan.
|
|
146
|
+
*/
|
|
147
|
+
export declare function getVaultBorrowerHealthFactor({ vault, options, }: {
|
|
148
|
+
vault: IAddress;
|
|
149
|
+
options: IVaultBaseOptions;
|
|
150
|
+
}): Promise<IVaultBorrowerHealthFactor[]>;
|
|
151
|
+
/**
|
|
152
|
+
* Aggregate borrower-health-factor data, optionally scoped to a single vault.
|
|
153
|
+
*
|
|
154
|
+
* - When `vault` is provided, only that vault's tokenized record is fetched
|
|
155
|
+
* and only its loans are read. This is the path callers should use when
|
|
156
|
+
* they already know which vault they care about — it skips the cross-chain
|
|
157
|
+
* fanout entirely.
|
|
158
|
+
* - When `vault` is omitted, the function fetches every tokenized vault and
|
|
159
|
+
* builds health factors for each, preserving the legacy behavior. Per-vault
|
|
160
|
+
* failures are isolated with `Promise.allSettled` so one bad vault returns
|
|
161
|
+
* an empty array instead of rejecting the whole map.
|
|
162
|
+
*
|
|
163
|
+
* The returned map is keyed by **lowercased** vault address so callers can
|
|
164
|
+
* look up entries without worrying about EIP-55 checksum casing in either the
|
|
165
|
+
* backend response or the caller's input.
|
|
166
|
+
*
|
|
167
|
+
* @param options - Standard vault options — `rpcUrl` should match `vault`'s chain.
|
|
168
|
+
* @param vault - Optional vault address to scope the fetch to.
|
|
169
|
+
* @returns Map of lowercased vault address → array of borrower-health-factor rows.
|
|
170
|
+
*/
|
|
171
|
+
export declare function getHealthFactorOfBorrowersByVault({ options, vault, }: {
|
|
172
|
+
options: IVaultBaseOptions;
|
|
173
|
+
vault?: IAddress;
|
|
174
|
+
}): Promise<Record<string, IVaultBorrowerHealthFactor[]>>;
|
|
175
|
+
/**
|
|
176
|
+
* Fetch user points from the backend API endpoint.
|
|
177
|
+
* This replaces client-side points calculation with server-side processing.
|
|
178
|
+
* @param userAddress - User wallet address (EVM or Solana)
|
|
179
|
+
* @param options - Request options including headers
|
|
180
|
+
* @returns Points data from the backend API
|
|
181
|
+
*/
|
|
182
|
+
export declare function getUserPoints({ userAddress, options, }: {
|
|
183
|
+
userAddress: IAddress;
|
|
184
|
+
options?: IVaultBaseOptions;
|
|
185
|
+
}): Promise<any>;
|
|
186
|
+
/**
|
|
187
|
+
* Register a user for the points program, authenticated by a wallet signature.
|
|
188
|
+
*
|
|
189
|
+
* The caller must obtain a personal_sign (EIP-191) signature over the
|
|
190
|
+
* canonical message template below — the backend reconstructs the same
|
|
191
|
+
* string from these fields and verifies the signature recovers to
|
|
192
|
+
* `userAddress`. Building the message client-side and server-side from the
|
|
193
|
+
* same primitives means a hostile client cannot show one message in the
|
|
194
|
+
* wallet prompt while submitting a different one for validation.
|
|
195
|
+
*
|
|
196
|
+
* Canonical message (`\n`-separated, no trailing newline):
|
|
197
|
+
*
|
|
198
|
+
* ```
|
|
199
|
+
* Upshift: register {userAddress.toLowerCase()}
|
|
200
|
+
* referrer: {referrerAddress.toLowerCase() || "none"}
|
|
201
|
+
* chain: {chainId}
|
|
202
|
+
* nonce: {nonce}
|
|
203
|
+
* expires: {expiry}
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @param userAddress - EVM wallet address being registered. Must match the
|
|
207
|
+
* signer that produced `signature`. Lowercased before being embedded in
|
|
208
|
+
* the canonical message.
|
|
209
|
+
* @param referrerAddress - Optional EVM address that referred this user.
|
|
210
|
+
* Lowercased when embedded; the literal string `"none"` is used when
|
|
211
|
+
* absent. Tampering with this field after signing produces 401.
|
|
212
|
+
* @param chainId - Chain on which the wallet signed. For smart-contract wallets
|
|
213
|
+
* (Safe etc.) this is the chain whose RPC the backend will use to run the
|
|
214
|
+
* EIP-1271 `isValidSignature` check; for EOAs it still pins the signature
|
|
215
|
+
* to a chain so it can't be replayed cross-chain. Must be one of the chains
|
|
216
|
+
* Upshift supports (see backend `SUPPORTED_REGISTRATION_CHAINS`).
|
|
217
|
+
* @param signature - `0x`-prefixed hex of the personal_sign signature over
|
|
218
|
+
* the canonical message. Single-use: replays within ~10 min are rejected.
|
|
219
|
+
* @param nonce - Caller-generated random string (8–128 chars). Pair with
|
|
220
|
+
* `userAddress` to form the single-use key in the backend's nonce store.
|
|
221
|
+
* @param expiry - Unix timestamp (seconds). Must be in the future and within
|
|
222
|
+
* the backend's TTL window (currently 10 min).
|
|
223
|
+
* @param options - Request options (headers).
|
|
224
|
+
* @returns Raw `Response` from the backend. 200 on success, 401 for
|
|
225
|
+
* expired / replayed / mismatched-signer / tampered-referrer, 422 for an
|
|
226
|
+
* unsupported `chainId`.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* const nonce = crypto.randomUUID().replace(/-/g, '');
|
|
231
|
+
* const expiry = Math.floor(Date.now() / 1000) + 300;
|
|
232
|
+
* const message =
|
|
233
|
+
* `Upshift: register ${address.toLowerCase()}\n` +
|
|
234
|
+
* `referrer: ${referrer?.toLowerCase() ?? 'none'}\n` +
|
|
235
|
+
* `chain: ${chainId}\n` +
|
|
236
|
+
* `nonce: ${nonce}\n` +
|
|
237
|
+
* `expires: ${expiry}`;
|
|
238
|
+
* const signature = await walletClient.signMessage({ account: address, message });
|
|
239
|
+
* await registerUserForPoints({ userAddress: address, referrerAddress: referrer, chainId, signature, nonce, expiry });
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export declare function registerUserForPoints({ userAddress, referrerAddress, chainId, signature, nonce, expiry, options, }: {
|
|
243
|
+
userAddress: IAddress;
|
|
244
|
+
referrerAddress?: IAddress;
|
|
245
|
+
chainId: number;
|
|
246
|
+
signature: string;
|
|
247
|
+
nonce: string;
|
|
248
|
+
expiry: number;
|
|
249
|
+
options?: IVaultBaseOptions;
|
|
250
|
+
}): Promise<Response>;
|
|
251
|
+
/**
|
|
252
|
+
* Fetch the points leaderboard data.
|
|
253
|
+
* @param params - Optional parameters for pagination and sorting
|
|
254
|
+
* @param options - Request options including headers
|
|
255
|
+
* @returns Leaderboard response data
|
|
256
|
+
*/
|
|
257
|
+
export declare function fetchPointsLeaderboard({ params, options, }: {
|
|
258
|
+
params?: {
|
|
259
|
+
page?: number;
|
|
260
|
+
perPage?: number;
|
|
261
|
+
sortBy?: 'streakDays' | 'totalPoints';
|
|
262
|
+
};
|
|
263
|
+
options?: IVaultBaseOptions;
|
|
264
|
+
}): Promise<any>;
|
|
265
|
+
/**
|
|
266
|
+
* Fetch the timestamp when yield was last realized for a vault.
|
|
267
|
+
* Returns the assetsUpdatedOn timestamp from the vault contract.
|
|
268
|
+
* @param vault - Vault contract address
|
|
269
|
+
* @param options - RPC configuration
|
|
270
|
+
* @returns Timestamp (Unix timestamp in seconds) when yield was last realized
|
|
271
|
+
*/
|
|
272
|
+
export declare function getYieldLastRealizedOn({ vault, options, }: {
|
|
273
|
+
vault: IAddress;
|
|
274
|
+
options: IVaultBaseOptions;
|
|
275
|
+
}): Promise<number>;
|
|
276
|
+
/** Inputs the lifetime-PnL history guard inspects. */
|
|
277
|
+
export interface PnlHistoryConsistencyParams {
|
|
278
|
+
/** Vault contract address, used for the error message and context. */
|
|
279
|
+
vault: IAddress;
|
|
280
|
+
/** User wallet address, used for the error message and context. */
|
|
281
|
+
wallet: IAddress;
|
|
282
|
+
/**
|
|
283
|
+
* Whether the resolved deposit history contains at least one deposit record
|
|
284
|
+
* (subgraph deposits or LayerZero cross-chain deposits).
|
|
285
|
+
*/
|
|
286
|
+
hasDeposits: boolean;
|
|
287
|
+
/** Total withdrawn, in raw base units (asset decimals). */
|
|
288
|
+
totalWithdrawnRaw: bigint;
|
|
289
|
+
/** Current on-chain position value, in raw base units (asset decimals). */
|
|
290
|
+
currentPositionRaw: bigint;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Guard against the 2026-07-09 lifetime-PnL over-inflation failure mode.
|
|
294
|
+
*
|
|
295
|
+
* Lifetime PnL is `currentPosition + totalWithdrawn - totalDeposited`. When the
|
|
296
|
+
* deposit/withdrawal history fails to load it collapses to empty, so both
|
|
297
|
+
* `totalDeposited` and `totalWithdrawn` read as zero. If the wallet still holds
|
|
298
|
+
* a live on-chain position, the formula degenerates to reporting the entire
|
|
299
|
+
* position as pure profit — a plausible-looking but wrong number.
|
|
300
|
+
*
|
|
301
|
+
* This guard rejects exactly that state: a non-zero position with no recorded
|
|
302
|
+
* deposits *and* no recorded withdrawals. Any of the following is treated as
|
|
303
|
+
* consistent and passes:
|
|
304
|
+
* - deposits are present (the normal, computable case);
|
|
305
|
+
* - withdrawals are present (a fully-exited-then-re-entered position is still
|
|
306
|
+
* computable — the withdrawal records prove history loaded);
|
|
307
|
+
* - the current position is zero (the wallet never interacted or fully exited,
|
|
308
|
+
* so a zero PnL is correct, not inflated).
|
|
309
|
+
*
|
|
310
|
+
* Pure and synchronous — no RPC, no I/O — so it is safe to call inside the hot
|
|
311
|
+
* path with no added latency.
|
|
312
|
+
*
|
|
313
|
+
* Known imprecision — vault shares are transferable ERC-20 receipt tokens, so a
|
|
314
|
+
* wallet that *received* shares via a direct token transfer (never deposited,
|
|
315
|
+
* never withdrew) legitimately has `position > 0` with no history records and
|
|
316
|
+
* will throw `HISTORY_UNAVAILABLE` even though its history loaded fine. This is
|
|
317
|
+
* not a regression — the pre-guard formula reported that same position as 100%
|
|
318
|
+
* profit, which was also wrong — but the error message is misleading for that
|
|
319
|
+
* (rare) path. If receipt-token transfer becomes a real user flow, distinguish
|
|
320
|
+
* it here (e.g. by checking for a share-transfer event) rather than widening
|
|
321
|
+
* the guard.
|
|
322
|
+
*
|
|
323
|
+
* @param params - See {@link PnlHistoryConsistencyParams}.
|
|
324
|
+
* @returns `void` when the history is consistent.
|
|
325
|
+
* @throws {@link AugustHistoryUnavailableError} with code `HISTORY_UNAVAILABLE`
|
|
326
|
+
* and `context: { vault, wallet }` when a non-zero position has neither
|
|
327
|
+
* deposits nor withdrawals recorded. The message carries the
|
|
328
|
+
* `#getVaultUserLifetimePnl::<vault>::<wallet>` prefix so it groups with the
|
|
329
|
+
* other errors leaving the getter.
|
|
330
|
+
* @example
|
|
331
|
+
* ```ts
|
|
332
|
+
* assertPnlHistoryConsistent({
|
|
333
|
+
* vault,
|
|
334
|
+
* wallet,
|
|
335
|
+
* hasDeposits: depositsByAsset.size > 0,
|
|
336
|
+
* totalWithdrawnRaw,
|
|
337
|
+
* currentPositionRaw: currentPositionValue.raw,
|
|
338
|
+
* });
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
export declare function assertPnlHistoryConsistent({ vault, wallet, hasDeposits, totalWithdrawnRaw, currentPositionRaw, }: PnlHistoryConsistencyParams): void;
|
|
342
|
+
/**
|
|
343
|
+
* Sum a wallet's per-asset deposits into the vault's own decimals, at face
|
|
344
|
+
* value — 1 unit of any deposited asset is treated as 1 unit of the vault's
|
|
345
|
+
* reporting currency, with no live price conversion.
|
|
346
|
+
*
|
|
347
|
+
* Used by {@link getVaultUserLifetimePnl} for `totalDeposited`. Pre-deposit
|
|
348
|
+
* multi-asset vaults only accept dollar-pegged stablecoins (USDC, USDT, DAI,
|
|
349
|
+
* USDS, RLUSD, etc.) into a dollar-denominated vault, so face value is a
|
|
350
|
+
* reasonable stand-in for USD value. This intentionally does NOT re-quote
|
|
351
|
+
* through a live price oracle: doing so priced a historical deposit at
|
|
352
|
+
* today's market rate, so `totalDeposited` (and lifetimePnl) drifted between
|
|
353
|
+
* calls purely from stablecoin peg noise, and approximately re-inflated
|
|
354
|
+
* deposits back toward face value — which silently excluded the vault's
|
|
355
|
+
* entry fee from PnL. The fee is money the user actually paid, so PnL must
|
|
356
|
+
* be computed net of it.
|
|
357
|
+
*
|
|
358
|
+
* @param depositsByAsset - Raw deposited amount per asset, keyed by
|
|
359
|
+
* lowercased asset address (or `'default'` / `'lz-default'` for
|
|
360
|
+
* single-asset / cross-chain rows).
|
|
361
|
+
* @param assetDecimals - Decimals for each key in `depositsByAsset`.
|
|
362
|
+
* @param vaultDecimals - The vault's own decimals — the target scale every
|
|
363
|
+
* asset is rescaled to.
|
|
364
|
+
* @returns Total deposited, in raw base units at `vaultDecimals`.
|
|
365
|
+
*/
|
|
366
|
+
export declare function sumDepositsAtFaceValue(depositsByAsset: Map<string, bigint>, assetDecimals: Map<string, number>, vaultDecimals: number): bigint;
|
|
367
|
+
/**
|
|
368
|
+
* Calculate lifetime PnL for a user in a specific vault.
|
|
369
|
+
*
|
|
370
|
+
* Basic logic:
|
|
371
|
+
* 1. Get user's list of deposits and withdrawals from subgraph
|
|
372
|
+
* 2. Fetch user's current assets (balanceOf * sharePrice via convertToAssets)
|
|
373
|
+
* 3. Calculate PnL = assets withdrawn + current assets - assets deposited
|
|
374
|
+
*
|
|
375
|
+
* `totalDeposited` is the face value of what the user actually paid in
|
|
376
|
+
* (each deposited asset's raw amount, rescaled to the vault's decimals — no
|
|
377
|
+
* live price conversion), so any entry/exit fee the vault charges is
|
|
378
|
+
* automatically counted as a cost against PnL rather than excluded from it.
|
|
379
|
+
* Pre-deposit multi-asset vaults are assumed to only accept dollar-pegged
|
|
380
|
+
* stablecoins into a dollar-denominated vault; a vault accepting a
|
|
381
|
+
* non-pegged deposit asset would need deposit-time price conversion, which
|
|
382
|
+
* this function does not perform.
|
|
383
|
+
*
|
|
384
|
+
* @param vault - Vault contract address
|
|
385
|
+
* @param wallet - User wallet address
|
|
386
|
+
* @param options - RPC configuration and service options
|
|
387
|
+
* @returns Lifetime PnL data in both native token and USD
|
|
388
|
+
*/
|
|
389
|
+
export declare function getVaultUserLifetimePnl({ vault, wallet, options, }: {
|
|
390
|
+
vault: IAddress;
|
|
391
|
+
wallet: IAddress;
|
|
392
|
+
options: IVaultBaseOptions;
|
|
393
|
+
coingeckoKey?: string;
|
|
394
|
+
}): Promise<IVaultUserLifetimePnl>;
|
|
395
|
+
/**
|
|
396
|
+
* Calculate PnL for a vault (vault-level, not user-specific).
|
|
397
|
+
* Returns the vault's overall profit and loss across all users.
|
|
398
|
+
*
|
|
399
|
+
* @param vault - Vault contract address
|
|
400
|
+
* @param options - RPC configuration and service options
|
|
401
|
+
* @returns Vault PnL in USD and notional value
|
|
402
|
+
*/
|
|
403
|
+
export declare function getVaultPnl({ vault, options, }: {
|
|
404
|
+
vault: IAddress;
|
|
405
|
+
options: IVaultBaseOptions;
|
|
406
|
+
}): Promise<IVaultPnl>;
|
|
407
|
+
export declare function getVaultHistoricalTimeseries({ vault, nDays, options, }: {
|
|
408
|
+
vault: IAddress;
|
|
409
|
+
nDays?: number;
|
|
410
|
+
options?: IVaultBaseOptions;
|
|
411
|
+
}): Promise<IHistoricalTimeseriesResponse>;
|
|
412
|
+
/**
|
|
413
|
+
* Fetch annualized APY metrics for a vault.
|
|
414
|
+
*
|
|
415
|
+
* Supported Vaults: cUSDO, tETH, wstETH, rsETH
|
|
416
|
+
*
|
|
417
|
+
* @deprecated The `hgETH30dLiquidAPY` and `hgETH7dLiquidAPY` response fields are deprecated.
|
|
418
|
+
* These fields will be removed on 2026-01-01.
|
|
419
|
+
* Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
|
|
420
|
+
*
|
|
421
|
+
* @param vault - Vault contract address
|
|
422
|
+
* @param options - Request options including headers
|
|
423
|
+
* @returns Annualized APY data including liquidity APY
|
|
424
|
+
*/
|
|
425
|
+
export declare function getVaultAnnualizedApy({ vault, options, }: {
|
|
426
|
+
vault: IAddress;
|
|
427
|
+
options?: IVaultBaseOptions;
|
|
428
|
+
}): Promise<IVaultAnnualizedApy>;
|
|
429
|
+
/**
|
|
430
|
+
* Fetch summary data for a vault (name, type, chain, recent returns).
|
|
431
|
+
* @param vault - Vault contract address
|
|
432
|
+
* @param options - Request options including headers
|
|
433
|
+
* @returns Vault summary data
|
|
434
|
+
*/
|
|
435
|
+
export declare function getVaultSummary({ vault, options, }: {
|
|
436
|
+
vault: IAddress;
|
|
437
|
+
options?: IVaultBaseOptions;
|
|
438
|
+
}): Promise<IVaultSummary>;
|
|
439
|
+
/**
|
|
440
|
+
* Fetch withdrawal summary and pending queue for a vault.
|
|
441
|
+
* @param vault - Vault contract address
|
|
442
|
+
* @param chain - Chain identifier (e.g., chain ID as string)
|
|
443
|
+
* @param options - Request options including headers
|
|
444
|
+
* @returns Withdrawal summary and pending queue
|
|
445
|
+
*/
|
|
446
|
+
export declare function getVaultWithdrawals({ vault, chain, options, }: {
|
|
447
|
+
vault: IAddress;
|
|
448
|
+
chain: string;
|
|
449
|
+
options?: IVaultBaseOptions;
|
|
450
|
+
}): Promise<IVaultWithdrawals>;
|
|
451
|
+
/**
|
|
452
|
+
* Fetch pending redemptions for a vault with liquidity analysis.
|
|
453
|
+
* @param vault - Vault contract address
|
|
454
|
+
* @param pastDays - Number of past days to include (default 7, min 1, max 30)
|
|
455
|
+
* @param futureDays - Number of future days to include (default 14, min 1, max 30)
|
|
456
|
+
* @param options - Request options including headers
|
|
457
|
+
* @returns Pending redemptions grouped by date with liquidity summary
|
|
458
|
+
*/
|
|
459
|
+
export declare function getVaultPendingRedemptions({ vault, pastDays, futureDays, options, }: {
|
|
460
|
+
vault: IAddress;
|
|
461
|
+
pastDays?: number;
|
|
462
|
+
futureDays?: number;
|
|
463
|
+
options?: IVaultBaseOptions;
|
|
464
|
+
}): Promise<IVaultPendingRedemptions>;
|
|
465
|
+
/**
|
|
466
|
+
* Preview the amount of assets that would be received for redeeming shares (queued redemption).
|
|
467
|
+
* @param vault - Vault contract address
|
|
468
|
+
* @param sharesAmount - Amount of shares to redeem (human-readable, raw bigint, or string)
|
|
469
|
+
* @param options - RPC configuration
|
|
470
|
+
* @returns The amount of assets as an INormalizedNumber with `normalized` and `raw` fields
|
|
471
|
+
*/
|
|
472
|
+
export declare function getPreviewRedemption({ vault, sharesAmount, options, }: {
|
|
473
|
+
vault: IAddress;
|
|
474
|
+
sharesAmount: string | bigint | number;
|
|
475
|
+
options: IVaultBaseOptions;
|
|
476
|
+
}): Promise<INormalizedNumber>;
|
|
477
|
+
/**
|
|
478
|
+
* Withdrawal request with computed claimable date and current processing status.
|
|
479
|
+
* The unique identifier is (receiver, claimableDate).
|
|
480
|
+
*
|
|
481
|
+
* @interface WithdrawalRequestStatus
|
|
482
|
+
*/
|
|
483
|
+
export interface WithdrawalRequestStatus {
|
|
484
|
+
/** Transaction hash of the withdrawal request */
|
|
485
|
+
transactionHash: string;
|
|
486
|
+
/** Block timestamp when the withdrawal was requested (seconds, UTC) */
|
|
487
|
+
requestTimestamp: number;
|
|
488
|
+
/** Shares amount being redeemed */
|
|
489
|
+
shares: bigint;
|
|
490
|
+
/** Receiver address for the withdrawal */
|
|
491
|
+
receiver: string;
|
|
492
|
+
/** Computed claimable date in UTC (year, month, day) */
|
|
493
|
+
claimableDate: {
|
|
494
|
+
year: number;
|
|
495
|
+
month: number;
|
|
496
|
+
day: number;
|
|
497
|
+
};
|
|
498
|
+
/** Epoch timestamp when this withdrawal becomes claimable */
|
|
499
|
+
claimableEpoch: number;
|
|
500
|
+
/** Current status of the withdrawal */
|
|
501
|
+
status: 'pending' | 'ready_to_claim' | 'processed';
|
|
502
|
+
/** Transaction hash of the processing transaction (if processed) */
|
|
503
|
+
processedTransactionHash?: string;
|
|
504
|
+
/** Assets received (if processed) */
|
|
505
|
+
assetsReceived?: bigint;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Returns all withdrawal requests for a vault, enriched with computed claimable dates
|
|
509
|
+
* and current processing status.
|
|
510
|
+
*
|
|
511
|
+
* The unique identifier for matching requests to processed events is:
|
|
512
|
+
* (receiver, claimableDate.year, claimableDate.month, claimableDate.day)
|
|
513
|
+
*
|
|
514
|
+
* This is the primary method for integrators to reliably track withdrawal status
|
|
515
|
+
* when multiple requests are submitted by the same receiver.
|
|
516
|
+
*
|
|
517
|
+
* ## Data sources
|
|
518
|
+
* - **Withdrawal requests** come from the subgraph (all historical requests).
|
|
519
|
+
* - **Processed events** come from on-chain `WithdrawalProcessed` logs, which are
|
|
520
|
+
* limited to a finite lookback window determined by the chain's block parameters.
|
|
521
|
+
*
|
|
522
|
+
* ## Lookback window & filtering
|
|
523
|
+
* On-chain logs only cover a limited number of recent blocks (e.g. ~20 days on Monad,
|
|
524
|
+
* ~21 days on Ethereum). The `lookbackBlocks` parameter controls how far back to scan
|
|
525
|
+
* and is applied uniformly to both data sources: it bounds the `WithdrawalProcessed`
|
|
526
|
+
* log query *and* drops any withdrawal request whose submission timestamp falls outside
|
|
527
|
+
* the window — regardless of whether a matching processed event was found. Callers who
|
|
528
|
+
* need deeper history should widen `lookbackBlocks`.
|
|
529
|
+
*
|
|
530
|
+
* ## Status determination
|
|
531
|
+
* - `'processed'` — A matching `WithdrawalProcessed` event was found (by receiver + claimable date).
|
|
532
|
+
* - `'ready_to_claim'` — Claimable date has passed (within the lookback window) but no processed event found.
|
|
533
|
+
* - `'pending'` — Claimable date is still in the future.
|
|
534
|
+
*
|
|
535
|
+
* @param params - Query parameters:
|
|
536
|
+
* - `vault` — Vault address to query.
|
|
537
|
+
* - `receiver` — (Optional) Filter by receiver address.
|
|
538
|
+
* - `lookbackBlocks` — (Optional) On-chain log lookback window in blocks.
|
|
539
|
+
* Defaults to a chain-specific value (e.g. 150,000 for Ethereum, 3,456,000 for Monad).
|
|
540
|
+
* Increasing this scans more history but requires more RPC calls.
|
|
541
|
+
* - `options` — Standard vault query options (provider, RPC URL, etc.).
|
|
542
|
+
* @returns Array of withdrawal requests with status and claimable dates
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```typescript
|
|
546
|
+
* const requests = await getWithdrawalRequestsWithStatus({
|
|
547
|
+
* vault: '0xVault...',
|
|
548
|
+
* receiver: '0xReceiver...'
|
|
549
|
+
* });
|
|
550
|
+
*
|
|
551
|
+
* // Results show exact status + claimable date
|
|
552
|
+
* requests.forEach(req => {
|
|
553
|
+
* console.log(
|
|
554
|
+
* `${req.claimableDate.year}-${req.claimableDate.month}-${req.claimableDate.day}: ${req.status}`
|
|
555
|
+
* );
|
|
556
|
+
* });
|
|
557
|
+
*
|
|
558
|
+
* // With custom lookback window (e.g. 30 days on Ethereum ≈ 216,000 blocks)
|
|
559
|
+
* const moreResults = await getWithdrawalRequestsWithStatus({
|
|
560
|
+
* vault: '0xVault...',
|
|
561
|
+
* lookbackBlocks: 216_000,
|
|
562
|
+
* });
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
export declare function getWithdrawalRequestsWithStatus(params: {
|
|
566
|
+
vault: IAddress;
|
|
567
|
+
receiver?: IAddress;
|
|
568
|
+
lookbackBlocks?: number;
|
|
569
|
+
options: IVaultBaseOptions;
|
|
570
|
+
}): Promise<WithdrawalRequestStatus[]>;
|