@upshiftfinance/sdk 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +408 -2
- 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 +953 -0
- package/lib/abis/SwapRouter.js +1228 -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 +249 -0
- package/lib/adapters/evm/index.d.ts +539 -0
- package/lib/adapters/evm/index.js +656 -0
- package/lib/adapters/evm/utils.d.ts +8 -0
- package/lib/adapters/evm/utils.js +51 -0
- package/lib/adapters/solana/confirm.d.ts +88 -0
- package/lib/adapters/solana/confirm.js +291 -0
- package/lib/adapters/solana/constants.d.ts +42 -0
- package/lib/adapters/solana/constants.js +59 -0
- package/lib/adapters/solana/getters.d.ts +42 -0
- package/lib/adapters/solana/getters.js +275 -0
- package/lib/adapters/solana/idl/vault-idl.d.ts +700 -0
- package/lib/adapters/solana/idl/vault-idl.js +2101 -0
- package/lib/adapters/solana/idl/withdrawal-queue-idl.d.ts +795 -0
- package/lib/adapters/solana/idl/withdrawal-queue-idl.js +1864 -0
- package/lib/adapters/solana/index.d.ts +372 -0
- package/lib/adapters/solana/index.js +459 -0
- package/lib/adapters/solana/pricing.d.ts +184 -0
- package/lib/adapters/solana/pricing.js +239 -0
- package/lib/adapters/solana/queue-hints.d.ts +29 -0
- package/lib/adapters/solana/queue-hints.js +59 -0
- package/lib/adapters/solana/queue.actions.d.ts +97 -0
- package/lib/adapters/solana/queue.actions.js +468 -0
- package/lib/adapters/solana/token-reads.d.ts +108 -0
- package/lib/adapters/solana/token-reads.js +145 -0
- package/lib/adapters/solana/types.d.ts +325 -0
- package/lib/adapters/solana/types.js +3 -0
- package/lib/adapters/solana/utils.d.ts +229 -0
- package/lib/adapters/solana/utils.js +773 -0
- package/lib/adapters/solana/vault.actions.d.ts +140 -0
- package/lib/adapters/solana/vault.actions.js +657 -0
- package/lib/adapters/solana/withdrawal-queue.d.ts +125 -0
- package/lib/adapters/solana/withdrawal-queue.js +301 -0
- package/lib/adapters/stellar/actions.d.ts +41 -0
- package/lib/adapters/stellar/actions.js +126 -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 +126 -0
- package/lib/adapters/stellar/index.js +187 -0
- package/lib/adapters/stellar/invocation.d.ts +55 -0
- package/lib/adapters/stellar/invocation.js +92 -0
- package/lib/adapters/stellar/soroban.d.ts +131 -0
- package/lib/adapters/stellar/soroban.js +617 -0
- package/lib/adapters/stellar/submit.d.ts +42 -0
- package/lib/adapters/stellar/submit.js +195 -0
- package/lib/adapters/stellar/types.d.ts +57 -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 +1 -0
- package/lib/adapters/sui/constants.js +9 -0
- package/lib/adapters/sui/getters.d.ts +24 -0
- package/lib/adapters/sui/getters.js +134 -0
- package/lib/adapters/sui/index.d.ts +53 -0
- package/lib/adapters/sui/index.js +96 -0
- package/lib/adapters/sui/transformer.d.ts +10 -0
- package/lib/adapters/sui/transformer.js +115 -0
- package/lib/adapters/sui/types.d.ts +70 -0
- package/lib/adapters/sui/types.js +3 -0
- package/lib/adapters/sui/utils.d.ts +8 -0
- package/lib/adapters/sui/utils.js +17 -0
- package/lib/core/analytics/app-name.d.ts +27 -0
- package/lib/core/analytics/app-name.js +48 -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 +15 -0
- package/lib/core/analytics/constants.js +28 -0
- package/lib/core/analytics/env.d.ts +46 -0
- package/lib/core/analytics/env.js +147 -0
- package/lib/core/analytics/index.d.ts +39 -0
- package/lib/core/analytics/index.js +83 -0
- package/lib/core/analytics/instrumentation.d.ts +29 -0
- package/lib/core/analytics/instrumentation.js +292 -0
- package/lib/core/analytics/method-taxonomy.d.ts +19 -0
- package/lib/core/analytics/method-taxonomy.js +156 -0
- package/lib/core/analytics/metrics.d.ts +48 -0
- package/lib/core/analytics/metrics.js +142 -0
- package/lib/core/analytics/sanitize.d.ts +57 -0
- package/lib/core/analytics/sanitize.js +272 -0
- package/lib/core/analytics/sentry-runtime.d.ts +15 -0
- package/lib/core/analytics/sentry-runtime.js +131 -0
- package/lib/core/analytics/sentry.d.ts +100 -0
- package/lib/core/analytics/sentry.js +696 -0
- package/lib/core/analytics/types.d.ts +55 -0
- package/lib/core/analytics/types.js +3 -0
- package/lib/core/analytics/user-identity.d.ts +55 -0
- package/lib/core/analytics/user-identity.js +218 -0
- package/lib/core/analytics/version.d.ts +6 -0
- package/lib/core/analytics/version.js +10 -0
- package/lib/core/attribution.d.ts +159 -0
- package/lib/core/attribution.js +194 -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 +35 -0
- package/lib/core/base.class.d.ts +193 -0
- package/lib/core/base.class.js +163 -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 +162 -0
- package/lib/core/constants/core.js +281 -0
- package/lib/core/constants/swap-router.d.ts +180 -0
- package/lib/core/constants/swap-router.js +203 -0
- package/lib/core/constants/vaults.d.ts +93 -0
- package/lib/core/constants/vaults.js +277 -0
- package/lib/core/constants/web3.d.ts +106 -0
- package/lib/core/constants/web3.js +251 -0
- package/lib/core/errors/index.d.ts +177 -0
- package/lib/core/errors/index.js +257 -0
- package/lib/core/fetcher.d.ts +237 -0
- package/lib/core/fetcher.js +1103 -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 +697 -0
- package/lib/core/helpers/chain-support.d.ts +98 -0
- package/lib/core/helpers/chain-support.js +139 -0
- package/lib/core/helpers/concurrency.d.ts +51 -0
- package/lib/core/helpers/concurrency.js +79 -0
- package/lib/core/helpers/core.d.ts +92 -0
- package/lib/core/helpers/core.js +368 -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 +61 -0
- package/lib/core/helpers/signer.js +184 -0
- package/lib/core/helpers/swap-router.d.ts +269 -0
- package/lib/core/helpers/swap-router.js +542 -0
- package/lib/core/helpers/vault-version.d.ts +24 -0
- package/lib/core/helpers/vault-version.js +83 -0
- package/lib/core/helpers/vaults.d.ts +89 -0
- package/lib/core/helpers/vaults.js +241 -0
- package/lib/core/helpers/web3.d.ts +366 -0
- package/lib/core/helpers/web3.js +1034 -0
- package/lib/core/index.d.ts +23 -0
- package/lib/core/index.js +40 -0
- package/lib/core/logger/curator-alert.d.ts +217 -0
- package/lib/core/logger/curator-alert.js +276 -0
- package/lib/core/logger/index.d.ts +99 -0
- package/lib/core/logger/index.js +163 -0
- package/lib/core/logger/slack.d.ts +49 -0
- package/lib/core/logger/slack.js +111 -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 +132 -0
- package/lib/evm/methods/crossChainVault.js +857 -0
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +92 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +239 -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 +596 -0
- package/lib/main.js +681 -0
- package/lib/modules/api/fetcher.d.ts +108 -0
- package/lib/modules/api/fetcher.js +187 -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 +587 -0
- package/lib/modules/api/main.js +911 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
- package/lib/modules/sub-accounts/fetcher.js +96 -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 +249 -0
- package/lib/modules/sub-accounts/main.js +211 -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 +84 -0
- package/lib/modules/vaults/adapter.helpers.js +202 -0
- package/lib/modules/vaults/fetcher.d.ts +147 -0
- package/lib/modules/vaults/fetcher.js +357 -0
- package/lib/modules/vaults/getters.d.ts +1060 -0
- package/lib/modules/vaults/getters.js +4079 -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 +607 -0
- package/lib/modules/vaults/main.js +1687 -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 +406 -0
- package/lib/modules/vaults/read.actions.js +891 -0
- package/lib/modules/vaults/types.d.ts +149 -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 +153 -0
- package/lib/modules/vaults/utils.js +818 -0
- package/lib/modules/vaults/write.actions.d.ts +812 -0
- package/lib/modules/vaults/write.actions.js +2377 -0
- package/lib/polyfills.d.ts +1 -0
- package/lib/polyfills.js +12 -0
- package/lib/sdk.d.ts +30154 -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 +50 -0
- package/lib/services/debank/utils.js +325 -0
- package/lib/services/layerzero/deposits.d.ts +55 -0
- package/lib/services/layerzero/deposits.js +174 -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 +33 -0
- package/lib/services/octavfi/fetcher.js +39 -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 +244 -0
- package/lib/services/subgraph/fetcher.d.ts +2 -0
- package/lib/services/subgraph/fetcher.js +66 -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 +48 -0
- package/lib/services/subgraph/schema.js +87 -0
- package/lib/services/subgraph/vaults.d.ts +83 -0
- package/lib/services/subgraph/vaults.js +1282 -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/services/untangled/fetcher.d.ts +40 -0
- package/lib/services/untangled/fetcher.js +110 -0
- package/lib/services/untangled/index.d.ts +3 -0
- package/lib/services/untangled/index.js +20 -0
- package/lib/services/untangled/types.d.ts +83 -0
- package/lib/services/untangled/types.js +10 -0
- package/lib/services/untangled/utils.d.ts +91 -0
- package/lib/services/untangled/utils.js +339 -0
- package/lib/types/api.d.ts +498 -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 +150 -0
- package/lib/types/sub-accounts.js +3 -0
- package/lib/types/subgraph.d.ts +84 -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 +886 -0
- package/lib/types/vaults.js +30 -0
- package/lib/types/web3.d.ts +81 -0
- package/lib/types/web3.js +14 -0
- package/lib/types/webserver.d.ts +730 -0
- package/lib/types/webserver.js +3 -0
- package/package.json +78 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { IAddress, ITokenizedVault } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Per-vault on-chain reads resolved ahead of the positions fan-out, so
|
|
4
|
+
* `getVaultPositions` / `getVaultAvailableRedemptions` can skip their own
|
|
5
|
+
* `balanceOf` / `lagDuration` RPCs. A missing field means the read was not
|
|
6
|
+
* (or could not be) prefetched — the getter falls back to its own call.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface IPrefetchedVaultReads {
|
|
10
|
+
/** Raw share/receipt-token balance of the wallet (`balanceOf`). */
|
|
11
|
+
balance?: bigint;
|
|
12
|
+
/** Vault redemption lag in seconds (`lagDuration`). */
|
|
13
|
+
lagDuration?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Minimal shape of a backend tokenized-vault row the prefetch needs. The
|
|
17
|
+
* full backend response type is looser than this; only these fields are read.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
interface IPrefetchableVault {
|
|
21
|
+
address: string;
|
|
22
|
+
chain: number;
|
|
23
|
+
chain_type?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Backend vault kind. `getVaultVersionV2` reads this to classify evm-2
|
|
26
|
+
* (`multiAssetVault`) vaults whose address isn't in the hardcoded
|
|
27
|
+
* `MULTI_ASSET_VAULTS` list; without it such a vault would be misclassified
|
|
28
|
+
* as evm-1 and the batch would target the vault itself for `balanceOf`
|
|
29
|
+
* instead of its receipt token.
|
|
30
|
+
*/
|
|
31
|
+
internal_type?: ITokenizedVault['internal_type'];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Batch the two non-cacheable per-vault reads (`balanceOf`, `lagDuration`)
|
|
35
|
+
* for a vault list via Multicall3, grouped by chain, ahead of the per-vault
|
|
36
|
+
* positions fan-out.
|
|
37
|
+
*
|
|
38
|
+
* Scope and fallback rules (task 52):
|
|
39
|
+
* - Only EVM vaults on chains with a configured provider AND a verified
|
|
40
|
+
* Multicall3 deployment are batched. Solana/Stellar vaults, unverified
|
|
41
|
+
* chains (e.g. Citrea 4114), and provider-less chains are skipped — they
|
|
42
|
+
* keep today's exact per-vault read path.
|
|
43
|
+
* - `balanceOf` targets the receipt token for evm-2 vaults (resolved through
|
|
44
|
+
* the same cached `getReceiptTokenAddress` the getters use) and the vault
|
|
45
|
+
* itself for evm-1. Without an EVM wallet only `lagDuration` is batched.
|
|
46
|
+
* - Failures never propagate: a reverting vault call is simply absent from
|
|
47
|
+
* the result map, and a whole-chain error drops that chain's entries. The
|
|
48
|
+
* worst case is always "no prefetch → per-vault fallback", never wrong data.
|
|
49
|
+
*
|
|
50
|
+
* RPC cost: per batched chain, `ceil(reads / 10)` `eth_call`s (+1 cold
|
|
51
|
+
* `lpTokenAddress` per evm-2 vault) instead of ~2 `eth_call`s per vault.
|
|
52
|
+
*
|
|
53
|
+
* @param vaults Backend tokenized-vault rows about to be fanned out over.
|
|
54
|
+
* @param wallet Optional EVM wallet for `balanceOf` reads.
|
|
55
|
+
* @param providers Chain-id → RPC-url map (the module's `this.providers`).
|
|
56
|
+
* @returns Map keyed by lowercased vault address; vaults with no batched
|
|
57
|
+
* reads have no entry.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export declare function prefetchVaultPositionReads({ vaults, wallet, providers, }: {
|
|
61
|
+
vaults: IPrefetchableVault[];
|
|
62
|
+
wallet?: IAddress;
|
|
63
|
+
providers?: Partial<Record<number, string>>;
|
|
64
|
+
}): Promise<Map<string, IPrefetchedVaultReads>>;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prefetchVaultPositionReads = prefetchVaultPositionReads;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const abis_1 = require("../../abis");
|
|
6
|
+
const TokenizedVaultV2Receipt_1 = require("../../abis/TokenizedVaultV2Receipt");
|
|
7
|
+
const core_1 = require("../../core");
|
|
8
|
+
/**
|
|
9
|
+
* Batch the two non-cacheable per-vault reads (`balanceOf`, `lagDuration`)
|
|
10
|
+
* for a vault list via Multicall3, grouped by chain, ahead of the per-vault
|
|
11
|
+
* positions fan-out.
|
|
12
|
+
*
|
|
13
|
+
* Scope and fallback rules (task 52):
|
|
14
|
+
* - Only EVM vaults on chains with a configured provider AND a verified
|
|
15
|
+
* Multicall3 deployment are batched. Solana/Stellar vaults, unverified
|
|
16
|
+
* chains (e.g. Citrea 4114), and provider-less chains are skipped — they
|
|
17
|
+
* keep today's exact per-vault read path.
|
|
18
|
+
* - `balanceOf` targets the receipt token for evm-2 vaults (resolved through
|
|
19
|
+
* the same cached `getReceiptTokenAddress` the getters use) and the vault
|
|
20
|
+
* itself for evm-1. Without an EVM wallet only `lagDuration` is batched.
|
|
21
|
+
* - Failures never propagate: a reverting vault call is simply absent from
|
|
22
|
+
* the result map, and a whole-chain error drops that chain's entries. The
|
|
23
|
+
* worst case is always "no prefetch → per-vault fallback", never wrong data.
|
|
24
|
+
*
|
|
25
|
+
* RPC cost: per batched chain, `ceil(reads / 10)` `eth_call`s (+1 cold
|
|
26
|
+
* `lpTokenAddress` per evm-2 vault) instead of ~2 `eth_call`s per vault.
|
|
27
|
+
*
|
|
28
|
+
* @param vaults Backend tokenized-vault rows about to be fanned out over.
|
|
29
|
+
* @param wallet Optional EVM wallet for `balanceOf` reads.
|
|
30
|
+
* @param providers Chain-id → RPC-url map (the module's `this.providers`).
|
|
31
|
+
* @returns Map keyed by lowercased vault address; vaults with no batched
|
|
32
|
+
* reads have no entry.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
async function prefetchVaultPositionReads({ vaults, wallet, providers, }) {
|
|
36
|
+
const reads = new Map();
|
|
37
|
+
const hasWallet = !!(wallet && (0, ethers_1.isAddress)(wallet));
|
|
38
|
+
const byChain = new Map();
|
|
39
|
+
for (const v of vaults) {
|
|
40
|
+
if (!v?.address || !(0, ethers_1.isAddress)(v.address))
|
|
41
|
+
continue;
|
|
42
|
+
if (!(0, core_1.isMulticall3Supported)(v.chain))
|
|
43
|
+
continue;
|
|
44
|
+
if (!providers?.[v.chain])
|
|
45
|
+
continue;
|
|
46
|
+
const group = byChain.get(v.chain) ?? [];
|
|
47
|
+
group.push(v);
|
|
48
|
+
byChain.set(v.chain, group);
|
|
49
|
+
}
|
|
50
|
+
await Promise.all(Array.from(byChain.entries()).map(async ([chain, chainVaults]) => {
|
|
51
|
+
try {
|
|
52
|
+
// Same cache key as the getters (`createProvider(rpcUrl)` without a
|
|
53
|
+
// chainId) so the receipt-token/decimals caches stay shared.
|
|
54
|
+
const provider = (0, core_1.createProvider)(providers[chain]);
|
|
55
|
+
// Resolve each vault's `balanceOf` target — the receipt token for
|
|
56
|
+
// evm-2 vaults (one `lpTokenAddress` read each on a cold cache),
|
|
57
|
+
// the vault itself otherwise. Bound the fan-out to
|
|
58
|
+
// `MULTICALL3_BATCH_SIZE` concurrent reads (CLAUDE.md §4.1): a wallet
|
|
59
|
+
// with many uncached evm-2 vaults on one chain would otherwise burst
|
|
60
|
+
// N simultaneous reads before the aggregate3 batch even fires.
|
|
61
|
+
const balanceTargets = [];
|
|
62
|
+
for (let i = 0; i < chainVaults.length; i += core_1.MULTICALL3_BATCH_SIZE) {
|
|
63
|
+
const slice = chainVaults.slice(i, i + core_1.MULTICALL3_BATCH_SIZE);
|
|
64
|
+
const resolved = await Promise.all(slice.map(async (v) => {
|
|
65
|
+
if (!hasWallet)
|
|
66
|
+
return undefined;
|
|
67
|
+
if ((0, core_1.getVaultVersionV2)(v) === 'evm-2') {
|
|
68
|
+
// Cached + in-flight-deduped; a cold miss costs the same
|
|
69
|
+
// `lpTokenAddress` read the getter itself would make.
|
|
70
|
+
return (0, core_1.getReceiptTokenAddress)(provider, v.address);
|
|
71
|
+
}
|
|
72
|
+
return v.address;
|
|
73
|
+
}));
|
|
74
|
+
balanceTargets.push(...resolved);
|
|
75
|
+
}
|
|
76
|
+
const calls = [];
|
|
77
|
+
const slots = [];
|
|
78
|
+
chainVaults.forEach((v, i) => {
|
|
79
|
+
calls.push({
|
|
80
|
+
target: v.address,
|
|
81
|
+
abi: abis_1.ABI_LENDING_POOL_V2,
|
|
82
|
+
functionName: 'lagDuration',
|
|
83
|
+
});
|
|
84
|
+
slots.push({ address: v.address, field: 'lagDuration' });
|
|
85
|
+
const target = balanceTargets[i];
|
|
86
|
+
if (hasWallet && target && (0, ethers_1.isAddress)(target)) {
|
|
87
|
+
calls.push({
|
|
88
|
+
target: target,
|
|
89
|
+
abi: target === v.address
|
|
90
|
+
? abis_1.ABI_LENDING_POOL_V2
|
|
91
|
+
: TokenizedVaultV2Receipt_1.ABI_TOKENIZED_VAULT_V2_RECEIPT,
|
|
92
|
+
functionName: 'balanceOf',
|
|
93
|
+
args: [wallet],
|
|
94
|
+
});
|
|
95
|
+
slots.push({ address: v.address, field: 'balance' });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
const results = await (0, core_1.multicall3Aggregate)(provider, chain, calls);
|
|
99
|
+
results.forEach((r, i) => {
|
|
100
|
+
if (!r.success)
|
|
101
|
+
return;
|
|
102
|
+
const slot = slots[i];
|
|
103
|
+
const key = slot.address.toLowerCase();
|
|
104
|
+
const entry = reads.get(key) ?? {};
|
|
105
|
+
if (slot.field === 'lagDuration') {
|
|
106
|
+
entry.lagDuration = Number(r.value);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
entry.balance = BigInt(r.value);
|
|
110
|
+
}
|
|
111
|
+
reads.set(key, entry);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
core_1.Logger.log.warn('prefetchVaultPositionReads', `chain ${chain} prefetch failed — falling back to per-vault reads`, e);
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
return reads;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=prefetch.js.map
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import type { IAddress, IContractRunner, INormalizedNumber } from '../../types';
|
|
2
|
+
import type { IContractWriteOptions } from './write.actions';
|
|
3
|
+
/**
|
|
4
|
+
* Function to fetch instant redemption fee
|
|
5
|
+
* @param signer - signer / provider object
|
|
6
|
+
* @param options - object including pool contract address, user wallet address
|
|
7
|
+
* @returns normalized number object of the instant redemption fee
|
|
8
|
+
*/
|
|
9
|
+
export declare function fetchInstantRedemptionFee(signer: IContractRunner, options: IContractWriteOptions): Promise<INormalizedNumber>;
|
|
10
|
+
/**
|
|
11
|
+
* allowance checks user's current allowance per pool
|
|
12
|
+
* @param signer - signer / provider object
|
|
13
|
+
* @param options - object including pool contract address, user wallet address
|
|
14
|
+
* @returns normalized number object of the user's current allowance
|
|
15
|
+
*/
|
|
16
|
+
export declare function vaultAllowance(signer: IContractRunner, options: IContractWriteOptions): Promise<INormalizedNumber>;
|
|
17
|
+
/**
|
|
18
|
+
* Fetches the senders whitelist contract address from a whitelisted allocation vault
|
|
19
|
+
* @param signer - signer / provider object
|
|
20
|
+
* @param options - object including vault contract address
|
|
21
|
+
* @returns the senders whitelist contract address
|
|
22
|
+
*/
|
|
23
|
+
export declare function sendersWhitelistAddress(signer: IContractRunner, options: {
|
|
24
|
+
vault: IAddress;
|
|
25
|
+
}): Promise<IAddress | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if an address is whitelisted on a whitelist contract
|
|
28
|
+
* @param signer - signer / provider object
|
|
29
|
+
* @param options - object including whitelist contract address and wallet address to check
|
|
30
|
+
* @returns boolean indicating if the address is whitelisted
|
|
31
|
+
*/
|
|
32
|
+
export declare function isWhitelisted(signer: IContractRunner, options: {
|
|
33
|
+
whitelist: IAddress;
|
|
34
|
+
wallet: IAddress;
|
|
35
|
+
}): Promise<boolean | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Fetches the total amount deposited by an address on a whitelist contract
|
|
38
|
+
* @param signer - signer / provider object
|
|
39
|
+
* @param options - object including whitelist contract address, wallet address, and vault address
|
|
40
|
+
* @returns normalized number of the deposited amount
|
|
41
|
+
*/
|
|
42
|
+
export declare function getDeposited(signer: IContractRunner, options: {
|
|
43
|
+
whitelist: IAddress;
|
|
44
|
+
wallet: IAddress;
|
|
45
|
+
vault: IAddress;
|
|
46
|
+
}): Promise<INormalizedNumber | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* Fetches the remaining allocation for an address on a whitelist contract
|
|
49
|
+
* @param signer - signer / provider object
|
|
50
|
+
* @param options - object including whitelist contract address, wallet address, vault address, and optional deposit cap amount
|
|
51
|
+
* @returns the remaining allocation as normalized number
|
|
52
|
+
*/
|
|
53
|
+
export declare function getRemainingAllocations(signer: IContractRunner, options: {
|
|
54
|
+
whitelist: IAddress;
|
|
55
|
+
wallet: IAddress;
|
|
56
|
+
vault: IAddress;
|
|
57
|
+
depositCapAmount?: bigint;
|
|
58
|
+
}): Promise<INormalizedNumber | undefined>;
|
|
59
|
+
export type IPreviewRwaRedemptionOptions = {
|
|
60
|
+
/** RwaRedeemSubaccount contract address */
|
|
61
|
+
target: IAddress;
|
|
62
|
+
/** Redeemable asset address (e.g. USDC, USDT) */
|
|
63
|
+
asset: IAddress;
|
|
64
|
+
/** Amount of vault shares to preview */
|
|
65
|
+
amount: string | bigint | number;
|
|
66
|
+
/** Decimals of the vault share token */
|
|
67
|
+
decimals: number;
|
|
68
|
+
/** Decimals of the output/redeemable asset */
|
|
69
|
+
outputDecimals: number;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Preview the output amount for an RWA instant redemption via the RwaRedeemSubaccount contract.
|
|
73
|
+
* @param signer - signer / provider object
|
|
74
|
+
* @param options - object including subaccount address, asset, amount, decimals, and outputDecimals
|
|
75
|
+
* @returns normalized number of the expected output amount (in output asset decimals)
|
|
76
|
+
*/
|
|
77
|
+
export declare function previewRwaRedemption(signer: IContractRunner, options: IPreviewRwaRedemptionOptions): Promise<INormalizedNumber | undefined>;
|
|
78
|
+
/** Options for {@link previewDeposit}. */
|
|
79
|
+
export type IPreviewDepositOptions = {
|
|
80
|
+
/** Vault contract address. */
|
|
81
|
+
vault: IAddress;
|
|
82
|
+
/** Deposit amount in the deposit asset's smallest unit (raw bigint-shaped). */
|
|
83
|
+
amount: string | bigint | number;
|
|
84
|
+
/**
|
|
85
|
+
* Optional deposit asset. Required for multi-asset vaults (EVM-2); ignored
|
|
86
|
+
* for single-asset vaults where the underlying is implicit.
|
|
87
|
+
*/
|
|
88
|
+
asset?: IAddress;
|
|
89
|
+
};
|
|
90
|
+
/** Options for {@link previewRedeem}. */
|
|
91
|
+
export type IPreviewRedeemOptions = {
|
|
92
|
+
/** Vault contract address. */
|
|
93
|
+
vault: IAddress;
|
|
94
|
+
/** Share amount in the vault share token's smallest unit (raw bigint-shaped). */
|
|
95
|
+
shares: string | bigint | number;
|
|
96
|
+
};
|
|
97
|
+
/** Options for {@link allowance}. */
|
|
98
|
+
export type IAllowanceOptions = {
|
|
99
|
+
/** Spender contract — usually the vault address. */
|
|
100
|
+
vault: IAddress;
|
|
101
|
+
/** Owner whose ERC-20 allowance is being queried. */
|
|
102
|
+
owner: IAddress;
|
|
103
|
+
/**
|
|
104
|
+
* Token whose allowance is queried. Defaults to the vault's underlying
|
|
105
|
+
* asset, resolved via `IERC4626.asset()`.
|
|
106
|
+
*/
|
|
107
|
+
asset?: IAddress;
|
|
108
|
+
};
|
|
109
|
+
/** Options for {@link balanceOf}. */
|
|
110
|
+
export type IBalanceOfOptions = {
|
|
111
|
+
/** ERC-20 token address. */
|
|
112
|
+
asset: IAddress;
|
|
113
|
+
/** Owner whose balance is queried. */
|
|
114
|
+
owner: IAddress;
|
|
115
|
+
};
|
|
116
|
+
/** Options for {@link maxDeposit}. */
|
|
117
|
+
export type IMaxDepositOptions = {
|
|
118
|
+
/** Vault contract address. */
|
|
119
|
+
vault: IAddress;
|
|
120
|
+
/**
|
|
121
|
+
* Receiver address — passed to ERC-4626 `maxDeposit(address)` on single-
|
|
122
|
+
* asset vaults. Ignored by EVM-2 multi-asset vaults which expose a vault-
|
|
123
|
+
* level `maxDepositAmount()` without a receiver argument.
|
|
124
|
+
*/
|
|
125
|
+
receiver?: IAddress;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Preview the number of shares that would be minted for a deposit, without
|
|
129
|
+
* touching on-chain state. Routes between single-asset ERC-4626 and EVM-2
|
|
130
|
+
* multi-asset vaults using the vault version detected from backend metadata.
|
|
131
|
+
*
|
|
132
|
+
* @returns The number of shares (raw on-chain units, share-token decimals).
|
|
133
|
+
* @throws UpshiftValidationError on invalid vault address or amount.
|
|
134
|
+
* @throws UpshiftSDKError when the underlying contract call fails.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* const shares = await upshiftSdk.evm.previewDeposit({
|
|
139
|
+
* vault: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32',
|
|
140
|
+
* amount: 1_000_000n, // 1 USDC (6 decimals)
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export declare function previewDeposit(signer: IContractRunner, options: IPreviewDepositOptions): Promise<bigint>;
|
|
145
|
+
/**
|
|
146
|
+
* Preview the number of underlying assets returned by redeeming a given
|
|
147
|
+
* number of shares, without touching on-chain state. Routes between single-
|
|
148
|
+
* asset ERC-4626 (`previewRedeem`) and EVM-2 multi-asset
|
|
149
|
+
* (`previewRedemption(shares, isInstant=false)`) using the vault version.
|
|
150
|
+
*
|
|
151
|
+
* @returns The assets that would be redeemed (raw on-chain units, asset
|
|
152
|
+
* decimals).
|
|
153
|
+
* @throws UpshiftValidationError on invalid vault or share input.
|
|
154
|
+
* @throws UpshiftSDKError when the underlying contract call fails.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* const assets = await upshiftSdk.evm.previewRedeem({
|
|
159
|
+
* vault: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32',
|
|
160
|
+
* shares: 1_000_000_000_000_000_000n, // 1 share (18 decimals)
|
|
161
|
+
* });
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
export declare function previewRedeem(signer: IContractRunner, options: IPreviewRedeemOptions): Promise<bigint>;
|
|
165
|
+
/**
|
|
166
|
+
* Read the ERC-20 allowance an `owner` has granted to a vault (the spender).
|
|
167
|
+
* If `asset` is omitted, the vault's underlying asset is resolved via
|
|
168
|
+
* `IERC4626.asset()` and used as the token.
|
|
169
|
+
*
|
|
170
|
+
* Returns a raw `bigint` to keep BigInt math precise — call
|
|
171
|
+
* {@link toNormalizedBn} if you need a UI-shaped {@link INormalizedNumber}.
|
|
172
|
+
*
|
|
173
|
+
* @returns Allowance in raw on-chain units of `asset`.
|
|
174
|
+
* @throws UpshiftValidationError on invalid addresses.
|
|
175
|
+
* @throws UpshiftSDKError when the underlying contract call fails.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* const raw = await upshiftSdk.evm.allowance({
|
|
180
|
+
* vault: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32',
|
|
181
|
+
* owner: walletAddress,
|
|
182
|
+
* });
|
|
183
|
+
* if (raw < requiredAmount) {
|
|
184
|
+
* await upshiftSdk.evm.vaultApprove({
|
|
185
|
+
* target: vault,
|
|
186
|
+
* wallet: walletAddress,
|
|
187
|
+
* amount: requiredAmount.toString(),
|
|
188
|
+
* });
|
|
189
|
+
* }
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export declare function allowance(signer: IContractRunner, options: IAllowanceOptions): Promise<bigint>;
|
|
193
|
+
/**
|
|
194
|
+
* Read an ERC-20 balance directly. Returns the raw on-chain value as
|
|
195
|
+
* `bigint`; call {@link toNormalizedBn} if you need a {@link INormalizedNumber}.
|
|
196
|
+
*
|
|
197
|
+
* @returns Balance in raw on-chain units of `asset`.
|
|
198
|
+
* @throws UpshiftValidationError on invalid asset / owner addresses.
|
|
199
|
+
* @throws UpshiftSDKError when the underlying contract call fails.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* const raw = await upshiftSdk.evm.balanceOf({
|
|
204
|
+
* asset: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
205
|
+
* owner: walletAddress,
|
|
206
|
+
* });
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export declare function balanceOf(signer: IContractRunner, options: IBalanceOfOptions): Promise<bigint>;
|
|
210
|
+
/**
|
|
211
|
+
* Read the maximum deposit currently accepted by a vault. Routes between
|
|
212
|
+
* single-asset ERC-4626 (`maxDeposit(receiver)`) and EVM-2 multi-asset
|
|
213
|
+
* (`maxDepositAmount()`, vault-level cap, no receiver dependence).
|
|
214
|
+
*
|
|
215
|
+
* @returns Max deposit in raw on-chain units of the deposit asset.
|
|
216
|
+
* @throws UpshiftValidationError on invalid vault address.
|
|
217
|
+
* @throws UpshiftSDKError when the underlying contract call fails.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```ts
|
|
221
|
+
* const cap = await upshiftSdk.evm.maxDeposit({ vault });
|
|
222
|
+
* if (cap === 0n) showVaultIsFullToast();
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare function maxDeposit(signer: IContractRunner, options: IMaxDepositOptions): Promise<bigint>;
|
|
226
|
+
/** Options for {@link getIdleLiquidity}. */
|
|
227
|
+
export type IGetIdleLiquidityOptions = {
|
|
228
|
+
/** EVM-2 (Tokenized Vault V2) vault contract address. */
|
|
229
|
+
vault: IAddress;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Read an EVM-2 vault's idle (uncommitted) liquidity — the balance available
|
|
233
|
+
* to satisfy an instant redemption without a synchronous recall from the
|
|
234
|
+
* settlement module, computed as `getTotalAssets() - externalAssets()`.
|
|
235
|
+
*
|
|
236
|
+
* EVM-2 only. Two on-chain reads with no caching — call it immediately
|
|
237
|
+
* before sizing an instant redemption rather than reusing a stale value, and
|
|
238
|
+
* size the redemption against the result rather than against total assets.
|
|
239
|
+
*
|
|
240
|
+
* @returns Idle liquidity, in the vault's reference-asset raw units.
|
|
241
|
+
* @throws UpshiftValidationError on invalid vault address or a non-EVM-2 vault.
|
|
242
|
+
* @throws UpshiftSDKError when either underlying contract read fails.
|
|
243
|
+
*
|
|
244
|
+
* @worstCaseRpcCalls 3 — vault-version lookup, `getTotalAssets`, `externalAssets`.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* const idle = await upshiftSdk.evm.getIdleLiquidity({ vault: vaultAddress });
|
|
249
|
+
* if (redeemAmount > idle) {
|
|
250
|
+
* // fall back to a queued withdrawal instead of an instant one
|
|
251
|
+
* }
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
export declare function getIdleLiquidity(signer: IContractRunner, options: IGetIdleLiquidityOptions): Promise<bigint>;
|
|
255
|
+
/** Options for {@link lagDuration}. */
|
|
256
|
+
export type ILagDurationOptions = {
|
|
257
|
+
/** EVM-2 (Tokenized Vault V2) vault contract address. */
|
|
258
|
+
vault: IAddress;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Read an EVM-2 vault's queued-withdrawal lag — the delay, in seconds,
|
|
262
|
+
* between `requestRedeem` and the withdrawal epoch becoming claimable.
|
|
263
|
+
*
|
|
264
|
+
* EVM-2 only. This value is per-vault (259,200s / 3 days on sentUSD, but
|
|
265
|
+
* shorter on other deployments) and can change after launch — read it live
|
|
266
|
+
* rather than hardcoding it.
|
|
267
|
+
*
|
|
268
|
+
* @returns Lag duration, in seconds.
|
|
269
|
+
* @throws UpshiftValidationError on invalid vault address or a non-EVM-2 vault.
|
|
270
|
+
* @throws UpshiftSDKError when the underlying contract read fails.
|
|
271
|
+
*
|
|
272
|
+
* @worstCaseRpcCalls 2 — vault-version lookup, `lagDuration`.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* const seconds = await upshiftSdk.evm.lagDuration({ vault: vaultAddress });
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
export declare function lagDuration(signer: IContractRunner, options: ILagDurationOptions): Promise<bigint>;
|
|
280
|
+
/** Options for {@link getWithdrawalEpoch}. */
|
|
281
|
+
export type IGetWithdrawalEpochOptions = {
|
|
282
|
+
/** EVM-2 (Tokenized Vault V2) vault contract address. */
|
|
283
|
+
vault: IAddress;
|
|
284
|
+
};
|
|
285
|
+
/** An EVM-2 vault's current withdrawal epoch, as read from `getWithdrawalEpoch()`. */
|
|
286
|
+
export type IWithdrawalEpoch = {
|
|
287
|
+
year: bigint;
|
|
288
|
+
month: bigint;
|
|
289
|
+
day: bigint;
|
|
290
|
+
/** Unix timestamp at which the current epoch's queued withdrawals become claimable. */
|
|
291
|
+
claimableEpoch: bigint;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Read an EVM-2 vault's current withdrawal epoch.
|
|
295
|
+
*
|
|
296
|
+
* The on-chain return order is `(year, month, day, claimableEpoch)` —
|
|
297
|
+
* `claimableEpoch` last, not first. This is the opposite order from what
|
|
298
|
+
* `requestRedeem` returns (`(claimableEpoch, year, month, day)`, epoch
|
|
299
|
+
* first); treat that call's return value, not this one, as the source of
|
|
300
|
+
* truth for a specific withdrawal's claim date.
|
|
301
|
+
*
|
|
302
|
+
* @returns The vault's current withdrawal epoch, by named field.
|
|
303
|
+
* @throws UpshiftValidationError on invalid vault address or a non-EVM-2 vault.
|
|
304
|
+
* @throws UpshiftSDKError when the underlying contract read fails.
|
|
305
|
+
*
|
|
306
|
+
* @worstCaseRpcCalls 2 — vault-version lookup, `getWithdrawalEpoch`.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* const { year, month, day, claimableEpoch } = await upshiftSdk.evm.getWithdrawalEpoch({
|
|
311
|
+
* vault: vaultAddress,
|
|
312
|
+
* });
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
export declare function getWithdrawalEpoch(signer: IContractRunner, options: IGetWithdrawalEpochOptions): Promise<IWithdrawalEpoch>;
|
|
316
|
+
/** Options shared by the EVM-2 queued-withdrawal-date reads. */
|
|
317
|
+
type IWithdrawalDateOptions = {
|
|
318
|
+
/** EVM-2 (Tokenized Vault V2) vault contract address. */
|
|
319
|
+
vault: IAddress;
|
|
320
|
+
/** Withdrawal-epoch year, as returned by `requestRedeem`/`getWithdrawalEpoch`. */
|
|
321
|
+
year: string | bigint | number;
|
|
322
|
+
/** Withdrawal-epoch month, same source as `year`. */
|
|
323
|
+
month: string | bigint | number;
|
|
324
|
+
/** Withdrawal-epoch day, same source as `year`. */
|
|
325
|
+
day: string | bigint | number;
|
|
326
|
+
};
|
|
327
|
+
/** Options for {@link getBurnableAmountByReceiver}. */
|
|
328
|
+
export type IGetBurnableAmountByReceiverOptions = IWithdrawalDateOptions & {
|
|
329
|
+
/** Address whose claimable amount for this date is being queried. */
|
|
330
|
+
receiver: IAddress;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Read how much of a withdrawal-epoch date's queue a given receiver can
|
|
334
|
+
* currently claim via `claim`, before sending the claim transaction.
|
|
335
|
+
*
|
|
336
|
+
* EVM-2 only.
|
|
337
|
+
*
|
|
338
|
+
* @returns The claimable amount, in share-token raw units.
|
|
339
|
+
* @throws UpshiftValidationError on invalid address input or a non-EVM-2 vault.
|
|
340
|
+
* @throws UpshiftSDKError when the underlying contract read fails.
|
|
341
|
+
*
|
|
342
|
+
* @worstCaseRpcCalls 2 — vault-version lookup, `getBurnableAmountByReceiver`.
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```ts
|
|
346
|
+
* const claimable = await upshiftSdk.evm.getBurnableAmountByReceiver({
|
|
347
|
+
* vault: vaultAddress,
|
|
348
|
+
* receiver: walletAddress,
|
|
349
|
+
* year, month, day,
|
|
350
|
+
* });
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
export declare function getBurnableAmountByReceiver(signer: IContractRunner, options: IGetBurnableAmountByReceiverOptions): Promise<bigint>;
|
|
354
|
+
/** Options for {@link getRequirementByDate}. */
|
|
355
|
+
export type IGetRequirementByDateOptions = IWithdrawalDateOptions;
|
|
356
|
+
/**
|
|
357
|
+
* Read the total shares required to settle a withdrawal-epoch date's entire
|
|
358
|
+
* queue.
|
|
359
|
+
*
|
|
360
|
+
* EVM-2 only.
|
|
361
|
+
*
|
|
362
|
+
* @returns Required shares, in share-token raw units.
|
|
363
|
+
* @throws UpshiftValidationError on invalid vault address or a non-EVM-2 vault.
|
|
364
|
+
* @throws UpshiftSDKError when the underlying contract read fails.
|
|
365
|
+
*
|
|
366
|
+
* @worstCaseRpcCalls 2 — vault-version lookup, `getRequirementByDate`.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```ts
|
|
370
|
+
* const shares = await upshiftSdk.evm.getRequirementByDate({
|
|
371
|
+
* vault: vaultAddress,
|
|
372
|
+
* year, month, day,
|
|
373
|
+
* });
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
export declare function getRequirementByDate(signer: IContractRunner, options: IGetRequirementByDateOptions): Promise<bigint>;
|
|
377
|
+
/** Options for {@link getScheduledTransactionsByDate}. */
|
|
378
|
+
export type IGetScheduledTransactionsByDateOptions = IWithdrawalDateOptions;
|
|
379
|
+
/** Scheduled queued-withdrawal volume for a withdrawal-epoch date. */
|
|
380
|
+
export type IScheduledTransactionsByDate = {
|
|
381
|
+
totalTransactions: bigint;
|
|
382
|
+
/** Unix timestamp this date's queue is scheduled to execute. */
|
|
383
|
+
executionEpoch: bigint;
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Read the scheduled queued-withdrawal volume for a withdrawal-epoch date.
|
|
387
|
+
*
|
|
388
|
+
* EVM-2 only.
|
|
389
|
+
*
|
|
390
|
+
* @returns Total scheduled transactions and their execution epoch.
|
|
391
|
+
* @throws UpshiftValidationError on invalid vault address or a non-EVM-2 vault.
|
|
392
|
+
* @throws UpshiftSDKError when the underlying contract read fails.
|
|
393
|
+
*
|
|
394
|
+
* @worstCaseRpcCalls 2 — vault-version lookup, `getScheduledTransactionsByDate`.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```ts
|
|
398
|
+
* const { totalTransactions, executionEpoch } =
|
|
399
|
+
* await upshiftSdk.evm.getScheduledTransactionsByDate({
|
|
400
|
+
* vault: vaultAddress,
|
|
401
|
+
* year, month, day,
|
|
402
|
+
* });
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
export declare function getScheduledTransactionsByDate(signer: IContractRunner, options: IGetScheduledTransactionsByDateOptions): Promise<IScheduledTransactionsByDate>;
|
|
406
|
+
export {};
|