@augustdigital/sdk 8.5.0 → 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/adapters/evm/index.d.ts +4 -4
- package/lib/adapters/evm/index.js +2 -0
- package/lib/adapters/solana/constants.d.ts +1 -1
- package/lib/adapters/solana/getters.d.ts +1 -1
- package/lib/adapters/solana/index.d.ts +4 -4
- package/lib/adapters/solana/index.js +4 -0
- package/lib/adapters/solana/types.d.ts +1 -1
- package/lib/adapters/solana/utils.d.ts +3 -3
- package/lib/adapters/solana/vault.actions.d.ts +4 -4
- package/lib/adapters/stellar/actions.d.ts +1 -1
- package/lib/adapters/stellar/index.d.ts +24 -2
- package/lib/adapters/stellar/index.js +25 -2
- package/lib/adapters/stellar/soroban.d.ts +1 -1
- package/lib/adapters/stellar/soroban.js +1 -1
- package/lib/adapters/stellar/submit.d.ts +20 -3
- package/lib/adapters/stellar/submit.js +74 -8
- package/lib/adapters/sui/getters.d.ts +1 -1
- package/lib/adapters/sui/index.d.ts +1 -1
- package/lib/adapters/sui/index.js +2 -0
- package/lib/adapters/sui/transformer.d.ts +2 -2
- package/lib/adapters/sui/transformer.js +1 -0
- package/lib/adapters/sui/types.d.ts +1 -1
- package/lib/core/analytics/sentry-runtime.js +1 -1
- package/lib/core/analytics/sentry.d.ts +2 -2
- package/lib/core/analytics/types.d.ts +1 -1
- package/lib/core/analytics/user-identity.d.ts +2 -2
- package/lib/core/analytics/user-identity.js +1 -1
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/base.class.d.ts +3 -3
- package/lib/core/base.class.js +10 -4
- package/lib/core/constants/adapters.d.ts +1 -1
- package/lib/core/constants/core.d.ts +2 -0
- package/lib/core/constants/core.js +6 -0
- package/lib/core/constants/swap-router.d.ts +37 -1
- package/lib/core/constants/swap-router.js +41 -1
- package/lib/core/constants/vaults.d.ts +1 -1
- package/lib/core/constants/web3.d.ts +1 -1
- package/lib/core/constants/web3.js +0 -3
- package/lib/core/errors/index.d.ts +2 -2
- package/lib/core/errors/index.js +9 -0
- package/lib/core/fetcher.d.ts +39 -39
- package/lib/core/fetcher.js +75 -57
- package/lib/core/helpers/adapters.d.ts +1 -1
- package/lib/core/helpers/core.d.ts +21 -18
- package/lib/core/helpers/core.js +22 -20
- package/lib/core/helpers/explorer-link.d.ts +1 -1
- package/lib/core/helpers/signer.d.ts +1 -1
- package/lib/core/helpers/swap-router.d.ts +1 -1
- package/lib/core/helpers/vault-version.d.ts +1 -1
- package/lib/core/helpers/vaults.d.ts +1 -1
- package/lib/core/helpers/web3.d.ts +2 -2
- package/lib/core/helpers/web3.js +9 -9
- package/lib/core/vault-metadata.d.ts +1 -1
- package/lib/core/version-check.js +1 -1
- package/lib/evm/methods/crossChainVault.js +1 -1
- package/lib/evm/types/crossChain.js +1 -1
- package/lib/main.d.ts +1 -1
- package/lib/main.js +7 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +2 -2
- package/lib/modules/sub-accounts/main.d.ts +2 -2
- package/lib/modules/sub-accounts/main.js +1 -1
- package/lib/modules/sub-accounts/utils.d.ts +1 -1
- package/lib/modules/vaults/adapter.helpers.d.ts +3 -3
- package/lib/modules/vaults/fetcher.d.ts +25 -0
- package/lib/modules/vaults/fetcher.js +51 -1
- package/lib/modules/vaults/getters.d.ts +50 -50
- package/lib/modules/vaults/getters.js +68 -67
- package/lib/modules/vaults/main.js +3 -1
- package/lib/modules/vaults/read.actions.d.ts +2 -2
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +1 -1
- package/lib/modules/vaults/utils.d.ts +19 -3
- package/lib/modules/vaults/utils.js +39 -6
- package/lib/modules/vaults/write.actions.js +35 -1
- package/lib/polyfills.js +3 -3
- package/lib/sdk.d.ts +1339 -1197
- package/lib/services/coingecko/fetcher.d.ts +10 -9
- package/lib/services/coingecko/fetcher.js +22 -18
- package/lib/services/debank/fetcher.d.ts +1 -1
- package/lib/services/debank/utils.d.ts +1 -1
- package/lib/services/debank/utils.js +1 -1
- package/lib/services/layerzero/deposits.d.ts +1 -1
- package/lib/services/layerzero/redeems.d.ts +1 -1
- package/lib/services/octavfi/fetcher.d.ts +1 -1
- package/lib/services/octavfi/types.d.ts +1 -1
- package/lib/services/octavfi/utils.d.ts +2 -2
- package/lib/services/subgraph/fetcher.js +1 -1
- package/lib/services/subgraph/vaults.js +76 -0
- package/lib/services/swap-quotes/index.d.ts +9 -0
- package/lib/services/swap-quotes/index.js +2 -1
- package/lib/services/swap-quotes/paraswap.d.ts +8 -0
- package/lib/services/swap-quotes/paraswap.js +8 -0
- package/lib/types/pools.d.ts +2 -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/vaults.d.ts +26 -0
- package/lib/types/web3.d.ts +1 -1
- package/lib/types/webserver.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ethers, Interface, InterfaceAbi, JsonRpcProvider } from 'ethers';
|
|
1
|
+
import { ethers, Interface, type InterfaceAbi, JsonRpcProvider } from 'ethers';
|
|
2
2
|
import type { Abi } from 'abitype';
|
|
3
3
|
import type { TypedContract } from '../../types/typed-contract';
|
|
4
|
-
import { IAddress, IContractRunner, IInfuraOptions } from '../../types';
|
|
4
|
+
import type { IAddress, IContractRunner, IInfuraOptions } from '../../types';
|
|
5
5
|
/**
|
|
6
6
|
* Web3 Helper Utilities
|
|
7
7
|
*
|
package/lib/core/helpers/web3.js
CHANGED
|
@@ -41,13 +41,13 @@ const vault_version_1 = require("./vault-version");
|
|
|
41
41
|
const determineBlockCutoff = (chain) => {
|
|
42
42
|
switch (chain) {
|
|
43
43
|
case 56:
|
|
44
|
-
return
|
|
44
|
+
return 120_000;
|
|
45
45
|
case 43114:
|
|
46
|
-
return
|
|
46
|
+
return 120_000;
|
|
47
47
|
case 143:
|
|
48
|
-
return
|
|
48
|
+
return 3_456_000;
|
|
49
49
|
default:
|
|
50
|
-
return
|
|
50
|
+
return 150_000;
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
exports.determineBlockCutoff = determineBlockCutoff;
|
|
@@ -78,15 +78,15 @@ exports.determineSecondsPerBlock = determineSecondsPerBlock;
|
|
|
78
78
|
const determineBlockSkipInternal = (chain) => {
|
|
79
79
|
switch (chain) {
|
|
80
80
|
case 43114:
|
|
81
|
-
return
|
|
81
|
+
return 8_000;
|
|
82
82
|
case 56:
|
|
83
|
-
return
|
|
83
|
+
return 8_000;
|
|
84
84
|
case 143: // Monad — Alchemy limits eth_getLogs to 1000 blocks
|
|
85
|
-
return
|
|
85
|
+
return 1_000;
|
|
86
86
|
case 999: // HyperEVM — rpc.hypurrscan.io limits eth_getLogs to 1000 blocks
|
|
87
|
-
return
|
|
87
|
+
return 1_000;
|
|
88
88
|
default:
|
|
89
|
-
return
|
|
89
|
+
return 50_000;
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
exports.determineBlockSkipInternal = determineBlockSkipInternal;
|
|
@@ -30,7 +30,7 @@ let hasRunCheck = false;
|
|
|
30
30
|
const NPM_PACKAGE = '@augustdigital/sdk';
|
|
31
31
|
const REGISTRY_URL = `https://registry.npmjs.org/${NPM_PACKAGE}/latest`;
|
|
32
32
|
/** Timeout for the registry request. 5s is generous; faster failures stay silent. */
|
|
33
|
-
const REQUEST_TIMEOUT_MS =
|
|
33
|
+
const REQUEST_TIMEOUT_MS = 5_000;
|
|
34
34
|
/**
|
|
35
35
|
* Read the current installed SDK version from the generated `version.ts`
|
|
36
36
|
* shim. Returns `null` when running from source (the file is gitignored and
|
|
@@ -90,7 +90,7 @@ const DEFAULT_HUB_LZ_COMPOSE_GAS_LIMIT = 2000000n;
|
|
|
90
90
|
// serialize patched calls. The timeout THROWS rather than silently racing
|
|
91
91
|
// concurrent callers' patches.
|
|
92
92
|
// ---------------------------------------------------------------------------
|
|
93
|
-
const PATCH_LOCK_TIMEOUT_MS =
|
|
93
|
+
const PATCH_LOCK_TIMEOUT_MS = 30_000;
|
|
94
94
|
let patchLock = Promise.resolve();
|
|
95
95
|
// ---------------------------------------------------------------------------
|
|
96
96
|
// Internal helpers
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CROSS_CHAIN_QUOTE_TTL_MS = void 0;
|
|
13
13
|
exports.isQuoteStale = isQuoteStale;
|
|
14
14
|
/** Default validity window for a cross-chain quote (30s). */
|
|
15
|
-
exports.CROSS_CHAIN_QUOTE_TTL_MS =
|
|
15
|
+
exports.CROSS_CHAIN_QUOTE_TTL_MS = 30_000;
|
|
16
16
|
/** Returns `true` when the quote should be refreshed before submitting. */
|
|
17
17
|
function isQuoteStale(quote, now = Date.now()) {
|
|
18
18
|
return now >= quote.expiresAt;
|
package/lib/main.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export declare class AugustSDK extends AugustBase {
|
|
|
69
69
|
* @param symbol - Token symbol or contract address
|
|
70
70
|
* @returns Current price in USD
|
|
71
71
|
*/
|
|
72
|
-
getPrice(symbol: string): Promise<
|
|
72
|
+
getPrice(symbol: string): Promise<number>;
|
|
73
73
|
/**
|
|
74
74
|
* Vault Data and Operations
|
|
75
75
|
*/
|
package/lib/main.js
CHANGED
|
@@ -56,6 +56,13 @@ const api_1 = require("./modules/api");
|
|
|
56
56
|
* Provides unified access to EVM, Solana, Sui, and Stellar blockchain adapters.
|
|
57
57
|
*/
|
|
58
58
|
class AugustSDK extends core_1.AugustBase {
|
|
59
|
+
vaults;
|
|
60
|
+
subaccounts;
|
|
61
|
+
api;
|
|
62
|
+
solana;
|
|
63
|
+
sui;
|
|
64
|
+
stellar;
|
|
65
|
+
evm;
|
|
59
66
|
/**
|
|
60
67
|
* Initialize the August SDK with provider configuration.
|
|
61
68
|
* Automatically sets up EVM adapter and optionally initializes Solana if RPC URL is provided.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IFetchAugustOptions } from '../../core';
|
|
2
|
-
import { IAddress, IOTCPosition, IWSSubaccountCefi, IWSSubAccountHealthFactor, IWSSubaccountLoan, IWSSubaccountSummary } from '../../types';
|
|
1
|
+
import { type IFetchAugustOptions } from '../../core';
|
|
2
|
+
import type { IAddress, IOTCPosition, IWSSubaccountCefi, IWSSubAccountHealthFactor, IWSSubaccountLoan, IWSSubaccountSummary } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Fetch subaccount health factor for a given subaccount address
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AugustBase, IAugustBase } from '../../core';
|
|
2
|
-
import { IAddress } from '../../types';
|
|
1
|
+
import { AugustBase, type IAugustBase } from '../../core';
|
|
2
|
+
import type { IAddress } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Subaccount operation class interacting with August Subaccounts
|
|
5
5
|
* Subaccount is a smart contract wallet that serves as the fundamental infrastructure for August's platform.
|
|
@@ -16,9 +16,9 @@ const core_1 = require("../../core");
|
|
|
16
16
|
* Most of the operations require a August API key to perform
|
|
17
17
|
*/
|
|
18
18
|
class AugustSubAccounts extends core_1.AugustBase {
|
|
19
|
+
headers = null;
|
|
19
20
|
constructor(baseConfig) {
|
|
20
21
|
super(baseConfig);
|
|
21
|
-
this.headers = null;
|
|
22
22
|
this.headers = {
|
|
23
23
|
'x-environment': this.monitoring?.['x-environment'],
|
|
24
24
|
'x-user-id': this.monitoring?.['x-user-id'],
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Functions to support deposits with alternative tokens through swap adapters,
|
|
5
5
|
* wrapper contracts, and Paraswap integration.
|
|
6
6
|
*/
|
|
7
|
-
import { BaseContract, Signer, Wallet } from 'ethers';
|
|
8
|
-
import { IAddress } from '../../types';
|
|
9
|
-
import { IVaultAdapterConfig } from '../../types/vaults';
|
|
7
|
+
import type { BaseContract, Signer, Wallet } from 'ethers';
|
|
8
|
+
import type { IAddress } from '../../types';
|
|
9
|
+
import type { IVaultAdapterConfig } from '../../types/vaults';
|
|
10
10
|
/**
|
|
11
11
|
* Get quote from Paraswap for token swap
|
|
12
12
|
*/
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
import type { IAddress } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Fetch the set of vaults whose deposit/withdraw history is served from the
|
|
4
|
+
* backend Mongo snapshot (`/upshift/vault_history`) rather than their (retired)
|
|
5
|
+
* Goldsky subgraph.
|
|
6
|
+
*
|
|
7
|
+
* This is the routing source of truth: a vault appears here only once its
|
|
8
|
+
* history has been backfilled, so the SDK can never reroute a vault to empty
|
|
9
|
+
* snapshot data ahead of its backfill. Result is cached for 10 minutes.
|
|
10
|
+
*
|
|
11
|
+
* Side effects: one HTTP GET to the public API (cached).
|
|
12
|
+
*
|
|
13
|
+
* @returns A set of lowercased vault addresses. Empty on any error — callers
|
|
14
|
+
* then fall back to the subgraph path, which is the safe default while
|
|
15
|
+
* subgraphs still exist.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchArchivedVaults(): Promise<Set<string>>;
|
|
18
|
+
/**
|
|
19
|
+
* Whether a vault's history should be served from the backend snapshot rather
|
|
20
|
+
* than its subgraph. Backed by {@link fetchArchivedVaults} (cached).
|
|
21
|
+
*
|
|
22
|
+
* @param vaultAddress - The vault contract address (any casing).
|
|
23
|
+
* @returns `true` if the vault has a backfilled history snapshot.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isArchivedVault(vaultAddress: IAddress): Promise<boolean>;
|
|
1
26
|
/**
|
|
2
27
|
* Specialized vault fetching with enhanced retry logic and fallback strategies
|
|
3
28
|
* This function attempts to fetch vault data with multiple fallback approaches
|
|
@@ -1,11 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchVaultMetadata = void 0;
|
|
4
|
+
exports.fetchArchivedVaults = fetchArchivedVaults;
|
|
5
|
+
exports.isArchivedVault = isArchivedVault;
|
|
4
6
|
exports.fetchVaultWithFallback = fetchVaultWithFallback;
|
|
5
7
|
exports.fetchVaultsBatch = fetchVaultsBatch;
|
|
6
8
|
exports.fetchVaultsComprehensive = fetchVaultsComprehensive;
|
|
7
9
|
exports.filterVaultsIntelligently = filterVaultsIntelligently;
|
|
8
10
|
const core_1 = require("../../core");
|
|
11
|
+
const ARCHIVED_VAULTS_CACHE_KEY = 'archived_vaults';
|
|
12
|
+
const ARCHIVED_VAULTS_TTL_MS = 10 * 60 * 1000;
|
|
13
|
+
/**
|
|
14
|
+
* Fetch the set of vaults whose deposit/withdraw history is served from the
|
|
15
|
+
* backend Mongo snapshot (`/upshift/vault_history`) rather than their (retired)
|
|
16
|
+
* Goldsky subgraph.
|
|
17
|
+
*
|
|
18
|
+
* This is the routing source of truth: a vault appears here only once its
|
|
19
|
+
* history has been backfilled, so the SDK can never reroute a vault to empty
|
|
20
|
+
* snapshot data ahead of its backfill. Result is cached for 10 minutes.
|
|
21
|
+
*
|
|
22
|
+
* Side effects: one HTTP GET to the public API (cached).
|
|
23
|
+
*
|
|
24
|
+
* @returns A set of lowercased vault addresses. Empty on any error — callers
|
|
25
|
+
* then fall back to the subgraph path, which is the safe default while
|
|
26
|
+
* subgraphs still exist.
|
|
27
|
+
*/
|
|
28
|
+
async function fetchArchivedVaults() {
|
|
29
|
+
const cached = core_1.CACHE.get(ARCHIVED_VAULTS_CACHE_KEY);
|
|
30
|
+
if (cached)
|
|
31
|
+
return cached;
|
|
32
|
+
try {
|
|
33
|
+
const response = await (0, core_1.fetchAugustPublic)(core_1.WEBSERVER_ENDPOINTS.public.tokenizedVault.archivedVaults);
|
|
34
|
+
if (response.status !== 200) {
|
|
35
|
+
core_1.Logger.log.error('fetchArchivedVaults', `non-200 from archived endpoint: ${response.status}`);
|
|
36
|
+
return new Set();
|
|
37
|
+
}
|
|
38
|
+
const addresses = (await response.json());
|
|
39
|
+
const set = new Set(addresses.map((a) => a.toLowerCase()));
|
|
40
|
+
core_1.CACHE.set(ARCHIVED_VAULTS_CACHE_KEY, set, { ttl: ARCHIVED_VAULTS_TTL_MS });
|
|
41
|
+
return set;
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
core_1.Logger.log.error('fetchArchivedVaults', e);
|
|
45
|
+
return new Set();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether a vault's history should be served from the backend snapshot rather
|
|
50
|
+
* than its subgraph. Backed by {@link fetchArchivedVaults} (cached).
|
|
51
|
+
*
|
|
52
|
+
* @param vaultAddress - The vault contract address (any casing).
|
|
53
|
+
* @returns `true` if the vault has a backfilled history snapshot.
|
|
54
|
+
*/
|
|
55
|
+
async function isArchivedVault(vaultAddress) {
|
|
56
|
+
const archived = await fetchArchivedVaults();
|
|
57
|
+
return archived.has(vaultAddress.toLowerCase());
|
|
58
|
+
}
|
|
9
59
|
/** @internal */
|
|
10
60
|
async function runWithConcurrency(tasks, limit) {
|
|
11
61
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
@@ -151,7 +201,7 @@ async function fetchVaultsComprehensive(vaults, fetchFn, options = {}) {
|
|
|
151
201
|
catch (error) {
|
|
152
202
|
lastError = error;
|
|
153
203
|
if (attempts < maxRetries) {
|
|
154
|
-
const delay = baseDelay *
|
|
204
|
+
const delay = baseDelay * 2 ** (attempts - 1);
|
|
155
205
|
core_1.Logger.log.warn('fetchVaultsComprehensive', `Vault ${vault.address} attempt ${attempts} failed, retrying in ${delay}ms: ${error.message}`);
|
|
156
206
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
157
207
|
}
|
|
@@ -19,10 +19,10 @@ import type { IVaultBaseOptions } from './types';
|
|
|
19
19
|
* Fetch comprehensive vault data including on-chain state and backend metadata.
|
|
20
20
|
* Routes to appropriate chain adapter (EVM v1/v2, Solana, or Stellar) based on vault version.
|
|
21
21
|
* Optionally enriches with loan and allocation data.
|
|
22
|
-
* @param vault Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
|
|
23
|
-
* @param loans Include active loan data
|
|
24
|
-
* @param allocations Include DeFi/CeFi allocation breakdowns
|
|
25
|
-
* @param options RPC and service configuration
|
|
22
|
+
* @param vault - Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
|
|
23
|
+
* @param loans - Include active loan data
|
|
24
|
+
* @param allocations - Include DeFi/CeFi allocation breakdowns
|
|
25
|
+
* @param options - RPC and service configuration
|
|
26
26
|
* @returns Complete vault object with optional enrichments
|
|
27
27
|
*/
|
|
28
28
|
export declare function getVault({ vault, loans, allocations, options, loadSubaccounts, loadSnapshots, }: {
|
|
@@ -48,8 +48,8 @@ export declare function getVaultSubaccountLoans(vault: VaultAddress | IVault, op
|
|
|
48
48
|
* Fetch comprehensive vault asset allocation breakdown.
|
|
49
49
|
* Includes DeFi protocols (via DeBank), CeFi balances, OTC positions, and loans.
|
|
50
50
|
* Categorizes exposures by borrowing, supplying, lending, and wallet holdings.
|
|
51
|
-
* @param vault Vault address
|
|
52
|
-
* @param options RPC configuration
|
|
51
|
+
* @param vault - Vault address
|
|
52
|
+
* @param options - RPC configuration
|
|
53
53
|
* @returns Detailed allocation data with exposure categorization
|
|
54
54
|
*/
|
|
55
55
|
export declare function getVaultAllocations(vault: IAddress, options: IVaultBaseOptions): Promise<IVaultAllocations>;
|
|
@@ -117,8 +117,8 @@ export declare function getVaultTvl({ vault, options, historical, }: {
|
|
|
117
117
|
* `health_factor: undefined` so callers can render an explicit empty state
|
|
118
118
|
* rather than a perpetual loading skeleton.
|
|
119
119
|
*
|
|
120
|
-
* @param vault Vault address to scope the fetch to.
|
|
121
|
-
* @param options Standard vault options — `rpcUrl` must point at `vault`'s chain.
|
|
120
|
+
* @param vault - Vault address to scope the fetch to.
|
|
121
|
+
* @param options - Standard vault options — `rpcUrl` must point at `vault`'s chain.
|
|
122
122
|
* @returns Array of `IVaultBorrowerHealthFactor`, one entry per active loan.
|
|
123
123
|
*/
|
|
124
124
|
export declare function getVaultBorrowerHealthFactor({ vault, options, }: {
|
|
@@ -141,8 +141,8 @@ export declare function getVaultBorrowerHealthFactor({ vault, options, }: {
|
|
|
141
141
|
* look up entries without worrying about EIP-55 checksum casing in either the
|
|
142
142
|
* backend response or the caller's input.
|
|
143
143
|
*
|
|
144
|
-
* @param options Standard vault options — `rpcUrl` should match `vault`'s chain.
|
|
145
|
-
* @param vault Optional vault address to scope the fetch to.
|
|
144
|
+
* @param options - Standard vault options — `rpcUrl` should match `vault`'s chain.
|
|
145
|
+
* @param vault - Optional vault address to scope the fetch to.
|
|
146
146
|
* @returns Map of lowercased vault address → array of borrower-health-factor rows.
|
|
147
147
|
*/
|
|
148
148
|
export declare function getHealthFactorOfBorrowersByVault({ options, vault, }: {
|
|
@@ -152,8 +152,8 @@ export declare function getHealthFactorOfBorrowersByVault({ options, vault, }: {
|
|
|
152
152
|
/**
|
|
153
153
|
* Fetch user points from the backend API endpoint.
|
|
154
154
|
* This replaces client-side points calculation with server-side processing.
|
|
155
|
-
* @param userAddress User wallet address (EVM or Solana)
|
|
156
|
-
* @param options Request options including headers
|
|
155
|
+
* @param userAddress - User wallet address (EVM or Solana)
|
|
156
|
+
* @param options - Request options including headers
|
|
157
157
|
* @returns Points data from the backend API
|
|
158
158
|
*/
|
|
159
159
|
export declare function getUserPoints({ userAddress, options, }: {
|
|
@@ -180,24 +180,24 @@ export declare function getUserPoints({ userAddress, options, }: {
|
|
|
180
180
|
* expires: {expiry}
|
|
181
181
|
* ```
|
|
182
182
|
*
|
|
183
|
-
* @param userAddress EVM wallet address being registered. Must match the
|
|
183
|
+
* @param userAddress - EVM wallet address being registered. Must match the
|
|
184
184
|
* signer that produced `signature`. Lowercased before being embedded in
|
|
185
185
|
* the canonical message.
|
|
186
|
-
* @param referrerAddress Optional EVM address that referred this user.
|
|
186
|
+
* @param referrerAddress - Optional EVM address that referred this user.
|
|
187
187
|
* Lowercased when embedded; the literal string `"none"` is used when
|
|
188
188
|
* absent. Tampering with this field after signing produces 401.
|
|
189
|
-
* @param chainId Chain on which the wallet signed. For smart-contract wallets
|
|
189
|
+
* @param chainId - Chain on which the wallet signed. For smart-contract wallets
|
|
190
190
|
* (Safe etc.) this is the chain whose RPC the backend will use to run the
|
|
191
191
|
* EIP-1271 `isValidSignature` check; for EOAs it still pins the signature
|
|
192
192
|
* to a chain so it can't be replayed cross-chain. Must be one of the chains
|
|
193
193
|
* Upshift supports (see backend `SUPPORTED_REGISTRATION_CHAINS`).
|
|
194
|
-
* @param signature `0x`-prefixed hex of the personal_sign signature over
|
|
194
|
+
* @param signature - `0x`-prefixed hex of the personal_sign signature over
|
|
195
195
|
* the canonical message. Single-use: replays within ~10 min are rejected.
|
|
196
|
-
* @param nonce Caller-generated random string (8–128 chars). Pair with
|
|
196
|
+
* @param nonce - Caller-generated random string (8–128 chars). Pair with
|
|
197
197
|
* `userAddress` to form the single-use key in the backend's nonce store.
|
|
198
|
-
* @param expiry Unix timestamp (seconds). Must be in the future and within
|
|
198
|
+
* @param expiry - Unix timestamp (seconds). Must be in the future and within
|
|
199
199
|
* the backend's TTL window (currently 10 min).
|
|
200
|
-
* @param options Request options (headers).
|
|
200
|
+
* @param options - Request options (headers).
|
|
201
201
|
* @returns Raw `Response` from the backend. 200 on success, 401 for
|
|
202
202
|
* expired / replayed / mismatched-signer / tampered-referrer, 422 for an
|
|
203
203
|
* unsupported `chainId`.
|
|
@@ -227,8 +227,8 @@ export declare function registerUserForPoints({ userAddress, referrerAddress, ch
|
|
|
227
227
|
}): Promise<Response>;
|
|
228
228
|
/**
|
|
229
229
|
* Fetch the points leaderboard data.
|
|
230
|
-
* @param params Optional parameters for pagination and sorting
|
|
231
|
-
* @param options Request options including headers
|
|
230
|
+
* @param params - Optional parameters for pagination and sorting
|
|
231
|
+
* @param options - Request options including headers
|
|
232
232
|
* @returns Leaderboard response data
|
|
233
233
|
*/
|
|
234
234
|
export declare function fetchPointsLeaderboard({ params, options, }: {
|
|
@@ -242,8 +242,8 @@ export declare function fetchPointsLeaderboard({ params, options, }: {
|
|
|
242
242
|
/**
|
|
243
243
|
* Fetch the timestamp when yield was last realized for a vault.
|
|
244
244
|
* Returns the assetsUpdatedOn timestamp from the vault contract.
|
|
245
|
-
* @param vault Vault contract address
|
|
246
|
-
* @param options RPC configuration
|
|
245
|
+
* @param vault - Vault contract address
|
|
246
|
+
* @param options - RPC configuration
|
|
247
247
|
* @returns Timestamp (Unix timestamp in seconds) when yield was last realized
|
|
248
248
|
*/
|
|
249
249
|
export declare function getYieldLastRealizedOn({ vault, options, }: {
|
|
@@ -258,9 +258,9 @@ export declare function getYieldLastRealizedOn({ vault, options, }: {
|
|
|
258
258
|
* 2. Fetch user's current assets (balanceOf * sharePrice via convertToAssets)
|
|
259
259
|
* 3. Calculate PnL = assets withdrawn + current assets - assets deposited
|
|
260
260
|
*
|
|
261
|
-
* @param vault Vault contract address
|
|
262
|
-
* @param wallet User wallet address
|
|
263
|
-
* @param options RPC configuration and service options
|
|
261
|
+
* @param vault - Vault contract address
|
|
262
|
+
* @param wallet - User wallet address
|
|
263
|
+
* @param options - RPC configuration and service options
|
|
264
264
|
* @returns Lifetime PnL data in both native token and USD
|
|
265
265
|
*/
|
|
266
266
|
export declare function getVaultUserLifetimePnl({ vault, wallet, options, }: {
|
|
@@ -273,8 +273,8 @@ export declare function getVaultUserLifetimePnl({ vault, wallet, options, }: {
|
|
|
273
273
|
* Calculate PnL for a vault (vault-level, not user-specific).
|
|
274
274
|
* Returns the vault's overall profit and loss across all users.
|
|
275
275
|
*
|
|
276
|
-
* @param vault Vault contract address
|
|
277
|
-
* @param options RPC configuration and service options
|
|
276
|
+
* @param vault - Vault contract address
|
|
277
|
+
* @param options - RPC configuration and service options
|
|
278
278
|
* @returns Vault PnL in USD and notional value
|
|
279
279
|
*/
|
|
280
280
|
export declare function getVaultPnl({ vault, options, }: {
|
|
@@ -295,8 +295,8 @@ export declare function getVaultHistoricalTimeseries({ vault, nDays, options, }:
|
|
|
295
295
|
* These fields will be removed on 2026-01-01.
|
|
296
296
|
* Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
|
|
297
297
|
*
|
|
298
|
-
* @param vault Vault contract address
|
|
299
|
-
* @param options Request options including headers
|
|
298
|
+
* @param vault - Vault contract address
|
|
299
|
+
* @param options - Request options including headers
|
|
300
300
|
* @returns Annualized APY data including liquidity APY
|
|
301
301
|
*/
|
|
302
302
|
export declare function getVaultAnnualizedApy({ vault, options, }: {
|
|
@@ -305,8 +305,8 @@ export declare function getVaultAnnualizedApy({ vault, options, }: {
|
|
|
305
305
|
}): Promise<IVaultAnnualizedApy>;
|
|
306
306
|
/**
|
|
307
307
|
* Fetch summary data for a vault (name, type, chain, recent returns).
|
|
308
|
-
* @param vault Vault contract address
|
|
309
|
-
* @param options Request options including headers
|
|
308
|
+
* @param vault - Vault contract address
|
|
309
|
+
* @param options - Request options including headers
|
|
310
310
|
* @returns Vault summary data
|
|
311
311
|
*/
|
|
312
312
|
export declare function getVaultSummary({ vault, options, }: {
|
|
@@ -315,9 +315,9 @@ export declare function getVaultSummary({ vault, options, }: {
|
|
|
315
315
|
}): Promise<IVaultSummary>;
|
|
316
316
|
/**
|
|
317
317
|
* Fetch withdrawal summary and pending queue for a vault.
|
|
318
|
-
* @param vault Vault contract address
|
|
319
|
-
* @param chain Chain identifier (e.g., chain ID as string)
|
|
320
|
-
* @param options Request options including headers
|
|
318
|
+
* @param vault - Vault contract address
|
|
319
|
+
* @param chain - Chain identifier (e.g., chain ID as string)
|
|
320
|
+
* @param options - Request options including headers
|
|
321
321
|
* @returns Withdrawal summary and pending queue
|
|
322
322
|
*/
|
|
323
323
|
export declare function getVaultWithdrawals({ vault, chain, options, }: {
|
|
@@ -327,10 +327,10 @@ export declare function getVaultWithdrawals({ vault, chain, options, }: {
|
|
|
327
327
|
}): Promise<IVaultWithdrawals>;
|
|
328
328
|
/**
|
|
329
329
|
* Fetch pending redemptions for a vault with liquidity analysis.
|
|
330
|
-
* @param vault Vault contract address
|
|
331
|
-
* @param pastDays Number of past days to include (default 7, min 1, max 30)
|
|
332
|
-
* @param futureDays Number of future days to include (default 14, min 1, max 30)
|
|
333
|
-
* @param options Request options including headers
|
|
330
|
+
* @param vault - Vault contract address
|
|
331
|
+
* @param pastDays - Number of past days to include (default 7, min 1, max 30)
|
|
332
|
+
* @param futureDays - Number of future days to include (default 14, min 1, max 30)
|
|
333
|
+
* @param options - Request options including headers
|
|
334
334
|
* @returns Pending redemptions grouped by date with liquidity summary
|
|
335
335
|
*/
|
|
336
336
|
export declare function getVaultPendingRedemptions({ vault, pastDays, futureDays, options, }: {
|
|
@@ -341,10 +341,10 @@ export declare function getVaultPendingRedemptions({ vault, pastDays, futureDays
|
|
|
341
341
|
}): Promise<IVaultPendingRedemptions>;
|
|
342
342
|
/**
|
|
343
343
|
* Preview the amount of assets that would be received for redeeming shares (queued redemption).
|
|
344
|
-
* @param vault Vault contract address
|
|
345
|
-
* @param sharesAmount Amount of shares to redeem (human-readable, raw bigint, or string)
|
|
346
|
-
* @param options RPC configuration
|
|
347
|
-
* @returns The amount of assets as INormalizedNumber
|
|
344
|
+
* @param vault - Vault contract address
|
|
345
|
+
* @param sharesAmount - Amount of shares to redeem (human-readable, raw bigint, or string)
|
|
346
|
+
* @param options - RPC configuration
|
|
347
|
+
* @returns The amount of assets as an INormalizedNumber with `normalized` and `raw` fields
|
|
348
348
|
*/
|
|
349
349
|
export declare function getPreviewRedemption({ vault, sharesAmount, options, }: {
|
|
350
350
|
vault: IAddress;
|
|
@@ -409,13 +409,13 @@ export interface WithdrawalRequestStatus {
|
|
|
409
409
|
* - `'ready_to_claim'` — Claimable date has passed (within the lookback window) but no processed event found.
|
|
410
410
|
* - `'pending'` — Claimable date is still in the future.
|
|
411
411
|
*
|
|
412
|
-
* @param params - Query parameters
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
412
|
+
* @param params - Query parameters:
|
|
413
|
+
* - `vault` — Vault address to query.
|
|
414
|
+
* - `receiver` — (Optional) Filter by receiver address.
|
|
415
|
+
* - `lookbackBlocks` — (Optional) On-chain log lookback window in blocks.
|
|
416
|
+
* Defaults to a chain-specific value (e.g. 150,000 for Ethereum, 3,456,000 for Monad).
|
|
417
|
+
* Increasing this scans more history but requires more RPC calls.
|
|
418
|
+
* - `options` — Standard vault query options (provider, RPC URL, etc.).
|
|
419
419
|
* @returns Array of withdrawal requests with status and claimable dates
|
|
420
420
|
*
|
|
421
421
|
* @example
|