@augustdigital/sdk 8.22.1 → 8.25.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/adapters/solana/idl/vault-idl.d.ts +185 -18
- package/lib/adapters/solana/idl/vault-idl.js +521 -28
- package/lib/core/analytics/method-taxonomy.js +10 -0
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/attribution.d.ts +24 -8
- package/lib/core/attribution.js +21 -5
- package/lib/core/constants/core.d.ts +11 -0
- package/lib/core/constants/core.js +54 -0
- package/lib/core/helpers/signer.d.ts +2 -1
- package/lib/core/helpers/signer.js +7 -5
- package/lib/evm/methods/crossChainVault.d.ts +5 -1
- package/lib/evm/methods/crossChainVault.js +8 -4
- package/lib/main.d.ts +22 -2
- package/lib/main.js +22 -2
- package/lib/modules/api/fetcher.d.ts +27 -1
- package/lib/modules/api/fetcher.js +38 -1
- package/lib/modules/api/main.d.ts +288 -14
- package/lib/modules/api/main.js +439 -13
- package/lib/modules/vaults/write.actions.d.ts +4 -0
- package/lib/modules/vaults/write.actions.js +9 -1
- package/lib/sdk.d.ts +11586 -10847
- package/lib/types/api.d.ts +218 -0
- package/package.json +1 -1
|
@@ -36,6 +36,16 @@ exports.METHOD_CATEGORIES = {
|
|
|
36
36
|
getTimelockRequests: 'read.vault',
|
|
37
37
|
getVaultPerformanceFees: 'read.vault',
|
|
38
38
|
getVaultOracleClassification: 'read.vault',
|
|
39
|
+
// Transparency dashboard (one per card/tab)
|
|
40
|
+
getVaultPositionSnapshot: 'read.vault',
|
|
41
|
+
getVaultBackingSeries: 'read.vault',
|
|
42
|
+
getVaultSmoothedApy: 'read.vault',
|
|
43
|
+
getVaultHistoricalAllocations: 'read.vault',
|
|
44
|
+
getVaultFeeConfig: 'read.vault',
|
|
45
|
+
getVaultGovernanceRoles: 'read.vault',
|
|
46
|
+
getVaultGovernancePermissions: 'read.vault',
|
|
47
|
+
getVaultGovernanceTimelocks: 'read.vault',
|
|
48
|
+
getVaultGovernanceAuditLog: 'read.vault',
|
|
39
49
|
getVaultBorrowerHealthFactor: 'read.vault',
|
|
40
50
|
getYieldLastRealizedOn: 'read.vault',
|
|
41
51
|
getVaultActivity: 'read.vault',
|
|
@@ -42,10 +42,15 @@ export interface IAttributionConfig {
|
|
|
42
42
|
/**
|
|
43
43
|
* EVM chain IDs to attribute. Omit to attribute writes on every EVM chain
|
|
44
44
|
* (the suffix is inert on chains without an ERC-8021 indexer and costs
|
|
45
|
-
* ~16 gas per non-zero byte). When set,
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* ~16 gas per non-zero byte). When set, gating is fail-closed: writes on
|
|
46
|
+
* other chains — and writes whose chain ID cannot be determined — are sent
|
|
47
|
+
* without the suffix.
|
|
48
|
+
*
|
|
49
|
+
* Over-attribution is not harmless. The suffix makes calldata longer than
|
|
50
|
+
* the ABI encoding of the call, which breaks clear-signing on hardware
|
|
51
|
+
* wallets: a Ledger rejects an over-long ERC-20 `approve` with
|
|
52
|
+
* `EthAppCommandError: Invalid data 6a80`, so an unattributed chain that
|
|
53
|
+
* receives the suffix anyway cannot be transacted on from a Ledger at all.
|
|
49
54
|
*/
|
|
50
55
|
chains?: number[];
|
|
51
56
|
}
|
|
@@ -83,13 +88,23 @@ export declare function buildAttributionSuffix(codes: string[]): string;
|
|
|
83
88
|
* init, not on the first write.
|
|
84
89
|
*/
|
|
85
90
|
export declare function setAttribution(config: IAttributionConfig | null): void;
|
|
91
|
+
/**
|
|
92
|
+
* Whether attribution is configured at all, independent of any chain gate.
|
|
93
|
+
*
|
|
94
|
+
* Call sites that need to know whether to resolve a chain ID before asking
|
|
95
|
+
* for the suffix use this; {@link getAttributionSuffix} applies the gate.
|
|
96
|
+
*
|
|
97
|
+
* @returns `true` when builder codes are configured.
|
|
98
|
+
*/
|
|
99
|
+
export declare function isAttributionEnabled(): boolean;
|
|
86
100
|
/**
|
|
87
101
|
* Return the active ERC-8021 suffix for a write on the given chain, or
|
|
88
|
-
* `undefined` when attribution is off or the chain is
|
|
102
|
+
* `undefined` when attribution is off or the chain is not attributed.
|
|
89
103
|
*
|
|
90
104
|
* @param chainId EVM chain ID of the transaction, when the call site knows
|
|
91
|
-
* it. When
|
|
92
|
-
*
|
|
105
|
+
* it. When a `chains` restriction is configured, gating is fail-closed: an
|
|
106
|
+
* omitted chain ID yields no suffix, since a suffix on an unattributed
|
|
107
|
+
* chain buys nothing and breaks hardware-wallet clear-signing (see
|
|
93
108
|
* {@link IAttributionConfig.chains}).
|
|
94
109
|
* @returns `0x`-prefixed hex suffix, or `undefined` when nothing should be
|
|
95
110
|
* appended.
|
|
@@ -99,7 +114,8 @@ export declare function getAttributionSuffix(chainId?: number): string | undefin
|
|
|
99
114
|
* Append the active attribution suffix to calldata.
|
|
100
115
|
*
|
|
101
116
|
* No-ops (returns `data` unchanged) when attribution is off, the chain is
|
|
102
|
-
*
|
|
117
|
+
* not attributed (including an unknown chain under a `chains` restriction),
|
|
118
|
+
* `data` is empty/absent (plain value transfers are never
|
|
103
119
|
* attributed), or `data` already ends with the ERC-8021 marker (guards
|
|
104
120
|
* against double-appending when an upstream layer — e.g. a wagmi config
|
|
105
121
|
* `dataSuffix` — already attributed the transaction).
|
package/lib/core/attribution.js
CHANGED
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.ERC8021_MARKER = void 0;
|
|
19
19
|
exports.buildAttributionSuffix = buildAttributionSuffix;
|
|
20
20
|
exports.setAttribution = setAttribution;
|
|
21
|
+
exports.isAttributionEnabled = isAttributionEnabled;
|
|
21
22
|
exports.getAttributionSuffix = getAttributionSuffix;
|
|
22
23
|
exports.appendAttributionSuffix = appendAttributionSuffix;
|
|
23
24
|
/**
|
|
@@ -96,13 +97,25 @@ function setAttribution(config) {
|
|
|
96
97
|
? config.chains
|
|
97
98
|
: null;
|
|
98
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Whether attribution is configured at all, independent of any chain gate.
|
|
102
|
+
*
|
|
103
|
+
* Call sites that need to know whether to resolve a chain ID before asking
|
|
104
|
+
* for the suffix use this; {@link getAttributionSuffix} applies the gate.
|
|
105
|
+
*
|
|
106
|
+
* @returns `true` when builder codes are configured.
|
|
107
|
+
*/
|
|
108
|
+
function isAttributionEnabled() {
|
|
109
|
+
return activeSuffix !== null;
|
|
110
|
+
}
|
|
99
111
|
/**
|
|
100
112
|
* Return the active ERC-8021 suffix for a write on the given chain, or
|
|
101
|
-
* `undefined` when attribution is off or the chain is
|
|
113
|
+
* `undefined` when attribution is off or the chain is not attributed.
|
|
102
114
|
*
|
|
103
115
|
* @param chainId EVM chain ID of the transaction, when the call site knows
|
|
104
|
-
* it. When
|
|
105
|
-
*
|
|
116
|
+
* it. When a `chains` restriction is configured, gating is fail-closed: an
|
|
117
|
+
* omitted chain ID yields no suffix, since a suffix on an unattributed
|
|
118
|
+
* chain buys nothing and breaks hardware-wallet clear-signing (see
|
|
106
119
|
* {@link IAttributionConfig.chains}).
|
|
107
120
|
* @returns `0x`-prefixed hex suffix, or `undefined` when nothing should be
|
|
108
121
|
* appended.
|
|
@@ -110,7 +123,9 @@ function setAttribution(config) {
|
|
|
110
123
|
function getAttributionSuffix(chainId) {
|
|
111
124
|
if (!activeSuffix)
|
|
112
125
|
return undefined;
|
|
113
|
-
if (activeChains
|
|
126
|
+
if (activeChains) {
|
|
127
|
+
if (typeof chainId !== 'number')
|
|
128
|
+
return undefined;
|
|
114
129
|
if (!activeChains.includes(chainId))
|
|
115
130
|
return undefined;
|
|
116
131
|
}
|
|
@@ -120,7 +135,8 @@ function getAttributionSuffix(chainId) {
|
|
|
120
135
|
* Append the active attribution suffix to calldata.
|
|
121
136
|
*
|
|
122
137
|
* No-ops (returns `data` unchanged) when attribution is off, the chain is
|
|
123
|
-
*
|
|
138
|
+
* not attributed (including an unknown chain under a `chains` restriction),
|
|
139
|
+
* `data` is empty/absent (plain value transfers are never
|
|
124
140
|
* attributed), or `data` already ends with the ERC-8021 marker (guards
|
|
125
141
|
* against double-appending when an upstream layer — e.g. a wagmi config
|
|
126
142
|
* `dataSuffix` — already attributed the transaction).
|
|
@@ -117,6 +117,17 @@ export declare const WEBSERVER_ENDPOINTS: {
|
|
|
117
117
|
};
|
|
118
118
|
revertReason: (txHash: string, chain: number) => string;
|
|
119
119
|
oracleClassification: (vaultAddress: string, chainId: number) => string;
|
|
120
|
+
transparency: {
|
|
121
|
+
positions: (vaultAddress: string, chainId: number) => string;
|
|
122
|
+
historicalAllocations: (vaultAddress: string, chainId: number, startDate?: string, endDate?: string) => string;
|
|
123
|
+
fees: (vaultAddress: string, chainId: number) => string;
|
|
124
|
+
ratioSeries: (vaultAddress: string, startDate?: string, endDate?: string, limit?: number) => string;
|
|
125
|
+
smoothedApy: (vaultAddress: string, daysAgo: number, averagingPeriodDays: number, applySmoothing: boolean) => string;
|
|
126
|
+
governanceRoles: (vaultAddress: string, chainId: number) => string;
|
|
127
|
+
governancePermissions: (vaultAddress: string, chainId: number) => string;
|
|
128
|
+
governanceTimelocks: (vaultAddress: string, chainId: number, status?: string) => string;
|
|
129
|
+
governanceAuditLog: (vaultAddress: string, chainId: number, category?: string, before?: string, limit?: number) => string;
|
|
130
|
+
};
|
|
120
131
|
};
|
|
121
132
|
upshift: {
|
|
122
133
|
vaults: {
|
|
@@ -191,6 +191,60 @@ exports.WEBSERVER_ENDPOINTS = {
|
|
|
191
191
|
chain: String(chain),
|
|
192
192
|
}).toString()}`,
|
|
193
193
|
oracleClassification: (vaultAddress, chainId) => `/upshift/oracle_classification/${encodeURIComponent(vaultAddress)}?chain_id=${chainId}`,
|
|
194
|
+
// Transparency dashboard endpoints (all public, snapshot-backed).
|
|
195
|
+
transparency: {
|
|
196
|
+
positions: (vaultAddress, chainId) => `/upshift/positions/${encodeURIComponent(vaultAddress)}?chain_id=${chainId}`,
|
|
197
|
+
historicalAllocations: (vaultAddress, chainId, startDate, endDate) => {
|
|
198
|
+
const q = new URLSearchParams({ chain_id: String(chainId) });
|
|
199
|
+
if (startDate)
|
|
200
|
+
q.set('start_date', startDate);
|
|
201
|
+
// The backend compares `<= end_date` as a datetime, so a bare date
|
|
202
|
+
// would exclude the whole last day; widen to end-of-day for the
|
|
203
|
+
// documented inclusive semantics.
|
|
204
|
+
if (endDate)
|
|
205
|
+
q.set('end_date', `${endDate}T23:59:59.999`);
|
|
206
|
+
return `/upshift/historical_allocations/${encodeURIComponent(vaultAddress)}?${q.toString()}`;
|
|
207
|
+
},
|
|
208
|
+
fees: (vaultAddress, chainId) => `/upshift/fees/${encodeURIComponent(vaultAddress)}?chain_id=${chainId}`,
|
|
209
|
+
ratioSeries: (vaultAddress, startDate, endDate, limit) => {
|
|
210
|
+
const q = new URLSearchParams({
|
|
211
|
+
vault_address: vaultAddress,
|
|
212
|
+
fields: 'ratio',
|
|
213
|
+
});
|
|
214
|
+
if (startDate)
|
|
215
|
+
q.set('start_date', startDate);
|
|
216
|
+
// See historicalAllocations: widen to end-of-day for inclusive semantics.
|
|
217
|
+
if (endDate)
|
|
218
|
+
q.set('end_date', `${endDate}T23:59:59.999`);
|
|
219
|
+
if (limit !== undefined)
|
|
220
|
+
q.set('limit', String(limit));
|
|
221
|
+
return `/upshift/unrealized_pnl?${q.toString()}`;
|
|
222
|
+
},
|
|
223
|
+
smoothedApy: (vaultAddress, daysAgo, averagingPeriodDays, applySmoothing) => `/upshift/historical_apy/chart?${new URLSearchParams({
|
|
224
|
+
vault_address: vaultAddress,
|
|
225
|
+
days_ago: String(daysAgo),
|
|
226
|
+
averaging_period_in_days: String(averagingPeriodDays),
|
|
227
|
+
apply_smoothing: String(applySmoothing),
|
|
228
|
+
}).toString()}`,
|
|
229
|
+
governanceRoles: (vaultAddress, chainId) => `/upshift/governance/${encodeURIComponent(vaultAddress)}/roles?chain_id=${chainId}`,
|
|
230
|
+
governancePermissions: (vaultAddress, chainId) => `/upshift/governance/${encodeURIComponent(vaultAddress)}/permissions?chain_id=${chainId}`,
|
|
231
|
+
governanceTimelocks: (vaultAddress, chainId, status) => {
|
|
232
|
+
const q = new URLSearchParams({ chain_id: String(chainId) });
|
|
233
|
+
if (status)
|
|
234
|
+
q.set('status', status);
|
|
235
|
+
return `/upshift/governance/${encodeURIComponent(vaultAddress)}/timelocks?${q.toString()}`;
|
|
236
|
+
},
|
|
237
|
+
governanceAuditLog: (vaultAddress, chainId, category, before, limit) => {
|
|
238
|
+
const q = new URLSearchParams({ chain_id: String(chainId) });
|
|
239
|
+
if (category)
|
|
240
|
+
q.set('category', category);
|
|
241
|
+
if (before)
|
|
242
|
+
q.set('before', before);
|
|
243
|
+
if (limit !== undefined)
|
|
244
|
+
q.set('limit', String(limit));
|
|
245
|
+
return `/upshift/governance/${encodeURIComponent(vaultAddress)}/audit_log?${q.toString()}`;
|
|
246
|
+
},
|
|
247
|
+
},
|
|
194
248
|
},
|
|
195
249
|
upshift: {
|
|
196
250
|
vaults: {
|
|
@@ -44,7 +44,8 @@ export type CompatibleSigner = Signer | Wallet | any;
|
|
|
44
44
|
* already ending in the ERC-8021 marker is left untouched. When the
|
|
45
45
|
* configured `chains` list requires a chain check and the transaction does
|
|
46
46
|
* not carry a `chainId`, the signer's provider network is consulted (one
|
|
47
|
-
* cached RPC call)
|
|
47
|
+
* cached RPC call); if that lookup fails the transaction is sent
|
|
48
|
+
* unattributed.
|
|
48
49
|
*
|
|
49
50
|
* @param signer Normalized ethers Signer or Wallet.
|
|
50
51
|
* @returns A proxied signer with an attribution-aware `sendTransaction`.
|
|
@@ -107,7 +107,8 @@ async function normalizeSigner(signer) {
|
|
|
107
107
|
* already ending in the ERC-8021 marker is left untouched. When the
|
|
108
108
|
* configured `chains` list requires a chain check and the transaction does
|
|
109
109
|
* not carry a `chainId`, the signer's provider network is consulted (one
|
|
110
|
-
* cached RPC call)
|
|
110
|
+
* cached RPC call); if that lookup fails the transaction is sent
|
|
111
|
+
* unattributed.
|
|
111
112
|
*
|
|
112
113
|
* @param signer Normalized ethers Signer or Wallet.
|
|
113
114
|
* @returns A proxied signer with an attribution-aware `sendTransaction`.
|
|
@@ -117,7 +118,7 @@ function wrapSignerWithAttribution(signer) {
|
|
|
117
118
|
get(target, prop) {
|
|
118
119
|
if (prop === 'sendTransaction') {
|
|
119
120
|
return async (tx) => {
|
|
120
|
-
if (!(0, attribution_1.
|
|
121
|
+
if (!(0, attribution_1.isAttributionEnabled)() || typeof tx?.data !== 'string') {
|
|
121
122
|
return target.sendTransaction(tx);
|
|
122
123
|
}
|
|
123
124
|
let chainId = tx.chainId != null ? Number(tx.chainId) : undefined;
|
|
@@ -126,9 +127,10 @@ function wrapSignerWithAttribution(signer) {
|
|
|
126
127
|
chainId = Number((await target.provider.getNetwork()).chainId);
|
|
127
128
|
}
|
|
128
129
|
catch {
|
|
129
|
-
// Unknown chain: fall through with chainId undefined
|
|
130
|
-
//
|
|
131
|
-
//
|
|
130
|
+
// Unknown chain: fall through with chainId undefined. Under a
|
|
131
|
+
// `chains` restriction that means no suffix — attributing a
|
|
132
|
+
// chain we cannot identify risks breaking hardware-wallet
|
|
133
|
+
// clear-signing for a gain we cannot confirm.
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
136
|
const data = (0, attribution_1.appendAttributionSuffix)(tx.data, chainId);
|
|
@@ -43,6 +43,10 @@ export declare function needsCrossChainApproval(tokenAddress: IAddress, spenderA
|
|
|
43
43
|
/**
|
|
44
44
|
* Execute a token approval for a cross-chain operation.
|
|
45
45
|
*
|
|
46
|
+
* @param chainId Chain the approval is sent on, used to gate ERC-8021
|
|
47
|
+
* attribution. Omitted means unattributed under a `chains` restriction —
|
|
48
|
+
* the suffix would lengthen `approve` calldata past its ABI encoding and
|
|
49
|
+
* break Ledger clear-signing.
|
|
46
50
|
* @returns Transaction hash of the approval
|
|
47
51
|
*/
|
|
48
52
|
export declare function approveCrossChain(tokenAddress: IAddress, spenderAddress: IAddress, amount: bigint, walletClient: {
|
|
@@ -56,7 +60,7 @@ export declare function approveCrossChain(tokenAddress: IAddress, spenderAddress
|
|
|
56
60
|
}) => Promise<{
|
|
57
61
|
status: string;
|
|
58
62
|
}>;
|
|
59
|
-
}): Promise<string>;
|
|
63
|
+
}, chainId?: number): Promise<string>;
|
|
60
64
|
/**
|
|
61
65
|
* Execute a cross-chain deposit via LayerZero OVault. Validates the source
|
|
62
66
|
* chain, ensures approval, estimates gas with a buffer, and waits for the
|
|
@@ -526,9 +526,13 @@ async function needsCrossChainApproval(tokenAddress, spenderAddress, walletAddre
|
|
|
526
526
|
/**
|
|
527
527
|
* Execute a token approval for a cross-chain operation.
|
|
528
528
|
*
|
|
529
|
+
* @param chainId Chain the approval is sent on, used to gate ERC-8021
|
|
530
|
+
* attribution. Omitted means unattributed under a `chains` restriction —
|
|
531
|
+
* the suffix would lengthen `approve` calldata past its ABI encoding and
|
|
532
|
+
* break Ledger clear-signing.
|
|
529
533
|
* @returns Transaction hash of the approval
|
|
530
534
|
*/
|
|
531
|
-
async function approveCrossChain(tokenAddress, spenderAddress, amount, walletClient, publicClient) {
|
|
535
|
+
async function approveCrossChain(tokenAddress, spenderAddress, amount, walletClient, publicClient, chainId) {
|
|
532
536
|
if (!walletClient.account) {
|
|
533
537
|
throw new Error('Wallet not ready — please reconnect your wallet');
|
|
534
538
|
}
|
|
@@ -538,7 +542,7 @@ async function approveCrossChain(tokenAddress, spenderAddress, amount, walletCli
|
|
|
538
542
|
abi: OFT_1.ABI_CROSS_CHAIN_ERC20,
|
|
539
543
|
functionName: 'approve',
|
|
540
544
|
args: [spenderAddress, amount],
|
|
541
|
-
dataSuffix: (0, attribution_1.getAttributionSuffix)(),
|
|
545
|
+
dataSuffix: (0, attribution_1.getAttributionSuffix)(chainId),
|
|
542
546
|
});
|
|
543
547
|
const receipt = await publicClient.waitForTransactionReceipt({
|
|
544
548
|
hash: hash,
|
|
@@ -595,7 +599,7 @@ async function crossChainVaultDeposit(props) {
|
|
|
595
599
|
BigInt((0, core_1.toNormalizedBn)(props.amount, props.decimals).raw);
|
|
596
600
|
const approvalNeeded = await needsCrossChainApproval(tokenAddr, spenderAddr, props.walletAddress, approvalAmount, publicClient);
|
|
597
601
|
if (approvalNeeded) {
|
|
598
|
-
await approveCrossChain(tokenAddr, spenderAddr, approvalAmount, walletClient, publicClient);
|
|
602
|
+
await approveCrossChain(tokenAddr, spenderAddr, approvalAmount, walletClient, publicClient, props.userChainId);
|
|
599
603
|
}
|
|
600
604
|
}
|
|
601
605
|
// 3. Estimate gas with buffer
|
|
@@ -678,7 +682,7 @@ async function crossChainVaultRedeem(props) {
|
|
|
678
682
|
if (!props.skipApprovalCheck && txInputs.approval) {
|
|
679
683
|
const approvalNeeded = await needsCrossChainApproval(txInputs.approval.tokenAddress, txInputs.approval.spender, props.walletAddress, txInputs.approval.amount, publicClient);
|
|
680
684
|
if (approvalNeeded) {
|
|
681
|
-
await approveCrossChain(txInputs.approval.tokenAddress, txInputs.approval.spender, txInputs.approval.amount, walletClient, publicClient);
|
|
685
|
+
await approveCrossChain(txInputs.approval.tokenAddress, txInputs.approval.spender, txInputs.approval.amount, walletClient, publicClient, props.config.hubChainId);
|
|
682
686
|
}
|
|
683
687
|
}
|
|
684
688
|
// 4. Estimate gas with buffer
|
package/lib/main.d.ts
CHANGED
|
@@ -41,8 +41,9 @@ export declare class AugustSDK extends AugustBase {
|
|
|
41
41
|
get vaultsModule(): AugustVaults;
|
|
42
42
|
/**
|
|
43
43
|
* Get the backend API module instance ({@link AugustApi}) — read-only
|
|
44
|
-
* access to backend-computed data with no on-chain equivalent
|
|
45
|
-
*
|
|
44
|
+
* access to backend-computed data with no on-chain equivalent: the
|
|
45
|
+
* unrealized-PnL series and the transparency dashboard (position snapshot,
|
|
46
|
+
* backing series, smoothed APY, allocations, fee config, governance).
|
|
46
47
|
*/
|
|
47
48
|
get apiModule(): AugustApi;
|
|
48
49
|
/**
|
|
@@ -119,8 +120,27 @@ export declare class AugustSDK extends AugustBase {
|
|
|
119
120
|
}): Promise<import("./types").IVaultLoan[]>;
|
|
120
121
|
/**
|
|
121
122
|
* Get vault asset allocations across DeFi protocols, CeFi, and OTC positions.
|
|
123
|
+
*
|
|
124
|
+
* This is the data behind the "Vault Exposure" section of the Upshift app —
|
|
125
|
+
* a partner rendering that section in their own frontend needs only this
|
|
126
|
+
* call. Read `exposurePerCategory` for the pre-bucketed view the UI renders
|
|
127
|
+
* (`supplying` / `borrowing` / `wallet` / `lending` legs plus per-category
|
|
128
|
+
* USD totals) and `netValue` for the headline figure; the raw `defi` /
|
|
129
|
+
* `cefi` / `otc` arrays back the drill-downs. See the "Rendering the Vault
|
|
130
|
+
* Exposure section" guide in the vaults docs for a faithful reproduction.
|
|
131
|
+
*
|
|
122
132
|
* @param props - Vault address and chain ID
|
|
123
133
|
* @returns Detailed breakdown of vault allocations by category
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* const { exposurePerCategory, netValue } = await sdk.getVaultAllocations({
|
|
137
|
+
* vault: '0xcd69123b3FBBfC666E1f6a501da27B564C00De54',
|
|
138
|
+
* chainId: 1,
|
|
139
|
+
* });
|
|
140
|
+
* for (const item of exposurePerCategory?.supplying ?? []) {
|
|
141
|
+
* console.log(item.protocol, item.symbol, item.amount);
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
124
144
|
*/
|
|
125
145
|
getVaultAllocations(props: {
|
|
126
146
|
vault: IAddress;
|
package/lib/main.js
CHANGED
|
@@ -146,8 +146,9 @@ class AugustSDK extends core_1.AugustBase {
|
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Get the backend API module instance ({@link AugustApi}) — read-only
|
|
149
|
-
* access to backend-computed data with no on-chain equivalent
|
|
150
|
-
*
|
|
149
|
+
* access to backend-computed data with no on-chain equivalent: the
|
|
150
|
+
* unrealized-PnL series and the transparency dashboard (position snapshot,
|
|
151
|
+
* backing series, smoothed APY, allocations, fee config, governance).
|
|
151
152
|
*/
|
|
152
153
|
get apiModule() {
|
|
153
154
|
return this.api;
|
|
@@ -242,8 +243,27 @@ class AugustSDK extends core_1.AugustBase {
|
|
|
242
243
|
}
|
|
243
244
|
/**
|
|
244
245
|
* Get vault asset allocations across DeFi protocols, CeFi, and OTC positions.
|
|
246
|
+
*
|
|
247
|
+
* This is the data behind the "Vault Exposure" section of the Upshift app —
|
|
248
|
+
* a partner rendering that section in their own frontend needs only this
|
|
249
|
+
* call. Read `exposurePerCategory` for the pre-bucketed view the UI renders
|
|
250
|
+
* (`supplying` / `borrowing` / `wallet` / `lending` legs plus per-category
|
|
251
|
+
* USD totals) and `netValue` for the headline figure; the raw `defi` /
|
|
252
|
+
* `cefi` / `otc` arrays back the drill-downs. See the "Rendering the Vault
|
|
253
|
+
* Exposure section" guide in the vaults docs for a faithful reproduction.
|
|
254
|
+
*
|
|
245
255
|
* @param props - Vault address and chain ID
|
|
246
256
|
* @returns Detailed breakdown of vault allocations by category
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* const { exposurePerCategory, netValue } = await sdk.getVaultAllocations({
|
|
260
|
+
* vault: '0xcd69123b3FBBfC666E1f6a501da27B564C00De54',
|
|
261
|
+
* chainId: 1,
|
|
262
|
+
* });
|
|
263
|
+
* for (const item of exposurePerCategory?.supplying ?? []) {
|
|
264
|
+
* console.log(item.protocol, item.symbol, item.amount);
|
|
265
|
+
* }
|
|
266
|
+
* ```
|
|
247
267
|
*/
|
|
248
268
|
async getVaultAllocations(props) {
|
|
249
269
|
return await this.vaults.getVaultAllocations(props);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IFetchAugustOptions } from '../../core';
|
|
2
|
-
import type { ICollateralExcessOrDeficit, ICollateralSimulationInput, ICollateralSimulationResults, ICuratorWhitelistStatus, IDiscountFactorLadder, ILoanBookInfo, IOracleClassification, IOtcMarginRequirement, IOtcPositionRead, IRevertReason, ITimelockRequest, IVaultPerformanceFees, IWSSubaccountListItem } from '../../types';
|
|
2
|
+
import type { ICollateralExcessOrDeficit, ICollateralSimulationInput, ICollateralSimulationResults, ICuratorWhitelistStatus, IDiscountFactorLadder, ILoanBookInfo, IOracleClassification, IOtcMarginRequirement, IOtcPositionRead, IRevertReason, ITimelockRequest, ITransparencyAuditLog, ITransparencyFees, ITransparencyGovernancePermissions, ITransparencyGovernanceRoles, ITransparencyHistoricalAllocations, ITransparencyPositions, ITransparencyRatioPoint, ITransparencyTimelocks, IVaultPerformanceFees, IWSSubaccountListItem } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Fetch the global loan-book aggregate (admin-only `GET /dashboard/loans`).
|
|
5
5
|
*/
|
|
@@ -80,3 +80,29 @@ export declare const fetchVaultPerformanceFees: (params: {
|
|
|
80
80
|
* required.
|
|
81
81
|
*/
|
|
82
82
|
export declare const fetchVaultOracleClassification: (vaultAddress: string, chainId: number, headers?: IFetchAugustOptions["headers"]) => Promise<IOracleClassification>;
|
|
83
|
+
/** Public `GET /upshift/positions/{vault}` — latest per-wallet position snapshot. */
|
|
84
|
+
export declare const fetchTransparencyPositions: (vaultAddress: string, chainId: number, headers?: IFetchAugustOptions["headers"]) => Promise<ITransparencyPositions>;
|
|
85
|
+
/** Public `GET /upshift/historical_allocations/{vault}` — daily per-protocol allocation history. */
|
|
86
|
+
export declare const fetchTransparencyHistoricalAllocations: (vaultAddress: string, chainId: number, startDate?: string, endDate?: string, headers?: IFetchAugustOptions["headers"]) => Promise<ITransparencyHistoricalAllocations>;
|
|
87
|
+
/** Public `GET /upshift/fees/{vault}` — vault fee configuration. */
|
|
88
|
+
export declare const fetchTransparencyFees: (vaultAddress: string, chainId: number, headers?: IFetchAugustOptions["headers"]) => Promise<ITransparencyFees>;
|
|
89
|
+
/** Public `GET /upshift/unrealized_pnl?fields=ratio` — hourly backing / supply / collateral-ratio series. */
|
|
90
|
+
export declare const fetchTransparencyRatioSeries: (vaultAddress: string, startDate?: string, endDate?: string, limit?: number, headers?: IFetchAugustOptions["headers"]) => Promise<ITransparencyRatioPoint[]>;
|
|
91
|
+
/** Public `GET /upshift/historical_apy/chart` — smoothed rolling-APY series; returns the raw backend envelope. */
|
|
92
|
+
export declare const fetchTransparencySmoothedApy: (vaultAddress: string, daysAgo: number, averagingPeriodDays: number, applySmoothing: boolean, headers?: IFetchAugustOptions["headers"]) => Promise<{
|
|
93
|
+
data: {
|
|
94
|
+
labels: string[];
|
|
95
|
+
values: number[];
|
|
96
|
+
};
|
|
97
|
+
average_apy?: number | null;
|
|
98
|
+
status: number;
|
|
99
|
+
error?: string | null;
|
|
100
|
+
}>;
|
|
101
|
+
/** Public `GET /upshift/governance/{vault}/roles` — owner/operator addresses with custody enrichment. */
|
|
102
|
+
export declare const fetchTransparencyGovernanceRoles: (vaultAddress: string, chainId: number, headers?: IFetchAugustOptions["headers"]) => Promise<ITransparencyGovernanceRoles>;
|
|
103
|
+
/** Public `GET /upshift/governance/{vault}/permissions` — whitelisted integrations per vault wallet. */
|
|
104
|
+
export declare const fetchTransparencyGovernancePermissions: (vaultAddress: string, chainId: number, headers?: IFetchAugustOptions["headers"]) => Promise<ITransparencyGovernancePermissions>;
|
|
105
|
+
/** Public `GET /upshift/governance/{vault}/timelocks` — timelock queue, default pending only. */
|
|
106
|
+
export declare const fetchTransparencyGovernanceTimelocks: (vaultAddress: string, chainId: number, status?: string, headers?: IFetchAugustOptions["headers"]) => Promise<ITransparencyTimelocks>;
|
|
107
|
+
/** Public `GET /upshift/governance/{vault}/audit_log` — one page of the governance audit log. */
|
|
108
|
+
export declare const fetchTransparencyGovernanceAuditLog: (vaultAddress: string, chainId: number, category?: string, before?: string, limit?: number, headers?: IFetchAugustOptions["headers"]) => Promise<ITransparencyAuditLog>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
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;
|
|
3
|
+
exports.fetchTransparencyGovernanceAuditLog = exports.fetchTransparencyGovernanceTimelocks = exports.fetchTransparencyGovernancePermissions = exports.fetchTransparencyGovernanceRoles = exports.fetchTransparencySmoothedApy = exports.fetchTransparencyRatioSeries = exports.fetchTransparencyFees = exports.fetchTransparencyHistoricalAllocations = exports.fetchTransparencyPositions = 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
4
|
const core_1 = require("../../core");
|
|
5
5
|
/**
|
|
6
6
|
* Fetch the global loan-book aggregate (admin-only `GET /dashboard/loans`).
|
|
@@ -147,4 +147,41 @@ const fetchVaultOracleClassification = async (vaultAddress, chainId, headers) =>
|
|
|
147
147
|
return response.json();
|
|
148
148
|
};
|
|
149
149
|
exports.fetchVaultOracleClassification = fetchVaultOracleClassification;
|
|
150
|
+
/**
|
|
151
|
+
* Shared GET for the public transparency-dashboard endpoints. One HTTPS
|
|
152
|
+
* request, no RPC. `fetchAugustPublic` already maps non-2xx to typed
|
|
153
|
+
* `AugustServerError` / `AugustRateLimitError` / `AugustTimeoutError`, so
|
|
154
|
+
* this only parses the body; validation happens in the module layer.
|
|
155
|
+
*/
|
|
156
|
+
const fetchTransparency = async (endpoint, headers) => {
|
|
157
|
+
const response = await (0, core_1.fetchAugustPublic)(endpoint, { headers });
|
|
158
|
+
return response.json();
|
|
159
|
+
};
|
|
160
|
+
/** Public `GET /upshift/positions/{vault}` — latest per-wallet position snapshot. */
|
|
161
|
+
const fetchTransparencyPositions = (vaultAddress, chainId, headers) => fetchTransparency(core_1.WEBSERVER_ENDPOINTS.public.transparency.positions(vaultAddress, chainId), headers);
|
|
162
|
+
exports.fetchTransparencyPositions = fetchTransparencyPositions;
|
|
163
|
+
/** Public `GET /upshift/historical_allocations/{vault}` — daily per-protocol allocation history. */
|
|
164
|
+
const fetchTransparencyHistoricalAllocations = (vaultAddress, chainId, startDate, endDate, headers) => fetchTransparency(core_1.WEBSERVER_ENDPOINTS.public.transparency.historicalAllocations(vaultAddress, chainId, startDate, endDate), headers);
|
|
165
|
+
exports.fetchTransparencyHistoricalAllocations = fetchTransparencyHistoricalAllocations;
|
|
166
|
+
/** Public `GET /upshift/fees/{vault}` — vault fee configuration. */
|
|
167
|
+
const fetchTransparencyFees = (vaultAddress, chainId, headers) => fetchTransparency(core_1.WEBSERVER_ENDPOINTS.public.transparency.fees(vaultAddress, chainId), headers);
|
|
168
|
+
exports.fetchTransparencyFees = fetchTransparencyFees;
|
|
169
|
+
/** Public `GET /upshift/unrealized_pnl?fields=ratio` — hourly backing / supply / collateral-ratio series. */
|
|
170
|
+
const fetchTransparencyRatioSeries = (vaultAddress, startDate, endDate, limit, headers) => fetchTransparency(core_1.WEBSERVER_ENDPOINTS.public.transparency.ratioSeries(vaultAddress, startDate, endDate, limit), headers);
|
|
171
|
+
exports.fetchTransparencyRatioSeries = fetchTransparencyRatioSeries;
|
|
172
|
+
/** Public `GET /upshift/historical_apy/chart` — smoothed rolling-APY series; returns the raw backend envelope. */
|
|
173
|
+
const fetchTransparencySmoothedApy = (vaultAddress, daysAgo, averagingPeriodDays, applySmoothing, headers) => fetchTransparency(core_1.WEBSERVER_ENDPOINTS.public.transparency.smoothedApy(vaultAddress, daysAgo, averagingPeriodDays, applySmoothing), headers);
|
|
174
|
+
exports.fetchTransparencySmoothedApy = fetchTransparencySmoothedApy;
|
|
175
|
+
/** Public `GET /upshift/governance/{vault}/roles` — owner/operator addresses with custody enrichment. */
|
|
176
|
+
const fetchTransparencyGovernanceRoles = (vaultAddress, chainId, headers) => fetchTransparency(core_1.WEBSERVER_ENDPOINTS.public.transparency.governanceRoles(vaultAddress, chainId), headers);
|
|
177
|
+
exports.fetchTransparencyGovernanceRoles = fetchTransparencyGovernanceRoles;
|
|
178
|
+
/** Public `GET /upshift/governance/{vault}/permissions` — whitelisted integrations per vault wallet. */
|
|
179
|
+
const fetchTransparencyGovernancePermissions = (vaultAddress, chainId, headers) => fetchTransparency(core_1.WEBSERVER_ENDPOINTS.public.transparency.governancePermissions(vaultAddress, chainId), headers);
|
|
180
|
+
exports.fetchTransparencyGovernancePermissions = fetchTransparencyGovernancePermissions;
|
|
181
|
+
/** Public `GET /upshift/governance/{vault}/timelocks` — timelock queue, default pending only. */
|
|
182
|
+
const fetchTransparencyGovernanceTimelocks = (vaultAddress, chainId, status, headers) => fetchTransparency(core_1.WEBSERVER_ENDPOINTS.public.transparency.governanceTimelocks(vaultAddress, chainId, status), headers);
|
|
183
|
+
exports.fetchTransparencyGovernanceTimelocks = fetchTransparencyGovernanceTimelocks;
|
|
184
|
+
/** Public `GET /upshift/governance/{vault}/audit_log` — one page of the governance audit log. */
|
|
185
|
+
const fetchTransparencyGovernanceAuditLog = (vaultAddress, chainId, category, before, limit, headers) => fetchTransparency(core_1.WEBSERVER_ENDPOINTS.public.transparency.governanceAuditLog(vaultAddress, chainId, category, before, limit), headers);
|
|
186
|
+
exports.fetchTransparencyGovernanceAuditLog = fetchTransparencyGovernanceAuditLog;
|
|
150
187
|
//# sourceMappingURL=fetcher.js.map
|