@augustdigital/sdk 8.7.2 → 8.9.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/lib/core/analytics/method-taxonomy.js +16 -0
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/base.class.d.ts +20 -1
- package/lib/core/base.class.js +8 -1
- package/lib/core/constants/core.d.ts +32 -0
- package/lib/core/constants/core.js +72 -0
- package/lib/core/constants/vaults.d.ts +5 -0
- package/lib/core/constants/vaults.js +7 -0
- package/lib/core/constants/web3.d.ts +17 -0
- package/lib/core/constants/web3.js +18 -1
- package/lib/core/fetcher.d.ts +35 -0
- package/lib/core/fetcher.js +80 -1
- package/lib/main.js +1 -1
- package/lib/modules/api/fetcher.d.ts +82 -0
- package/lib/modules/api/fetcher.js +150 -0
- package/lib/modules/api/main.d.ts +263 -2
- package/lib/modules/api/main.js +353 -4
- package/lib/modules/sub-accounts/fetcher.d.ts +28 -1
- package/lib/modules/sub-accounts/fetcher.js +51 -1
- package/lib/modules/sub-accounts/main.d.ts +93 -1
- package/lib/modules/sub-accounts/main.js +123 -0
- package/lib/sdk.d.ts +840 -2
- package/lib/services/subgraph/vaults.js +89 -20
- package/lib/types/api.d.ts +280 -0
- package/lib/types/api.js +3 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/sub-accounts.d.ts +36 -0
- package/lib/types/subgraph.d.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchVaultOracleClassification = exports.fetchVaultPerformanceFees = exports.fetchTimelockRequests = exports.fetchCuratorVaultWhitelist = exports.fetchCuratorVaultSubaccounts = exports.fetchOtcMarginRequirements = exports.fetchOtcPositions = exports.fetchRevertReason = exports.fetchCollateralSimulation = exports.fetchCollateralExcessOrDeficit = exports.fetchDiscountFactors = exports.fetchDashboardLoans = void 0;
|
|
4
|
+
const core_1 = require("../../core");
|
|
5
|
+
/**
|
|
6
|
+
* Fetch the global loan-book aggregate (admin-only `GET /dashboard/loans`).
|
|
7
|
+
*/
|
|
8
|
+
const fetchDashboardLoans = async (augustKey, headers) => {
|
|
9
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.dashboard.loans, { headers });
|
|
10
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
11
|
+
throw new Error(`Failed to fetch dashboard loans: ${response.statusText || 'Unknown error'}`);
|
|
12
|
+
}
|
|
13
|
+
return response.json();
|
|
14
|
+
};
|
|
15
|
+
exports.fetchDashboardLoans = fetchDashboardLoans;
|
|
16
|
+
/**
|
|
17
|
+
* Fetch every token discount-factor ladder (`GET /risk/discount_factors`).
|
|
18
|
+
*/
|
|
19
|
+
const fetchDiscountFactors = async (augustKey, headers) => {
|
|
20
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.risk.discountFactors, { headers });
|
|
21
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
22
|
+
throw new Error(`Failed to fetch discount factors: ${response.statusText || 'Unknown error'}`);
|
|
23
|
+
}
|
|
24
|
+
return response.json();
|
|
25
|
+
};
|
|
26
|
+
exports.fetchDiscountFactors = fetchDiscountFactors;
|
|
27
|
+
/**
|
|
28
|
+
* Fetch a subaccount's collateral excess/deficit for one token
|
|
29
|
+
* (`GET /risk/collateral_excess_or_deficit`).
|
|
30
|
+
*/
|
|
31
|
+
const fetchCollateralExcessOrDeficit = async (params, augustKey, headers) => {
|
|
32
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.risk.collateralExcessOrDeficit(params.subaccount, params.tokenAddress, params.tokenChain, params.targetHealthFactor), { headers });
|
|
33
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
34
|
+
throw new Error(`Failed to fetch collateral excess or deficit: ${response.statusText || 'Unknown error'}`);
|
|
35
|
+
}
|
|
36
|
+
return response.json();
|
|
37
|
+
};
|
|
38
|
+
exports.fetchCollateralExcessOrDeficit = fetchCollateralExcessOrDeficit;
|
|
39
|
+
/**
|
|
40
|
+
* Run a collateral simulation (`POST /risk/collateral_simulation`). This is a
|
|
41
|
+
* pure, read-only simulation — the backend computes required collateral for a
|
|
42
|
+
* hypothetical loan and changes no state.
|
|
43
|
+
*/
|
|
44
|
+
const fetchCollateralSimulation = async (body, augustKey, headers) => {
|
|
45
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.risk.collateralSimulation, { method: 'post', data: body, headers });
|
|
46
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
47
|
+
throw new Error(`Failed to run collateral simulation: ${response.statusText || 'Unknown error'}`);
|
|
48
|
+
}
|
|
49
|
+
return response.json();
|
|
50
|
+
};
|
|
51
|
+
exports.fetchCollateralSimulation = fetchCollateralSimulation;
|
|
52
|
+
/**
|
|
53
|
+
* Fetch the decoded revert reason(s) for a transaction from the public
|
|
54
|
+
* `GET /revert_reason` endpoint. No API key required.
|
|
55
|
+
*/
|
|
56
|
+
const fetchRevertReason = async (txHash, chain, headers) => {
|
|
57
|
+
const response = await (0, core_1.fetchAugustPublic)(core_1.WEBSERVER_ENDPOINTS.public.revertReason(txHash, chain), { headers });
|
|
58
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
59
|
+
throw new Error(`Failed to fetch revert reason: ${response.statusText || 'Unknown error'}`);
|
|
60
|
+
}
|
|
61
|
+
return response.json();
|
|
62
|
+
};
|
|
63
|
+
exports.fetchRevertReason = fetchRevertReason;
|
|
64
|
+
/**
|
|
65
|
+
* Fetch all OTC positions (admin-only `GET /otc/position`).
|
|
66
|
+
*/
|
|
67
|
+
const fetchOtcPositions = async (augustKey, headers) => {
|
|
68
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.otc.positions, { headers });
|
|
69
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
70
|
+
throw new Error(`Failed to fetch OTC positions: ${response.statusText || 'Unknown error'}`);
|
|
71
|
+
}
|
|
72
|
+
return response.json();
|
|
73
|
+
};
|
|
74
|
+
exports.fetchOtcPositions = fetchOtcPositions;
|
|
75
|
+
/**
|
|
76
|
+
* Fetch OTC margin requirements (admin-only `GET /otc/margin_requirement`),
|
|
77
|
+
* optionally filtered by counterparty id and/or payer.
|
|
78
|
+
*/
|
|
79
|
+
const fetchOtcMarginRequirements = async (filters, augustKey, headers) => {
|
|
80
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.otc.marginRequirements(filters.otcCounterpartyId, filters.payer), { headers });
|
|
81
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
82
|
+
throw new Error(`Failed to fetch OTC margin requirements: ${response.statusText || 'Unknown error'}`);
|
|
83
|
+
}
|
|
84
|
+
return response.json();
|
|
85
|
+
};
|
|
86
|
+
exports.fetchOtcMarginRequirements = fetchOtcMarginRequirements;
|
|
87
|
+
/**
|
|
88
|
+
* Fetch the subaccounts linked to a vault (curator-or-admin
|
|
89
|
+
* `GET /curator/vaults/{vault_address}/subaccounts`).
|
|
90
|
+
*/
|
|
91
|
+
const fetchCuratorVaultSubaccounts = async (vaultAddress, augustKey, headers) => {
|
|
92
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.curator.vaultSubaccounts(vaultAddress), { headers });
|
|
93
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
94
|
+
throw new Error(`Failed to fetch curator vault subaccounts: ${response.statusText || 'Unknown error'}`);
|
|
95
|
+
}
|
|
96
|
+
return response.json();
|
|
97
|
+
};
|
|
98
|
+
exports.fetchCuratorVaultSubaccounts = fetchCuratorVaultSubaccounts;
|
|
99
|
+
/**
|
|
100
|
+
* Fetch on-chain whitelist status for a vault's subaccounts (curator-or-admin
|
|
101
|
+
* `GET /curator/vaults/{vault_address}/whitelist`). EVM vaults only — the
|
|
102
|
+
* backend 400s for non-EVM vaults.
|
|
103
|
+
*/
|
|
104
|
+
const fetchCuratorVaultWhitelist = async (vaultAddress, augustKey, headers) => {
|
|
105
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.curator.vaultWhitelist(vaultAddress), { headers });
|
|
106
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
107
|
+
throw new Error(`Failed to fetch curator vault whitelist: ${response.statusText || 'Unknown error'}`);
|
|
108
|
+
}
|
|
109
|
+
return response.json();
|
|
110
|
+
};
|
|
111
|
+
exports.fetchCuratorVaultWhitelist = fetchCuratorVaultWhitelist;
|
|
112
|
+
/**
|
|
113
|
+
* Fetch timelock requests for a vault on a chain (`GET /timelock-requests`),
|
|
114
|
+
* optionally filtered by status.
|
|
115
|
+
*/
|
|
116
|
+
const fetchTimelockRequests = async (params, augustKey, headers) => {
|
|
117
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.timelockRequests(params.vaultAddress, params.chainId, params.status), { headers });
|
|
118
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
119
|
+
throw new Error(`Failed to fetch timelock requests: ${response.statusText || 'Unknown error'}`);
|
|
120
|
+
}
|
|
121
|
+
return response.json();
|
|
122
|
+
};
|
|
123
|
+
exports.fetchTimelockRequests = fetchTimelockRequests;
|
|
124
|
+
/**
|
|
125
|
+
* Fetch a vault's performance-fee computation
|
|
126
|
+
* (`GET /metrics/vault_performance_fees`). Slow first call (pandas over full
|
|
127
|
+
* snapshot history); 20-minute server-side cache.
|
|
128
|
+
*/
|
|
129
|
+
const fetchVaultPerformanceFees = async (params, augustKey, headers) => {
|
|
130
|
+
const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.metrics.vaultPerformanceFees(params), { headers });
|
|
131
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
132
|
+
throw new Error(`Failed to fetch vault performance fees: ${response.statusText || 'Unknown error'}`);
|
|
133
|
+
}
|
|
134
|
+
return response.json();
|
|
135
|
+
};
|
|
136
|
+
exports.fetchVaultPerformanceFees = fetchVaultPerformanceFees;
|
|
137
|
+
/**
|
|
138
|
+
* Fetch a vault's NAV-oracle classification table from the public
|
|
139
|
+
* `GET /upshift/oracle_classification/{vault_address}` endpoint. No API key
|
|
140
|
+
* required.
|
|
141
|
+
*/
|
|
142
|
+
const fetchVaultOracleClassification = async (vaultAddress, chainId, headers) => {
|
|
143
|
+
const response = await (0, core_1.fetchAugustPublic)(core_1.WEBSERVER_ENDPOINTS.public.oracleClassification(vaultAddress, chainId), { headers });
|
|
144
|
+
if (!response.ok || typeof response.json !== 'function') {
|
|
145
|
+
throw new Error(`Failed to fetch vault oracle classification: ${response.statusText || 'Unknown error'}`);
|
|
146
|
+
}
|
|
147
|
+
return response.json();
|
|
148
|
+
};
|
|
149
|
+
exports.fetchVaultOracleClassification = fetchVaultOracleClassification;
|
|
150
|
+
//# sourceMappingURL=fetcher.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { AugustBase, type IAugustBase } from '../../core/base.class';
|
|
2
|
+
import type { ICollateralExcessOrDeficit, ICollateralSimulationInput, ICollateralSimulationResults, ICuratorWhitelistStatus, IDiscountFactorLadder, ILoanBookInfo, IOracleClassification, IOtcMarginRequirement, IOtcPositionRead, IRevertReason, ITimelockRequest, IUnrealizedPnlSnapshot, IVaultPerformanceFees, IWSSubaccountListItem } from '../../types';
|
|
2
3
|
/**
|
|
3
4
|
* Read-only client for August backend REST endpoints that have no on-chain
|
|
4
5
|
* equivalent — currently the unrealized-PnL series the backend computes
|
|
@@ -11,8 +12,268 @@ import type { IUnrealizedPnlSnapshot } from '../../types';
|
|
|
11
12
|
*
|
|
12
13
|
* Accessible as `apiModule` on the SDK instance; the same methods are also
|
|
13
14
|
* exposed directly on the SDK class.
|
|
15
|
+
*
|
|
16
|
+
* A subset of methods (loan book, risk) hit authenticated admin-only backend
|
|
17
|
+
* endpoints and require an admin-scoped August API key on the SDK
|
|
18
|
+
* constructor; each such method documents the requirement.
|
|
14
19
|
*/
|
|
15
|
-
export declare class AugustApi {
|
|
20
|
+
export declare class AugustApi extends AugustBase {
|
|
21
|
+
private headers;
|
|
22
|
+
constructor(baseConfig: IAugustBase);
|
|
23
|
+
/**
|
|
24
|
+
* Retrieve the global loan-book aggregate across every active client
|
|
25
|
+
* subaccount — one {@link ILoanBookInfo} entry per loan, with principal /
|
|
26
|
+
* interest amounts, APRs, state, and the next upcoming payment.
|
|
27
|
+
*
|
|
28
|
+
* Backed by the admin-only `GET /dashboard/loans` backend endpoint (60-second
|
|
29
|
+
* server-side cache), so the August API key configured on the SDK must
|
|
30
|
+
* belong to an admin user. Makes exactly one HTTP request and no RPC calls.
|
|
31
|
+
*
|
|
32
|
+
* @returns Array of loan-book entries; empty when there are no active loans.
|
|
33
|
+
* @throws AugustAuthError When the API key is missing or not admin-scoped.
|
|
34
|
+
* @throws AugustServerError When the API responds with a non-2xx status.
|
|
35
|
+
* @example
|
|
36
|
+
* const loans = await sdk.apiModule.getDashboardLoans();
|
|
37
|
+
* const active = loans.filter((l) => l.state === 'ACTIVE');
|
|
38
|
+
*/
|
|
39
|
+
getDashboardLoans(): Promise<ILoanBookInfo[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieve every token discount-factor ladder the risk engine applies when
|
|
42
|
+
* valuing collateral.
|
|
43
|
+
*
|
|
44
|
+
* Backed by `GET /risk/discount_factors` (60-second server-side cache),
|
|
45
|
+
* which requires an authenticated August user; an admin-scoped API key
|
|
46
|
+
* works. Makes exactly one HTTP request and no RPC calls.
|
|
47
|
+
*
|
|
48
|
+
* @returns Array of {@link IDiscountFactorLadder}, one per whitelisted token that has a configured ladder.
|
|
49
|
+
* @throws AugustAuthError When the API key is missing or not authorized.
|
|
50
|
+
* @throws AugustServerError When the API responds with a non-2xx status.
|
|
51
|
+
* @example
|
|
52
|
+
* const ladders = await sdk.apiModule.getDiscountFactors();
|
|
53
|
+
* console.log(ladders.map((d) => `${d.address}@${d.chain}`));
|
|
54
|
+
*/
|
|
55
|
+
getDiscountFactors(): Promise<IDiscountFactorLadder[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Compute how much collateral a subaccount has in excess of — or is short
|
|
58
|
+
* of — what it needs to hold a target health factor, for one collateral
|
|
59
|
+
* token.
|
|
60
|
+
*
|
|
61
|
+
* Backed by `GET /risk/collateral_excess_or_deficit` (60-second server-side
|
|
62
|
+
* cache), which resolves the subaccount and reads its current health factor,
|
|
63
|
+
* so an authenticated (admin-scoped) August API key is required. Makes
|
|
64
|
+
* exactly one HTTP request and no RPC calls.
|
|
65
|
+
*
|
|
66
|
+
* @param params.subaccount Subaccount (smart-contract wallet) address.
|
|
67
|
+
* @param params.tokenAddress Collateral token address to evaluate.
|
|
68
|
+
* @param params.tokenChain Numeric August chain id of the token (e.g. `1` for Ethereum mainnet).
|
|
69
|
+
* @param params.targetHealthFactor Health factor to solve for. Defaults server-side to the minimum healthy factor (1.2); when supplied must be a finite number greater than 0.
|
|
70
|
+
* @returns The signed excess (positive) or deficit (negative) in USD and token units. Zeroes when the subaccount has no debt.
|
|
71
|
+
* @throws AugustValidationError When an address is invalid, `tokenChain` is not an integer, or `targetHealthFactor` is out of range.
|
|
72
|
+
* @throws AugustServerError When the token has no discount factor (backend 404) or the API otherwise responds non-2xx.
|
|
73
|
+
* @example
|
|
74
|
+
* const r = await sdk.apiModule.getCollateralExcessOrDeficit({
|
|
75
|
+
* subaccount: '0xabc…',
|
|
76
|
+
* tokenAddress: '0xdef…',
|
|
77
|
+
* tokenChain: 1,
|
|
78
|
+
* });
|
|
79
|
+
* console.log(r.amount_usd > 0 ? 'excess' : 'deficit');
|
|
80
|
+
*/
|
|
81
|
+
getCollateralExcessOrDeficit(params: {
|
|
82
|
+
subaccount: string;
|
|
83
|
+
tokenAddress: string;
|
|
84
|
+
tokenChain: number;
|
|
85
|
+
targetHealthFactor?: number;
|
|
86
|
+
}): Promise<ICollateralExcessOrDeficit>;
|
|
87
|
+
/**
|
|
88
|
+
* Simulate the collateral required to open a hypothetical loan against a
|
|
89
|
+
* chosen basket of collateral tokens.
|
|
90
|
+
*
|
|
91
|
+
* This is a pure, read-only simulation: the backend `POST
|
|
92
|
+
* /risk/collateral_simulation` endpoint (60-second server-side cache)
|
|
93
|
+
* computes required collateral and effective discount factors and changes
|
|
94
|
+
* no state. It runs against the authenticated backend, so an
|
|
95
|
+
* (admin-scoped) August API key is required. Makes exactly one HTTP request
|
|
96
|
+
* and no RPC calls.
|
|
97
|
+
*
|
|
98
|
+
* @param input Simulation parameters — see {@link ICollateralSimulationInput}. `collateral_tokens` and `collateral_token_allocation` must be non-empty and equal length; when `on_platform` is `true`, both `loan_redeployed_token_*` fields are required.
|
|
99
|
+
* @returns The simulated {@link ICollateralSimulationResults}: total debt, required collateral, resulting health factor, and a per-token breakdown.
|
|
100
|
+
* @throws AugustValidationError When addresses are invalid, `loan_amount` is not a finite non-negative number, the collateral arrays are empty / mismatched, or `on_platform` is set without redeployed-token details.
|
|
101
|
+
* @throws AugustServerError When the API responds with a non-2xx status (e.g. a token missing a discount factor).
|
|
102
|
+
* @example
|
|
103
|
+
* const sim = await sdk.apiModule.simulateCollateral({
|
|
104
|
+
* loan_token_chain: 1,
|
|
105
|
+
* loan_token_address: '0xloan…',
|
|
106
|
+
* loan_amount: 1_000_000,
|
|
107
|
+
* collateral_tokens: [[1, '0xcol…']],
|
|
108
|
+
* collateral_token_allocation: [1],
|
|
109
|
+
* });
|
|
110
|
+
* console.log(sim.total_required_collateral_usd);
|
|
111
|
+
*/
|
|
112
|
+
simulateCollateral(input: ICollateralSimulationInput): Promise<ICollateralSimulationResults>;
|
|
113
|
+
/**
|
|
114
|
+
* Fetch the decoded revert reason(s) for a transaction — error messages,
|
|
115
|
+
* revert strings, and recognized universal-subaccount errors extracted from
|
|
116
|
+
* a `debug_traceTransaction` call tree.
|
|
117
|
+
*
|
|
118
|
+
* Backed by the public (unauthenticated) `GET /revert_reason` endpoint; no
|
|
119
|
+
* API key required. The backend relies on the target chain's RPC supporting
|
|
120
|
+
* `debug_trace*`; on chains/RPCs without it the backend returns a 5xx whose
|
|
121
|
+
* detail explains why, surfaced here as an {@link AugustServerError}. Makes
|
|
122
|
+
* exactly one HTTP request and no RPC calls from the SDK itself.
|
|
123
|
+
*
|
|
124
|
+
* @param txHash Transaction hash to trace.
|
|
125
|
+
* @param chain Numeric August chain id the transaction is on (e.g. `1` for Ethereum mainnet).
|
|
126
|
+
* @returns The decoded {@link IRevertReason}; all arrays empty when the trace yielded no matching signal.
|
|
127
|
+
* @throws AugustValidationError When `txHash` is empty or `chain` is not an integer.
|
|
128
|
+
* @throws AugustServerError When the chain/RPC does not support tracing, or the API otherwise responds non-2xx.
|
|
129
|
+
* @example
|
|
130
|
+
* const r = await sdk.apiModule.getRevertReason('0xabc…', 1);
|
|
131
|
+
* console.log(r.revert_reasons);
|
|
132
|
+
*/
|
|
133
|
+
getRevertReason(txHash: string, chain: number): Promise<IRevertReason>;
|
|
134
|
+
/**
|
|
135
|
+
* Retrieve every tracked OTC position.
|
|
136
|
+
*
|
|
137
|
+
* Backed by the admin-only `GET /otc/position` backend endpoint, so the
|
|
138
|
+
* configured August API key must belong to an admin user. Makes exactly one
|
|
139
|
+
* HTTP request and no RPC calls.
|
|
140
|
+
*
|
|
141
|
+
* @returns Array of {@link IOtcPositionRead}; empty when there are no OTC positions.
|
|
142
|
+
* @throws AugustAuthError When the API key is missing or not admin-scoped.
|
|
143
|
+
* @throws AugustServerError When the API responds with a non-2xx status.
|
|
144
|
+
* @example
|
|
145
|
+
* const positions = await sdk.apiModule.getOtcPositions();
|
|
146
|
+
*/
|
|
147
|
+
getOtcPositions(): Promise<IOtcPositionRead[]>;
|
|
148
|
+
/**
|
|
149
|
+
* Retrieve OTC margin requirements, optionally filtered by counterparty
|
|
150
|
+
* and/or payer.
|
|
151
|
+
*
|
|
152
|
+
* Backed by the admin-only `GET /otc/margin_requirement` backend endpoint,
|
|
153
|
+
* so the configured August API key must belong to an admin user. Makes
|
|
154
|
+
* exactly one HTTP request and no RPC calls.
|
|
155
|
+
*
|
|
156
|
+
* @param options - Optional filters
|
|
157
|
+
* @param options.otcCounterpartyId - Restrict to a single counterparty (UUID)
|
|
158
|
+
* @param options.payer - Restrict to a single payer address
|
|
159
|
+
* @returns Array of {@link IOtcMarginRequirement} matching the filters (all when none given).
|
|
160
|
+
* @throws AugustAuthError When the API key is missing or not admin-scoped.
|
|
161
|
+
* @throws AugustServerError When the API responds with a non-2xx status.
|
|
162
|
+
* @example
|
|
163
|
+
* const reqs = await sdk.apiModule.getOtcMarginRequirements({ payer: '0xabc…' });
|
|
164
|
+
*/
|
|
165
|
+
getOtcMarginRequirements(options?: {
|
|
166
|
+
otcCounterpartyId?: string;
|
|
167
|
+
payer?: string;
|
|
168
|
+
}): Promise<IOtcMarginRequirement[]>;
|
|
169
|
+
/**
|
|
170
|
+
* List the subaccounts linked to a vault (curator surface).
|
|
171
|
+
*
|
|
172
|
+
* Backed by the curator-or-admin `GET
|
|
173
|
+
* /curator/vaults/{vault_address}/subaccounts` backend endpoint, so the
|
|
174
|
+
* configured August API key must belong to the vault's curator or an admin.
|
|
175
|
+
* Makes exactly one HTTP request and no RPC calls.
|
|
176
|
+
*
|
|
177
|
+
* @param vaultAddress - The vault address (EVM `0x…`, Solana, or Stellar)
|
|
178
|
+
* @returns Array of subaccount records linked to the vault (same shape as the subaccount directory); empty when none are linked.
|
|
179
|
+
* @throws AugustValidationError When `vaultAddress` is not a valid address.
|
|
180
|
+
* @throws AugustAuthError When the API key is missing or not curator/admin for the vault.
|
|
181
|
+
* @throws AugustServerError When the API responds with a non-2xx status.
|
|
182
|
+
* @example
|
|
183
|
+
* const subs = await sdk.apiModule.getCuratorVaultSubaccounts('0xvault…');
|
|
184
|
+
*/
|
|
185
|
+
getCuratorVaultSubaccounts(vaultAddress: string): Promise<IWSSubaccountListItem[]>;
|
|
186
|
+
/**
|
|
187
|
+
* Get on-chain whitelist status for every subaccount linked to a vault
|
|
188
|
+
* (curator surface).
|
|
189
|
+
*
|
|
190
|
+
* Backed by the curator-or-admin `GET
|
|
191
|
+
* /curator/vaults/{vault_address}/whitelist` backend endpoint. EVM vaults
|
|
192
|
+
* only — non-EVM vaults manage access internally and the backend returns a
|
|
193
|
+
* 400 (surfaced as {@link AugustServerError}). Makes exactly one HTTP
|
|
194
|
+
* request and no RPC calls from the SDK.
|
|
195
|
+
*
|
|
196
|
+
* @param vaultAddress - The EVM vault address (`0x…`)
|
|
197
|
+
* @returns Array of {@link ICuratorWhitelistStatus}, one per linked subaccount; empty when the vault has no subaccounts.
|
|
198
|
+
* @throws AugustValidationError When `vaultAddress` is not a valid address.
|
|
199
|
+
* @throws AugustAuthError When the API key is missing or not curator/admin for the vault.
|
|
200
|
+
* @throws AugustServerError When the vault is non-EVM (backend 400) or the API otherwise responds non-2xx.
|
|
201
|
+
* @example
|
|
202
|
+
* const status = await sdk.apiModule.getCuratorVaultWhitelist('0xvault…');
|
|
203
|
+
* console.log(status.filter((s) => !s.is_whitelisted));
|
|
204
|
+
*/
|
|
205
|
+
getCuratorVaultWhitelist(vaultAddress: string): Promise<ICuratorWhitelistStatus[]>;
|
|
206
|
+
/**
|
|
207
|
+
* List timelock (governance) requests for a vault on a chain, optionally
|
|
208
|
+
* filtered by status.
|
|
209
|
+
*
|
|
210
|
+
* Backed by the `GET /timelock-requests` backend endpoint. Makes exactly one
|
|
211
|
+
* HTTP request and no RPC calls.
|
|
212
|
+
*
|
|
213
|
+
* @param params.vaultAddress The vault address the requests target.
|
|
214
|
+
* @param params.chainId Numeric August chain id (must be a positive integer).
|
|
215
|
+
* @param params.status Status filter: `"scheduled"` (backend default), `"executed"`, `"cancelled"`, or `"all"`. Omit to use the backend default.
|
|
216
|
+
* @returns Array of {@link ITimelockRequest}; empty when the vault has no matching requests.
|
|
217
|
+
* @throws AugustValidationError When `vaultAddress` is invalid or `chainId` is not a positive integer.
|
|
218
|
+
* @throws AugustServerError When the API responds with a non-2xx status (e.g. an invalid status filter).
|
|
219
|
+
* @example
|
|
220
|
+
* const reqs = await sdk.apiModule.getTimelockRequests({ vaultAddress: '0xvault…', chainId: 1 });
|
|
221
|
+
*/
|
|
222
|
+
getTimelockRequests(params: {
|
|
223
|
+
vaultAddress: string;
|
|
224
|
+
chainId: number;
|
|
225
|
+
status?: string;
|
|
226
|
+
}): Promise<ITimelockRequest[]>;
|
|
227
|
+
/**
|
|
228
|
+
* Compute a vault's performance fees over a period (backend-computed from
|
|
229
|
+
* its snapshot history).
|
|
230
|
+
*
|
|
231
|
+
* Backed by `GET /metrics/vault_performance_fees`. The backend runs pandas
|
|
232
|
+
* over the vault's full snapshot history, so the first call is slow; results
|
|
233
|
+
* are cached server-side for 20 minutes. Makes exactly one HTTP request and
|
|
234
|
+
* no RPC calls.
|
|
235
|
+
*
|
|
236
|
+
* @param params.vault The vault address (EVM `0x…`, Solana, or Stellar).
|
|
237
|
+
* @param params.annualizedFeesPct Annualized performance-fee percentage. Defaults to 20.
|
|
238
|
+
* @param params.nativeDenominated Whether to denominate in the vault's native token. Defaults to `true`.
|
|
239
|
+
* @param params.calculationPeriod Period preset — `"YearToDate"` (default) or `"MonthToDate"`. Ignored by the backend when a custom `startDate`/`endDate` range is supplied.
|
|
240
|
+
* @param params.startDate ISO-8601 datetime range start. Must be supplied together with `endDate`.
|
|
241
|
+
* @param params.endDate ISO-8601 datetime range end. Must be supplied together with `startDate`.
|
|
242
|
+
* @returns The vault's {@link IVaultPerformanceFees} computation.
|
|
243
|
+
* @throws AugustValidationError When `vault` is invalid, or exactly one of `startDate`/`endDate` is supplied.
|
|
244
|
+
* @throws AugustServerError When there is insufficient snapshot data for the period, or the API otherwise responds non-2xx.
|
|
245
|
+
* @example
|
|
246
|
+
* const fees = await sdk.apiModule.getVaultPerformanceFees({ vault: '0xvault…' });
|
|
247
|
+
* console.log(fees.total_perf_fees_asset);
|
|
248
|
+
*/
|
|
249
|
+
getVaultPerformanceFees(params: {
|
|
250
|
+
vault: string;
|
|
251
|
+
annualizedFeesPct?: number;
|
|
252
|
+
nativeDenominated?: boolean;
|
|
253
|
+
calculationPeriod?: string;
|
|
254
|
+
startDate?: string;
|
|
255
|
+
endDate?: string;
|
|
256
|
+
}): Promise<IVaultPerformanceFees>;
|
|
257
|
+
/**
|
|
258
|
+
* Fetch a vault's NAV-oracle classification table — how each position/token
|
|
259
|
+
* is priced (Primary / Secondary Market / CeFi) and its USD value, plus
|
|
260
|
+
* warnings for tokens that could not be resolved.
|
|
261
|
+
*
|
|
262
|
+
* Backed by the public (unauthenticated) `GET
|
|
263
|
+
* /upshift/oracle_classification/{vault_address}` endpoint; no API key
|
|
264
|
+
* required. Reads the newest daily snapshot. Makes exactly one HTTP request
|
|
265
|
+
* and no RPC calls from the SDK.
|
|
266
|
+
*
|
|
267
|
+
* @param vault The vault address (EVM `0x…`, Solana, or Stellar).
|
|
268
|
+
* @param chainId Numeric August chain id the vault lives on.
|
|
269
|
+
* @returns The vault's {@link IOracleClassification}.
|
|
270
|
+
* @throws AugustValidationError When `vault` is invalid or `chainId` is not an integer.
|
|
271
|
+
* @throws AugustServerError When the vault or its snapshot is not found, or the API otherwise responds non-2xx.
|
|
272
|
+
* @example
|
|
273
|
+
* const cls = await sdk.apiModule.getVaultOracleClassification('0xvault…', 1);
|
|
274
|
+
* console.log(cls.warnings);
|
|
275
|
+
*/
|
|
276
|
+
getVaultOracleClassification(vault: string, chainId: number): Promise<IOracleClassification>;
|
|
16
277
|
/**
|
|
17
278
|
* Fetch the historical unrealized-PnL series for a vault, newest first,
|
|
18
279
|
* as computed by the August backend from periodic vault snapshots.
|