@augustdigital/sdk 9.12.0 → 9.13.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.
|
@@ -82,6 +82,14 @@ export declare function formatVaultApy(tokenizedVault: ITokenizedVault): IVault[
|
|
|
82
82
|
* the trailing `Z` is preserved.
|
|
83
83
|
*/
|
|
84
84
|
export declare function mapVaultFreshness(tokenizedVault: ITokenizedVault | undefined | null): IVaultFreshness | null;
|
|
85
|
+
/**
|
|
86
|
+
* Map a wrapper vault's link to the vault it wraps.
|
|
87
|
+
*
|
|
88
|
+
* @param tokenizedVault - Backend tokenized-vault payload.
|
|
89
|
+
* @returns The underlying vault address (casing preserved) and chain id, both
|
|
90
|
+
* null for a non-wrapper vault. A chain id without an address is dropped.
|
|
91
|
+
*/
|
|
92
|
+
export declare function mapUnderlyingVault(tokenizedVault: ITokenizedVault | undefined | null): Pick<IVault, 'underlyingVaultAddress' | 'underlyingChainId'>;
|
|
85
93
|
/**
|
|
86
94
|
* Map strategists from backend subaccounts or hardcoded list.
|
|
87
95
|
* Shared across all chain adapters.
|
|
@@ -7,6 +7,7 @@ exports.getIdleAssets = getIdleAssets;
|
|
|
7
7
|
exports.getYieldLastRealizedOn = getYieldLastRealizedOn;
|
|
8
8
|
exports.formatVaultApy = formatVaultApy;
|
|
9
9
|
exports.mapVaultFreshness = mapVaultFreshness;
|
|
10
|
+
exports.mapUnderlyingVault = mapUnderlyingVault;
|
|
10
11
|
exports.mapStrategists = mapStrategists;
|
|
11
12
|
exports.mapComposabilityIntegrations = mapComposabilityIntegrations;
|
|
12
13
|
exports.backendTvlToNormalizedBn = backendTvlToNormalizedBn;
|
|
@@ -268,6 +269,22 @@ function mapVaultFreshness(tokenizedVault) {
|
|
|
268
269
|
cachedAt: freshness.cached_at ?? null,
|
|
269
270
|
};
|
|
270
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Map a wrapper vault's link to the vault it wraps.
|
|
274
|
+
*
|
|
275
|
+
* @param tokenizedVault - Backend tokenized-vault payload.
|
|
276
|
+
* @returns The underlying vault address (casing preserved) and chain id, both
|
|
277
|
+
* null for a non-wrapper vault. A chain id without an address is dropped.
|
|
278
|
+
*/
|
|
279
|
+
function mapUnderlyingVault(tokenizedVault) {
|
|
280
|
+
const address = tokenizedVault?.underlying_vault_address;
|
|
281
|
+
if (!address)
|
|
282
|
+
return { underlyingVaultAddress: null, underlyingChainId: null };
|
|
283
|
+
return {
|
|
284
|
+
underlyingVaultAddress: address,
|
|
285
|
+
underlyingChainId: tokenizedVault?.underlying_chain ?? null,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
271
288
|
/**
|
|
272
289
|
* Map strategists from backend subaccounts or hardcoded list.
|
|
273
290
|
* Shared across all chain adapters.
|
|
@@ -437,6 +454,7 @@ function buildBackendVault(tokenizedVault, overrides) {
|
|
|
437
454
|
dailyPnlPerShare: mapDailyPnlPerShare(tokenizedVault.daily_pnl_per_share),
|
|
438
455
|
enabled_historical_price_horizons: tokenizedVault.enabled_historical_price_horizons || [],
|
|
439
456
|
latest_reported_tvl: tokenizedVault.latest_reported_tvl,
|
|
457
|
+
...mapUnderlyingVault(tokenizedVault),
|
|
440
458
|
defaultApyHorizon: tokenizedVault.default_apy_horizon,
|
|
441
459
|
...(tokenizedVault.instant_redeem_config
|
|
442
460
|
? {
|
|
@@ -659,6 +677,7 @@ async function buildFormattedVault(provider, tokenizedVault, contractCalls) {
|
|
|
659
677
|
enabled_historical_price_horizons: tokenizedVault?.enabled_historical_price_horizons,
|
|
660
678
|
defaultApyHorizon: tokenizedVault?.default_apy_horizon ?? null,
|
|
661
679
|
latest_reported_tvl: tokenizedVault?.latest_reported_tvl,
|
|
680
|
+
...mapUnderlyingVault(tokenizedVault),
|
|
662
681
|
cachedAt: tokenizedVault?.cached_at ?? null,
|
|
663
682
|
freshness: mapVaultFreshness(tokenizedVault),
|
|
664
683
|
showCapFilled: tokenizedVault?.show_cap_filled ?? null,
|
package/lib/sdk.d.ts
CHANGED
|
@@ -24276,6 +24276,14 @@ declare type AsArray<T> = T extends readonly unknown[] ? T : never;
|
|
|
24276
24276
|
enabled_historical_price_horizons?: number[];
|
|
24277
24277
|
defaultApyHorizon?: 7 | 30 | null;
|
|
24278
24278
|
latest_reported_tvl?: number | null;
|
|
24279
|
+
/**
|
|
24280
|
+
* Wrapper vaults only: the vault this one wraps, which holds the assets. A
|
|
24281
|
+
* wrapper's own on-chain `totalAssets` reads 0, so its TVL is the underlying
|
|
24282
|
+
* vault's. Null on a non-wrapper vault. Address casing is preserved verbatim.
|
|
24283
|
+
*/
|
|
24284
|
+
underlyingVaultAddress?: VaultAddress | null;
|
|
24285
|
+
/** Chain id of {@link IVault.underlyingVaultAddress}; null on a non-wrapper vault. */
|
|
24286
|
+
underlyingChainId?: number | null;
|
|
24279
24287
|
cachedAt?: string | null;
|
|
24280
24288
|
/**
|
|
24281
24289
|
* Provenance timestamps for the vault's server-side data — when its APY was last
|
|
@@ -25621,6 +25629,15 @@ declare type AsArray<T> = T extends readonly unknown[] ? T : never;
|
|
|
25621
25629
|
website_url: string;
|
|
25622
25630
|
}[];
|
|
25623
25631
|
|
|
25632
|
+
/**
|
|
25633
|
+
* Map a wrapper vault's link to the vault it wraps.
|
|
25634
|
+
*
|
|
25635
|
+
* @param tokenizedVault - Backend tokenized-vault payload.
|
|
25636
|
+
* @returns The underlying vault address (casing preserved) and chain id, both
|
|
25637
|
+
* null for a non-wrapper vault. A chain id without an address is dropped.
|
|
25638
|
+
*/
|
|
25639
|
+
export declare function mapUnderlyingVault(tokenizedVault: ITokenizedVault | undefined | null): Pick<IVault, 'underlyingVaultAddress' | 'underlyingChainId'>;
|
|
25640
|
+
|
|
25624
25641
|
/**
|
|
25625
25642
|
* Map the backend `freshness` object onto the camelCased {@link IVaultFreshness}
|
|
25626
25643
|
* shape carried on `IVault`. Shared across all chain adapters (EVM, Solana,
|
package/lib/types/vaults.d.ts
CHANGED
|
@@ -383,6 +383,14 @@ export interface IVault {
|
|
|
383
383
|
enabled_historical_price_horizons?: number[];
|
|
384
384
|
defaultApyHorizon?: 7 | 30 | null;
|
|
385
385
|
latest_reported_tvl?: number | null;
|
|
386
|
+
/**
|
|
387
|
+
* Wrapper vaults only: the vault this one wraps, which holds the assets. A
|
|
388
|
+
* wrapper's own on-chain `totalAssets` reads 0, so its TVL is the underlying
|
|
389
|
+
* vault's. Null on a non-wrapper vault. Address casing is preserved verbatim.
|
|
390
|
+
*/
|
|
391
|
+
underlyingVaultAddress?: VaultAddress | null;
|
|
392
|
+
/** Chain id of {@link IVault.underlyingVaultAddress}; null on a non-wrapper vault. */
|
|
393
|
+
underlyingChainId?: number | null;
|
|
386
394
|
cachedAt?: string | null;
|
|
387
395
|
/**
|
|
388
396
|
* Provenance timestamps for the vault's server-side data — when its APY was last
|