@augustdigital/sdk 9.2.0 → 9.2.1
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.
|
@@ -20,8 +20,12 @@ import type { IVaultBaseOptions } from './types';
|
|
|
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
22
|
* @param vault - Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
|
|
23
|
-
* @param loans - Include active loan data
|
|
24
|
-
*
|
|
23
|
+
* @param loans - Include active loan data. EVM vaults only — there is no
|
|
24
|
+
* non-EVM loan book to read, so other families keep the empty default.
|
|
25
|
+
* @param allocations - Include DeFi/CeFi allocation breakdowns. Resolved for EVM
|
|
26
|
+
* vaults (via DeBank) and Stellar vaults (via the Untangled portfolio API).
|
|
27
|
+
* Solana and Sui have no vault-level portfolio provider and keep the empty
|
|
28
|
+
* default.
|
|
25
29
|
* @param options - RPC and service configuration
|
|
26
30
|
* @param tokenizedVault - Optional pre-fetched backend row for `vault`. When a
|
|
27
31
|
* caller already holds the row (e.g. `getVaults` fetched the whole list one
|
|
@@ -110,8 +110,12 @@ const errors_1 = require("../../core/errors");
|
|
|
110
110
|
* Routes to appropriate chain adapter (EVM v1/v2, Solana, or Stellar) based on vault version.
|
|
111
111
|
* Optionally enriches with loan and allocation data.
|
|
112
112
|
* @param vault - Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
|
|
113
|
-
* @param loans - Include active loan data
|
|
114
|
-
*
|
|
113
|
+
* @param loans - Include active loan data. EVM vaults only — there is no
|
|
114
|
+
* non-EVM loan book to read, so other families keep the empty default.
|
|
115
|
+
* @param allocations - Include DeFi/CeFi allocation breakdowns. Resolved for EVM
|
|
116
|
+
* vaults (via DeBank) and Stellar vaults (via the Untangled portfolio API).
|
|
117
|
+
* Solana and Sui have no vault-level portfolio provider and keep the empty
|
|
118
|
+
* default.
|
|
115
119
|
* @param options - RPC and service configuration
|
|
116
120
|
* @param tokenizedVault - Optional pre-fetched backend row for `vault`. When a
|
|
117
121
|
* caller already holds the row (e.g. `getVaults` fetched the whole list one
|
|
@@ -153,24 +157,33 @@ async function getVault({ vault, loans = false, allocations = false, options, lo
|
|
|
153
157
|
core_1.Logger.log.error('getVault', err, { vault });
|
|
154
158
|
throw new Error(`#getVault::${vault}: ${err?.message}`);
|
|
155
159
|
}
|
|
156
|
-
// Loans
|
|
157
|
-
//
|
|
160
|
+
// Loans enrichment stays EVM-only — there is no non-EVM loan book to read.
|
|
161
|
+
// Allocations additionally covers Stellar, whose exposure resolves through the
|
|
162
|
+
// Untangled portfolio API rather than DeBank; gating it on `isEvmVault` left
|
|
163
|
+
// `getVaultAllocations` unreachable for the one chain family that needed the
|
|
164
|
+
// new path, so callers got the empty default while the standalone getter
|
|
165
|
+
// returned real data. Solana and Sui have no vault-level provider, so they
|
|
166
|
+
// keep the empty defaults.
|
|
158
167
|
const isEvmVault = returnedVault.version !== 'sol-0' &&
|
|
159
168
|
returnedVault.version !== 'stellar-0' &&
|
|
160
169
|
returnedVault.version !== 'sui-0';
|
|
161
|
-
|
|
162
|
-
|
|
170
|
+
const supportsLoans = isEvmVault;
|
|
171
|
+
const supportsAllocations = isEvmVault || returnedVault.version === 'stellar-0';
|
|
172
|
+
const readLoans = loans && supportsLoans;
|
|
173
|
+
const readAllocations = allocations && supportsAllocations;
|
|
174
|
+
if ((loans && !supportsLoans) || (allocations && !supportsAllocations)) {
|
|
175
|
+
core_1.Logger.log.warn('getVault', 'Loans/allocations enrichment is not supported for this vault — skipping', { vault, version: returnedVault.version });
|
|
163
176
|
}
|
|
164
|
-
if (
|
|
177
|
+
if (!(0, core_1.isBadVault)(vault) && (readLoans || readAllocations)) {
|
|
165
178
|
const [loansResult, allocationsResult] = await Promise.allSettled([
|
|
166
|
-
|
|
179
|
+
readLoans
|
|
167
180
|
? getVaultLoans(returnedVault, options)
|
|
168
181
|
: Promise.resolve(undefined),
|
|
169
|
-
|
|
182
|
+
readAllocations
|
|
170
183
|
? getVaultAllocations(vault, options)
|
|
171
184
|
: Promise.resolve(undefined),
|
|
172
185
|
]);
|
|
173
|
-
if (
|
|
186
|
+
if (readLoans) {
|
|
174
187
|
if (loansResult.status === 'fulfilled') {
|
|
175
188
|
returnedVault = {
|
|
176
189
|
...returnedVault,
|
|
@@ -183,7 +196,7 @@ async function getVault({ vault, loans = false, allocations = false, options, lo
|
|
|
183
196
|
});
|
|
184
197
|
}
|
|
185
198
|
}
|
|
186
|
-
if (
|
|
199
|
+
if (readAllocations) {
|
|
187
200
|
if (allocationsResult.status === 'fulfilled') {
|
|
188
201
|
returnedVault = {
|
|
189
202
|
...returnedVault,
|
package/lib/sdk.d.ts
CHANGED
|
@@ -19372,8 +19372,12 @@ declare type AsArray<T> = T extends readonly unknown[] ? T : never;
|
|
|
19372
19372
|
* Routes to appropriate chain adapter (EVM v1/v2, Solana, or Stellar) based on vault version.
|
|
19373
19373
|
* Optionally enriches with loan and allocation data.
|
|
19374
19374
|
* @param vault - Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
|
|
19375
|
-
* @param loans - Include active loan data
|
|
19376
|
-
*
|
|
19375
|
+
* @param loans - Include active loan data. EVM vaults only — there is no
|
|
19376
|
+
* non-EVM loan book to read, so other families keep the empty default.
|
|
19377
|
+
* @param allocations - Include DeFi/CeFi allocation breakdowns. Resolved for EVM
|
|
19378
|
+
* vaults (via DeBank) and Stellar vaults (via the Untangled portfolio API).
|
|
19379
|
+
* Solana and Sui have no vault-level portfolio provider and keep the empty
|
|
19380
|
+
* default.
|
|
19377
19381
|
* @param options - RPC and service configuration
|
|
19378
19382
|
* @param tokenizedVault - Optional pre-fetched backend row for `vault`. When a
|
|
19379
19383
|
* caller already holds the row (e.g. `getVaults` fetched the whole list one
|