@upshiftfinance/sdk 0.0.0-stage → 0.2.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/client.d.ts +83 -0
- package/lib/adapters/sui/client.js +216 -0
- package/lib/adapters/sui/constants.d.ts +33 -0
- package/lib/adapters/sui/constants.js +31 -0
- package/lib/adapters/sui/index.d.ts +57 -0
- package/lib/adapters/sui/index.js +100 -0
- package/lib/adapters/sui/targets.d.ts +171 -0
- package/lib/adapters/sui/targets.js +225 -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 +30173 -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 +100 -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 +79 -3
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solana Adapter for Upshift SDK
|
|
3
|
+
*
|
|
4
|
+
* @module SolanaAdapter
|
|
5
|
+
*/
|
|
6
|
+
import * as SolanaConstants from './constants';
|
|
7
|
+
import * as SolanaGetters from './getters';
|
|
8
|
+
import * as SolanaActions from './vault.actions';
|
|
9
|
+
import type { AnchorProvider, web3 } from '@coral-xyz/anchor';
|
|
10
|
+
import { type Commitment, Connection, PublicKey, type Transaction } from '@solana/web3.js';
|
|
11
|
+
import type { ISolanaCancelRedeemRequestParams, ISolanaDepositOptions, ISolanaNetwork, ISolanaRedeemOptions, ISolanaRequestRedeemParams, ISolanaRpcEndpoint } from './types';
|
|
12
|
+
import type { SendTransactionOptions } from '@solana/wallet-adapter-base';
|
|
13
|
+
export declare const Solana: {
|
|
14
|
+
utils: {
|
|
15
|
+
getExplorerLink: ({ signature, type, network, }: {
|
|
16
|
+
signature: string;
|
|
17
|
+
type: "tx" | "address" | "token";
|
|
18
|
+
} & import("./types").ISolanaConnectionOptions) => string;
|
|
19
|
+
isSolanaAddress: typeof import("./utils").isSolanaAddress;
|
|
20
|
+
isSolana: (signature: string) => boolean;
|
|
21
|
+
getProgram: ({ provider, idl, programId, network, }: {
|
|
22
|
+
idl?: any;
|
|
23
|
+
programId?: string;
|
|
24
|
+
} & import("./types").ISolanaConnectionOptions) => import("@coral-xyz/anchor").Program<any>;
|
|
25
|
+
getProvider: ({ connection, publicKey, signTransaction, }: {
|
|
26
|
+
publicKey: PublicKey;
|
|
27
|
+
signTransaction: (<T extends Transaction | web3.VersionedTransaction>(transaction: T) => Promise<T>) | undefined;
|
|
28
|
+
} & import("./types").ISolanaConnectionOptions) => import("./confirm").BlockhashConfirmingProvider;
|
|
29
|
+
getReadOnlyProvider: ({ connection }: import("./types").ISolanaConnectionOptions) => AnchorProvider;
|
|
30
|
+
deriveShareMintPda: (vaultProgramId: PublicKey | string) => web3.PublicKey;
|
|
31
|
+
deriveVaultStatePda: (vaultProgramId: PublicKey | string) => web3.PublicKey;
|
|
32
|
+
deriveVaultTokenAtaPda: (vaultProgramId: PublicKey | string, depositMint: PublicKey, vaultVersion?: number) => web3.PublicKey;
|
|
33
|
+
getVaultState: ({ provider, connection, vaultProgramId, vaultAddress, idl, }: {
|
|
34
|
+
vaultProgramId: PublicKey | string;
|
|
35
|
+
vaultAddress?: PublicKey | string;
|
|
36
|
+
idl: any;
|
|
37
|
+
} & import("./types").ISolanaConnectionOptions) => Promise<{
|
|
38
|
+
vaultState: unknown | null;
|
|
39
|
+
depositMintDecimals: number | null;
|
|
40
|
+
}>;
|
|
41
|
+
getVaultStateReadOnly: ({ vaultProgramId, vaultAddress, connection, idl, fresh, }: {
|
|
42
|
+
vaultProgramId: PublicKey | string;
|
|
43
|
+
vaultAddress?: PublicKey | string;
|
|
44
|
+
idl: any;
|
|
45
|
+
fresh?: boolean;
|
|
46
|
+
} & import("./types").ISolanaConnectionOptions) => Promise<{
|
|
47
|
+
vaultState: import("./types").ISolanaVaultState | null;
|
|
48
|
+
depositMintDecimals: number | null;
|
|
49
|
+
}>;
|
|
50
|
+
getToken: ({ mintAddress, endpoint, connection, }: {
|
|
51
|
+
mintAddress: string | PublicKey;
|
|
52
|
+
} & import("./types").ISolanaConnectionOptions) => Promise<{
|
|
53
|
+
address: string;
|
|
54
|
+
symbol: string;
|
|
55
|
+
decimals: number;
|
|
56
|
+
name: string;
|
|
57
|
+
image: string;
|
|
58
|
+
} | null>;
|
|
59
|
+
getTokenSymbol: ({ endpoint, mintAddress, }: {
|
|
60
|
+
mintAddress: string | PublicKey;
|
|
61
|
+
} & import("./types").ISolanaConnectionOptions) => Promise<string | null>;
|
|
62
|
+
fetchUserTokenBalance: ({ connection, publicKey, depositMint, }: {
|
|
63
|
+
publicKey: PublicKey | string;
|
|
64
|
+
depositMint?: PublicKey | string;
|
|
65
|
+
} & import("./types").ISolanaConnectionOptions) => Promise<string>;
|
|
66
|
+
fetchUserShareBalance: ({ connection, publicKey, shareMint, }: {
|
|
67
|
+
publicKey: PublicKey | string;
|
|
68
|
+
shareMint?: PublicKey | string;
|
|
69
|
+
} & import("./types").ISolanaConnectionOptions) => Promise<number>;
|
|
70
|
+
fetchUserShareBalanceRaw: ({ connection, publicKey, shareMint, }: {
|
|
71
|
+
publicKey: PublicKey | string;
|
|
72
|
+
shareMint?: PublicKey | string;
|
|
73
|
+
} & import("./types").ISolanaConnectionOptions) => Promise<{
|
|
74
|
+
amount: string;
|
|
75
|
+
decimals: number | null;
|
|
76
|
+
}>;
|
|
77
|
+
getBestRpcEndpoint: ({ endpoint, network, connection, }: import("./types").ISolanaConnectionOptions) => Promise<"http://127.0.0.1:8899" | `https://${string}`>;
|
|
78
|
+
fallbackDecimals: number;
|
|
79
|
+
fallbackNetwork: import("../..").ISolanaNetwork;
|
|
80
|
+
programIds: {
|
|
81
|
+
devnet: {
|
|
82
|
+
vault: string;
|
|
83
|
+
withdrawalQueue: string;
|
|
84
|
+
};
|
|
85
|
+
"mainnet-beta": {
|
|
86
|
+
vault: string;
|
|
87
|
+
withdrawalQueue: string;
|
|
88
|
+
};
|
|
89
|
+
localnet: {
|
|
90
|
+
vault: string;
|
|
91
|
+
withdrawalQueue: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
getVaultMints: ({ vaultProgramId, vaultAddress, connection, idl, }: {
|
|
95
|
+
vaultProgramId: PublicKey | string;
|
|
96
|
+
vaultAddress?: PublicKey | string;
|
|
97
|
+
idl: any;
|
|
98
|
+
} & import("./types").ISolanaConnectionOptions) => Promise<{
|
|
99
|
+
depositMint: string;
|
|
100
|
+
shareMint: string;
|
|
101
|
+
vaultVersion: number | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
resolveProgramId: (vaultAddress: string, solanaMetadata?: {
|
|
104
|
+
program_id?: string;
|
|
105
|
+
} | null) => string;
|
|
106
|
+
};
|
|
107
|
+
constants: typeof SolanaConstants;
|
|
108
|
+
actions: typeof SolanaActions;
|
|
109
|
+
getters: typeof SolanaGetters;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Solana Adapter for Upshift SDK
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* To access the Solana adapter instance
|
|
116
|
+
* ```
|
|
117
|
+
* const sdk = new UpshiftSDK()
|
|
118
|
+
* sdk.solana.getVaultState()
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
declare class SolanaAdapter {
|
|
122
|
+
private _endpoint;
|
|
123
|
+
private _network;
|
|
124
|
+
private _connection;
|
|
125
|
+
private _provider;
|
|
126
|
+
/**
|
|
127
|
+
* @param commitment - Commitment for every read this adapter makes *and* for
|
|
128
|
+
* the confirmation of every write, so the two always describe the same
|
|
129
|
+
* chain state — the vault handlers take it from this same `Connection`.
|
|
130
|
+
*
|
|
131
|
+
* Defaults to `'finalized'`, which is what this adapter has always used in
|
|
132
|
+
* practice: it previously passed no commitment at all, so both reads and
|
|
133
|
+
* confirmations fell through to the RPC's own `'finalized'` default. The
|
|
134
|
+
* default is stated explicitly now rather than inherited, but it is
|
|
135
|
+
* unchanged.
|
|
136
|
+
*
|
|
137
|
+
* Pass `'confirmed'` for a markedly faster round trip — seconds rather
|
|
138
|
+
* than tens of seconds — accepting that the state you act on can still, in
|
|
139
|
+
* principle, be rolled back. Also settable as the `commitment` field of
|
|
140
|
+
* the `solana` config passed to `UpshiftSDK`.
|
|
141
|
+
*/
|
|
142
|
+
constructor(endpoint: ISolanaRpcEndpoint, network?: ISolanaNetwork, commitment?: Commitment);
|
|
143
|
+
get endpoint(): `https://${string}`;
|
|
144
|
+
get network(): ISolanaNetwork;
|
|
145
|
+
get connection(): web3.Connection;
|
|
146
|
+
get provider(): AnchorProvider;
|
|
147
|
+
setWalletProvider(_publicKey: PublicKey | string, signTransaction: (<T extends Transaction | web3.VersionedTransaction>(transaction: T) => Promise<T>) | undefined): void;
|
|
148
|
+
/**
|
|
149
|
+
* Build an Anchor `Program` bound to this adapter's provider and network.
|
|
150
|
+
*
|
|
151
|
+
* The program id is resolved as: explicit `programId` → the `address` carried
|
|
152
|
+
* by a custom `programIdl` → the canonical deployment for this adapter's
|
|
153
|
+
* network. A copy of the SDK's bundled `vaultIdl` defers to the network
|
|
154
|
+
* default (its embedded `address` is a build stamp, not network-aware), so
|
|
155
|
+
* forwarding it on devnet never silently targets the mainnet program.
|
|
156
|
+
*
|
|
157
|
+
* An IDL whose `metadata.name` is `august_withdrawal_queue` resolves against
|
|
158
|
+
* the withdrawal queue program's network default instead of the vault's.
|
|
159
|
+
*
|
|
160
|
+
* @param programIdl - Anchor IDL to bind. Defaults to the SDK's bundled
|
|
161
|
+
* `august_vault` IDL. A custom IDL's `address` is honoured when it differs
|
|
162
|
+
* from the program's canonical id (the build stamp every bundled copy of
|
|
163
|
+
* the vault or queue IDL carries).
|
|
164
|
+
* @param programId - Base58 program id that overrides both the IDL's address
|
|
165
|
+
* and the network default. Use this to target a non-canonical deployment.
|
|
166
|
+
* @returns An Anchor `Program` for the resolved program id. No RPC is made —
|
|
167
|
+
* construction is offline.
|
|
168
|
+
* @throws {@link UpshiftValidationError} if no program id can be resolved
|
|
169
|
+
* because the program has no canonical deployment on this adapter's network
|
|
170
|
+
* (neither program on `testnet`) and neither `programId` nor a custom IDL
|
|
171
|
+
* address was supplied.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* // canonical program on the adapter's network
|
|
176
|
+
* const program = sdk.solana.getProgram();
|
|
177
|
+
*
|
|
178
|
+
* // a different deployment, same interface
|
|
179
|
+
* const legacy = sdk.solana.getProgram(vaultIdl, '7B8n9vL51b6ibqRAd1adZsi3x3kxtq5NZaondh22Vkyq');
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
getProgram(programIdl?: any, programId?: string): import("@coral-xyz/anchor").Program<any>;
|
|
183
|
+
getVaultState(vaultProgramId: PublicKey | string, idl: any, vaultAddress?: PublicKey | string): Promise<{
|
|
184
|
+
vaultState: unknown | null;
|
|
185
|
+
depositMintDecimals: number | null;
|
|
186
|
+
}>;
|
|
187
|
+
getVaultStateReadOnly(vaultProgramId: PublicKey | string, idl: any, vaultAddress?: PublicKey | string): Promise<{
|
|
188
|
+
vaultState: import("./types").ISolanaVaultState | null;
|
|
189
|
+
depositMintDecimals: number | null;
|
|
190
|
+
}>;
|
|
191
|
+
getToken(mintAddress: string | PublicKey): Promise<{
|
|
192
|
+
address: string;
|
|
193
|
+
symbol: string;
|
|
194
|
+
decimals: number;
|
|
195
|
+
name: string;
|
|
196
|
+
image: string;
|
|
197
|
+
}>;
|
|
198
|
+
getTokenSymbol(mintAddress: string | PublicKey): Promise<string>;
|
|
199
|
+
fetchUserTokenBalance(publicKey: PublicKey | string, depositMint: PublicKey | string): Promise<string>;
|
|
200
|
+
fetchUserShareBalance(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<number>;
|
|
201
|
+
/**
|
|
202
|
+
* BigInt-safe variant of {@link fetchUserShareBalance}. Returns the raw u64
|
|
203
|
+
* `amount` (as a base-units string) plus the mint's `decimals` (or `null`
|
|
204
|
+
* when the scale can't be determined — see Returns), so the caller can
|
|
205
|
+
* produce a correct `INormalizedNumber` without losing precision.
|
|
206
|
+
*
|
|
207
|
+
* Prefer this anywhere the result feeds BigInt math — positions, max-
|
|
208
|
+
* actions, redemption sizing, allowance checks. `fetchUserShareBalance`
|
|
209
|
+
* returns a JS-number `uiAmount` which silently encodes against 18 decimals
|
|
210
|
+
* when passed through `toNormalizedBn(value)` without an explicit decimals
|
|
211
|
+
* argument; that's exactly how the jitoSOL "missing position" regression
|
|
212
|
+
* manifested.
|
|
213
|
+
*
|
|
214
|
+
* RPC cost: 1 `getParsedTokenAccountsByOwner` call. Worst case ~150ms on a
|
|
215
|
+
* healthy mainnet endpoint.
|
|
216
|
+
*
|
|
217
|
+
* @param publicKey Wallet owner (PublicKey or base58 string).
|
|
218
|
+
* @param shareMint The vault's share-token mint (PublicKey or base58).
|
|
219
|
+
* @returns
|
|
220
|
+
* `{ amount, decimals }`. Three observable shapes:
|
|
221
|
+
* - `{ amount: '<u64>', decimals: <number> }` — token account exists.
|
|
222
|
+
* - `{ amount: '0', decimals: null }` — no token account for this mint
|
|
223
|
+
* under this wallet, OR `tokenAmount` was missing from the response,
|
|
224
|
+
* OR `publicKey`/`shareMint` was not supplied. Distinguishable from a
|
|
225
|
+
* genuine zero-balance account (`decimals` would be set there).
|
|
226
|
+
* - `{ amount: '0', decimals: null }` — RPC threw (error is logged).
|
|
227
|
+
*
|
|
228
|
+
* `decimals === null` means "we could not determine the scale" — callers
|
|
229
|
+
* that need an `INormalizedNumber` must fall back to a known decimals
|
|
230
|
+
* value (typically the deposit mint's decimals from backend metadata)
|
|
231
|
+
* before normalizing. Never throws.
|
|
232
|
+
*/
|
|
233
|
+
fetchUserShareBalanceRaw(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<{
|
|
234
|
+
amount: string;
|
|
235
|
+
decimals: number | null;
|
|
236
|
+
}>;
|
|
237
|
+
/**
|
|
238
|
+
* Deposit funds into a Solana Upshift vault.
|
|
239
|
+
* @param depositAmount `bigint` (raw on-chain units) or `number` (UI amount).
|
|
240
|
+
* @param sendTransaction - **Ignored; scheduled for removal in the next major release.**
|
|
241
|
+
* Share-account creation is now prepended to the deposit instruction, so
|
|
242
|
+
* the SDK sends no second transaction and never invokes this callback —
|
|
243
|
+
* signing goes through the provider's wallet.
|
|
244
|
+
*
|
|
245
|
+
* **Pass `undefined` here; do not delete the argument.** It sits *before*
|
|
246
|
+
* `vaultAddress`, so removing it shifts your vault address into this slot
|
|
247
|
+
* and leaves `vaultAddress` undefined — which silently falls back to the
|
|
248
|
+
* legacy single-vault PDA derivation and targets a different vault.
|
|
249
|
+
* @param options - Slippage protection. By default the SDK quotes the shares this deposit should mint
|
|
250
|
+
* from the vault's current state and passes that quote, lowered by 50 bps,
|
|
251
|
+
* as the floor to the program's checked instruction. See {@link ISolanaDepositOptions}.
|
|
252
|
+
*/
|
|
253
|
+
vaultDeposit(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, depositAmount: number | bigint, sendTransaction?: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string, options?: ISolanaDepositOptions): Promise<any>;
|
|
254
|
+
/**
|
|
255
|
+
* Redeem vault shares from a Solana Upshift vault.
|
|
256
|
+
* @param redeemShares `bigint` (raw share units) or `number` (UI amount).
|
|
257
|
+
* @param sendTransaction - **Ignored; scheduled for removal in the next major release.**
|
|
258
|
+
* Payout- and fee-recipient-account creation is now prepended to the redeem
|
|
259
|
+
* instruction, so the SDK sends no second transaction and never invokes
|
|
260
|
+
* this callback — signing goes through the provider's wallet.
|
|
261
|
+
*
|
|
262
|
+
* **Pass `undefined` here; do not delete the argument.** It sits *before*
|
|
263
|
+
* `vaultAddress`, so removing it shifts your vault address into this slot
|
|
264
|
+
* and leaves `vaultAddress` undefined — which silently falls back to the
|
|
265
|
+
* legacy single-vault PDA derivation and targets a different vault.
|
|
266
|
+
* @param options - Slippage protection. By default the SDK quotes the net payout these shares should return
|
|
267
|
+
* from the vault's current state and passes that quote, lowered by 50 bps,
|
|
268
|
+
* as the floor to the program's checked instruction. See {@link ISolanaRedeemOptions}.
|
|
269
|
+
*
|
|
270
|
+
* **On a vault with a withdrawal queue**, holders cannot redeem directly:
|
|
271
|
+
* request with {@link SolanaAdapter.vaultRequestRedeem}, then claim here with
|
|
272
|
+
* `options.request` once the cooldown has run. The claim settles at the share
|
|
273
|
+
* price of that moment, net of the withdrawal fee, held to the floor set at
|
|
274
|
+
* request time, and pays the request's recipient; `redeemShares` and
|
|
275
|
+
* `vaultAddress` are then ignored, and `slippageBps` / `minAssetsOut` must
|
|
276
|
+
* be left unset. Without `request`, a
|
|
277
|
+
* queued vault is refused before signing.
|
|
278
|
+
* @returns The confirmed transaction's signature.
|
|
279
|
+
* @throws {@link UpshiftValidationError} for bad input, for a queued vault
|
|
280
|
+
* without `options.request`, or for a request the wallet cannot claim yet.
|
|
281
|
+
* @example
|
|
282
|
+
* ```ts
|
|
283
|
+
* // A vault with a withdrawal queue: claim a ready request.
|
|
284
|
+
* const { pendingRedemptions } = await sdk.getVaultAvailableRedemptions({ vault, wallet });
|
|
285
|
+
* await sdk.solana.vaultRedeem(programId, vaultIdl, wallet, 0n, undefined, undefined, {
|
|
286
|
+
* request: pendingRedemptions[0].id,
|
|
287
|
+
* });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
vaultRedeem(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, redeemShares: number | bigint, sendTransaction?: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string, options?: ISolanaRedeemOptions): Promise<any>;
|
|
291
|
+
/**
|
|
292
|
+
* Request a withdrawal from a Solana vault that has a withdrawal queue.
|
|
293
|
+
*
|
|
294
|
+
* With a queue attached, a vault's shares cannot be redeemed directly: the
|
|
295
|
+
* holder escrows them in a request, waits out the queue's cooldown, then
|
|
296
|
+
* claims with {@link SolanaAdapter.vaultRedeem} and `options.request`, or
|
|
297
|
+
* anyone the request permits (a keeper, by default) claims for them. The
|
|
298
|
+
* payout is priced when the request is claimed, not now, but never below the
|
|
299
|
+
* floor set here: by default the current net quote lowered by 50 bps, so a
|
|
300
|
+
* fee rise or mark-down in between makes the claim fail rather than pay
|
|
301
|
+
* less. A pending request
|
|
302
|
+
* can be cancelled at any time with
|
|
303
|
+
* {@link SolanaAdapter.vaultCancelRedeemRequest}, which returns the shares.
|
|
304
|
+
*
|
|
305
|
+
* Signs through the provider's wallet and submits one transaction, which
|
|
306
|
+
* also creates the recipient's deposit-token account when it has none. The
|
|
307
|
+
* holder pays the request account's rent, refunded when it is claimed or
|
|
308
|
+
* cancelled, plus rent for any account created. Use
|
|
309
|
+
* `getVaultAvailableRedemptions` to list requests and see when they can be
|
|
310
|
+
* claimed.
|
|
311
|
+
*
|
|
312
|
+
* RPC: three to four reads, then the send.
|
|
313
|
+
*
|
|
314
|
+
* @param params - Vault, wallet, shares, and optional recipient, finalizer,
|
|
315
|
+
* request id and floor. See {@link ISolanaRequestRedeemParams}.
|
|
316
|
+
* @returns The signature, the request's address (pass it as `request` to
|
|
317
|
+
* claim or cancel) and its id.
|
|
318
|
+
* @throws {@link UpshiftValidationError} for bad input, a vault without an
|
|
319
|
+
* attached queue, a frozen account or too few shares, before signing.
|
|
320
|
+
* @throws {@link UpshiftSDKError} when the transaction fails.
|
|
321
|
+
* @example
|
|
322
|
+
* ```ts
|
|
323
|
+
* const { request } = await sdk.solana.vaultRequestRedeem({
|
|
324
|
+
* vault: vaultStateAddress,
|
|
325
|
+
* wallet: wallet.publicKey,
|
|
326
|
+
* amount: 10, // shares, UI units
|
|
327
|
+
* });
|
|
328
|
+
* // ...once the cooldown has run:
|
|
329
|
+
* await sdk.solana.vaultRedeem(programId, vaultIdl, wallet.publicKey, 0n, undefined, undefined, { request });
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
vaultRequestRedeem(params: ISolanaRequestRedeemParams): Promise<import("./types").ISolanaRequestRedeemResult>;
|
|
333
|
+
/**
|
|
334
|
+
* Cancel a pending withdrawal request, returning its shares to the holder.
|
|
335
|
+
*
|
|
336
|
+
* Allowed at any time while the request exists: during the cooldown, after
|
|
337
|
+
* it, past the fulfillment window, and while the vault is paused. Only the
|
|
338
|
+
* holder who made the request may cancel it. Signs through the provider's
|
|
339
|
+
* wallet; the request's rent is refunded to the holder.
|
|
340
|
+
*
|
|
341
|
+
* RPC: three reads, then the send.
|
|
342
|
+
*
|
|
343
|
+
* @param params - The holder and the request address. See
|
|
344
|
+
* {@link ISolanaCancelRedeemRequestParams}.
|
|
345
|
+
* @returns The confirmed transaction's signature.
|
|
346
|
+
* @throws {@link UpshiftValidationError} for a missing request, or one this
|
|
347
|
+
* wallet did not make, before signing.
|
|
348
|
+
* @throws {@link UpshiftSDKError} when the transaction fails.
|
|
349
|
+
* @example
|
|
350
|
+
* ```ts
|
|
351
|
+
* await sdk.solana.vaultCancelRedeemRequest({ wallet: wallet.publicKey, request });
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
vaultCancelRedeemRequest(params: ISolanaCancelRedeemRequestParams): Promise<string>;
|
|
355
|
+
/**
|
|
356
|
+
* Canonical program id for a program type on this adapter's network.
|
|
357
|
+
*
|
|
358
|
+
* @param type - Program to look up: `'vault'` (august_vault) or
|
|
359
|
+
* `'withdrawalQueue'` (august_withdrawal_queue).
|
|
360
|
+
* @returns The base58 program id.
|
|
361
|
+
* @throws {@link UpshiftValidationError} if `type` is not one of the two
|
|
362
|
+
* program types, or the program is not deployed on this adapter's network
|
|
363
|
+
* (neither program on `testnet`).
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* const queueProgram = adapter.getProgramId('withdrawalQueue');
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
getProgramId(type: 'vault' | 'withdrawalQueue'): string;
|
|
370
|
+
}
|
|
371
|
+
export type { ISolanaCancelRedeemRequestParams, ISolanaDepositOptions, ISolanaRedeemOptions, ISolanaRequestRedeemParams, ISolanaRequestRedeemResult, } from './types';
|
|
372
|
+
export default SolanaAdapter;
|