@augustdigital/sdk 8.3.2 → 8.6.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/README.md +207 -117
- package/lib/abis/ERC20_Bytes32.d.ts +4 -0
- package/lib/abis/ERC20_Bytes32.js +4 -0
- package/lib/abis/ERC4626.d.ts +1 -0
- package/lib/abis/ERC4626.js +1 -0
- package/lib/abis/ERC721.d.ts +1 -0
- package/lib/abis/ERC721.js +1 -0
- package/lib/abis/FeeOracle.js +1 -0
- package/lib/abis/LendingPool.js +1 -0
- package/lib/abis/LendingPoolV2.js +1 -0
- package/lib/abis/Multicall3.js +3 -0
- package/lib/abis/OFT.d.ts +20 -0
- package/lib/abis/OFT.js +20 -0
- package/lib/abis/SmartAccount.d.ts +1 -0
- package/lib/abis/SmartAccount.js +3 -0
- package/lib/abis/SwapRouter.d.ts +1 -0
- package/lib/abis/SwapRouter.js +1 -0
- package/lib/abis/UniversalSignatureValidator.js +3 -0
- package/lib/abis/index.d.ts +5 -0
- package/lib/abis/index.js +5 -0
- package/lib/adapters/evm/getters.d.ts +17 -2
- package/lib/adapters/evm/getters.js +35 -3
- package/lib/adapters/evm/index.d.ts +266 -4
- package/lib/adapters/evm/index.js +270 -1
- package/lib/adapters/evm/utils.d.ts +6 -0
- package/lib/adapters/evm/utils.js +7 -0
- package/lib/adapters/solana/constants.d.ts +1 -1
- package/lib/adapters/solana/constants.js +4 -1
- package/lib/adapters/solana/getters.d.ts +9 -1
- package/lib/adapters/solana/getters.js +21 -0
- package/lib/adapters/solana/idl/vault-idl.js +9 -0
- package/lib/adapters/solana/index.d.ts +59 -4
- package/lib/adapters/solana/index.js +61 -0
- package/lib/adapters/solana/types.d.ts +1 -1
- package/lib/adapters/solana/utils.d.ts +31 -3
- package/lib/adapters/solana/utils.js +79 -4
- package/lib/adapters/solana/vault.actions.d.ts +23 -4
- package/lib/adapters/solana/vault.actions.js +47 -3
- package/lib/adapters/stellar/actions.d.ts +26 -1
- package/lib/adapters/stellar/actions.js +33 -0
- package/lib/adapters/stellar/constants.d.ts +26 -0
- package/lib/adapters/stellar/constants.js +29 -0
- package/lib/adapters/stellar/getters.d.ts +56 -0
- package/lib/adapters/stellar/getters.js +81 -0
- package/lib/adapters/stellar/index.d.ts +70 -0
- package/lib/adapters/stellar/index.js +71 -0
- package/lib/adapters/stellar/soroban.d.ts +21 -1
- package/lib/adapters/stellar/soroban.js +47 -1
- package/lib/adapters/stellar/submit.d.ts +29 -0
- package/lib/adapters/stellar/submit.js +90 -5
- package/lib/adapters/stellar/types.d.ts +27 -0
- package/lib/adapters/stellar/types.js +3 -0
- package/lib/adapters/stellar/utils.d.ts +10 -0
- package/lib/adapters/stellar/utils.js +10 -0
- package/lib/adapters/sui/getters.d.ts +7 -1
- package/lib/adapters/sui/getters.js +6 -0
- package/lib/adapters/sui/index.d.ts +16 -1
- package/lib/adapters/sui/index.js +17 -0
- package/lib/adapters/sui/transformer.d.ts +8 -2
- package/lib/adapters/sui/transformer.js +7 -0
- package/lib/adapters/sui/types.d.ts +1 -1
- package/lib/adapters/sui/utils.d.ts +6 -0
- package/lib/adapters/sui/utils.js +6 -0
- package/lib/core/analytics/chain-name.d.ts +8 -0
- package/lib/core/analytics/chain-name.js +8 -0
- package/lib/core/analytics/constants.d.ts +4 -0
- package/lib/core/analytics/constants.js +4 -0
- package/lib/core/analytics/env.d.ts +25 -0
- package/lib/core/analytics/env.js +26 -0
- package/lib/core/analytics/index.d.ts +26 -0
- package/lib/core/analytics/index.js +35 -0
- package/lib/core/analytics/instrumentation.d.ts +26 -0
- package/lib/core/analytics/instrumentation.js +66 -2
- package/lib/core/analytics/method-taxonomy.d.ts +16 -0
- package/lib/core/analytics/method-taxonomy.js +18 -0
- package/lib/core/analytics/metrics.d.ts +23 -0
- package/lib/core/analytics/metrics.js +40 -0
- package/lib/core/analytics/sanitize.d.ts +38 -0
- package/lib/core/analytics/sanitize.js +46 -0
- package/lib/core/analytics/sentry-runtime.d.ts +11 -0
- package/lib/core/analytics/sentry-runtime.js +20 -1
- package/lib/core/analytics/sentry.d.ts +47 -2
- package/lib/core/analytics/sentry.js +115 -2
- package/lib/core/analytics/types.d.ts +28 -1
- package/lib/core/analytics/user-identity.d.ts +36 -2
- package/lib/core/analytics/user-identity.js +43 -1
- package/lib/core/analytics/version.d.ts +6 -1
- package/lib/core/analytics/version.js +6 -1
- package/lib/core/auth/verify.js +5 -0
- package/lib/core/base.class.d.ts +78 -3
- package/lib/core/base.class.js +66 -4
- package/lib/core/cache.d.ts +5 -0
- package/lib/core/cache.js +6 -0
- package/lib/core/constants/adapters.d.ts +16 -1
- package/lib/core/constants/adapters.js +28 -8
- package/lib/core/constants/core.d.ts +14 -1
- package/lib/core/constants/core.js +18 -0
- package/lib/core/constants/swap-router.d.ts +83 -1
- package/lib/core/constants/swap-router.js +91 -1
- package/lib/core/constants/vaults.d.ts +57 -1
- package/lib/core/constants/vaults.js +66 -1
- package/lib/core/constants/web3.d.ts +4 -1
- package/lib/core/constants/web3.js +15 -5
- package/lib/core/errors/index.d.ts +38 -2
- package/lib/core/errors/index.js +38 -0
- package/lib/core/fetcher.d.ts +136 -2
- package/lib/core/fetcher.js +229 -25
- package/lib/core/helpers/adapters.d.ts +10 -1
- package/lib/core/helpers/adapters.js +11 -0
- package/lib/core/helpers/chain-address.d.ts +10 -0
- package/lib/core/helpers/chain-address.js +11 -0
- package/lib/core/helpers/core.d.ts +49 -4
- package/lib/core/helpers/core.js +74 -7
- package/lib/core/helpers/explorer-link.d.ts +15 -1
- package/lib/core/helpers/explorer-link.js +14 -0
- package/lib/core/helpers/signer.d.ts +27 -1
- package/lib/core/helpers/signer.js +39 -0
- package/lib/core/helpers/swap-router.d.ts +33 -1
- package/lib/core/helpers/swap-router.js +32 -0
- package/lib/core/helpers/vault-version.d.ts +2 -1
- package/lib/core/helpers/vault-version.js +2 -0
- package/lib/core/helpers/vaults.d.ts +9 -1
- package/lib/core/helpers/vaults.js +22 -8
- package/lib/core/helpers/web3.d.ts +154 -2
- package/lib/core/helpers/web3.js +192 -15
- package/lib/core/logger/index.d.ts +55 -0
- package/lib/core/logger/index.js +19 -0
- package/lib/core/logger/slack.d.ts +3 -0
- package/lib/core/logger/slack.js +3 -0
- package/lib/core/vault-metadata.d.ts +7 -1
- package/lib/core/vault-metadata.js +6 -0
- package/lib/core/version-check.d.ts +52 -0
- package/lib/core/version-check.js +82 -1
- package/lib/evm/methods/crossChainVault.d.ts +90 -0
- package/lib/evm/methods/crossChainVault.js +187 -2
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +1 -0
- package/lib/evm/methods/index.js +1 -0
- package/lib/evm/types/crossChain.d.ts +202 -0
- package/lib/evm/types/crossChain.js +12 -1
- package/lib/index.d.ts +16 -0
- package/lib/index.js +19 -0
- package/lib/main.d.ts +289 -6
- package/lib/main.js +312 -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 +52 -0
- package/lib/modules/api/main.js +130 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +17 -2
- package/lib/modules/sub-accounts/fetcher.js +15 -0
- package/lib/modules/sub-accounts/main.d.ts +35 -2
- package/lib/modules/sub-accounts/main.js +39 -1
- package/lib/modules/sub-accounts/utils.d.ts +4 -1
- package/lib/modules/sub-accounts/utils.js +3 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +21 -3
- package/lib/modules/vaults/adapter.helpers.js +34 -0
- package/lib/modules/vaults/fetcher.d.ts +45 -0
- package/lib/modules/vaults/fetcher.js +91 -4
- package/lib/modules/vaults/getters.d.ts +295 -0
- package/lib/modules/vaults/getters.js +567 -26
- package/lib/modules/vaults/index.d.ts +12 -0
- package/lib/modules/vaults/index.js +12 -0
- package/lib/modules/vaults/main.d.ts +292 -4
- package/lib/modules/vaults/main.js +382 -8
- package/lib/modules/vaults/read.actions.d.ts +170 -2
- package/lib/modules/vaults/read.actions.js +143 -0
- package/lib/modules/vaults/types.d.ts +34 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +48 -1
- package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
- package/lib/modules/vaults/utils/date-utils.js +47 -1
- package/lib/modules/vaults/utils.d.ts +85 -0
- package/lib/modules/vaults/utils.js +139 -7
- package/lib/modules/vaults/write.actions.d.ts +363 -3
- package/lib/modules/vaults/write.actions.js +399 -3
- package/lib/polyfills.js +4 -2
- package/lib/sdk.d.ts +23847 -0
- package/lib/services/coingecko/fetcher.d.ts +15 -1
- package/lib/services/coingecko/fetcher.js +30 -9
- package/lib/services/debank/fetcher.d.ts +15 -1
- package/lib/services/debank/fetcher.js +12 -0
- package/lib/services/debank/utils.d.ts +1 -1
- package/lib/services/debank/utils.js +18 -1
- package/lib/services/layerzero/deposits.d.ts +12 -1
- package/lib/services/layerzero/deposits.js +34 -11
- package/lib/services/layerzero/redeems.d.ts +11 -1
- package/lib/services/layerzero/redeems.js +13 -0
- package/lib/services/layerzero/utils.d.ts +8 -0
- package/lib/services/layerzero/utils.js +11 -0
- package/lib/services/octavfi/fetcher.d.ts +8 -1
- package/lib/services/octavfi/fetcher.js +25 -0
- package/lib/services/octavfi/types.d.ts +1 -1
- package/lib/services/octavfi/utils.d.ts +14 -2
- package/lib/services/octavfi/utils.js +44 -10
- package/lib/services/subgraph/fetcher.js +4 -2
- package/lib/services/subgraph/vaults.d.ts +12 -0
- package/lib/services/subgraph/vaults.js +119 -2
- package/lib/services/swap-quotes/index.d.ts +80 -0
- package/lib/services/swap-quotes/index.js +27 -1
- package/lib/services/swap-quotes/paraswap.d.ts +25 -0
- package/lib/services/swap-quotes/paraswap.js +22 -0
- package/lib/types/pools.d.ts +5 -2
- package/lib/types/staking.d.ts +1 -1
- package/lib/types/sub-accounts.d.ts +1 -1
- package/lib/types/subgraph.d.ts +10 -1
- package/lib/types/typed-contract.d.ts +64 -0
- package/lib/types/vaults.d.ts +163 -2
- package/lib/types/vaults.js +10 -0
- package/lib/types/web3.d.ts +9 -1
- package/lib/types/web3.js +1 -0
- package/lib/types/webserver.d.ts +47 -2
- package/package.json +6 -5
package/lib/core/fetcher.d.ts
CHANGED
|
@@ -1,29 +1,163 @@
|
|
|
1
1
|
import type { IAddress, IContractRunner, IHistoricalTimeseriesResponse, ITokenizedVault, IWSMonitorHeaders, IWSVaultLoan, VaultAddress } from '../types';
|
|
2
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
|
+
*/
|
|
3
13
|
export type IFetchAugustMethods = 'get' | 'post' | 'put';
|
|
4
14
|
export type IFetchAugustOptions = {
|
|
5
15
|
method?: IFetchAugustMethods;
|
|
6
16
|
headers?: Record<string, string>;
|
|
7
|
-
data?:
|
|
17
|
+
data?: unknown;
|
|
8
18
|
server?: keyof typeof WEBSERVER_URL;
|
|
19
|
+
/** Caller-supplied AbortSignal; combined with the default timeout. */
|
|
9
20
|
signal?: AbortSignal;
|
|
21
|
+
/** Per-request timeout in ms. Defaults to `REQUEST_TIMEOUT_MS`. */
|
|
10
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
|
+
*/
|
|
11
27
|
override?: boolean;
|
|
12
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
|
+
*/
|
|
13
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
|
+
*/
|
|
14
43
|
export declare function getSdkRequestTimeout(): number;
|
|
15
44
|
import { CACHE, getSafeCache, setSafeCache } from './cache';
|
|
16
45
|
export { CACHE, getSafeCache, setSafeCache };
|
|
46
|
+
/**
|
|
47
|
+
* Make authenticated requests to August backend services using API key.
|
|
48
|
+
* Automatically logs errors with correlation IDs for debugging.
|
|
49
|
+
* @param apiKey - August API key for authentication
|
|
50
|
+
* @param relativeUrl - Endpoint path relative to base URL
|
|
51
|
+
* @param options - Request configuration including method and headers
|
|
52
|
+
* @returns Response object if successful
|
|
53
|
+
* @throws Error with correlation ID if request fails
|
|
54
|
+
*/
|
|
17
55
|
export declare function fetchAugustWithKey(apiKey: string, relativeUrl: string, options?: IFetchAugustOptions): Promise<Response>;
|
|
56
|
+
/**
|
|
57
|
+
* Make unauthenticated requests to August public API endpoints.
|
|
58
|
+
* Used for fetching vault metadata and public market data.
|
|
59
|
+
* @param relativeUrl - Endpoint path relative to public API base URL
|
|
60
|
+
* @param options - Request configuration including method and headers
|
|
61
|
+
* @returns Response object if successful
|
|
62
|
+
* @throws Error with correlation ID if request fails
|
|
63
|
+
*/
|
|
18
64
|
export declare function fetchAugustPublic(relativeUrl: string, options?: IFetchAugustOptions): Promise<Response>;
|
|
65
|
+
/**
|
|
66
|
+
* Make authenticated requests using Bearer token authentication.
|
|
67
|
+
* Typically used for user-specific operations requiring OAuth tokens.
|
|
68
|
+
* @param bearerToken - OAuth bearer token
|
|
69
|
+
* @param relativeUrl - Endpoint path relative to base URL
|
|
70
|
+
* @param options - Request configuration including method and headers
|
|
71
|
+
* @returns Response object if successful
|
|
72
|
+
* @throws Error with correlation ID if request fails
|
|
73
|
+
*/
|
|
19
74
|
export declare function fetchAugustWithBearer(bearerToken: string, relativeUrl: string, options?: IFetchAugustOptions): Promise<Response>;
|
|
75
|
+
/**
|
|
76
|
+
* Check if an error is network-related and suitable for retry.
|
|
77
|
+
* Identifies timeouts, connection resets, and fetch failures.
|
|
78
|
+
*/
|
|
20
79
|
export declare function isRetryableError(error: Error): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Wrap async operations with exponential backoff retry logic.
|
|
82
|
+
* Retries on network errors with increasing delays between attempts.
|
|
83
|
+
* @param fn - Async function to execute with retry logic
|
|
84
|
+
* @param maxRetries - Maximum number of retry attempts
|
|
85
|
+
* @param baseDelay - Initial delay in milliseconds (doubles each retry)
|
|
86
|
+
* @param shouldRetry - Custom function to determine if error is retryable
|
|
87
|
+
* @returns Result of successful function execution
|
|
88
|
+
* @throws Last error if all retries exhausted
|
|
89
|
+
*/
|
|
21
90
|
export declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number, shouldRetry?: (error: Error) => boolean): Promise<T>;
|
|
91
|
+
/**
|
|
92
|
+
* Fetch tokenized vault configurations from backend API.
|
|
93
|
+
* Results are cached to reduce API calls. Optionally filter by specific vault address.
|
|
94
|
+
* @param pool - Optional vault address to filter results
|
|
95
|
+
* @param headers - Monitoring headers for request tracking
|
|
96
|
+
* @returns Array of tokenized vault configurations
|
|
97
|
+
*/
|
|
22
98
|
export declare function fetchTokenizedVault(pool: VaultAddress, headers?: IWSMonitorHeaders, loadSubaccounts?: boolean, loadSnapshots?: boolean): Promise<ITokenizedVault[]>;
|
|
99
|
+
/**
|
|
100
|
+
* Fetch tokenized vault configurations from backend API.
|
|
101
|
+
* Results are cached to reduce API calls. Optionally filter by specific vault address.
|
|
102
|
+
* @param pool - Optional vault address to filter results
|
|
103
|
+
* @param headers - Monitoring headers for request tracking
|
|
104
|
+
* @param loadSubaccounts - Optional flag to load subaccounts and EOA operators (defaults to true on API)
|
|
105
|
+
* @returns Array of tokenized vault configurations
|
|
106
|
+
*/
|
|
23
107
|
export declare function fetchTokenizedVaults(pool?: IAddress, headers?: IWSMonitorHeaders, loadSubaccounts?: boolean, loadSnapshots?: boolean): Promise<ITokenizedVault[]>;
|
|
24
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Fetch current USD price for a token symbol or vault LP token.
|
|
110
|
+
* For vault LP tokens, calculates share price using totalAssets/totalSupply ratio.
|
|
111
|
+
* Falls back to CoinGecko if primary source fails.
|
|
112
|
+
* @param symbol - Token symbol or contract address
|
|
113
|
+
* @param provider - Optional web3 provider for on-chain price calculations
|
|
114
|
+
* @param coinGeckoKey - Optional CoinGecko API key for fallback pricing
|
|
115
|
+
* @param headers - Monitoring headers for request tracking
|
|
116
|
+
* @returns Token price in USD
|
|
117
|
+
*/
|
|
118
|
+
export declare function fetchTokenPrice(symbol: string, provider?: IContractRunner, coinGeckoKey?: string, headers?: IWSMonitorHeaders): Promise<number>;
|
|
119
|
+
/**
|
|
120
|
+
* Fetch token price by contract address and chain ID from August price server.
|
|
121
|
+
* @param address - Token contract address
|
|
122
|
+
* @param chainId - Network chain ID
|
|
123
|
+
* @param headers - Optional monitoring headers for request tracking
|
|
124
|
+
* @returns Token price in USD, or 0 if not found
|
|
125
|
+
*/
|
|
25
126
|
export declare function fetchTokenPriceByAddress(address: VaultAddress, chainId: number, headers?: IWSMonitorHeaders): Promise<number>;
|
|
127
|
+
/**
|
|
128
|
+
* Fetch active loans for a specific vault from backend API.
|
|
129
|
+
* Results are cached per vault and chain to reduce API calls.
|
|
130
|
+
* @param pool - Vault address
|
|
131
|
+
* @param chainId - Network chain ID
|
|
132
|
+
* @param headers - Monitoring headers for request tracking
|
|
133
|
+
* @returns Array of active loan objects
|
|
134
|
+
*/
|
|
26
135
|
export declare function fetchTokenizedVaultLoans(pool: VaultAddress, chainId: number, headers?: IWSMonitorHeaders): Promise<IWSVaultLoan[]>;
|
|
136
|
+
/**
|
|
137
|
+
* Fetch subaccount loans for a specific tokenized vault (lending pool).
|
|
138
|
+
* Retrieves all active subaccount loan data from the backend.
|
|
139
|
+
* @param pool - Vault address
|
|
140
|
+
* @param chainId - Network chain ID
|
|
141
|
+
* @param headers - Monitoring headers for request tracking
|
|
142
|
+
* @returns Array of active subaccount loan objects
|
|
143
|
+
*/
|
|
27
144
|
export declare function fetchTokenizedVaultSubaccountLoans(pool: VaultAddress, chainId: number, headers?: IWSMonitorHeaders): Promise<IWSVaultLoan[]>;
|
|
145
|
+
/**
|
|
146
|
+
* Fetch historical timeseries data for a specific vault.
|
|
147
|
+
* Returns TVL, APY, PnL, and share price data over time.
|
|
148
|
+
* @param vaultAddress - Vault contract address
|
|
149
|
+
* @param nDays - Number of days of historical data to fetch (default 30, min 1)
|
|
150
|
+
* @param headers - Monitoring headers for request tracking
|
|
151
|
+
* @returns Historical timeseries data with date keys
|
|
152
|
+
*/
|
|
28
153
|
export declare function fetchVaultHistoricalTimeseries(vaultAddress: IAddress, nDays?: number, headers?: IWSMonitorHeaders): Promise<IHistoricalTimeseriesResponse>;
|
|
154
|
+
/**
|
|
155
|
+
* Execute multiple promises with retry logic and allow partial failures.
|
|
156
|
+
* Unlike Promise.all, continues execution if some promises fail.
|
|
157
|
+
* Failed promises return null to maintain array index alignment.
|
|
158
|
+
* @param promises - Array of promises to execute
|
|
159
|
+
* @param maxRetries - Maximum retry attempts per promise
|
|
160
|
+
* @param baseDelay - Initial delay for exponential backoff
|
|
161
|
+
* @returns Array of results with null for failed promises
|
|
162
|
+
*/
|
|
29
163
|
export declare function promiseSettle<T>(promises: Promise<T>[], maxRetries?: number, baseDelay?: number): Promise<T[]>;
|