@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,587 @@
|
|
|
1
|
+
import { UpshiftBase, type IUpshiftBase } from '../../core/base.class';
|
|
2
|
+
import type { ICollateralExcessOrDeficit, ICollateralSimulationInput, ICollateralSimulationResults, ICuratorWhitelistStatus, IDiscountFactorLadder, ILoanBookInfo, IOracleClassification, IOtcMarginRequirement, IOtcPositionRead, IRevertReason, ITimelockRequest, ITransparencyApySeries, ITransparencyAuditCategory, ITransparencyAuditLog, ITransparencyFees, ITransparencyGovernancePermissions, ITransparencyGovernanceRoles, ITransparencyHistoricalAllocations, ITransparencyPositions, ITransparencyRatioPoint, ITransparencyTimelocks, ITransparencyTimelockStatus, IUnrealizedPnlSnapshot, IVaultPerformanceFees, IWSSubaccountListItem } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Read-only client for Upshift backend REST endpoints that have no on-chain
|
|
5
|
+
* equivalent: the unrealized-PnL series, the transparency dashboard
|
|
6
|
+
* (position snapshot, backing series, smoothed APY, allocations, fee config,
|
|
7
|
+
* governance), plus authenticated loan-book / risk / OTC reads.
|
|
8
|
+
*
|
|
9
|
+
* Every public method makes exactly one HTTPS request to the Upshift API and
|
|
10
|
+
* zero RPC calls. Responses are not cached by the SDK: this is time-sensitive
|
|
11
|
+
* state where staleness is worse than a request. Accessible as
|
|
12
|
+
* `sdk.apiModule`; only the unrealized-PnL methods are also mirrored on the
|
|
13
|
+
* root `UpshiftSDK` class.
|
|
14
|
+
*/
|
|
15
|
+
export declare class UpshiftApi extends UpshiftBase {
|
|
16
|
+
private headers;
|
|
17
|
+
constructor(baseConfig: IUpshiftBase);
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve the global loan-book aggregate across every active client
|
|
20
|
+
* subaccount — one {@link ILoanBookInfo} entry per loan, with principal /
|
|
21
|
+
* interest amounts, APRs, state, and the next upcoming payment.
|
|
22
|
+
*
|
|
23
|
+
* Backed by the admin-only `GET /dashboard/loans` backend endpoint (60-second
|
|
24
|
+
* server-side cache), so the Upshift API key configured on the SDK must
|
|
25
|
+
* belong to an admin user. Makes exactly one HTTP request and no RPC calls.
|
|
26
|
+
*
|
|
27
|
+
* @returns Array of loan-book entries; empty when there are no active loans.
|
|
28
|
+
* @throws UpshiftAuthError When the API key is missing or not admin-scoped.
|
|
29
|
+
* @throws UpshiftServerError When the API responds with a non-2xx status.
|
|
30
|
+
* @example
|
|
31
|
+
* const loans = await sdk.apiModule.getDashboardLoans();
|
|
32
|
+
* const active = loans.filter((l) => l.state === 'ACTIVE');
|
|
33
|
+
*/
|
|
34
|
+
getDashboardLoans(): Promise<ILoanBookInfo[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve every token discount-factor ladder the risk engine applies when
|
|
37
|
+
* valuing collateral.
|
|
38
|
+
*
|
|
39
|
+
* Backed by `GET /risk/discount_factors` (60-second server-side cache),
|
|
40
|
+
* which requires an authenticated Upshift user; an admin-scoped API key
|
|
41
|
+
* works. Makes exactly one HTTP request and no RPC calls.
|
|
42
|
+
*
|
|
43
|
+
* @returns Array of {@link IDiscountFactorLadder}, one per whitelisted token that has a configured ladder.
|
|
44
|
+
* @throws UpshiftAuthError When the API key is missing or not authorized.
|
|
45
|
+
* @throws UpshiftServerError When the API responds with a non-2xx status.
|
|
46
|
+
* @example
|
|
47
|
+
* const ladders = await sdk.apiModule.getDiscountFactors();
|
|
48
|
+
* console.log(ladders.map((d) => `${d.address}@${d.chain}`));
|
|
49
|
+
*/
|
|
50
|
+
getDiscountFactors(): Promise<IDiscountFactorLadder[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Compute how much collateral a subaccount has in excess of — or is short
|
|
53
|
+
* of — what it needs to hold a target health factor, for one collateral
|
|
54
|
+
* token.
|
|
55
|
+
*
|
|
56
|
+
* Backed by `GET /risk/collateral_excess_or_deficit` (60-second server-side
|
|
57
|
+
* cache), which resolves the subaccount and reads its current health factor.
|
|
58
|
+
* The backend serves this route to anonymous callers today, so no Upshift API
|
|
59
|
+
* key is needed; pass one if you get `AUTH_UNAUTHORIZED`. Makes exactly one
|
|
60
|
+
* HTTP request and no RPC calls.
|
|
61
|
+
*
|
|
62
|
+
* @param params.subaccount Subaccount (smart-contract wallet) address.
|
|
63
|
+
* @param params.tokenAddress Collateral token address to evaluate.
|
|
64
|
+
* @param params.tokenChain Numeric Upshift chain id of the token (e.g. `1` for Ethereum mainnet).
|
|
65
|
+
* @param params.targetHealthFactor Health factor to solve for. Defaults server-side to the minimum healthy factor (1.2); when supplied must be a finite number greater than 0.
|
|
66
|
+
* @returns The signed excess (positive) or deficit (negative) in USD and token units. Zeroes when the subaccount has no debt.
|
|
67
|
+
* @throws UpshiftValidationError When an address is invalid, `tokenChain` is not an integer, or `targetHealthFactor` is out of range.
|
|
68
|
+
* @throws UpshiftServerError When the token has no discount factor (backend 404) or the API otherwise responds non-2xx.
|
|
69
|
+
* @example
|
|
70
|
+
* const r = await sdk.apiModule.getCollateralExcessOrDeficit({
|
|
71
|
+
* subaccount: '0xabc…',
|
|
72
|
+
* tokenAddress: '0xdef…',
|
|
73
|
+
* tokenChain: 1,
|
|
74
|
+
* });
|
|
75
|
+
* console.log(r.amount_usd > 0 ? 'excess' : 'deficit');
|
|
76
|
+
*/
|
|
77
|
+
getCollateralExcessOrDeficit(params: {
|
|
78
|
+
subaccount: string;
|
|
79
|
+
tokenAddress: string;
|
|
80
|
+
tokenChain: number;
|
|
81
|
+
targetHealthFactor?: number;
|
|
82
|
+
}): Promise<ICollateralExcessOrDeficit>;
|
|
83
|
+
/**
|
|
84
|
+
* Simulate the collateral required to open a hypothetical loan against a
|
|
85
|
+
* chosen basket of collateral tokens.
|
|
86
|
+
*
|
|
87
|
+
* This is a pure, read-only simulation: the backend `POST
|
|
88
|
+
* /risk/collateral_simulation` endpoint (60-second server-side cache)
|
|
89
|
+
* computes required collateral and effective discount factors and changes
|
|
90
|
+
* no state. The route is public, so no Upshift API key is needed. Makes
|
|
91
|
+
* exactly one HTTP request and no RPC calls.
|
|
92
|
+
*
|
|
93
|
+
* @param input Simulation parameters — see {@link ICollateralSimulationInput}. `collateral_tokens` and `collateral_token_allocation` must be non-empty and equal length; when `on_platform` is `true`, both `loan_redeployed_token_*` fields are required.
|
|
94
|
+
* @returns The simulated {@link ICollateralSimulationResults}: total debt, required collateral, resulting health factor, and a per-token breakdown.
|
|
95
|
+
* @throws UpshiftValidationError When addresses are invalid, `loan_amount` is not a finite non-negative number, the collateral arrays are empty / mismatched, or `on_platform` is set without redeployed-token details.
|
|
96
|
+
* @throws UpshiftServerError When the API responds with a non-2xx status (e.g. a token missing a discount factor).
|
|
97
|
+
* @example
|
|
98
|
+
* const sim = await sdk.apiModule.simulateCollateral({
|
|
99
|
+
* loan_token_chain: 1,
|
|
100
|
+
* loan_token_address: '0xloan…',
|
|
101
|
+
* loan_amount: 1_000_000,
|
|
102
|
+
* collateral_tokens: [[1, '0xcol…']],
|
|
103
|
+
* collateral_token_allocation: [1],
|
|
104
|
+
* });
|
|
105
|
+
* console.log(sim.total_required_collateral_usd);
|
|
106
|
+
*/
|
|
107
|
+
simulateCollateral(input: ICollateralSimulationInput): Promise<ICollateralSimulationResults>;
|
|
108
|
+
/**
|
|
109
|
+
* Fetch the decoded revert reason(s) for a transaction — error messages,
|
|
110
|
+
* revert strings, and recognized universal-subaccount errors extracted from
|
|
111
|
+
* a `debug_traceTransaction` call tree.
|
|
112
|
+
*
|
|
113
|
+
* Backed by the public (unauthenticated) `GET /revert_reason` endpoint; no
|
|
114
|
+
* API key required. The backend relies on the target chain's RPC supporting
|
|
115
|
+
* `debug_trace*`; on chains/RPCs without it the backend returns a 5xx whose
|
|
116
|
+
* detail explains why, surfaced here as an {@link UpshiftServerError}. Makes
|
|
117
|
+
* exactly one HTTP request and no RPC calls from the SDK itself.
|
|
118
|
+
*
|
|
119
|
+
* @param txHash Transaction hash to trace.
|
|
120
|
+
* @param chain Numeric Upshift chain id the transaction is on (e.g. `1` for Ethereum mainnet).
|
|
121
|
+
* @returns The decoded {@link IRevertReason}; all arrays empty when the trace yielded no matching signal.
|
|
122
|
+
* @throws UpshiftValidationError When `txHash` is empty or `chain` is not an integer.
|
|
123
|
+
* @throws UpshiftServerError When the chain/RPC does not support tracing, or the API otherwise responds non-2xx.
|
|
124
|
+
* @example
|
|
125
|
+
* const r = await sdk.apiModule.getRevertReason('0xabc…', 1);
|
|
126
|
+
* console.log(r.revert_reasons);
|
|
127
|
+
*/
|
|
128
|
+
getRevertReason(txHash: string, chain: number): Promise<IRevertReason>;
|
|
129
|
+
/**
|
|
130
|
+
* Retrieve every tracked OTC position.
|
|
131
|
+
*
|
|
132
|
+
* Backed by the admin-only `GET /otc/position` backend endpoint, so the
|
|
133
|
+
* configured Upshift API key must belong to an admin user. Makes exactly one
|
|
134
|
+
* HTTP request and no RPC calls.
|
|
135
|
+
*
|
|
136
|
+
* @returns Array of {@link IOtcPositionRead}; empty when there are no OTC positions.
|
|
137
|
+
* @throws UpshiftAuthError When the API key is missing or not admin-scoped.
|
|
138
|
+
* @throws UpshiftServerError When the API responds with a non-2xx status.
|
|
139
|
+
* @example
|
|
140
|
+
* const positions = await sdk.apiModule.getOtcPositions();
|
|
141
|
+
*/
|
|
142
|
+
getOtcPositions(): Promise<IOtcPositionRead[]>;
|
|
143
|
+
/**
|
|
144
|
+
* Retrieve OTC margin requirements, optionally filtered by counterparty
|
|
145
|
+
* and/or payer.
|
|
146
|
+
*
|
|
147
|
+
* Backed by the admin-only `GET /otc/margin_requirement` backend endpoint,
|
|
148
|
+
* so the configured Upshift API key must belong to an admin user. Makes
|
|
149
|
+
* exactly one HTTP request and no RPC calls.
|
|
150
|
+
*
|
|
151
|
+
* @param options - Optional filters
|
|
152
|
+
* @param options.otcCounterpartyId - Restrict to a single counterparty (UUID)
|
|
153
|
+
* @param options.payer - Restrict to a single payer address
|
|
154
|
+
* @returns Array of {@link IOtcMarginRequirement} matching the filters (all when none given).
|
|
155
|
+
* @throws UpshiftAuthError When the API key is missing or not admin-scoped.
|
|
156
|
+
* @throws UpshiftServerError When the API responds with a non-2xx status.
|
|
157
|
+
* @example
|
|
158
|
+
* const reqs = await sdk.apiModule.getOtcMarginRequirements({ payer: '0xabc…' });
|
|
159
|
+
*/
|
|
160
|
+
getOtcMarginRequirements(options?: {
|
|
161
|
+
otcCounterpartyId?: string;
|
|
162
|
+
payer?: string;
|
|
163
|
+
}): Promise<IOtcMarginRequirement[]>;
|
|
164
|
+
/**
|
|
165
|
+
* List the subaccounts linked to a vault (curator surface).
|
|
166
|
+
*
|
|
167
|
+
* Backed by the curator-or-admin `GET
|
|
168
|
+
* /curator/vaults/{vault_address}/subaccounts` backend endpoint, so the
|
|
169
|
+
* configured Upshift API key must belong to the vault's curator or an admin.
|
|
170
|
+
* Makes exactly one HTTP request and no RPC calls.
|
|
171
|
+
*
|
|
172
|
+
* @param vaultAddress - The vault address (EVM `0x…`, Solana, or Stellar)
|
|
173
|
+
* @returns Array of subaccount records linked to the vault (same shape as the subaccount directory); empty when none are linked.
|
|
174
|
+
* @throws UpshiftValidationError When `vaultAddress` is not a valid address.
|
|
175
|
+
* @throws UpshiftAuthError When the API key is missing or not curator/admin for the vault.
|
|
176
|
+
* @throws UpshiftServerError When the API responds with a non-2xx status.
|
|
177
|
+
* @example
|
|
178
|
+
* const subs = await sdk.apiModule.getCuratorVaultSubaccounts('0xvault…');
|
|
179
|
+
*/
|
|
180
|
+
getCuratorVaultSubaccounts(vaultAddress: string): Promise<IWSSubaccountListItem[]>;
|
|
181
|
+
/**
|
|
182
|
+
* Get on-chain whitelist status for every subaccount linked to a vault
|
|
183
|
+
* (curator surface).
|
|
184
|
+
*
|
|
185
|
+
* Backed by the curator-or-admin `GET
|
|
186
|
+
* /curator/vaults/{vault_address}/whitelist` backend endpoint. EVM vaults
|
|
187
|
+
* only — non-EVM vaults manage access internally and the backend returns a
|
|
188
|
+
* 400 (surfaced as {@link UpshiftServerError}). Makes exactly one HTTP
|
|
189
|
+
* request and no RPC calls from the SDK.
|
|
190
|
+
*
|
|
191
|
+
* @param vaultAddress - The EVM vault address (`0x…`)
|
|
192
|
+
* @returns Array of {@link ICuratorWhitelistStatus}, one per linked subaccount; empty when the vault has no subaccounts.
|
|
193
|
+
* @throws UpshiftValidationError When `vaultAddress` is not a valid address.
|
|
194
|
+
* @throws UpshiftAuthError When the API key is missing or not curator/admin for the vault.
|
|
195
|
+
* @throws UpshiftServerError When the vault is non-EVM (backend 400) or the API otherwise responds non-2xx.
|
|
196
|
+
* @example
|
|
197
|
+
* const status = await sdk.apiModule.getCuratorVaultWhitelist('0xvault…');
|
|
198
|
+
* console.log(status.filter((s) => !s.is_whitelisted));
|
|
199
|
+
*/
|
|
200
|
+
getCuratorVaultWhitelist(vaultAddress: string): Promise<ICuratorWhitelistStatus[]>;
|
|
201
|
+
/**
|
|
202
|
+
* List timelock (governance) requests for a vault on a chain, optionally
|
|
203
|
+
* filtered by status.
|
|
204
|
+
*
|
|
205
|
+
* Backed by the `GET /timelock-requests` backend endpoint. Makes exactly one
|
|
206
|
+
* HTTP request and no RPC calls.
|
|
207
|
+
*
|
|
208
|
+
* @param params.vaultAddress The vault address the requests target.
|
|
209
|
+
* @param params.chainId Numeric Upshift chain id (must be a positive integer).
|
|
210
|
+
* @param params.status Status filter: `"scheduled"` (backend default), `"executed"`, `"cancelled"`, or `"all"`. Omit to use the backend default.
|
|
211
|
+
* @returns Array of {@link ITimelockRequest}; empty when the vault has no matching requests.
|
|
212
|
+
* @throws UpshiftValidationError When `vaultAddress` is invalid or `chainId` is not a positive integer.
|
|
213
|
+
* @throws UpshiftServerError When the API responds with a non-2xx status (e.g. an invalid status filter).
|
|
214
|
+
* @example
|
|
215
|
+
* const reqs = await sdk.apiModule.getTimelockRequests({ vaultAddress: '0xvault…', chainId: 1 });
|
|
216
|
+
*/
|
|
217
|
+
getTimelockRequests(params: {
|
|
218
|
+
vaultAddress: string;
|
|
219
|
+
chainId: number;
|
|
220
|
+
status?: string;
|
|
221
|
+
}): Promise<ITimelockRequest[]>;
|
|
222
|
+
/**
|
|
223
|
+
* Compute a vault's performance fees over a period (backend-computed from
|
|
224
|
+
* its snapshot history).
|
|
225
|
+
*
|
|
226
|
+
* Backed by `GET /metrics/vault_performance_fees`. The backend runs pandas
|
|
227
|
+
* over the vault's full snapshot history, so the first call is slow; results
|
|
228
|
+
* are cached server-side for 20 minutes. Makes exactly one HTTP request and
|
|
229
|
+
* no RPC calls.
|
|
230
|
+
*
|
|
231
|
+
* @param params.vault The vault address (EVM `0x…`, Solana, or Stellar).
|
|
232
|
+
* @param params.annualizedFeesPct Annualized performance-fee percentage. Defaults to 20.
|
|
233
|
+
* @param params.nativeDenominated Whether to denominate in the vault's native token. Defaults to `true`.
|
|
234
|
+
* @param params.calculationPeriod Period preset — `"YearToDate"` (default) or `"MonthToDate"`. Ignored by the backend when a custom `startDate`/`endDate` range is supplied.
|
|
235
|
+
* @param params.startDate ISO-8601 datetime range start. Must be supplied together with `endDate`.
|
|
236
|
+
* @param params.endDate ISO-8601 datetime range end. Must be supplied together with `startDate`.
|
|
237
|
+
* @returns The vault's {@link IVaultPerformanceFees} computation.
|
|
238
|
+
* @throws UpshiftValidationError When `vault` is invalid, or exactly one of `startDate`/`endDate` is supplied.
|
|
239
|
+
* @throws UpshiftServerError When there is insufficient snapshot data for the period, or the API otherwise responds non-2xx.
|
|
240
|
+
* @example
|
|
241
|
+
* const fees = await sdk.apiModule.getVaultPerformanceFees({ vault: '0xvault…' });
|
|
242
|
+
* console.log(fees.total_perf_fees_asset);
|
|
243
|
+
*/
|
|
244
|
+
getVaultPerformanceFees(params: {
|
|
245
|
+
vault: string;
|
|
246
|
+
annualizedFeesPct?: number;
|
|
247
|
+
nativeDenominated?: boolean;
|
|
248
|
+
calculationPeriod?: string;
|
|
249
|
+
startDate?: string;
|
|
250
|
+
endDate?: string;
|
|
251
|
+
}): Promise<IVaultPerformanceFees>;
|
|
252
|
+
/**
|
|
253
|
+
* Fetch a vault's NAV-oracle classification table — how each position/token
|
|
254
|
+
* is priced (Primary / Secondary Market / CeFi) and its USD value, plus
|
|
255
|
+
* warnings for tokens that could not be resolved.
|
|
256
|
+
*
|
|
257
|
+
* Backed by the public (unauthenticated) `GET
|
|
258
|
+
* /upshift/oracle_classification/{vault_address}` endpoint; no API key
|
|
259
|
+
* required. Reads the newest daily snapshot. Makes exactly one HTTP request
|
|
260
|
+
* and no RPC calls from the SDK.
|
|
261
|
+
*
|
|
262
|
+
* @param vault The vault address (EVM `0x…`, Solana, or Stellar).
|
|
263
|
+
* @param chainId Numeric Upshift chain id the vault lives on.
|
|
264
|
+
* @returns The vault's {@link IOracleClassification}.
|
|
265
|
+
* @throws UpshiftValidationError When `vault` is invalid or `chainId` is not an integer.
|
|
266
|
+
* @throws UpshiftServerError When the vault or its snapshot is not found, or the API otherwise responds non-2xx.
|
|
267
|
+
* @example
|
|
268
|
+
* const cls = await sdk.apiModule.getVaultOracleClassification('0xvault…', 1);
|
|
269
|
+
* console.log(cls.warnings);
|
|
270
|
+
*/
|
|
271
|
+
getVaultOracleClassification(vault: string, chainId: number): Promise<IOracleClassification>;
|
|
272
|
+
/**
|
|
273
|
+
* Fetch the latest position snapshot for a vault, grouped per wallet — the
|
|
274
|
+
* data behind the transparency Overview tab (strategy breakdown, backing
|
|
275
|
+
* composition, vault buffer, per-wallet table, headline TVL).
|
|
276
|
+
*
|
|
277
|
+
* Public `GET /upshift/positions/{vault_address}`; no API key. One HTTPS
|
|
278
|
+
* request, no RPC. Snapshots land hourly; every field is from the single
|
|
279
|
+
* `snapshot_at` instant. Vault buffer = `total_nav − Σ subaccounts[].total_usd`;
|
|
280
|
+
* `reported_tvl` is the vault-contract-reported total assets from the same snapshot.
|
|
281
|
+
*
|
|
282
|
+
* @param params.vault EVM vault address.
|
|
283
|
+
* @param params.chainId Numeric chain id the vault lives on.
|
|
284
|
+
* @returns {@link ITransparencyPositions}.
|
|
285
|
+
* @throws UpshiftValidationError When arguments fail validation (no request is made).
|
|
286
|
+
* @throws UpshiftServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
|
|
287
|
+
* @throws UpshiftServerError (status 200) When the body is not the documented shape — backend contract drift.
|
|
288
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
289
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* const p = await sdk.apiModule.getVaultPositionSnapshot({ vault: '0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA', chainId: 143 });
|
|
293
|
+
* const buffer = p.total_nav - p.subaccounts.reduce((a, s) => a + s.total_usd, 0);
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
getVaultPositionSnapshot(params: {
|
|
297
|
+
vault: string;
|
|
298
|
+
chainId: number;
|
|
299
|
+
}): Promise<ITransparencyPositions>;
|
|
300
|
+
/**
|
|
301
|
+
* Fetch the backing / supply / collateral-ratio time series behind the
|
|
302
|
+
* Performance tab's "Backing vs Supply" and "Collateral Ratio" charts, and
|
|
303
|
+
* the Overview sidebar's 7-day deltas.
|
|
304
|
+
*
|
|
305
|
+
* Public `GET /upshift/unrealized_pnl?fields=ratio`; no API key. One HTTPS
|
|
306
|
+
* request, no RPC. Points are hourly, returned newest-first — sort before
|
|
307
|
+
* charting. `actual_tvl` = backing (mark-to-market), `tvl_on_vault` = supply
|
|
308
|
+
* (vault-reported), `adjusted_redeem_ratio` = collateral ratio.
|
|
309
|
+
*
|
|
310
|
+
* Unlike the chain-scoped transparency endpoints (positions, fees,
|
|
311
|
+
* governance…), this one is keyed by vault address only and accepts
|
|
312
|
+
* non-EVM (Solana / Stellar) vaults — same contract as
|
|
313
|
+
* {@link UpshiftApi.getVaultUnrealizedPnlHistory}, which it shares a route with.
|
|
314
|
+
*
|
|
315
|
+
* @param params.vault Vault address (EVM, Solana, or Stellar).
|
|
316
|
+
* @param params.startDate Optional inclusive lower bound, `YYYY-MM-DD`.
|
|
317
|
+
* @param params.endDate Optional inclusive upper bound, `YYYY-MM-DD`.
|
|
318
|
+
* @param params.limit Optional max points.
|
|
319
|
+
* @returns Array of {@link ITransparencyRatioPoint}; empty when no history.
|
|
320
|
+
* @throws UpshiftValidationError When arguments fail validation (no request is made).
|
|
321
|
+
* @throws UpshiftServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
|
|
322
|
+
* @throws UpshiftServerError (status 200) When the body is not the documented shape — backend contract drift.
|
|
323
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
324
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
325
|
+
* @example
|
|
326
|
+
* ```ts
|
|
327
|
+
* const pts = await sdk.apiModule.getVaultBackingSeries({ vault, startDate: '2026-08-01' });
|
|
328
|
+
* const ratio = pts.map((p) => p.adjusted_redeem_ratio * 100); // percent
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
getVaultBackingSeries(params: {
|
|
332
|
+
vault: string;
|
|
333
|
+
startDate?: string;
|
|
334
|
+
endDate?: string;
|
|
335
|
+
limit?: number;
|
|
336
|
+
}): Promise<ITransparencyRatioPoint[]>;
|
|
337
|
+
/**
|
|
338
|
+
* Fetch the smoothed 7-day APY series — the exact series the Upshift app
|
|
339
|
+
* charts (Overview "APY last 30 days" and Performance "APY Over Time").
|
|
340
|
+
*
|
|
341
|
+
* Public `GET /upshift/historical_apy/chart`; no API key. One HTTPS request,
|
|
342
|
+
* no RPC. The backend marks this route deprecated in its OpenAPI spec but it
|
|
343
|
+
* remains the series the Upshift app itself charts; this wrapper tracks it.
|
|
344
|
+
* The backend applies a rolling-median/mean smoothing filter server-side
|
|
345
|
+
* when `applySmoothing` is true (the app default); computing APY locally from
|
|
346
|
+
* raw share ratios will NOT match the published figures.
|
|
347
|
+
*
|
|
348
|
+
* Unlike the chain-scoped transparency endpoints (positions, fees,
|
|
349
|
+
* governance…), this one is keyed by vault address only and accepts
|
|
350
|
+
* non-EVM (Solana / Stellar) vaults.
|
|
351
|
+
*
|
|
352
|
+
* @param params.vault Vault address (EVM, Solana, or Stellar).
|
|
353
|
+
* @param params.daysAgo Window length in days; pass `-1` for the full history since inception. Default 30.
|
|
354
|
+
* @param params.averagingPeriodDays Rolling window for the annualized return; must be ≥ 2. Default 7 (the app's "7D APY").
|
|
355
|
+
* @param params.applySmoothing Apply the backend smoothing filter. Default true.
|
|
356
|
+
* @returns {@link ITransparencyApySeries} — `labels` are `M/D/YYYY`, `values` are decimal fractions (0.0245 = 2.45%). Empty arrays when the vault has no data.
|
|
357
|
+
* @throws UpshiftValidationError When arguments fail validation (no request is made).
|
|
358
|
+
* @throws UpshiftServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
|
|
359
|
+
* @throws UpshiftServerError (status 200) When the body is not the documented shape — backend contract drift.
|
|
360
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
361
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* const apy = await sdk.apiModule.getVaultSmoothedApy({ vault, daysAgo: 30 });
|
|
365
|
+
* console.log(apy.values.at(-1)); // latest 7D APY as a fraction
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
getVaultSmoothedApy(params: {
|
|
369
|
+
vault: string;
|
|
370
|
+
daysAgo?: number;
|
|
371
|
+
averagingPeriodDays?: number;
|
|
372
|
+
applySmoothing?: boolean;
|
|
373
|
+
}): Promise<ITransparencyApySeries>;
|
|
374
|
+
/**
|
|
375
|
+
* Fetch daily allocation history per protocol — the Performance tab's
|
|
376
|
+
* "Allocation Over Time" chart.
|
|
377
|
+
*
|
|
378
|
+
* Public `GET /upshift/historical_allocations/{vault_address}`; no API key.
|
|
379
|
+
* One HTTPS request, no RPC.
|
|
380
|
+
*
|
|
381
|
+
* @param params.vault EVM vault address.
|
|
382
|
+
* @param params.chainId Numeric chain id.
|
|
383
|
+
* @param params.startDate Optional inclusive lower bound, `YYYY-MM-DD`.
|
|
384
|
+
* @param params.endDate Optional inclusive upper bound, `YYYY-MM-DD`.
|
|
385
|
+
* @returns {@link ITransparencyHistoricalAllocations}.
|
|
386
|
+
* @throws UpshiftValidationError When arguments fail validation (no request is made).
|
|
387
|
+
* @throws UpshiftServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
|
|
388
|
+
* @throws UpshiftServerError (status 200) When the body is not the documented shape — backend contract drift.
|
|
389
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
390
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* const h = await sdk.apiModule.getVaultHistoricalAllocations({ vault, chainId: 143, startDate: '2026-08-01' });
|
|
394
|
+
* const byDate = Map.groupBy(h.points, (p) => p.date);
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
getVaultHistoricalAllocations(params: {
|
|
398
|
+
vault: string;
|
|
399
|
+
chainId: number;
|
|
400
|
+
startDate?: string;
|
|
401
|
+
endDate?: string;
|
|
402
|
+
}): Promise<ITransparencyHistoricalAllocations>;
|
|
403
|
+
/**
|
|
404
|
+
* Fetch a vault's fee configuration — the Performance tab's fee card.
|
|
405
|
+
*
|
|
406
|
+
* Public `GET /upshift/fees/{vault_address}`; no API key. One HTTPS
|
|
407
|
+
* request, no RPC. Percent fields are already scaled (`management_fee_pct`
|
|
408
|
+
* of `1.5` means 1.5%).
|
|
409
|
+
*
|
|
410
|
+
* @param params.vault EVM vault address.
|
|
411
|
+
* @param params.chainId Numeric chain id.
|
|
412
|
+
* @returns {@link ITransparencyFees}.
|
|
413
|
+
* @throws UpshiftValidationError When arguments fail validation (no request is made).
|
|
414
|
+
* @throws UpshiftServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
|
|
415
|
+
* @throws UpshiftServerError (status 200) When the body is not the documented shape — backend contract drift.
|
|
416
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
417
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
418
|
+
* @example
|
|
419
|
+
* ```ts
|
|
420
|
+
* const fees = await sdk.apiModule.getVaultFeeConfig({ vault, chainId: 143 });
|
|
421
|
+
* console.log(`${fees.management_fee_pct}% mgmt / ${fees.performance_fee_pct}% perf`);
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
getVaultFeeConfig(params: {
|
|
425
|
+
vault: string;
|
|
426
|
+
chainId: number;
|
|
427
|
+
}): Promise<ITransparencyFees>;
|
|
428
|
+
/**
|
|
429
|
+
* Fetch the vault's privileged addresses (owner / operators) with custody
|
|
430
|
+
* enrichment — the Governance tab's "Vault Roles" card.
|
|
431
|
+
*
|
|
432
|
+
* Public `GET /upshift/governance/{vault_address}/roles`; no API key. One
|
|
433
|
+
* HTTPS request from the SDK (the backend performs the on-chain reads).
|
|
434
|
+
* Third-party enrichment failures (Safe / Fordefi) degrade rows and append
|
|
435
|
+
* to `warnings` rather than failing.
|
|
436
|
+
*
|
|
437
|
+
* @param params.vault EVM vault address.
|
|
438
|
+
* @param params.chainId Numeric chain id.
|
|
439
|
+
* @returns {@link ITransparencyGovernanceRoles}.
|
|
440
|
+
* @throws UpshiftValidationError When arguments fail validation (no request is made).
|
|
441
|
+
* @throws UpshiftServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
|
|
442
|
+
* @throws UpshiftServerError (status 200) When the body is not the documented shape — backend contract drift.
|
|
443
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
444
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
445
|
+
* @example
|
|
446
|
+
* ```ts
|
|
447
|
+
* const { roles, warnings } = await sdk.apiModule.getVaultGovernanceRoles({ vault, chainId: 143 });
|
|
448
|
+
* const owner = roles.find((r) => r.role === 'owner'); // owner?.is_safe → Safe threshold in safe_threshold
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
getVaultGovernanceRoles(params: {
|
|
452
|
+
vault: string;
|
|
453
|
+
chainId: number;
|
|
454
|
+
}): Promise<ITransparencyGovernanceRoles>;
|
|
455
|
+
/**
|
|
456
|
+
* Fetch the integrations each vault wallet is whitelisted to operate —
|
|
457
|
+
* the Governance tab's "Vault Permissions" table.
|
|
458
|
+
*
|
|
459
|
+
* Public `GET /upshift/governance/{vault_address}/permissions`; no API key.
|
|
460
|
+
* One HTTPS request, no RPC.
|
|
461
|
+
*
|
|
462
|
+
* @param params.vault EVM vault address.
|
|
463
|
+
* @param params.chainId Numeric chain id.
|
|
464
|
+
* @returns {@link ITransparencyGovernancePermissions}.
|
|
465
|
+
* @throws UpshiftValidationError When arguments fail validation (no request is made).
|
|
466
|
+
* @throws UpshiftServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
|
|
467
|
+
* @throws UpshiftServerError (status 200) When the body is not the documented shape — backend contract drift.
|
|
468
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
469
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
470
|
+
* @example
|
|
471
|
+
* ```ts
|
|
472
|
+
* const { permissions } = await sdk.apiModule.getVaultGovernancePermissions({ vault, chainId: 143 });
|
|
473
|
+
* for (const p of permissions) console.log(p.integration, p.functions.join(','));
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
getVaultGovernancePermissions(params: {
|
|
477
|
+
vault: string;
|
|
478
|
+
chainId: number;
|
|
479
|
+
}): Promise<ITransparencyGovernancePermissions>;
|
|
480
|
+
/**
|
|
481
|
+
* Fetch the vault's timelock queue — the Governance tab's "Pending
|
|
482
|
+
* Timelocks" table. Defaults to pending (`scheduled`) requests.
|
|
483
|
+
*
|
|
484
|
+
* Public `GET /upshift/governance/{vault_address}/timelocks`; no API key.
|
|
485
|
+
* `executable_at` is `scheduled_at + TIMELOCK_DURATION()` read live from
|
|
486
|
+
* the timelock contract; null (plus a warning) when that read failed.
|
|
487
|
+
* The default filter is pending only — the list is often empty; pass
|
|
488
|
+
* `status: 'all'` for history. `getTimelockRequests` returns the raw
|
|
489
|
+
* backend rows; this returns the dashboard view (labels, `executable_at`,
|
|
490
|
+
* warnings).
|
|
491
|
+
*
|
|
492
|
+
* @param params.vault EVM vault address.
|
|
493
|
+
* @param params.chainId Numeric chain id.
|
|
494
|
+
* @param params.status Filter: a single {@link ITransparencyTimelockStatus} or `'all'`. Default `'scheduled'`. Any other string is rejected with `UpshiftValidationError` before a request is made.
|
|
495
|
+
* @returns {@link ITransparencyTimelocks}.
|
|
496
|
+
* @throws UpshiftValidationError When arguments fail validation (no request is made).
|
|
497
|
+
* @throws UpshiftServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
|
|
498
|
+
* @throws UpshiftServerError (status 200) When the body is not the documented shape — backend contract drift.
|
|
499
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
500
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
501
|
+
* @example
|
|
502
|
+
* ```ts
|
|
503
|
+
* const { timelocks } = await sdk.apiModule.getVaultGovernanceTimelocks({ vault, chainId: 1 }); // pending only
|
|
504
|
+
* const ready = timelocks.filter((t) => t.executable_at && Date.parse(`${t.executable_at}Z`) <= Date.now());
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
getVaultGovernanceTimelocks(params: {
|
|
508
|
+
vault: string;
|
|
509
|
+
chainId: number;
|
|
510
|
+
status?: ITransparencyTimelockStatus | 'all';
|
|
511
|
+
}): Promise<ITransparencyTimelocks>;
|
|
512
|
+
/**
|
|
513
|
+
* Fetch one page of the vault's governance audit log, newest first — the
|
|
514
|
+
* Governance tab's "Audit Log" timeline. Merges live timelock events with
|
|
515
|
+
* manually recorded entries (attestations, permission changes).
|
|
516
|
+
*
|
|
517
|
+
* Public `GET /upshift/governance/{vault_address}/audit_log`; no API key.
|
|
518
|
+
* Paginate with `before` = the last returned entry's `timestamp` while
|
|
519
|
+
* `has_more` is true (exclusive cursor; ties at the exact boundary
|
|
520
|
+
* timestamp are skipped, never duplicated).
|
|
521
|
+
*
|
|
522
|
+
* @param params.vault EVM vault address.
|
|
523
|
+
* @param params.chainId Numeric chain id.
|
|
524
|
+
* @param params.category Optional {@link ITransparencyAuditCategory} filter. Any other string is rejected with `UpshiftValidationError` before a request is made.
|
|
525
|
+
* @param params.before Optional exclusive cursor — pass the previous page's last `entry.timestamp` back verbatim (naive-UTC, no offset).
|
|
526
|
+
* @param params.limit Page size, 1–200. Backend default 50.
|
|
527
|
+
* @returns {@link ITransparencyAuditLog}.
|
|
528
|
+
* @throws UpshiftValidationError When arguments fail validation (no request is made).
|
|
529
|
+
* @throws UpshiftServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
|
|
530
|
+
* @throws UpshiftServerError (status 200) When the body is not the documented shape — backend contract drift.
|
|
531
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
532
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
533
|
+
* @example
|
|
534
|
+
* ```ts
|
|
535
|
+
* // Walk the whole log, newest first.
|
|
536
|
+
* let before: string | undefined;
|
|
537
|
+
* do {
|
|
538
|
+
* const page = await sdk.apiModule.getVaultGovernanceAuditLog({ vault, chainId: 1, before, limit: 50 });
|
|
539
|
+
* for (const e of page.entries) console.log(e.timestamp, e.type, e.summary);
|
|
540
|
+
* before = page.has_more ? page.entries.at(-1)?.timestamp : undefined;
|
|
541
|
+
* } while (before);
|
|
542
|
+
* ```
|
|
543
|
+
*/
|
|
544
|
+
getVaultGovernanceAuditLog(params: {
|
|
545
|
+
vault: string;
|
|
546
|
+
chainId: number;
|
|
547
|
+
category?: ITransparencyAuditCategory;
|
|
548
|
+
before?: string;
|
|
549
|
+
limit?: number;
|
|
550
|
+
}): Promise<ITransparencyAuditLog>;
|
|
551
|
+
/**
|
|
552
|
+
* Fetch the historical unrealized-PnL series for a vault, newest first,
|
|
553
|
+
* as computed by the Upshift backend from periodic vault snapshots.
|
|
554
|
+
*
|
|
555
|
+
* Makes one HTTPS request to the public Upshift API; no RPC calls.
|
|
556
|
+
*
|
|
557
|
+
* @param params.vault Vault address (EVM `0x…`, Solana, or Stellar).
|
|
558
|
+
* @param params.limit Maximum number of snapshots to return (1–1000). Backend default applies when omitted.
|
|
559
|
+
* @returns Array of {@link IUnrealizedPnlSnapshot}; empty when the backend has no history for the vault.
|
|
560
|
+
* @throws UpshiftValidationError When `vault` is not a valid address or `limit` is out of range.
|
|
561
|
+
* @throws UpshiftServerError When the API responds with a 5xx, or returns a body that is not a snapshot array.
|
|
562
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
563
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
564
|
+
* @example
|
|
565
|
+
* const series = await sdk.getVaultUnrealizedPnlHistory({ vault: '0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA', limit: 30 });
|
|
566
|
+
* console.log(series[0]?.unrealizedPnlInAsset);
|
|
567
|
+
*/
|
|
568
|
+
getVaultUnrealizedPnlHistory(params: {
|
|
569
|
+
vault: string;
|
|
570
|
+
limit?: number;
|
|
571
|
+
}): Promise<IUnrealizedPnlSnapshot[]>;
|
|
572
|
+
/**
|
|
573
|
+
* Fetch the latest unrealized-PnL snapshot for every vault the backend
|
|
574
|
+
* tracks — one entry per vault.
|
|
575
|
+
*
|
|
576
|
+
* Makes one HTTPS request to the public Upshift API; no RPC calls.
|
|
577
|
+
*
|
|
578
|
+
* @returns Array of {@link IUnrealizedPnlSnapshot}, one per tracked vault.
|
|
579
|
+
* @throws UpshiftServerError When the API responds with a 5xx, or returns a body that is not a snapshot array.
|
|
580
|
+
* @throws UpshiftRateLimitError When the API responds 429.
|
|
581
|
+
* @throws UpshiftTimeoutError When the request exceeds the SDK request timeout.
|
|
582
|
+
* @example
|
|
583
|
+
* const all = await sdk.getLatestUnrealizedPnl();
|
|
584
|
+
* const losing = all.filter((s) => s.unrealizedPnl < 0);
|
|
585
|
+
*/
|
|
586
|
+
getLatestUnrealizedPnl(): Promise<IUnrealizedPnlSnapshot[]>;
|
|
587
|
+
}
|