@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,812 @@
|
|
|
1
|
+
import { type Signer, type Wallet, type TransactionResponse } from 'ethers';
|
|
2
|
+
import { type IAddress, SwapRouterVaultType } from '../../types';
|
|
3
|
+
import type { ISwapAndDepositOptions, ISwapRouterDirectDepositOptions, ISwapRouterNativeDepositOptions, ISwapRouterDepositOptions } from '../../types';
|
|
4
|
+
export type IContractWriteOptions = {
|
|
5
|
+
target: IAddress;
|
|
6
|
+
wallet: IAddress;
|
|
7
|
+
amount?: string | bigint | number;
|
|
8
|
+
wait?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Optional: Token to deposit (defaults to vault's underlying asset)
|
|
11
|
+
* If different from underlying, will use adapter logic
|
|
12
|
+
*/
|
|
13
|
+
depositAsset?: IAddress;
|
|
14
|
+
/**
|
|
15
|
+
* Optional: Chain ID for the vault (used for adapter routing)
|
|
16
|
+
*/
|
|
17
|
+
chainId?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Optional: Pool/vault name for adapter routing
|
|
20
|
+
*/
|
|
21
|
+
poolName?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional: boolean for instant redeem
|
|
24
|
+
*/
|
|
25
|
+
isInstantRedeem?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Optional: boolean for depositWithPermit
|
|
28
|
+
*/
|
|
29
|
+
isDepositWithPermit?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Ignored — `vaultDeposit` mints to `wallet`. Use
|
|
32
|
+
* {@link swapRouterDeposit}'s `receiver` instead.
|
|
33
|
+
*/
|
|
34
|
+
receiver?: IAddress;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Ignored — `vaultDeposit` never swaps. Use
|
|
37
|
+
* {@link swapRouterDeposit}'s `slippageBps` instead.
|
|
38
|
+
*/
|
|
39
|
+
slippageBps?: number;
|
|
40
|
+
};
|
|
41
|
+
export type INativeDepositOptions = {
|
|
42
|
+
/**
|
|
43
|
+
* MultiAssetNativeDepositWrapper contract address
|
|
44
|
+
*/
|
|
45
|
+
wrapperAddress: IAddress;
|
|
46
|
+
/**
|
|
47
|
+
* Optional: Receiver address for the deposit (defaults to signer address)
|
|
48
|
+
* If not provided, uses the overload without receiver parameter
|
|
49
|
+
*/
|
|
50
|
+
receiver?: IAddress;
|
|
51
|
+
/**
|
|
52
|
+
* Amount of native token (ETH/AVAX/etc) to deposit
|
|
53
|
+
*/
|
|
54
|
+
amount: string | bigint | number;
|
|
55
|
+
/**
|
|
56
|
+
* Optional: Wait for transaction confirmation
|
|
57
|
+
*/
|
|
58
|
+
wait?: boolean;
|
|
59
|
+
};
|
|
60
|
+
/** @internal */
|
|
61
|
+
export declare function safeBigInt(value: unknown, context?: string): bigint;
|
|
62
|
+
/** @internal */
|
|
63
|
+
export declare function resolveDepositTokenDecimals(args: {
|
|
64
|
+
actualDepositAsset: IAddress;
|
|
65
|
+
underlyingAsset: IAddress;
|
|
66
|
+
isNativeToken: boolean;
|
|
67
|
+
isMultiAssetVault: boolean;
|
|
68
|
+
vaultDecimals: number;
|
|
69
|
+
readErc20Decimals: (address: IAddress) => Promise<number>;
|
|
70
|
+
}): Promise<number>;
|
|
71
|
+
/** @internal */
|
|
72
|
+
export declare function resolveSpender(args: {
|
|
73
|
+
target: IAddress;
|
|
74
|
+
isMultiAssetVault: boolean;
|
|
75
|
+
isAdapterDeposit: boolean;
|
|
76
|
+
adapterWrapperAddress?: IAddress;
|
|
77
|
+
}): IAddress;
|
|
78
|
+
/** @internal */
|
|
79
|
+
export declare function validateAmountPrecision(amount: string | bigint | number): void;
|
|
80
|
+
/** @internal */
|
|
81
|
+
export declare function isNonceParsing(error: unknown): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Await a broadcast transaction's receipt, surviving both malformed-nonce RPCs
|
|
84
|
+
* and transient transport faults while still reporting genuine on-chain
|
|
85
|
+
* failures.
|
|
86
|
+
*
|
|
87
|
+
* `tx.wait()` is tried first because it preserves ethers' replacement-tx
|
|
88
|
+
* detection and revert checks. Two recoverable failure modes are handled:
|
|
89
|
+
*
|
|
90
|
+
* 1. **Malformed nonce** ({@link isNonceParsing}) — Monad-style RPCs return
|
|
91
|
+
* `nonce: "undefined"` on the pending tx and ethers throws while parsing.
|
|
92
|
+
* One direct `provider.waitForTransaction()` recovers it (unchanged
|
|
93
|
+
* behaviour).
|
|
94
|
+
* 2. **Transient transport fault** ({@link isRetryableRpcError}) — the provider
|
|
95
|
+
* hiccups while polling `eth_getTransactionReceipt` and ethers surfaces
|
|
96
|
+
* `could not coalesce error (… "code": -32603 …)`. This used to propagate
|
|
97
|
+
* and make every write path report a **successfully mined** transaction as
|
|
98
|
+
* failed, driving users to retry into `ERC20InsufficientBalance`. The hash
|
|
99
|
+
* is already on the wire and receipt polling is idempotent, so we re-poll
|
|
100
|
+
* with bounded exponential backoff instead of rethrowing.
|
|
101
|
+
*
|
|
102
|
+
* Everything else — notably a real revert — is rethrown untouched.
|
|
103
|
+
*
|
|
104
|
+
* Every error this function throws is stamped by {@link markBroadcast}: by the
|
|
105
|
+
* time `tx.wait()` can fail, the transaction is already on the wire, so the
|
|
106
|
+
* caller must never report it as "never sent". See
|
|
107
|
+
* {@link localTxBroadcastContext} for how that reaches
|
|
108
|
+
* `UpshiftSDKError.context`.
|
|
109
|
+
*
|
|
110
|
+
* @param tx - The broadcast transaction response to await.
|
|
111
|
+
* @returns The mined receipt (never `null` on the fallback paths; `tx.wait()`
|
|
112
|
+
* itself may return `null` when the caller configured 0 confirmations).
|
|
113
|
+
* @throws {Error} `Transaction <hash> reverted on-chain` when the receipt
|
|
114
|
+
* reports `status === 0`. Marked `confirmationUnknown: false` — the chain
|
|
115
|
+
* answered.
|
|
116
|
+
* @throws {Error} `Transaction <hash> was not confirmed within <n>s` when the
|
|
117
|
+
* overall wait times out with no receipt. Marked
|
|
118
|
+
* `confirmationUnknown: true`.
|
|
119
|
+
* @throws The underlying transport error once receipt-poll retries are
|
|
120
|
+
* exhausted, marked `confirmationUnknown: true`.
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
export declare function safeWaitForTx(tx: TransactionResponse): Promise<import("ethers").TransactionReceipt>;
|
|
124
|
+
/**
|
|
125
|
+
* Wraps an ethers contract call that returns a TransactionResponse.
|
|
126
|
+
* Some RPCs (e.g. Monad) return malformed pending tx fields like `nonce: "undefined"`,
|
|
127
|
+
* which causes ethers.js to throw during response parsing before safeWaitForTx runs.
|
|
128
|
+
* This wrapper catches that error, extracts the tx hash from the error context, and
|
|
129
|
+
* falls back to provider.waitForTransaction().
|
|
130
|
+
*/
|
|
131
|
+
/** @internal */
|
|
132
|
+
export declare function safeSendTx(contractCall: () => Promise<TransactionResponse>, provider: Signer | Wallet, shouldWait?: boolean): Promise<{
|
|
133
|
+
tx: TransactionResponse | null;
|
|
134
|
+
hash: string;
|
|
135
|
+
}>;
|
|
136
|
+
/**
|
|
137
|
+
* Shared nonce-recovery helper for catch blocks. When an RPC returns a
|
|
138
|
+
* malformed nonce and ethers throws, try to extract the tx hash from the
|
|
139
|
+
* error payload. Optionally waits for confirmation (with status check).
|
|
140
|
+
*
|
|
141
|
+
* Returns the recovered hash, or null if this error is not a nonce-parse error
|
|
142
|
+
* or if no hash could be extracted (caller should re-throw the original error).
|
|
143
|
+
*/
|
|
144
|
+
/** @internal */
|
|
145
|
+
export declare function tryRecoverTxHash(error: unknown, signer: Signer | Wallet, wait?: boolean): Promise<string | null>;
|
|
146
|
+
/**
|
|
147
|
+
* Discriminated union returned by {@link approve}. Lets callers tell apart
|
|
148
|
+
* "we sent a tx" / "existing allowance already covers it" / "native token, no
|
|
149
|
+
* allowance applies" without re-reading on-chain state.
|
|
150
|
+
*/
|
|
151
|
+
export type ApproveResult =
|
|
152
|
+
/** An `approve` transaction was sent. `hash` is the tx hash. */
|
|
153
|
+
{
|
|
154
|
+
kind: 'sent';
|
|
155
|
+
hash: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Existing allowance already covers `amount`; no tx sent. `existing` is
|
|
159
|
+
* the on-chain allowance (raw bigint, in deposit-token units).
|
|
160
|
+
*/
|
|
161
|
+
| {
|
|
162
|
+
kind: 'sufficient';
|
|
163
|
+
existing: bigint;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The resolved deposit asset is the native token — it travels as
|
|
167
|
+
* `msg.value`, so no ERC-20 allowance applies. No tx sent.
|
|
168
|
+
*/
|
|
169
|
+
| {
|
|
170
|
+
kind: 'native';
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Why {@link getDepositRoute} kept a deposit on the vault's native path, or,
|
|
174
|
+
* on the router route, why the configured origin code was not sent.
|
|
175
|
+
*
|
|
176
|
+
* Native-path reasons: `no-router` (no SwapRouter on the chain), `permit`,
|
|
177
|
+
* `native-token`, `adapter`, `legacy-pool` (an `evm-0` lending pool, never
|
|
178
|
+
* tested against the router), `asset-not-accepted`, `kyc-vault` (the vault has
|
|
179
|
+
* a senders whitelist, so the router cannot deposit for the user) and
|
|
180
|
+
* `router-paused` (the owner paused the router; the deposit goes straight to
|
|
181
|
+
* the vault, even under `attribution.strictOrigin`, until it is unpaused).
|
|
182
|
+
*
|
|
183
|
+
* Router-route reason: `origin-not-registered` (the configured code is not
|
|
184
|
+
* registered on the router, so the deposit sends the zero code instead).
|
|
185
|
+
*
|
|
186
|
+
* `no-origin-code`, `chain-not-supported`, `vault-not-registered` and
|
|
187
|
+
* `router-token-not-whitelisted` are no longer returned: since SwapRouter v2 a
|
|
188
|
+
* deposit routes without an origin code and the router has no vault registry,
|
|
189
|
+
* and the router's direct deposit takes any asset the vault accepts. They stay
|
|
190
|
+
* in the union so integrator code that switches on them keeps compiling.
|
|
191
|
+
*/
|
|
192
|
+
export type DepositRouteReason = 'no-router' | 'permit' | 'native-token' | 'adapter' | 'legacy-pool' | 'asset-not-accepted' | 'kyc-vault' | 'router-paused' | 'origin-not-registered'
|
|
193
|
+
/** @deprecated Not returned since SwapRouter v2: a deposit routes without an origin code. */
|
|
194
|
+
| 'no-origin-code'
|
|
195
|
+
/** @deprecated Not returned since SwapRouter v2: routing no longer depends on the attribution chain list. */
|
|
196
|
+
| 'chain-not-supported'
|
|
197
|
+
/** @deprecated Not returned since SwapRouter v2: the router has no vault registry. */
|
|
198
|
+
| 'vault-not-registered'
|
|
199
|
+
/** @deprecated Not returned: the router's direct deposit takes any asset the vault accepts. */
|
|
200
|
+
| 'router-token-not-whitelisted';
|
|
201
|
+
/** A deposit's route — the SwapRouter or the vault's native path — and the address to approve. */
|
|
202
|
+
export type IDepositRoute = {
|
|
203
|
+
/**
|
|
204
|
+
* `router`: `SwapRouter.deposit` (a direct deposit, never a swap) carrying
|
|
205
|
+
* `originCode`. `native`: the vault's own deposit path.
|
|
206
|
+
*/
|
|
207
|
+
via: 'native' | 'router';
|
|
208
|
+
/** Address to approve for the deposit token; `null` for a native-token deposit (`msg.value`). */
|
|
209
|
+
spender: IAddress | null;
|
|
210
|
+
/**
|
|
211
|
+
* Why the deposit stays native. On the router route it is set only to
|
|
212
|
+
* `origin-not-registered`, when the configured code was replaced by the zero
|
|
213
|
+
* code.
|
|
214
|
+
*/
|
|
215
|
+
reason?: DepositRouteReason;
|
|
216
|
+
/**
|
|
217
|
+
* Router route only: the 32-byte origin code the deposit sends. The
|
|
218
|
+
* instance `attribution.originCode` when it is registered, else the all-zero
|
|
219
|
+
* code ({@link ORIGIN_CODES.default}, no origin fee).
|
|
220
|
+
*/
|
|
221
|
+
originCode?: `0x${string}`;
|
|
222
|
+
/** Router route only: the vault type the deposit sends to the router. */
|
|
223
|
+
vaultType?: SwapRouterVaultType;
|
|
224
|
+
};
|
|
225
|
+
/** Options for {@link getDepositRoute} — the same fields `vaultDeposit` reads. */
|
|
226
|
+
export type IGetDepositRouteOptions = Pick<IContractWriteOptions, 'target' | 'depositAsset' | 'chainId' | 'isDepositWithPermit'>;
|
|
227
|
+
/**
|
|
228
|
+
* Resolve whether a deposit goes through the SwapRouter (`router`) or takes
|
|
229
|
+
* the vault's native path (`native`), and which address to approve.
|
|
230
|
+
* Read-only. `vaultDeposit` and `approve` follow this route, so integrators
|
|
231
|
+
* that manage approvals themselves must approve `route.spender`, not the
|
|
232
|
+
* vault.
|
|
233
|
+
*
|
|
234
|
+
* Since SwapRouter v2 a normal deposit routes whether or not an origin code is
|
|
235
|
+
* configured: the route is `router` when the chain has a SwapRouter, the
|
|
236
|
+
* vault accepts the asset directly (its reference asset, or a Tokenized
|
|
237
|
+
* Vault V2 whitelisted asset — deposited as-is, never swapped), the vault has
|
|
238
|
+
* no senders whitelist (KYC), the router is not paused, and the deposit is not
|
|
239
|
+
* a permit, native-token, adapter or legacy lending-pool deposit. Otherwise it
|
|
240
|
+
* is `native` with a `reason`. The router's token whitelist does not apply: it
|
|
241
|
+
* only gates swaps.
|
|
242
|
+
*
|
|
243
|
+
* The router route carries the instance `attribution.originCode` when it is
|
|
244
|
+
* registered, else the zero code (with `reason: 'origin-not-registered'` when
|
|
245
|
+
* a configured code was dropped). A paused router gives `router-paused` even
|
|
246
|
+
* under `attribution.strictOrigin`.
|
|
247
|
+
*
|
|
248
|
+
* @param signer - ethers `Signer` / `Wallet` used for the reads.
|
|
249
|
+
* @param options - {@link IGetDepositRouteOptions}; `depositAsset` defaults
|
|
250
|
+
* to the vault's underlying.
|
|
251
|
+
* @returns {@link IDepositRoute}.
|
|
252
|
+
* @throws UpshiftValidationError on an invalid `target`, or an unregistered
|
|
253
|
+
* code under `attribution.strictOrigin` while the router is not paused.
|
|
254
|
+
* @throws UpshiftSDKError when a backend, vault or router read fails.
|
|
255
|
+
* @worstCaseRpcCalls 7 — the backend vault row, `asset()`, the vault's
|
|
256
|
+
* `assetsWhitelistAddress()` and `getWhitelistedAssets()` (Tokenized Vault
|
|
257
|
+
* V2 non-reference asset only), its `sendersWhitelistAddress()` (Tokenized
|
|
258
|
+
* Vault V2 only), the router's `isPaused()` and `origins` (non-zero code
|
|
259
|
+
* only). Every read except `asset()` is cached for 5 minutes, `isPaused()`
|
|
260
|
+
* for 15 seconds. No router read on a chain without a SwapRouter.
|
|
261
|
+
* @example
|
|
262
|
+
* ```ts
|
|
263
|
+
* const route = await upshiftSdk.evm.getDepositRoute({ target: vault, depositAsset: usdt });
|
|
264
|
+
* if (route.spender) await approveToken(usdt, route.spender, amount);
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
export declare function getDepositRoute(signer: Signer | Wallet, options: IGetDepositRouteOptions): Promise<IDepositRoute>;
|
|
268
|
+
/**
|
|
269
|
+
* Approve a vault (or the appropriate adapter wrapper) to spend a token
|
|
270
|
+
* ahead of a separate deposit call. Spender routing mirrors
|
|
271
|
+
* {@link vaultDeposit} (multi-asset → vault, adapter → wrapper, standard →
|
|
272
|
+
* vault, SwapRouter when {@link getDepositRoute} routes there). Returns
|
|
273
|
+
* `undefined` when the existing allowance already covers `amount` **or**
|
|
274
|
+
* when the deposit asset is native.
|
|
275
|
+
*
|
|
276
|
+
* @returns Transaction hash when an approval was sent, `undefined` when
|
|
277
|
+
* the existing allowance already covers `amount` or the deposit asset is
|
|
278
|
+
* native (no ERC-20 allowance applies). Use {@link approve} for a
|
|
279
|
+
* discriminated `ApproveResult` if you need to tell those two cases apart.
|
|
280
|
+
* @throws UpshiftValidationError on invalid wallet/target/amount.
|
|
281
|
+
* @throws UpshiftValidationError when `attribution.strictOrigin` is set and the
|
|
282
|
+
* configured origin code is not registered on the SwapRouter (the spender
|
|
283
|
+
* follows {@link getDepositRoute}).
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```ts
|
|
287
|
+
* const hash = await upshiftSdk.evm.vaultApprove({
|
|
288
|
+
* target: '0x...', // vault contract address
|
|
289
|
+
* wallet: walletAddress,
|
|
290
|
+
* amount: '100', // 100 of the deposit token (UI units)
|
|
291
|
+
* wait: true, // wait for the approval to confirm
|
|
292
|
+
* });
|
|
293
|
+
* if (hash) console.log('approve tx', hash);
|
|
294
|
+
* // hash === undefined means the on-chain allowance already covers the
|
|
295
|
+
* // amount, or the deposit asset is native (msg.value, no allowance).
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
export declare function vaultApprove(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string | undefined>;
|
|
299
|
+
/**
|
|
300
|
+
* Same approval logic as {@link vaultApprove} but returns a discriminated
|
|
301
|
+
* union so callers can tell `sent` apart from `sufficient` and `native`
|
|
302
|
+
* without re-reading on-chain state. Preferred shape for new integrations.
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```ts
|
|
306
|
+
* const r = await upshiftSdk.evm.approve({
|
|
307
|
+
* target: vaultAddress,
|
|
308
|
+
* wallet: walletAddress,
|
|
309
|
+
* amount: '100',
|
|
310
|
+
* wait: true,
|
|
311
|
+
* });
|
|
312
|
+
* switch (r.kind) {
|
|
313
|
+
* case 'sent':
|
|
314
|
+
* showToast('Approval submitted', r.hash);
|
|
315
|
+
* break;
|
|
316
|
+
* case 'sufficient':
|
|
317
|
+
* // r.existing is the existing on-chain allowance (raw bigint)
|
|
318
|
+
* break;
|
|
319
|
+
* case 'native':
|
|
320
|
+
* // No allowance needed; native token will travel as msg.value
|
|
321
|
+
* break;
|
|
322
|
+
* }
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* @throws UpshiftValidationError on invalid wallet/target/amount.
|
|
326
|
+
* @throws UpshiftValidationError when `attribution.strictOrigin` is set and the
|
|
327
|
+
* configured origin code is not registered on the SwapRouter (the spender
|
|
328
|
+
* follows {@link getDepositRoute}).
|
|
329
|
+
* @throws UpshiftSDKError when the approval submission fails.
|
|
330
|
+
*/
|
|
331
|
+
export declare function approve(signer: Signer | Wallet, options: IContractWriteOptions): Promise<ApproveResult>;
|
|
332
|
+
/**
|
|
333
|
+
* Deposit underlying token into the specified vault. Auto-routes to the
|
|
334
|
+
* correct contract path (single-asset ERC-4626, EVM-2 multi-asset,
|
|
335
|
+
* Paraswap adapter, native-token wrapper, depositWithPermit) based on the
|
|
336
|
+
* vault version and `depositAsset`.
|
|
337
|
+
*
|
|
338
|
+
* A deposit the SwapRouter can take directly goes through `SwapRouter.deposit`
|
|
339
|
+
* with or without an origin code, and the router is approved instead of the
|
|
340
|
+
* vault — see {@link getDepositRoute} for the rules and the fallback reasons.
|
|
341
|
+
* It carries the instance `attribution.originCode` when that code is
|
|
342
|
+
* registered, else the zero code.
|
|
343
|
+
*
|
|
344
|
+
* Amounts are encoded against the **deposit token's** decimals, not the
|
|
345
|
+
* vault's share decimals. The SDK reads the appropriate decimals via the
|
|
346
|
+
* vault metadata and the asset's ERC-20.
|
|
347
|
+
*
|
|
348
|
+
* Approval is handled automatically: if the existing allowance doesn't
|
|
349
|
+
* cover `amount`, an `approve` is sent and **always waited for** (regardless
|
|
350
|
+
* of the caller's `wait` flag) so the deposit tx can't be re-ordered ahead
|
|
351
|
+
* of the approval on Monad-style RPCs.
|
|
352
|
+
*
|
|
353
|
+
* @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
|
|
354
|
+
* @param options Vault address, wallet, amount, optional `depositAsset` for
|
|
355
|
+
* adapter routes, optional `wait` to wait for the deposit receipt.
|
|
356
|
+
* @returns Deposit transaction hash.
|
|
357
|
+
* @throws UpshiftValidationError on invalid wallet/target/amount or missing
|
|
358
|
+
* adapter config when `depositAsset` differs from the vault underlying.
|
|
359
|
+
* @throws UpshiftValidationError (`INVALID_INPUT`) when the vault's adapter is
|
|
360
|
+
* the Paraswap bridge (`bridgeId === 2`): that route is not supported here
|
|
361
|
+
* and is refused before any approval or deposit transaction is sent — use
|
|
362
|
+
* {@link swapRouterDeposit} or deposit the underlying asset directly.
|
|
363
|
+
* @throws UpshiftValidationError when `attribution.strictOrigin` is set and the
|
|
364
|
+
* configured origin code is not registered on the SwapRouter.
|
|
365
|
+
* @throws UpshiftSDKError when the deposit submission or on-chain call fails.
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```ts
|
|
369
|
+
* const hash = await upshiftSdk.evm.vaultDeposit({
|
|
370
|
+
* target: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32', // vault
|
|
371
|
+
* wallet: walletAddress,
|
|
372
|
+
* amount: '100', // 100 USDC (UI units)
|
|
373
|
+
* wait: true, // wait for the deposit receipt
|
|
374
|
+
* });
|
|
375
|
+
* ```
|
|
376
|
+
*
|
|
377
|
+
* @example Adapter deposit (different deposit asset than the vault's underlying)
|
|
378
|
+
* ```ts
|
|
379
|
+
* await upshiftSdk.evm.vaultDeposit({
|
|
380
|
+
* target: vaultAddress,
|
|
381
|
+
* wallet: walletAddress,
|
|
382
|
+
* amount: '0.5',
|
|
383
|
+
* depositAsset: WETH_ADDRESS, // swap WETH -> vault underlying via the adapter
|
|
384
|
+
* chainId: 1,
|
|
385
|
+
* });
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export declare function vaultDeposit(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
|
|
389
|
+
/**
|
|
390
|
+
* Request to redeem vault shares. For EVM-1 vaults this queues a standard
|
|
391
|
+
* redemption (claimable later via `vaultRedeem`). For EVM-2 vaults the queued
|
|
392
|
+
* `requestRedeem` escrows the shares in the vault via `transferFrom`, so this
|
|
393
|
+
* also approves the receipt token when its allowance is short; the instant
|
|
394
|
+
* path (`isInstantRedeem: true`) burns the caller's shares directly and sends
|
|
395
|
+
* no approval.
|
|
396
|
+
*
|
|
397
|
+
* The receipt-token approval (EVM-2 queued path) is always waited on before
|
|
398
|
+
* the redeem call, regardless of the caller's `wait` flag.
|
|
399
|
+
*
|
|
400
|
+
* @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
|
|
401
|
+
* @param options Vault address, wallet, amount, optional `isInstantRedeem`,
|
|
402
|
+
* optional `wait` to wait for the redeem receipt.
|
|
403
|
+
* @returns Redeem transaction hash.
|
|
404
|
+
* @throws UpshiftValidationError on invalid wallet/target/amount.
|
|
405
|
+
* @throws UpshiftSDKError when the redeem submission or on-chain call fails.
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```ts
|
|
409
|
+
* const hash = await upshiftSdk.evm.vaultRequestRedeem({
|
|
410
|
+
* target: vaultAddress,
|
|
411
|
+
* wallet: walletAddress,
|
|
412
|
+
* amount: '10', // 10 shares (UI units)
|
|
413
|
+
* wait: true,
|
|
414
|
+
* });
|
|
415
|
+
* ```
|
|
416
|
+
*
|
|
417
|
+
* @example Instant redemption
|
|
418
|
+
* ```ts
|
|
419
|
+
* await upshiftSdk.evm.vaultRequestRedeem({
|
|
420
|
+
* target: vaultAddress,
|
|
421
|
+
* wallet: walletAddress,
|
|
422
|
+
* amount: '10',
|
|
423
|
+
* isInstantRedeem: true,
|
|
424
|
+
* });
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
export declare function vaultRequestRedeem(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
|
|
428
|
+
/**
|
|
429
|
+
* @description withdraw funds from the specified pool including accrued rewards
|
|
430
|
+
* @param signer signer / wallet object
|
|
431
|
+
* @param options object including pool contract address, user wallet address, and more
|
|
432
|
+
* @returns claim tx hash
|
|
433
|
+
*/
|
|
434
|
+
export declare function vaultRedeem(signer: Signer | Wallet, options: IContractWriteOptions & {
|
|
435
|
+
year: string;
|
|
436
|
+
month: string;
|
|
437
|
+
day: string;
|
|
438
|
+
receiverIndex: string;
|
|
439
|
+
}): Promise<string>;
|
|
440
|
+
/** Options for {@link claimWithdrawal}. */
|
|
441
|
+
export type IClaimWithdrawalOptions = {
|
|
442
|
+
/** EVM-2 (Tokenized Vault V2) vault contract address. */
|
|
443
|
+
target: IAddress;
|
|
444
|
+
/**
|
|
445
|
+
* Wallet initiating the claim. Not a signer, but it is the default
|
|
446
|
+
* `receiver` of the withdrawn assets when `receiver` is omitted.
|
|
447
|
+
*/
|
|
448
|
+
wallet: IAddress;
|
|
449
|
+
/**
|
|
450
|
+
* Withdrawal-epoch year to settle, from the `(claimableEpoch, year, month,
|
|
451
|
+
* day)` tuple `vaultRequestRedeem`/`requestRedeem` returned for this
|
|
452
|
+
* withdrawal — do not re-derive it from a timestamp.
|
|
453
|
+
*/
|
|
454
|
+
year: string | bigint | number;
|
|
455
|
+
/** Withdrawal-epoch month, same source as `year`. */
|
|
456
|
+
month: string | bigint | number;
|
|
457
|
+
/** Withdrawal-epoch day, same source as `year`. */
|
|
458
|
+
day: string | bigint | number;
|
|
459
|
+
/** Address receiving the withdrawn assets. Defaults to `wallet`. */
|
|
460
|
+
receiver?: IAddress;
|
|
461
|
+
/** Wait for transaction confirmation. */
|
|
462
|
+
wait?: boolean;
|
|
463
|
+
};
|
|
464
|
+
/**
|
|
465
|
+
* Claim a previously-requested queued withdrawal on an EVM-2 (Tokenized
|
|
466
|
+
* Vault V2) vault, once its withdrawal epoch has passed.
|
|
467
|
+
*
|
|
468
|
+
* EVM-2 only — v1/v0 vaults use a different claim path ({@link vaultRedeem}).
|
|
469
|
+
* The vault's on-chain `claim(year, month, day, receiverAddr)` reverts if the
|
|
470
|
+
* epoch has not yet elapsed, or if the vault's idle reserve has not been
|
|
471
|
+
* refilled from subaccounts to cover the queue for that date; neither
|
|
472
|
+
* condition is checked client-side before sending.
|
|
473
|
+
*
|
|
474
|
+
* @param signer ethers Signer / Wallet.
|
|
475
|
+
* @param options.target EVM-2 vault contract address.
|
|
476
|
+
* @param options.wallet Wallet initiating the claim; receives the withdrawn assets unless `receiver` is set.
|
|
477
|
+
* @param options.year Withdrawal-epoch year (see `getWithdrawalRequestsWithStatus` / `getWithdrawalEpoch`).
|
|
478
|
+
* @param options.month Withdrawal-epoch month.
|
|
479
|
+
* @param options.day Withdrawal-epoch day.
|
|
480
|
+
* @param options.receiver Address receiving the withdrawn assets. Defaults to `wallet`.
|
|
481
|
+
* @param options.wait Wait for transaction confirmation.
|
|
482
|
+
* @returns Claim transaction hash.
|
|
483
|
+
* @throws UpshiftValidationError on invalid address input, missing or non-integer date fields, or a non-EVM-2 vault.
|
|
484
|
+
* @throws UpshiftSDKError when the on-chain claim call fails.
|
|
485
|
+
*
|
|
486
|
+
* @worstCaseRpcCalls 2 — one vault-version lookup, one claim transaction.
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* ```ts
|
|
490
|
+
* // vaultRequestRedeem returns the request tx hash, not the epoch. Read the
|
|
491
|
+
* // epoch of each queued request (and whether it is claimable yet) from
|
|
492
|
+
* // getWithdrawalRequestsWithStatus (exported from '@upshiftfinance/sdk').
|
|
493
|
+
* await upshiftSdk.evm.vaultRequestRedeem({
|
|
494
|
+
* target: vaultAddress,
|
|
495
|
+
* wallet: walletAddress,
|
|
496
|
+
* amount: '10',
|
|
497
|
+
* });
|
|
498
|
+
* const requests = await getWithdrawalRequestsWithStatus({
|
|
499
|
+
* vault: vaultAddress,
|
|
500
|
+
* receiver: walletAddress,
|
|
501
|
+
* options: { rpcUrl },
|
|
502
|
+
* });
|
|
503
|
+
* const ready = requests.find((r) => r.status === 'ready_to_claim');
|
|
504
|
+
* if (!ready) return;
|
|
505
|
+
* const { year, month, day } = ready.claimableDate;
|
|
506
|
+
* await upshiftSdk.evm.claimWithdrawal({
|
|
507
|
+
* target: vaultAddress,
|
|
508
|
+
* wallet: walletAddress,
|
|
509
|
+
* year,
|
|
510
|
+
* month,
|
|
511
|
+
* day,
|
|
512
|
+
* wait: true,
|
|
513
|
+
* });
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
export declare function claimWithdrawal(signer: Signer | Wallet, options: IClaimWithdrawalOptions): Promise<string>;
|
|
517
|
+
/**
|
|
518
|
+
* Deposit a native token (ETH / AVAX / etc.) into a vault via the
|
|
519
|
+
* `MultiAssetNativeDepositWrapper`. The wrapper forwards `msg.value` to
|
|
520
|
+
* the vault as the deposit underlying — no allowance is required.
|
|
521
|
+
*
|
|
522
|
+
* `amount` is the **raw on-chain value in wei-equivalent** (18 decimals
|
|
523
|
+
* for ETH-family natives). If you have a UI-shaped amount in ether, scale
|
|
524
|
+
* it first.
|
|
525
|
+
*
|
|
526
|
+
* @param signer ethers Signer / Wallet
|
|
527
|
+
* @param options `wrapperAddress` is the deployed wrapper contract;
|
|
528
|
+
* `receiver` defaults to the signer's address; `amount` is the native
|
|
529
|
+
* amount in wei; `wait` waits for the deposit receipt.
|
|
530
|
+
* @returns Deposit transaction hash.
|
|
531
|
+
* @throws UpshiftValidationError on invalid wrapper / receiver / amount.
|
|
532
|
+
* @throws UpshiftSDKError when the deposit submission or on-chain call fails.
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* ```ts
|
|
536
|
+
* import { parseEther } from 'ethers';
|
|
537
|
+
*
|
|
538
|
+
* await upshiftSdk.evm.depositNative({
|
|
539
|
+
* wrapperAddress: nativeWrapperAddress,
|
|
540
|
+
* amount: parseEther('0.5'), // 0.5 ETH in wei
|
|
541
|
+
* wait: true,
|
|
542
|
+
* });
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
export declare function depositNative(signer: Signer | Wallet, options: INativeDepositOptions): Promise<string>;
|
|
546
|
+
export type IRwaRedeemOptions = {
|
|
547
|
+
/** RwaRedeemSubaccount contract address */
|
|
548
|
+
target: IAddress;
|
|
549
|
+
/** User wallet address */
|
|
550
|
+
wallet: IAddress;
|
|
551
|
+
/** Redeemable asset address (e.g. USDC, USDT) */
|
|
552
|
+
asset: IAddress;
|
|
553
|
+
/** Amount of vault shares to redeem */
|
|
554
|
+
amount: string | bigint | number;
|
|
555
|
+
/** Minimum output amount (slippage protection), in output asset decimals */
|
|
556
|
+
minOut: string | bigint | number;
|
|
557
|
+
/** Decimals of the vault share token */
|
|
558
|
+
decimals: number;
|
|
559
|
+
/** Decimals of the output/redeemable asset */
|
|
560
|
+
outputDecimals: number;
|
|
561
|
+
/** Wait for transaction confirmation */
|
|
562
|
+
wait?: boolean;
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* Redeem vault shares for an underlying asset via the RwaRedeemSubaccount.
|
|
566
|
+
* Caller must approve the **vault share token** (not the output asset) to
|
|
567
|
+
* the subaccount beforehand — it pulls shares via `transferFrom`.
|
|
568
|
+
*
|
|
569
|
+
* Pass `minOut` to enforce slippage protection (in `outputDecimals` units).
|
|
570
|
+
* The SDK does not currently compute `minOut` from a slippage percentage —
|
|
571
|
+
* the caller is responsible for choosing a safe lower bound.
|
|
572
|
+
*
|
|
573
|
+
* @throws UpshiftValidationError on invalid addresses or amount inputs.
|
|
574
|
+
* @throws UpshiftSDKError when the redeem submission or on-chain call fails.
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* ```ts
|
|
578
|
+
* // 1. Approve the vault share token to the subaccount first.
|
|
579
|
+
* await upshiftSdk.evm.vaultApprove({
|
|
580
|
+
* target: subaccountAddress,
|
|
581
|
+
* wallet: walletAddress,
|
|
582
|
+
* amount: '10',
|
|
583
|
+
* wait: true,
|
|
584
|
+
* });
|
|
585
|
+
*
|
|
586
|
+
* // 2. Redeem 10 shares for USDC, requiring at least 9.5 USDC out.
|
|
587
|
+
* await upshiftSdk.evm.rwaRedeemAsset({
|
|
588
|
+
* target: subaccountAddress,
|
|
589
|
+
* wallet: walletAddress,
|
|
590
|
+
* asset: USDC_ADDRESS,
|
|
591
|
+
* amount: '10',
|
|
592
|
+
* minOut: '9.5',
|
|
593
|
+
* decimals: 18, // vault share decimals
|
|
594
|
+
* outputDecimals: 6, // USDC decimals
|
|
595
|
+
* wait: true,
|
|
596
|
+
* });
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
599
|
+
export declare function rwaRedeemAsset(signer: Signer | Wallet, options: IRwaRedeemOptions): Promise<string>;
|
|
600
|
+
/**
|
|
601
|
+
* Swap one or more whitelisted ERC-20s into a vault's reference asset via
|
|
602
|
+
* the on-chain SwapRouter, then deposit the proceeds into the vault.
|
|
603
|
+
*
|
|
604
|
+
* Approval is sent automatically when the caller's allowance on each
|
|
605
|
+
* `swaps[i].tokenIn` against the SwapRouter is below `amountIn`.
|
|
606
|
+
*
|
|
607
|
+
* @param signer - ethers `Signer` or `Wallet` with the EOA that holds the input tokens.
|
|
608
|
+
* @param options - {@link ISwapAndDepositOptions}.
|
|
609
|
+
* @returns The transaction hash of the `swapAndDeposit` call.
|
|
610
|
+
*
|
|
611
|
+
* @throws {@link UpshiftValidationError} for unsupported chains, invalid
|
|
612
|
+
* addresses, empty/oversized swap arrays, a vault the router cannot deposit
|
|
613
|
+
* into (a legacy `evm-0` pool, or a Tokenized Vault V2 with a senders
|
|
614
|
+
* whitelist), or an origin code not registered on the router (a per-call
|
|
615
|
+
* code, or the instance code under `attribution.strictOrigin`), before any
|
|
616
|
+
* approval.
|
|
617
|
+
* @throws {@link UpshiftSDKError} while the SwapRouter is paused (checked before
|
|
618
|
+
* any approval), or on unrecoverable contract or RPC failure.
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```ts
|
|
622
|
+
* const quote = await fetchSwapQuote({
|
|
623
|
+
* chainId: 1,
|
|
624
|
+
* srcToken: WBTC,
|
|
625
|
+
* srcDecimals: 8,
|
|
626
|
+
* destToken: USDC,
|
|
627
|
+
* destDecimals: 6,
|
|
628
|
+
* amount: 100_000_000n,
|
|
629
|
+
* receiver: SWAP_ROUTER_ADDRESSES[1]!,
|
|
630
|
+
* });
|
|
631
|
+
* const hash = await swapAndDeposit(signer, {
|
|
632
|
+
* chainId: 1,
|
|
633
|
+
* vault: '0x8AcA0841993ef4C87244d519166e767f49362C21',
|
|
634
|
+
* receiver: wallet,
|
|
635
|
+
* swaps: [{
|
|
636
|
+
* tokenIn: WBTC,
|
|
637
|
+
* tokenOut: USDC,
|
|
638
|
+
* amountIn: 100_000_000n,
|
|
639
|
+
* minAmountOut: quote.minAmountOut,
|
|
640
|
+
* router: quote.router,
|
|
641
|
+
* payload: quote.payload,
|
|
642
|
+
* }],
|
|
643
|
+
* });
|
|
644
|
+
* ```
|
|
645
|
+
*/
|
|
646
|
+
export declare function swapAndDeposit(signer: Signer | Wallet, options: ISwapAndDepositOptions): Promise<string>;
|
|
647
|
+
/**
|
|
648
|
+
* Deposit a vault's reference asset directly through the SwapRouter — no
|
|
649
|
+
* swap. Useful when the caller already holds the reference asset but wants
|
|
650
|
+
* the origin/referral fee accounting that only the SwapRouter path provides.
|
|
651
|
+
*
|
|
652
|
+
* @param signer - ethers `Signer` or `Wallet`.
|
|
653
|
+
* @param options - {@link ISwapRouterDirectDepositOptions}.
|
|
654
|
+
* @returns The transaction hash of the `deposit` call.
|
|
655
|
+
*
|
|
656
|
+
* @throws {@link UpshiftValidationError} for unsupported chains, invalid
|
|
657
|
+
* addresses, zero amount, a vault the router cannot deposit into (a legacy
|
|
658
|
+
* `evm-0` pool, or a Tokenized Vault V2 with a senders whitelist), or an
|
|
659
|
+
* origin code not registered on the router (a per-call code, or the instance
|
|
660
|
+
* code under `attribution.strictOrigin`), before any approval; with code
|
|
661
|
+
* `ACCOUNT_NOT_FUNDED` when the account cannot cover gas.
|
|
662
|
+
* @throws {@link UpshiftSDKError} while the SwapRouter is paused (checked before
|
|
663
|
+
* any approval), or on unrecoverable contract or RPC failure.
|
|
664
|
+
*/
|
|
665
|
+
export declare function depositViaSwapRouter(signer: Signer | Wallet, options: ISwapRouterDirectDepositOptions): Promise<string>;
|
|
666
|
+
/**
|
|
667
|
+
* Deposit native ETH (or chain-native equivalent) into a vault via the
|
|
668
|
+
* SwapRouter. The router wraps `amount` to the chain's wrapped-native token
|
|
669
|
+
* before depositing — only valid when the vault's reference asset equals
|
|
670
|
+
* the wrapped-native token.
|
|
671
|
+
*
|
|
672
|
+
* **Wrap-only limitation**: the on-chain SwapRouter has no ETH→other-asset
|
|
673
|
+
* swap leg, so this only ever reaches a WETH-accepting vault (see
|
|
674
|
+
* {@link SWAP_ROUTER_WRAPPED_NATIVE}). There is no atomic native-ETH deposit
|
|
675
|
+
* into a non-WETH-reference vault (e.g. a USDC vault) — deposit the wrapped
|
|
676
|
+
* native token instead (already whitelisted, routes through the swap leg for
|
|
677
|
+
* a non-reference-asset vault). Use {@link isNativeSwapRouterDepositSupported}
|
|
678
|
+
* to check eligibility before offering this path in a UI.
|
|
679
|
+
*
|
|
680
|
+
* No ERC-20 approval is needed; `amount` travels as `msg.value`.
|
|
681
|
+
*
|
|
682
|
+
* @param signer - ethers `Signer` or `Wallet`.
|
|
683
|
+
* @param options - {@link ISwapRouterNativeDepositOptions}.
|
|
684
|
+
* @returns The transaction hash of the `depositNativeToken` call.
|
|
685
|
+
*
|
|
686
|
+
* @throws {@link UpshiftValidationError} for unsupported chains, invalid
|
|
687
|
+
* addresses, zero amount, a vault the router cannot deposit into (a legacy
|
|
688
|
+
* `evm-0` pool, or a Tokenized Vault V2 with a senders whitelist), or an
|
|
689
|
+
* origin code not registered on the router (a per-call code, or the instance
|
|
690
|
+
* code under `attribution.strictOrigin`), before any approval; with code
|
|
691
|
+
* `ACCOUNT_NOT_FUNDED` when the account cannot cover gas.
|
|
692
|
+
* @throws {@link UpshiftSDKError} while the SwapRouter is paused (checked before
|
|
693
|
+
* any approval), or on unrecoverable contract or RPC failure.
|
|
694
|
+
*/
|
|
695
|
+
export declare function depositNativeViaSwapRouter(signer: Signer | Wallet, options: ISwapRouterNativeDepositOptions): Promise<string>;
|
|
696
|
+
/**
|
|
697
|
+
* Whether a vault can take a native-ETH (chain-native token) SwapRouter
|
|
698
|
+
* deposit — the pre-flight check for {@link depositNativeViaSwapRouter} and
|
|
699
|
+
* {@link swapRouterDeposit} with a zero-address `depositAsset`.
|
|
700
|
+
*
|
|
701
|
+
* The on-chain SwapRouter only wraps native ETH to the chain's wrapped-native
|
|
702
|
+
* token and deposits that — it has no ETH→other-asset swap leg (see
|
|
703
|
+
* {@link SWAP_ROUTER_WRAPPED_NATIVE}). So a native deposit needs both: a
|
|
704
|
+
* SwapRouter deployed on `chainId`, and the vault's own on-chain `asset()`
|
|
705
|
+
* equal to that chain's wrapped-native token. The v2 router has no vault
|
|
706
|
+
* registry, so no router read is needed. Use this to gate a
|
|
707
|
+
* "deposit ETH" UI option before the user picks it, instead of discovering
|
|
708
|
+
* the answer via a thrown {@link UpshiftValidationError} or an on-chain revert.
|
|
709
|
+
*
|
|
710
|
+
* It checks configuration only — a deposit that passes this check can still
|
|
711
|
+
* fail on balance, gas, a paused vault, or a deposit cap.
|
|
712
|
+
*
|
|
713
|
+
* Read-only and provider-agnostic (no signer required) — safe to call before
|
|
714
|
+
* a wallet is connected. Makes no backend call.
|
|
715
|
+
*
|
|
716
|
+
* @param chainId - EVM chain ID the vault is deployed on.
|
|
717
|
+
* @param vault - Upshift vault address to check.
|
|
718
|
+
* @param options - `rpcUrl` for `chainId`, passed to `createProvider`.
|
|
719
|
+
* @returns `true` iff a SwapRouter exists on `chainId` and the vault's
|
|
720
|
+
* `asset()` is the chain's wrapped-native token. `false` — never throws —
|
|
721
|
+
* for a chain with no SwapRouter deployment, a missing/invalid `rpcUrl`, an
|
|
722
|
+
* unreadable vault, or a vault whose reference asset isn't the
|
|
723
|
+
* wrapped-native token.
|
|
724
|
+
* @worstCaseRpcCalls 1 — the vault's `asset()`. None on a chain with no
|
|
725
|
+
* SwapRouter.
|
|
726
|
+
* @example
|
|
727
|
+
* ```ts
|
|
728
|
+
* const canDepositEth = await isNativeSwapRouterDepositSupported(
|
|
729
|
+
* 1,
|
|
730
|
+
* '0x1234000000000000000000000000000000005678',
|
|
731
|
+
* { rpcUrl: 'https://eth-mainnet.example/v2/KEY' },
|
|
732
|
+
* );
|
|
733
|
+
* // true only if that vault's asset is WETH and mainnet has a SwapRouter
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
736
|
+
export declare function isNativeSwapRouterDepositSupported(chainId: number, vault: IAddress, options: {
|
|
737
|
+
rpcUrl: string;
|
|
738
|
+
}): Promise<boolean>;
|
|
739
|
+
/**
|
|
740
|
+
* Deposit into an Upshift vault through the on-chain `SwapRouter`, selecting the
|
|
741
|
+
* correct router path from the deposit asset.
|
|
742
|
+
*
|
|
743
|
+
* {@link vaultDeposit} never swaps; this function always routes through the
|
|
744
|
+
* SwapRouter, because the caller asked it to. Keeping swaps opt-in is the
|
|
745
|
+
* point: a native-deposit vault (e.g. a multi-asset Tokenized Vault V2 whose
|
|
746
|
+
* non-reference assets are accepted directly) is never accidentally swapped —
|
|
747
|
+
* the regression that implicit, allowlist-driven routing inside `vaultDeposit`
|
|
748
|
+
* caused before it was removed. Use `vaultDeposit` for native / adapter
|
|
749
|
+
* deposits and this for SwapRouter deposits.
|
|
750
|
+
*
|
|
751
|
+
* The vault's reference asset and its decimals are read on-chain (never trusted
|
|
752
|
+
* from the caller — a wrong reference asset would mis-route the swap). The path
|
|
753
|
+
* is then chosen from `depositAsset`:
|
|
754
|
+
* - equals the reference asset, or is an asset a Tokenized Vault V2 accepts
|
|
755
|
+
* as-is (e.g. USDT into Sentora USD) → direct router deposit, no swap and
|
|
756
|
+
* no swap fee
|
|
757
|
+
* ({@link depositViaSwapRouter});
|
|
758
|
+
* - the zero address → native-token deposit ({@link depositNativeViaSwapRouter}),
|
|
759
|
+
* valid only when the reference asset is the chain's wrapped-native token —
|
|
760
|
+
* the router only wraps ETH, it never swaps it, so this throws for any
|
|
761
|
+
* other reference asset (see {@link SWAP_ROUTER_WRAPPED_NATIVE} for why, and
|
|
762
|
+
* {@link isNativeSwapRouterDepositSupported} to check first);
|
|
763
|
+
* - any other ERC-20 → a swap to the reference asset (Paraswap quote pinned to
|
|
764
|
+
* the chain's whitelisted aggregator, fail-closed on router/selector drift)
|
|
765
|
+
* bundled into {@link swapAndDeposit}.
|
|
766
|
+
*
|
|
767
|
+
* The origin code — the per-call `originCode`, else the SDK instance's
|
|
768
|
+
* `attribution.originCode` on Ethereum mainnet, else the all-zero sentinel
|
|
769
|
+
* ("no origin fee") — is forwarded to whichever of those three entry points
|
|
770
|
+
* runs, so a partner's origin fee accrues on every path.
|
|
771
|
+
*
|
|
772
|
+
* Side effects: reads tokenized-vault metadata, the vault's reference asset and
|
|
773
|
+
* decimals, for a Tokenized Vault V2 non-reference asset the vault's assets
|
|
774
|
+
* whitelist, the origin code's registration, and (on the swap path) one Paraswap quote;
|
|
775
|
+
* sends one ERC-20 `approve` to the SwapRouter when allowance is short, then
|
|
776
|
+
* the deposit tx.
|
|
777
|
+
*
|
|
778
|
+
* @param signer - ethers `Signer` or `Wallet` that signs the approval + deposit.
|
|
779
|
+
* @param options - {@link ISwapRouterDepositOptions}.
|
|
780
|
+
* @returns The transaction hash of the router deposit call.
|
|
781
|
+
* @throws {@link UpshiftValidationError} for an unsupported chain (no SwapRouter
|
|
782
|
+
* deployment), an invalid vault or deposit-asset address, a missing or zero
|
|
783
|
+
* amount, a vault the router cannot deposit into (a legacy `evm-0` pool, or
|
|
784
|
+
* a Tokenized Vault V2 with a senders whitelist), a native deposit into a
|
|
785
|
+
* non-wrapped-native vault, drift between
|
|
786
|
+
* the aggregator quote and the on-chain router whitelist, or an origin code
|
|
787
|
+
* not registered on the router (a per-call code, or the instance code under
|
|
788
|
+
* `attribution.strictOrigin`), before any approval; with code
|
|
789
|
+
* `ACCOUNT_NOT_FUNDED` when the account cannot cover gas.
|
|
790
|
+
* @throws {@link UpshiftSDKError} while the SwapRouter is paused (checked before
|
|
791
|
+
* any approval), or on unrecoverable contract or RPC failure.
|
|
792
|
+
* @worstCaseRpcCalls 10 on the swap path into a Tokenized Vault V2 —
|
|
793
|
+
* tokenized-vault metadata, reference asset + decimals, deposit-token
|
|
794
|
+
* decimals, the vault's `assetsWhitelistAddress()`, `getWhitelistedAssets()`
|
|
795
|
+
* and `sendersWhitelistAddress()`, the quote, the router's `isPaused()`,
|
|
796
|
+
* the origin code's `origins` (none for the zero sentinel), and the
|
|
797
|
+
* allowance read. The router reads, `getWhitelistedAssets()` and
|
|
798
|
+
* `sendersWhitelistAddress()` are cached for 5 minutes, except `isPaused()`
|
|
799
|
+
* (15 seconds).
|
|
800
|
+
* @example
|
|
801
|
+
* ```ts
|
|
802
|
+
* // USDT deposited into a USDC-reference vault → swapped to USDC en route.
|
|
803
|
+
* const hash = await upshiftSdk.evm.swapRouterDeposit({
|
|
804
|
+
* chainId: 1,
|
|
805
|
+
* vault: '0xe9b725010a9e419412ed67d0fa5f3a5f40159d32',
|
|
806
|
+
* depositAsset: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
807
|
+
* amount: '100',
|
|
808
|
+
* slippageBps: 50,
|
|
809
|
+
* });
|
|
810
|
+
* ```
|
|
811
|
+
*/
|
|
812
|
+
export declare function swapRouterDeposit(signer: Signer | Wallet, options: ISwapRouterDepositOptions): Promise<string>;
|