upshift-config 0.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +349 -0
- package/lib/abis/AddressResolver.d.ts +28 -0
- package/lib/abis/AddressResolver.js +23 -0
- package/lib/abis/ChainlinkV3.d.ts +87 -0
- package/lib/abis/ChainlinkV3.js +117 -0
- package/lib/abis/ERC20.d.ts +168 -0
- package/lib/abis/ERC20.js +226 -0
- package/lib/abis/ERC20_Bytes32.d.ts +139 -0
- package/lib/abis/ERC20_Bytes32.js +196 -0
- package/lib/abis/ERC4626.d.ts +364 -0
- package/lib/abis/ERC4626.js +507 -0
- package/lib/abis/ERC721.d.ts +231 -0
- package/lib/abis/ERC721.js +321 -0
- package/lib/abis/FeeOracle.d.ts +120 -0
- package/lib/abis/FeeOracle.js +162 -0
- package/lib/abis/LendingPool.d.ts +1393 -0
- package/lib/abis/LendingPool.js +1807 -0
- package/lib/abis/LendingPoolV2.d.ts +1413 -0
- package/lib/abis/LendingPoolV2.js +1833 -0
- package/lib/abis/LendingPoolV3.d.ts +1677 -0
- package/lib/abis/LendingPoolV3.js +1160 -0
- package/lib/abis/Loan.d.ts +837 -0
- package/lib/abis/Loan.js +1080 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
- package/lib/abis/Multicall3.d.ts +30 -0
- package/lib/abis/Multicall3.js +97 -0
- package/lib/abis/OFT.d.ts +116 -0
- package/lib/abis/OFT.js +85 -0
- package/lib/abis/PoolAdapter.d.ts +36 -0
- package/lib/abis/PoolAdapter.js +51 -0
- package/lib/abis/RewardDistributor.d.ts +267 -0
- package/lib/abis/RewardDistributor.js +352 -0
- package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
- package/lib/abis/RwaRedeemSubaccount.js +548 -0
- package/lib/abis/SmartAccount.d.ts +17 -0
- package/lib/abis/SmartAccount.js +19 -0
- package/lib/abis/SwapRouter.d.ts +1043 -0
- package/lib/abis/SwapRouter.js +740 -0
- package/lib/abis/TextResolver.d.ts +16 -0
- package/lib/abis/TextResolver.js +16 -0
- package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
- package/lib/abis/TokenizedVaultV2.js +1041 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
- package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
- package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
- package/lib/abis/UniversalResolverResolve.d.ts +69 -0
- package/lib/abis/UniversalResolverResolve.js +35 -0
- package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
- package/lib/abis/UniversalSignatureValidator.js +30 -0
- package/lib/abis/WrapperAdapter.d.ts +71 -0
- package/lib/abis/WrapperAdapter.js +77 -0
- package/lib/abis/index.d.ts +34 -0
- package/lib/abis/index.js +51 -0
- package/lib/adapters/evm/getters.d.ts +19 -0
- package/lib/adapters/evm/getters.js +209 -0
- package/lib/adapters/evm/index.d.ts +353 -0
- package/lib/adapters/evm/index.js +434 -0
- package/lib/adapters/evm/utils.d.ts +8 -0
- package/lib/adapters/evm/utils.js +51 -0
- package/lib/adapters/solana/constants.d.ts +33 -0
- package/lib/adapters/solana/constants.js +52 -0
- package/lib/adapters/solana/getters.d.ts +11 -0
- package/lib/adapters/solana/getters.js +165 -0
- package/lib/adapters/solana/idl/vault-idl.d.ts +272 -0
- package/lib/adapters/solana/idl/vault-idl.js +1084 -0
- package/lib/adapters/solana/index.d.ts +233 -0
- package/lib/adapters/solana/index.js +291 -0
- package/lib/adapters/solana/types.d.ts +67 -0
- package/lib/adapters/solana/types.js +3 -0
- package/lib/adapters/solana/utils.d.ts +141 -0
- package/lib/adapters/solana/utils.js +595 -0
- package/lib/adapters/solana/vault.actions.d.ts +57 -0
- package/lib/adapters/solana/vault.actions.js +379 -0
- package/lib/adapters/stellar/actions.d.ts +28 -0
- package/lib/adapters/stellar/actions.js +77 -0
- package/lib/adapters/stellar/constants.d.ts +43 -0
- package/lib/adapters/stellar/constants.js +53 -0
- package/lib/adapters/stellar/getters.d.ts +68 -0
- package/lib/adapters/stellar/getters.js +290 -0
- package/lib/adapters/stellar/index.d.ts +114 -0
- package/lib/adapters/stellar/index.js +175 -0
- package/lib/adapters/stellar/soroban.d.ts +123 -0
- package/lib/adapters/stellar/soroban.js +613 -0
- package/lib/adapters/stellar/submit.d.ts +34 -0
- package/lib/adapters/stellar/submit.js +149 -0
- package/lib/adapters/stellar/types.d.ts +58 -0
- package/lib/adapters/stellar/types.js +6 -0
- package/lib/adapters/stellar/utils.d.ts +24 -0
- package/lib/adapters/stellar/utils.js +34 -0
- package/lib/adapters/sui/constants.d.ts +14 -0
- package/lib/adapters/sui/constants.js +29 -0
- package/lib/adapters/sui/getters.d.ts +9 -0
- package/lib/adapters/sui/getters.js +60 -0
- package/lib/adapters/sui/index.d.ts +45 -0
- package/lib/adapters/sui/index.js +101 -0
- package/lib/adapters/sui/transformer.d.ts +10 -0
- package/lib/adapters/sui/transformer.js +107 -0
- package/lib/adapters/sui/types.d.ts +66 -0
- package/lib/adapters/sui/types.js +3 -0
- package/lib/adapters/sui/utils.d.ts +10 -0
- package/lib/adapters/sui/utils.js +29 -0
- package/lib/core/analytics/chain-name.d.ts +9 -0
- package/lib/core/analytics/chain-name.js +34 -0
- package/lib/core/analytics/constants.d.ts +5 -0
- package/lib/core/analytics/constants.js +9 -0
- package/lib/core/analytics/env.d.ts +29 -0
- package/lib/core/analytics/env.js +59 -0
- package/lib/core/analytics/index.d.ts +36 -0
- package/lib/core/analytics/index.js +79 -0
- package/lib/core/analytics/instrumentation.d.ts +29 -0
- package/lib/core/analytics/instrumentation.js +277 -0
- package/lib/core/analytics/method-taxonomy.d.ts +19 -0
- package/lib/core/analytics/method-taxonomy.js +128 -0
- package/lib/core/analytics/metrics.d.ts +33 -0
- package/lib/core/analytics/metrics.js +116 -0
- package/lib/core/analytics/sanitize.d.ts +44 -0
- package/lib/core/analytics/sanitize.js +260 -0
- package/lib/core/analytics/sentry-runtime.d.ts +15 -0
- package/lib/core/analytics/sentry-runtime.js +97 -0
- package/lib/core/analytics/sentry.d.ts +67 -0
- package/lib/core/analytics/sentry.js +613 -0
- package/lib/core/analytics/types.d.ts +48 -0
- package/lib/core/analytics/types.js +3 -0
- package/lib/core/analytics/user-identity.d.ts +41 -0
- package/lib/core/analytics/user-identity.js +141 -0
- package/lib/core/analytics/version.d.ts +6 -0
- package/lib/core/analytics/version.js +10 -0
- package/lib/core/attribution.d.ts +111 -0
- package/lib/core/attribution.js +142 -0
- package/lib/core/auth/index.d.ts +1 -0
- package/lib/core/auth/index.js +18 -0
- package/lib/core/auth/verify.d.ts +2 -0
- package/lib/core/auth/verify.js +31 -0
- package/lib/core/base.class.d.ts +152 -0
- package/lib/core/base.class.js +172 -0
- package/lib/core/cache.d.ts +9 -0
- package/lib/core/cache.js +31 -0
- package/lib/core/constants/adapters.d.ts +103 -0
- package/lib/core/constants/adapters.js +180 -0
- package/lib/core/constants/core.d.ts +133 -0
- package/lib/core/constants/core.js +209 -0
- package/lib/core/constants/swap-router.d.ts +150 -0
- package/lib/core/constants/swap-router.js +169 -0
- package/lib/core/constants/vaults.d.ts +93 -0
- package/lib/core/constants/vaults.js +273 -0
- package/lib/core/constants/web3.d.ts +91 -0
- package/lib/core/constants/web3.js +229 -0
- package/lib/core/errors/index.d.ts +114 -0
- package/lib/core/errors/index.js +183 -0
- package/lib/core/fetcher.d.ts +198 -0
- package/lib/core/fetcher.js +903 -0
- package/lib/core/helpers/adapters.d.ts +13 -0
- package/lib/core/helpers/adapters.js +39 -0
- package/lib/core/helpers/chain-address.d.ts +13 -0
- package/lib/core/helpers/chain-address.js +47 -0
- package/lib/core/helpers/chain-error.d.ts +207 -0
- package/lib/core/helpers/chain-error.js +682 -0
- package/lib/core/helpers/chain-support.d.ts +80 -0
- package/lib/core/helpers/chain-support.js +115 -0
- package/lib/core/helpers/core.d.ts +68 -0
- package/lib/core/helpers/core.js +285 -0
- package/lib/core/helpers/explorer-link.d.ts +16 -0
- package/lib/core/helpers/explorer-link.js +26 -0
- package/lib/core/helpers/multicall.d.ts +68 -0
- package/lib/core/helpers/multicall.js +103 -0
- package/lib/core/helpers/revert-decode.d.ts +248 -0
- package/lib/core/helpers/revert-decode.js +515 -0
- package/lib/core/helpers/signer.d.ts +52 -0
- package/lib/core/helpers/signer.js +145 -0
- package/lib/core/helpers/swap-router.d.ts +211 -0
- package/lib/core/helpers/swap-router.js +480 -0
- package/lib/core/helpers/vault-version.d.ts +23 -0
- package/lib/core/helpers/vault-version.js +75 -0
- package/lib/core/helpers/vaults.d.ts +89 -0
- package/lib/core/helpers/vaults.js +235 -0
- package/lib/core/helpers/web3.d.ts +353 -0
- package/lib/core/helpers/web3.js +992 -0
- package/lib/core/index.d.ts +23 -0
- package/lib/core/index.js +40 -0
- package/lib/core/logger/index.d.ts +98 -0
- package/lib/core/logger/index.js +144 -0
- package/lib/core/logger/slack.d.ts +16 -0
- package/lib/core/logger/slack.js +57 -0
- package/lib/core/vault-metadata.d.ts +12 -0
- package/lib/core/vault-metadata.js +42 -0
- package/lib/core/version-check.d.ts +58 -0
- package/lib/core/version-check.js +182 -0
- package/lib/evm/index.d.ts +2 -0
- package/lib/evm/index.js +19 -0
- package/lib/evm/methods/crossChainVault.d.ts +128 -0
- package/lib/evm/methods/crossChainVault.js +853 -0
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +2 -0
- package/lib/evm/methods/index.js +19 -0
- package/lib/evm/types/crossChain.d.ts +363 -0
- package/lib/evm/types/crossChain.js +20 -0
- package/lib/evm/types/index.d.ts +1 -0
- package/lib/evm/types/index.js +18 -0
- package/lib/index.d.ts +30 -0
- package/lib/index.js +52 -0
- package/lib/main.d.ts +527 -0
- package/lib/main.js +601 -0
- package/lib/modules/api/fetcher.d.ts +82 -0
- package/lib/modules/api/fetcher.js +150 -0
- package/lib/modules/api/index.d.ts +1 -0
- package/lib/modules/api/index.js +6 -0
- package/lib/modules/api/main.d.ts +313 -0
- package/lib/modules/api/main.js +479 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
- package/lib/modules/sub-accounts/fetcher.js +120 -0
- package/lib/modules/sub-accounts/index.d.ts +2 -0
- package/lib/modules/sub-accounts/index.js +19 -0
- package/lib/modules/sub-accounts/main.d.ts +243 -0
- package/lib/modules/sub-accounts/main.js +205 -0
- package/lib/modules/sub-accounts/utils.d.ts +106 -0
- package/lib/modules/sub-accounts/utils.js +112 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +64 -0
- package/lib/modules/vaults/adapter.helpers.js +184 -0
- package/lib/modules/vaults/fetcher.d.ts +147 -0
- package/lib/modules/vaults/fetcher.js +368 -0
- package/lib/modules/vaults/getters.d.ts +570 -0
- package/lib/modules/vaults/getters.js +3051 -0
- package/lib/modules/vaults/index.d.ts +20 -0
- package/lib/modules/vaults/index.js +44 -0
- package/lib/modules/vaults/main.d.ts +601 -0
- package/lib/modules/vaults/main.js +1623 -0
- package/lib/modules/vaults/prefetch.d.ts +65 -0
- package/lib/modules/vaults/prefetch.js +120 -0
- package/lib/modules/vaults/read.actions.d.ts +225 -0
- package/lib/modules/vaults/read.actions.js +596 -0
- package/lib/modules/vaults/types.d.ts +71 -0
- package/lib/modules/vaults/types.js +3 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
- package/lib/modules/vaults/utils/date-utils.js +84 -0
- package/lib/modules/vaults/utils.d.ts +140 -0
- package/lib/modules/vaults/utils.js +799 -0
- package/lib/modules/vaults/write.actions.d.ts +529 -0
- package/lib/modules/vaults/write.actions.js +1749 -0
- package/lib/polyfills.d.ts +1 -0
- package/lib/polyfills.js +12 -0
- package/lib/sdk.d.ts +26721 -0
- package/lib/services/coingecko/fetcher.d.ts +15 -0
- package/lib/services/coingecko/fetcher.js +67 -0
- package/lib/services/coingecko/index.d.ts +2 -0
- package/lib/services/coingecko/index.js +19 -0
- package/lib/services/coingecko/utils.d.ts +1 -0
- package/lib/services/coingecko/utils.js +24 -0
- package/lib/services/debank/fetcher.d.ts +126 -0
- package/lib/services/debank/fetcher.js +47 -0
- package/lib/services/debank/index.d.ts +2 -0
- package/lib/services/debank/index.js +19 -0
- package/lib/services/debank/utils.d.ts +38 -0
- package/lib/services/debank/utils.js +297 -0
- package/lib/services/layerzero/deposits.d.ts +49 -0
- package/lib/services/layerzero/deposits.js +166 -0
- package/lib/services/layerzero/redeems.d.ts +20 -0
- package/lib/services/layerzero/redeems.js +92 -0
- package/lib/services/layerzero/utils.d.ts +9 -0
- package/lib/services/layerzero/utils.js +22 -0
- package/lib/services/octavfi/fetcher.d.ts +9 -0
- package/lib/services/octavfi/fetcher.js +103 -0
- package/lib/services/octavfi/index.d.ts +3 -0
- package/lib/services/octavfi/index.js +20 -0
- package/lib/services/octavfi/types.d.ts +34 -0
- package/lib/services/octavfi/types.js +3 -0
- package/lib/services/octavfi/utils.d.ts +16 -0
- package/lib/services/octavfi/utils.js +212 -0
- package/lib/services/subgraph/fetcher.d.ts +2 -0
- package/lib/services/subgraph/fetcher.js +61 -0
- package/lib/services/subgraph/index.d.ts +2 -0
- package/lib/services/subgraph/index.js +19 -0
- package/lib/services/subgraph/schema.d.ts +45 -0
- package/lib/services/subgraph/schema.js +75 -0
- package/lib/services/subgraph/vaults.d.ts +25 -0
- package/lib/services/subgraph/vaults.js +1106 -0
- package/lib/services/swap-quotes/index.d.ts +105 -0
- package/lib/services/swap-quotes/index.js +77 -0
- package/lib/services/swap-quotes/paraswap.d.ts +51 -0
- package/lib/services/swap-quotes/paraswap.js +138 -0
- package/lib/types/api.d.ts +280 -0
- package/lib/types/api.js +3 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +28 -0
- package/lib/types/points.d.ts +28 -0
- package/lib/types/points.js +3 -0
- package/lib/types/pools.d.ts +144 -0
- package/lib/types/pools.js +3 -0
- package/lib/types/staking.d.ts +28 -0
- package/lib/types/staking.js +3 -0
- package/lib/types/sub-accounts.d.ts +140 -0
- package/lib/types/sub-accounts.js +3 -0
- package/lib/types/subgraph.d.ts +74 -0
- package/lib/types/subgraph.js +3 -0
- package/lib/types/typed-contract.d.ts +102 -0
- package/lib/types/typed-contract.js +3 -0
- package/lib/types/user.d.ts +1 -0
- package/lib/types/user.js +3 -0
- package/lib/types/vaults.d.ts +714 -0
- package/lib/types/vaults.js +24 -0
- package/lib/types/web3.d.ts +51 -0
- package/lib/types/web3.js +14 -0
- package/lib/types/webserver.d.ts +698 -0
- package/lib/types/webserver.js +3 -0
- package/package.json +78 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error class hierarchy for the SDK. All subclasses extend `AugustSDKError`,
|
|
3
|
+
* which extends the native `Error`.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { AugustAuthError, AugustTimeoutError } from '@augustdigital/sdk';
|
|
7
|
+
*
|
|
8
|
+
* try {
|
|
9
|
+
* await sdk.getVault(...);
|
|
10
|
+
* } catch (err) {
|
|
11
|
+
* if (err instanceof AugustAuthError) refreshKey();
|
|
12
|
+
* else if (err instanceof AugustTimeoutError) retry();
|
|
13
|
+
* else throw err;
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
/** Stable error codes attached to SDK errors. */
|
|
18
|
+
export type AugustErrorCode = 'AUTH_MISSING_KEY' | 'AUTH_INVALID_KEY' | 'AUTH_FORBIDDEN' | 'AUTH_UNAUTHORIZED' | 'INVALID_URL' | 'INVALID_INPUT' | 'INVALID_CHAIN' | 'INVALID_ADDRESS' | 'ACCOUNT_NOT_FUNDED' | 'NETWORK_ERROR' | 'TIMEOUT' | 'RATE_LIMITED' | 'SERVER_ERROR' | 'HISTORY_UNAVAILABLE' | 'UNKNOWN';
|
|
19
|
+
/** Options accepted by every SDK error constructor. */
|
|
20
|
+
export interface AugustErrorOptions {
|
|
21
|
+
/** Original error preserved for stack-trace chaining. */
|
|
22
|
+
cause?: unknown;
|
|
23
|
+
/** Set from the response `x-correlation-id` header when available. */
|
|
24
|
+
correlationId?: string;
|
|
25
|
+
/** Structured context attached to the error for logging. */
|
|
26
|
+
context?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
/** Base class for all SDK errors. */
|
|
29
|
+
export declare class AugustSDKError extends Error {
|
|
30
|
+
readonly code: AugustErrorCode;
|
|
31
|
+
readonly correlationId?: string;
|
|
32
|
+
readonly context?: Record<string, unknown>;
|
|
33
|
+
constructor(code: AugustErrorCode, message: string, options?: AugustErrorOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Serialize own properties to a plain object. Native `Error` enumerates
|
|
36
|
+
* nothing, so `JSON.stringify(err)` returns `"{}"` without this.
|
|
37
|
+
*/
|
|
38
|
+
toJSON(): Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
/** Authentication/authorization failure: missing key, invalid key, forbidden. */
|
|
41
|
+
export declare class AugustAuthError extends AugustSDKError {
|
|
42
|
+
constructor(code: Extract<AugustErrorCode, 'AUTH_MISSING_KEY' | 'AUTH_INVALID_KEY' | 'AUTH_FORBIDDEN' | 'AUTH_UNAUTHORIZED'>, message: string, options?: AugustErrorOptions);
|
|
43
|
+
}
|
|
44
|
+
/** Network-level failure: connection refused, DNS, fetch failed. */
|
|
45
|
+
export declare class AugustNetworkError extends AugustSDKError {
|
|
46
|
+
constructor(message: string, options?: AugustErrorOptions);
|
|
47
|
+
}
|
|
48
|
+
/** Request exceeded its deadline. */
|
|
49
|
+
export declare class AugustTimeoutError extends AugustSDKError {
|
|
50
|
+
/** Time elapsed (ms) before the request was aborted. */
|
|
51
|
+
readonly timeoutMs: number;
|
|
52
|
+
constructor(message: string, timeoutMs: number, options?: AugustErrorOptions);
|
|
53
|
+
toJSON(): Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
/** Caller-side input failed validation. */
|
|
56
|
+
export declare class AugustValidationError extends AugustSDKError {
|
|
57
|
+
constructor(code: Extract<AugustErrorCode, 'INVALID_URL' | 'INVALID_INPUT' | 'INVALID_CHAIN' | 'INVALID_ADDRESS' | 'ACCOUNT_NOT_FUNDED'>, message: string, options?: AugustErrorOptions);
|
|
58
|
+
}
|
|
59
|
+
/** Backend rate-limited the request (HTTP 429 or equivalent). */
|
|
60
|
+
export declare class AugustRateLimitError extends AugustSDKError {
|
|
61
|
+
/** Suggested wait before retrying, in milliseconds. */
|
|
62
|
+
readonly retryAfterMs?: number;
|
|
63
|
+
constructor(message: string, options?: AugustErrorOptions & {
|
|
64
|
+
retryAfterMs?: number;
|
|
65
|
+
});
|
|
66
|
+
toJSON(): Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
/** Backend returned a non-OK status that isn't auth, rate-limit, or timeout. */
|
|
69
|
+
export declare class AugustServerError extends AugustSDKError {
|
|
70
|
+
/** HTTP status code returned by the backend. */
|
|
71
|
+
readonly status: number;
|
|
72
|
+
constructor(status: number, message: string, options?: AugustErrorOptions);
|
|
73
|
+
toJSON(): Record<string, unknown>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Transaction/position history required to compute a value could not be
|
|
77
|
+
* retrieved or was empty, so the computed result would be wrong rather than
|
|
78
|
+
* merely missing.
|
|
79
|
+
*
|
|
80
|
+
* Motivation — the 2026-07-09 lifetime-PnL over-inflation incident. Lifetime
|
|
81
|
+
* PnL is `currentPosition + totalWithdrawn - totalDeposited`. Every
|
|
82
|
+
* history-fetch failure (deleted subgraph, subgraph deployed against the wrong
|
|
83
|
+
* ABI, missing archive backfill, deposits indexed on a different
|
|
84
|
+
* chain/contract) collapses the deposit/withdrawal history to empty. With
|
|
85
|
+
* `deposited = 0` and `withdrawn = 0` but a live on-chain `position > 0`, the
|
|
86
|
+
* formula degenerates to reporting the entire position as profit. Throwing this
|
|
87
|
+
* typed error makes that unrecoverable state fail loudly instead of returning
|
|
88
|
+
* an inflated number that looks plausible.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* try {
|
|
93
|
+
* await sdk.vaults.getVaultUserLifetimePnl({ vault, wallet, options });
|
|
94
|
+
* } catch (err) {
|
|
95
|
+
* if (err instanceof AugustHistoryUnavailableError) {
|
|
96
|
+
* // History backfill is broken — surface "temporarily unavailable",
|
|
97
|
+
* // never a fabricated PnL number.
|
|
98
|
+
* showUnavailable(err.context);
|
|
99
|
+
* } else throw err;
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare class AugustHistoryUnavailableError extends AugustSDKError {
|
|
104
|
+
/**
|
|
105
|
+
* @param message - Human-readable description of the missing history. Callers
|
|
106
|
+
* pass the same `#<method>::<vault>::<wallet>` prefix the surrounding getter
|
|
107
|
+
* uses so log grouping stays consistent.
|
|
108
|
+
* @param options - Standard SDK error options. `context` should carry the
|
|
109
|
+
* `{ vault, wallet }` (or equivalent) identifiers that scope the failure.
|
|
110
|
+
*/
|
|
111
|
+
constructor(message: string, options?: AugustErrorOptions);
|
|
112
|
+
}
|
|
113
|
+
/** Type guard. Works across realms (e.g. Web Worker / VM contexts). */
|
|
114
|
+
export declare function isAugustSDKError(err: unknown): err is AugustSDKError;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error class hierarchy for the SDK. All subclasses extend `AugustSDKError`,
|
|
4
|
+
* which extends the native `Error`.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { AugustAuthError, AugustTimeoutError } from '@augustdigital/sdk';
|
|
8
|
+
*
|
|
9
|
+
* try {
|
|
10
|
+
* await sdk.getVault(...);
|
|
11
|
+
* } catch (err) {
|
|
12
|
+
* if (err instanceof AugustAuthError) refreshKey();
|
|
13
|
+
* else if (err instanceof AugustTimeoutError) retry();
|
|
14
|
+
* else throw err;
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.AugustHistoryUnavailableError = exports.AugustServerError = exports.AugustRateLimitError = exports.AugustValidationError = exports.AugustTimeoutError = exports.AugustNetworkError = exports.AugustAuthError = exports.AugustSDKError = void 0;
|
|
20
|
+
exports.isAugustSDKError = isAugustSDKError;
|
|
21
|
+
/** Base class for all SDK errors. */
|
|
22
|
+
class AugustSDKError extends Error {
|
|
23
|
+
code;
|
|
24
|
+
correlationId;
|
|
25
|
+
context;
|
|
26
|
+
constructor(code, message, options = {}) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.name = 'AugustSDKError';
|
|
29
|
+
this.code = code;
|
|
30
|
+
this.correlationId = options.correlationId;
|
|
31
|
+
this.context = options.context;
|
|
32
|
+
if (options.cause !== undefined) {
|
|
33
|
+
this.cause = options.cause;
|
|
34
|
+
}
|
|
35
|
+
// Restore prototype chain for transpilation targets that downlevel `extends Error`.
|
|
36
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Serialize own properties to a plain object. Native `Error` enumerates
|
|
40
|
+
* nothing, so `JSON.stringify(err)` returns `"{}"` without this.
|
|
41
|
+
*/
|
|
42
|
+
toJSON() {
|
|
43
|
+
const out = {
|
|
44
|
+
name: this.name,
|
|
45
|
+
message: this.message,
|
|
46
|
+
code: this.code,
|
|
47
|
+
};
|
|
48
|
+
if (this.correlationId !== undefined)
|
|
49
|
+
out.correlationId = this.correlationId;
|
|
50
|
+
if (this.context !== undefined)
|
|
51
|
+
out.context = this.context;
|
|
52
|
+
if (this.stack !== undefined)
|
|
53
|
+
out.stack = this.stack;
|
|
54
|
+
const cause = this.cause;
|
|
55
|
+
if (cause !== undefined) {
|
|
56
|
+
out.cause =
|
|
57
|
+
cause instanceof Error
|
|
58
|
+
? { name: cause.name, message: cause.message }
|
|
59
|
+
: cause;
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.AugustSDKError = AugustSDKError;
|
|
65
|
+
/** Authentication/authorization failure: missing key, invalid key, forbidden. */
|
|
66
|
+
class AugustAuthError extends AugustSDKError {
|
|
67
|
+
constructor(code, message, options) {
|
|
68
|
+
super(code, message, options);
|
|
69
|
+
this.name = 'AugustAuthError';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.AugustAuthError = AugustAuthError;
|
|
73
|
+
/** Network-level failure: connection refused, DNS, fetch failed. */
|
|
74
|
+
class AugustNetworkError extends AugustSDKError {
|
|
75
|
+
constructor(message, options) {
|
|
76
|
+
super('NETWORK_ERROR', message, options);
|
|
77
|
+
this.name = 'AugustNetworkError';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.AugustNetworkError = AugustNetworkError;
|
|
81
|
+
/** Request exceeded its deadline. */
|
|
82
|
+
class AugustTimeoutError extends AugustSDKError {
|
|
83
|
+
/** Time elapsed (ms) before the request was aborted. */
|
|
84
|
+
timeoutMs;
|
|
85
|
+
constructor(message, timeoutMs, options) {
|
|
86
|
+
super('TIMEOUT', message, options);
|
|
87
|
+
this.name = 'AugustTimeoutError';
|
|
88
|
+
this.timeoutMs = timeoutMs;
|
|
89
|
+
}
|
|
90
|
+
toJSON() {
|
|
91
|
+
return { ...super.toJSON(), timeoutMs: this.timeoutMs };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.AugustTimeoutError = AugustTimeoutError;
|
|
95
|
+
/** Caller-side input failed validation. */
|
|
96
|
+
class AugustValidationError extends AugustSDKError {
|
|
97
|
+
constructor(code, message, options) {
|
|
98
|
+
super(code, message, options);
|
|
99
|
+
this.name = 'AugustValidationError';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.AugustValidationError = AugustValidationError;
|
|
103
|
+
/** Backend rate-limited the request (HTTP 429 or equivalent). */
|
|
104
|
+
class AugustRateLimitError extends AugustSDKError {
|
|
105
|
+
/** Suggested wait before retrying, in milliseconds. */
|
|
106
|
+
retryAfterMs;
|
|
107
|
+
constructor(message, options) {
|
|
108
|
+
super('RATE_LIMITED', message, options);
|
|
109
|
+
this.name = 'AugustRateLimitError';
|
|
110
|
+
this.retryAfterMs = options?.retryAfterMs;
|
|
111
|
+
}
|
|
112
|
+
toJSON() {
|
|
113
|
+
const base = super.toJSON();
|
|
114
|
+
if (this.retryAfterMs !== undefined)
|
|
115
|
+
base.retryAfterMs = this.retryAfterMs;
|
|
116
|
+
return base;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.AugustRateLimitError = AugustRateLimitError;
|
|
120
|
+
/** Backend returned a non-OK status that isn't auth, rate-limit, or timeout. */
|
|
121
|
+
class AugustServerError extends AugustSDKError {
|
|
122
|
+
/** HTTP status code returned by the backend. */
|
|
123
|
+
status;
|
|
124
|
+
constructor(status, message, options) {
|
|
125
|
+
super('SERVER_ERROR', message, options);
|
|
126
|
+
this.name = 'AugustServerError';
|
|
127
|
+
this.status = status;
|
|
128
|
+
}
|
|
129
|
+
toJSON() {
|
|
130
|
+
return { ...super.toJSON(), status: this.status };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.AugustServerError = AugustServerError;
|
|
134
|
+
/**
|
|
135
|
+
* Transaction/position history required to compute a value could not be
|
|
136
|
+
* retrieved or was empty, so the computed result would be wrong rather than
|
|
137
|
+
* merely missing.
|
|
138
|
+
*
|
|
139
|
+
* Motivation — the 2026-07-09 lifetime-PnL over-inflation incident. Lifetime
|
|
140
|
+
* PnL is `currentPosition + totalWithdrawn - totalDeposited`. Every
|
|
141
|
+
* history-fetch failure (deleted subgraph, subgraph deployed against the wrong
|
|
142
|
+
* ABI, missing archive backfill, deposits indexed on a different
|
|
143
|
+
* chain/contract) collapses the deposit/withdrawal history to empty. With
|
|
144
|
+
* `deposited = 0` and `withdrawn = 0` but a live on-chain `position > 0`, the
|
|
145
|
+
* formula degenerates to reporting the entire position as profit. Throwing this
|
|
146
|
+
* typed error makes that unrecoverable state fail loudly instead of returning
|
|
147
|
+
* an inflated number that looks plausible.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* try {
|
|
152
|
+
* await sdk.vaults.getVaultUserLifetimePnl({ vault, wallet, options });
|
|
153
|
+
* } catch (err) {
|
|
154
|
+
* if (err instanceof AugustHistoryUnavailableError) {
|
|
155
|
+
* // History backfill is broken — surface "temporarily unavailable",
|
|
156
|
+
* // never a fabricated PnL number.
|
|
157
|
+
* showUnavailable(err.context);
|
|
158
|
+
* } else throw err;
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
class AugustHistoryUnavailableError extends AugustSDKError {
|
|
163
|
+
/**
|
|
164
|
+
* @param message - Human-readable description of the missing history. Callers
|
|
165
|
+
* pass the same `#<method>::<vault>::<wallet>` prefix the surrounding getter
|
|
166
|
+
* uses so log grouping stays consistent.
|
|
167
|
+
* @param options - Standard SDK error options. `context` should carry the
|
|
168
|
+
* `{ vault, wallet }` (or equivalent) identifiers that scope the failure.
|
|
169
|
+
*/
|
|
170
|
+
constructor(message, options) {
|
|
171
|
+
super('HISTORY_UNAVAILABLE', message, options);
|
|
172
|
+
this.name = 'AugustHistoryUnavailableError';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.AugustHistoryUnavailableError = AugustHistoryUnavailableError;
|
|
176
|
+
/** Type guard. Works across realms (e.g. Web Worker / VM contexts). */
|
|
177
|
+
function isAugustSDKError(err) {
|
|
178
|
+
return (err instanceof AugustSDKError ||
|
|
179
|
+
(err instanceof Error &&
|
|
180
|
+
typeof err.code === 'string' &&
|
|
181
|
+
err.name.startsWith('August')));
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { IAddress, IContractRunner, IHistoricalTimeseriesResponse, ITokenizedVault, IWSMonitorHeaders, IWSVaultLoan, VaultAddress } from '../types';
|
|
2
|
+
import { WEBSERVER_URL } from './constants/core';
|
|
3
|
+
/**
|
|
4
|
+
* API Fetching and Data Utilities
|
|
5
|
+
*
|
|
6
|
+
* Core fetching functions for August backend services:
|
|
7
|
+
* - Authentication: fetchAugustWithKey, fetchAugustWithBearer, fetchAugustPublic
|
|
8
|
+
* - Retry Logic: withRetry, isRetryableError, promiseSettle
|
|
9
|
+
* - Vault Data: fetchTokenizedVaults, fetchTokenizedVaultLoans
|
|
10
|
+
* - Pricing: fetchTokenPrice (with CoinGecko fallback)
|
|
11
|
+
* - Caching: LRU cache for API responses
|
|
12
|
+
*/
|
|
13
|
+
export type IFetchAugustMethods = 'get' | 'post' | 'put';
|
|
14
|
+
export type IFetchAugustOptions = {
|
|
15
|
+
method?: IFetchAugustMethods;
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
data?: unknown;
|
|
18
|
+
server?: keyof typeof WEBSERVER_URL;
|
|
19
|
+
/** Caller-supplied AbortSignal; combined with the default timeout. */
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
/** Per-request timeout in ms. Defaults to `REQUEST_TIMEOUT_MS`. */
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Bypasses the API-key check for legacy unauthenticated endpoints.
|
|
25
|
+
* Will be removed in a future major version; pass a valid `apiKey` instead.
|
|
26
|
+
*/
|
|
27
|
+
override?: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Override the default request timeout used by every August fetcher helper
|
|
31
|
+
* when the caller doesn't supply a per-call `timeoutMs`. Pass `null` (or
|
|
32
|
+
* call with no arguments) to clear the override and fall back to the
|
|
33
|
+
* compiled-in `REQUEST_TIMEOUT_MS`.
|
|
34
|
+
*
|
|
35
|
+
* @param ms - Positive number of milliseconds to wait before aborting, or
|
|
36
|
+
* `null` to clear.
|
|
37
|
+
*/
|
|
38
|
+
export declare function setSdkRequestTimeout(ms?: number | null): void;
|
|
39
|
+
/**
|
|
40
|
+
* Read the active default request timeout — the SDK-level override if set,
|
|
41
|
+
* otherwise the compiled-in `REQUEST_TIMEOUT_MS`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getSdkRequestTimeout(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Override the base URL used for `WEBSERVER_URL.public` requests — the
|
|
46
|
+
* unauthenticated vault-catalog API that `getVault` / `fetchTokenizedVault`
|
|
47
|
+
* (and the other `fetchAugustPublic` callers) read from. Defaults to the
|
|
48
|
+
* compiled-in prod base (`https://api.augustdigital.io/api/v1`); pass `null`
|
|
49
|
+
* (or call with no arguments) to clear.
|
|
50
|
+
*
|
|
51
|
+
* Intended for non-prod deployments that run against an ISOLATED backend
|
|
52
|
+
* (e.g. a staging API): set it once at construction via
|
|
53
|
+
* `IAugustBase.publicApiBaseUrl` so a staging-only vault resolves. Production
|
|
54
|
+
* leaves it unset, so behaviour is unchanged.
|
|
55
|
+
*
|
|
56
|
+
* This is a process-global override on the fetcher helpers. The SDK constructor
|
|
57
|
+
* calls it on EVERY instantiation (with `null` when `publicApiBaseUrl` is
|
|
58
|
+
* omitted), so the last `AugustSDK` instantiated is authoritative — a prod
|
|
59
|
+
* instance resets it to the default even after a prior staging instance set it.
|
|
60
|
+
* An invalid or non-http(s) URL is treated as "no override": it RESETS to the
|
|
61
|
+
* compiled-in default (warned) rather than retaining a prior value, so a bad env
|
|
62
|
+
* value can neither break fetches nor silently leave a previous instance's base
|
|
63
|
+
* in place.
|
|
64
|
+
*
|
|
65
|
+
* Whenever the effective base CHANGES, the shared public-response cache is
|
|
66
|
+
* cleared, so catalog data fetched from the previous backend is never served for
|
|
67
|
+
* the new one (e.g. a prod-cached vault leaking into a staging instance). Base
|
|
68
|
+
* changes happen at construction, when the cache is cold, so this is ~free.
|
|
69
|
+
*
|
|
70
|
+
* @param url - Absolute http(s) base URL (trailing slash is trimmed). `null`, or
|
|
71
|
+
* an invalid / non-http(s) value, resets to the compiled-in public base.
|
|
72
|
+
*/
|
|
73
|
+
export declare function setPublicApiBaseUrl(url?: string | null): void;
|
|
74
|
+
/**
|
|
75
|
+
* Read the active base for the `public` server — the SDK-level override if set,
|
|
76
|
+
* otherwise the compiled-in `WEBSERVER_URL.public`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getPublicApiBaseUrl(): string;
|
|
79
|
+
import { CACHE, getSafeCache, setSafeCache } from './cache';
|
|
80
|
+
export { CACHE, getSafeCache, setSafeCache };
|
|
81
|
+
/**
|
|
82
|
+
* Make authenticated requests to August backend services using API key.
|
|
83
|
+
* Automatically logs errors with correlation IDs for debugging.
|
|
84
|
+
* @param apiKey - August API key for authentication
|
|
85
|
+
* @param relativeUrl - Endpoint path relative to base URL
|
|
86
|
+
* @param options - Request configuration including method and headers
|
|
87
|
+
* @returns Response object if successful
|
|
88
|
+
* @throws Error with correlation ID if request fails
|
|
89
|
+
*/
|
|
90
|
+
export declare function fetchAugustWithKey(apiKey: string, relativeUrl: string, options?: IFetchAugustOptions): Promise<Response>;
|
|
91
|
+
/**
|
|
92
|
+
* Make unauthenticated requests to August public API endpoints.
|
|
93
|
+
* Used for fetching vault metadata and public market data.
|
|
94
|
+
* @param relativeUrl - Endpoint path relative to public API base URL
|
|
95
|
+
* @param options - Request configuration including method and headers
|
|
96
|
+
* @returns Response object if successful
|
|
97
|
+
* @throws Error with correlation ID if request fails
|
|
98
|
+
*/
|
|
99
|
+
export declare function fetchAugustPublic(relativeUrl: string, options?: IFetchAugustOptions): Promise<Response>;
|
|
100
|
+
/**
|
|
101
|
+
* Make authenticated requests using Bearer token authentication.
|
|
102
|
+
* Typically used for user-specific operations requiring OAuth tokens.
|
|
103
|
+
* @param bearerToken - OAuth bearer token
|
|
104
|
+
* @param relativeUrl - Endpoint path relative to base URL
|
|
105
|
+
* @param options - Request configuration including method and headers
|
|
106
|
+
* @returns Response object if successful
|
|
107
|
+
* @throws Error with correlation ID if request fails
|
|
108
|
+
*/
|
|
109
|
+
export declare function fetchAugustWithBearer(bearerToken: string, relativeUrl: string, options?: IFetchAugustOptions): Promise<Response>;
|
|
110
|
+
/**
|
|
111
|
+
* Check if an error is network-related and suitable for retry.
|
|
112
|
+
* Identifies timeouts, connection resets, and fetch failures.
|
|
113
|
+
*/
|
|
114
|
+
export declare function isRetryableError(error: Error): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Wrap async operations with exponential backoff retry logic.
|
|
117
|
+
* Retries on network errors with increasing delays between attempts.
|
|
118
|
+
* @param fn - Async function to execute with retry logic
|
|
119
|
+
* @param maxRetries - Maximum number of retry attempts
|
|
120
|
+
* @param baseDelay - Initial delay in milliseconds (doubles each retry)
|
|
121
|
+
* @param shouldRetry - Custom function to determine if error is retryable
|
|
122
|
+
* @returns Result of successful function execution
|
|
123
|
+
* @throws Last error if all retries exhausted
|
|
124
|
+
*/
|
|
125
|
+
export declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number, shouldRetry?: (error: Error) => boolean): Promise<T>;
|
|
126
|
+
/**
|
|
127
|
+
* Fetch tokenized vault configurations from backend API.
|
|
128
|
+
* Results are cached to reduce API calls. Optionally filter by specific vault address.
|
|
129
|
+
* @param pool - Optional vault address to filter results
|
|
130
|
+
* @param headers - Monitoring headers for request tracking
|
|
131
|
+
* @returns Array of tokenized vault configurations
|
|
132
|
+
*/
|
|
133
|
+
export declare function fetchTokenizedVault(pool: VaultAddress, headers?: IWSMonitorHeaders, loadSubaccounts?: boolean, loadSnapshots?: boolean): Promise<ITokenizedVault[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Fetch tokenized vault configurations from backend API.
|
|
136
|
+
* Results are cached to reduce API calls. Optionally filter by specific vault address.
|
|
137
|
+
* @param pool - Optional vault address to filter results
|
|
138
|
+
* @param headers - Monitoring headers for request tracking
|
|
139
|
+
* @param loadSubaccounts - Optional flag to load subaccounts and EOA operators (defaults to true on API)
|
|
140
|
+
* @returns Array of tokenized vault configurations
|
|
141
|
+
*/
|
|
142
|
+
export declare function fetchTokenizedVaults(pool?: IAddress, headers?: IWSMonitorHeaders, loadSubaccounts?: boolean, loadSnapshots?: boolean): Promise<ITokenizedVault[]>;
|
|
143
|
+
/**
|
|
144
|
+
* Fetch current USD price for a token symbol or vault LP token.
|
|
145
|
+
* For vault LP tokens, calculates share price using totalAssets/totalSupply ratio.
|
|
146
|
+
* Falls back to CoinGecko if primary source fails.
|
|
147
|
+
* @param symbol - Token symbol or contract address
|
|
148
|
+
* @param provider - Optional web3 provider for on-chain price calculations
|
|
149
|
+
* @param coinGeckoKey - Optional CoinGecko API key for fallback pricing
|
|
150
|
+
* @param headers - Monitoring headers for request tracking
|
|
151
|
+
* @returns Token price in USD
|
|
152
|
+
*/
|
|
153
|
+
export declare function fetchTokenPrice(symbol: string, provider?: IContractRunner, coinGeckoKey?: string, headers?: IWSMonitorHeaders): Promise<number>;
|
|
154
|
+
/**
|
|
155
|
+
* Fetch token price by contract address and chain ID from August price server.
|
|
156
|
+
* @param address - Token contract address
|
|
157
|
+
* @param chainId - Network chain ID
|
|
158
|
+
* @param headers - Optional monitoring headers for request tracking
|
|
159
|
+
* @returns Token price in USD, or 0 if not found
|
|
160
|
+
*/
|
|
161
|
+
export declare function fetchTokenPriceByAddress(address: VaultAddress, chainId: number, headers?: IWSMonitorHeaders): Promise<number>;
|
|
162
|
+
/**
|
|
163
|
+
* Fetch active loans for a specific vault from backend API.
|
|
164
|
+
* Results are cached per vault and chain to reduce API calls.
|
|
165
|
+
* @param pool - Vault address
|
|
166
|
+
* @param chainId - Network chain ID
|
|
167
|
+
* @param headers - Monitoring headers for request tracking
|
|
168
|
+
* @returns Array of active loan objects
|
|
169
|
+
*/
|
|
170
|
+
export declare function fetchTokenizedVaultLoans(pool: VaultAddress, chainId: number, headers?: IWSMonitorHeaders): Promise<IWSVaultLoan[]>;
|
|
171
|
+
/**
|
|
172
|
+
* Fetch subaccount loans for a specific tokenized vault (lending pool).
|
|
173
|
+
* Retrieves all active subaccount loan data from the backend.
|
|
174
|
+
* @param pool - Vault address
|
|
175
|
+
* @param chainId - Network chain ID
|
|
176
|
+
* @param headers - Monitoring headers for request tracking
|
|
177
|
+
* @returns Array of active subaccount loan objects
|
|
178
|
+
*/
|
|
179
|
+
export declare function fetchTokenizedVaultSubaccountLoans(pool: VaultAddress, chainId: number, headers?: IWSMonitorHeaders): Promise<IWSVaultLoan[]>;
|
|
180
|
+
/**
|
|
181
|
+
* Fetch historical timeseries data for a specific vault.
|
|
182
|
+
* Returns TVL, APY, PnL, and share price data over time.
|
|
183
|
+
* @param vaultAddress - Vault contract address
|
|
184
|
+
* @param nDays - Number of days of historical data to fetch (default 30, min 1)
|
|
185
|
+
* @param headers - Monitoring headers for request tracking
|
|
186
|
+
* @returns Historical timeseries data with date keys
|
|
187
|
+
*/
|
|
188
|
+
export declare function fetchVaultHistoricalTimeseries(vaultAddress: IAddress, nDays?: number, headers?: IWSMonitorHeaders): Promise<IHistoricalTimeseriesResponse>;
|
|
189
|
+
/**
|
|
190
|
+
* Execute multiple promises with retry logic and allow partial failures.
|
|
191
|
+
* Unlike Promise.all, continues execution if some promises fail.
|
|
192
|
+
* Failed promises return null to maintain array index alignment.
|
|
193
|
+
* @param promises - Array of promises to execute
|
|
194
|
+
* @param maxRetries - Maximum retry attempts per promise
|
|
195
|
+
* @param baseDelay - Initial delay for exponential backoff
|
|
196
|
+
* @returns Array of results with null for failed promises
|
|
197
|
+
*/
|
|
198
|
+
export declare function promiseSettle<T>(promises: Promise<T>[], maxRetries?: number, baseDelay?: number): Promise<T[]>;
|