@steerprotocol/sdk 4.0.0-next.2 → 4.0.0-next.3
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 +47 -7
- package/dist/index.cjs +126 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -5
- package/dist/index.d.mts +26 -5
- package/dist/index.mjs +126 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -386,6 +386,7 @@ export type ProtocolBinding = {
|
|
|
386
386
|
};
|
|
387
387
|
export interface ResolvedVaultContext extends VaultReadContext {
|
|
388
388
|
readonly underlying: readonly VaultUnderlying[];
|
|
389
|
+
readonly metadata: VaultMetadata;
|
|
389
390
|
}
|
|
390
391
|
/** Exact implementation-specific readers and constructors, supplied by SDK integration code. */
|
|
391
392
|
export interface VaultImplementationBinding {
|
|
@@ -448,7 +449,7 @@ export declare class SteerNetwork {
|
|
|
448
449
|
get contracts(): SteerContracts;
|
|
449
450
|
get subgraphUrl(): string | undefined;
|
|
450
451
|
listUserVaults(request: UserVaultListRequest, options?: DataAdapterRequestOptions): Promise<UserVaultPage>;
|
|
451
|
-
listVaults(request?: VaultListRequest, options?: DataAdapterRequestOptions): Promise<Page
|
|
452
|
+
listVaults(request?: VaultListRequest, options?: DataAdapterRequestOptions): Promise<Page<VaultMetadata>>;
|
|
452
453
|
getVault(address: Address, options?: ReadOptions): Promise<KnownSteerVault>;
|
|
453
454
|
getVaults(addresses: readonly Address[], options?: ReadOptions): Promise<readonly KnownSteerVault[]>;
|
|
454
455
|
getVaultSnapshots(addresses: readonly Address[], options?: ReadOptions): Promise<readonly LiquidityVaultSnapshot<LiquidityPool>[]>;
|
|
@@ -465,7 +466,8 @@ export declare abstract class SteerVault {
|
|
|
465
466
|
readonly steer: SteerNetwork;
|
|
466
467
|
abstract readonly kind: VaultKind;
|
|
467
468
|
readonly underlying: readonly VaultUnderlying[];
|
|
468
|
-
|
|
469
|
+
readonly metadata: VaultMetadata;
|
|
470
|
+
constructor(address: Address, chain: ChainContext, steer: SteerNetwork, underlying: readonly VaultUnderlying[], metadata: VaultMetadata);
|
|
469
471
|
abstract getShareBalance(account: Address, options?: ReadOptions): Promise<bigint>;
|
|
470
472
|
abstract getPositions(options?: ReadOptions): Promise<readonly StrategyPosition[]>;
|
|
471
473
|
/** SDK request shape; contract implementations encode their own ABI and enforce asset rules. */
|
|
@@ -500,6 +502,24 @@ export declare abstract class CompositeVault extends SteerVault {
|
|
|
500
502
|
//#endregion
|
|
501
503
|
//#region src/vault/types.d.ts
|
|
502
504
|
type VaultAmmFilter = { [Protocol in AmmProtocol]: Omit<AmmLookupRequest<Protocol>, "chainId">; }[AmmProtocol];
|
|
505
|
+
/** Indexed descriptive data. This record does not establish current onchain identity. */
|
|
506
|
+
interface VaultMetadata {
|
|
507
|
+
readonly id: Address;
|
|
508
|
+
readonly name: string | null;
|
|
509
|
+
readonly symbol: string | null;
|
|
510
|
+
readonly decimals: string | null;
|
|
511
|
+
readonly beaconName: string;
|
|
512
|
+
readonly createdAt: string;
|
|
513
|
+
readonly state: string | null;
|
|
514
|
+
readonly pool: Address | null;
|
|
515
|
+
readonly poolKey?: string | null;
|
|
516
|
+
readonly token0: Address | null;
|
|
517
|
+
readonly token1: Address | null;
|
|
518
|
+
readonly payloadIpfs: string | null;
|
|
519
|
+
readonly strategyToken: {
|
|
520
|
+
readonly id: string;
|
|
521
|
+
} | null;
|
|
522
|
+
}
|
|
503
523
|
interface VaultListRequest extends PageRequest {
|
|
504
524
|
/** Select a configured AMM using the same protocol/version rules as getAmm(). */
|
|
505
525
|
readonly amm?: VaultAmmFilter;
|
|
@@ -761,7 +781,8 @@ export declare abstract class LendingDataAdapter<TMarketRef> extends DataAdapter
|
|
|
761
781
|
}
|
|
762
782
|
export declare abstract class SteerDataAdapter extends DataAdapter {
|
|
763
783
|
listUserVaults(_request: UserVaultListRequest, _options?: DataAdapterRequestOptions): Promise<UserVaultPage>;
|
|
764
|
-
|
|
784
|
+
getVaultMetadata(_addresses: readonly Address[], _options?: DataAdapterRequestOptions): Promise<readonly VaultMetadata[]>;
|
|
785
|
+
abstract listVaults(request?: VaultListRequest, options?: DataAdapterRequestOptions): Promise<Page<VaultMetadata>>;
|
|
765
786
|
}
|
|
766
787
|
//#endregion
|
|
767
788
|
//#region src/amm/adapters/aerodrome/types.d.ts
|
|
@@ -3529,7 +3550,7 @@ export declare class SteerClient {
|
|
|
3529
3550
|
getVaultSnapshots(chainId: number, addresses: readonly Address[], options?: ReadOptions): Promise<readonly LiquidityVaultSnapshot<LiquidityPool>[]>;
|
|
3530
3551
|
getVaultUserPositions(chainId: number, addresses: readonly Address[], account: Address, options?: ReadOptions): Promise<readonly VaultUserPosition[]>;
|
|
3531
3552
|
listUserVaults(request: UserVaultDiscoveryRequest, options?: DataAdapterRequestOptions): Promise<UserVaultPage>;
|
|
3532
|
-
listVaults(request: VaultDiscoveryRequest, options?: DataAdapterRequestOptions): Promise<Page
|
|
3553
|
+
listVaults(request: VaultDiscoveryRequest, options?: DataAdapterRequestOptions): Promise<Page<VaultMetadata>>;
|
|
3533
3554
|
getLiquidityVault(chainId: number, address: Address, options?: ReadOptions): Promise<LiquidityVault<AmmAdapter<unknown, unknown, Readonly<Record<string, ContractDeployment>>, unknown>, LiquidityPool>>;
|
|
3534
3555
|
getLendingVault(chainId: number, address: Address, options?: ReadOptions): Promise<LendingVault<LendingAdapter<unknown, unknown, Readonly<Record<string, ContractDeployment>>>>>;
|
|
3535
3556
|
getCompositeVault(chainId: number, address: Address, options?: ReadOptions): Promise<CompositeVault>;
|
|
@@ -3649,5 +3670,5 @@ export declare class UniswapV4Vault extends LiquidityVault<UniswapV4Adapter, V4V
|
|
|
3649
3670
|
prepareDeposit(request: PrepareDepositRequest, options?: ReadOptions): Promise<DepositPlan>;
|
|
3650
3671
|
}
|
|
3651
3672
|
//#endregion
|
|
3652
|
-
export { type AerodromeDepositPlan, type AerodromeDepositPreview, type AerodromeVaultSnapshot, type AerodromeWithdrawPlan, type AerodromeWithdrawPreview, type AlgebraContracts, type AlgebraIntegralContracts, type AlgebraIntegralPoolState, type AlgebraLegacyContracts, type AlgebraLegacyPoolLookupRequest, type AlgebraLegacyPoolState, type AlgebraLegacyPoolsLookupRequest, type AlgebraPoolLookupRequest, type AlgebraPoolReference, type AlgebraPoolState, type AlgebraPoolsLookupRequest, type AlgebraSwapFee, type AmmLookupRequest, type AmmProtocolAdapter, type AmmProtocolAdapters, type AmmProtocolVersion, type AmmVersion, type AssetAmount, type ConcentratedPoolState, type DepositPlan, type DepositPreview, type DepositQuote, type DepositRequest, type DiscoveredPool, type IndexerConfig, type InfinityCLContracts, type InfinityCLDirectionalFees, type InfinityCLPoolFees, type InfinityCLPoolIdReference, type InfinityCLPoolKey, type InfinityCLPoolKeyInput, type InfinityCLPoolLookupRequest, type InfinityCLPoolReference, type InfinityCLPoolState, type InfinityCLPoolsLookupRequest, type InfinityCLSwapQuoteRequest, type KnownSteerVault, type LiquidityDepositPreview, type LiquidityDepth, type LiquidityDepthRequest, type LiquidityDistribution, type LiquidityFees, type LiquidityInterval, type LiquidityPool, type LiquidityPosition, type LiquidityPositionRange, type LiquidityVaultRewards, type LiquidityVaultSnapshot, type LiquidityVaultUserPosition, type LogEvent, type Logger, type PoolLookupRequest, type PoolPrice, type PoolReadOptions, type PoolState, type PoolTicks, type PoolTokenBalance, type PoolsLookupRequest, type PrepareDepositRequest, type PrepareWithdrawRequest, type SlipstreamContracts, type SlipstreamPoolFees, type SlipstreamPoolLookupRequest, type SlipstreamPoolState, type SlipstreamPoolsLookupRequest, type SlipstreamQuoteOptions, type StrategyPosition, type SurroundingTicks, type SwapQuote, type SwapQuoteRequest, type TheGraphIndexerConfig, type TickLiquidity, type TickPoolState, type TickRange, type TokenPairAmounts, type UserVaultDiscoveryRequest, type UserVaultListRequest, type UserVaultPage, type V3Contracts, type V3PoolFees, type V3PoolLookupRequest, type V3PoolState, type V3PoolsLookupRequest, type V4Contracts, type V4DirectionalFees, type V4PoolFees, type V4PoolKey, type V4PoolLookupRequest, type V4PoolReference, type V4PoolState, type V4PoolsLookupRequest, type V4ReadOptions, type V4SwapQuoteRequest, type V4VaultPool, type VaultAmmFilter, type VaultDiscoveryRequest, type VaultListRequest, type VaultRewardPayout, type VaultUnderlying, type VaultUserPosition, type WithdrawPlan, type WithdrawPreview, type WithdrawRequest, type WithdrawRewards, ethereumContracts as mainnetContracts };
|
|
3673
|
+
export { type AerodromeDepositPlan, type AerodromeDepositPreview, type AerodromeVaultSnapshot, type AerodromeWithdrawPlan, type AerodromeWithdrawPreview, type AlgebraContracts, type AlgebraIntegralContracts, type AlgebraIntegralPoolState, type AlgebraLegacyContracts, type AlgebraLegacyPoolLookupRequest, type AlgebraLegacyPoolState, type AlgebraLegacyPoolsLookupRequest, type AlgebraPoolLookupRequest, type AlgebraPoolReference, type AlgebraPoolState, type AlgebraPoolsLookupRequest, type AlgebraSwapFee, type AmmLookupRequest, type AmmProtocolAdapter, type AmmProtocolAdapters, type AmmProtocolVersion, type AmmVersion, type AssetAmount, type ConcentratedPoolState, type DepositPlan, type DepositPreview, type DepositQuote, type DepositRequest, type DiscoveredPool, type IndexerConfig, type InfinityCLContracts, type InfinityCLDirectionalFees, type InfinityCLPoolFees, type InfinityCLPoolIdReference, type InfinityCLPoolKey, type InfinityCLPoolKeyInput, type InfinityCLPoolLookupRequest, type InfinityCLPoolReference, type InfinityCLPoolState, type InfinityCLPoolsLookupRequest, type InfinityCLSwapQuoteRequest, type KnownSteerVault, type LiquidityDepositPreview, type LiquidityDepth, type LiquidityDepthRequest, type LiquidityDistribution, type LiquidityFees, type LiquidityInterval, type LiquidityPool, type LiquidityPosition, type LiquidityPositionRange, type LiquidityVaultRewards, type LiquidityVaultSnapshot, type LiquidityVaultUserPosition, type LogEvent, type Logger, type PoolLookupRequest, type PoolPrice, type PoolReadOptions, type PoolState, type PoolTicks, type PoolTokenBalance, type PoolsLookupRequest, type PrepareDepositRequest, type PrepareWithdrawRequest, type SlipstreamContracts, type SlipstreamPoolFees, type SlipstreamPoolLookupRequest, type SlipstreamPoolState, type SlipstreamPoolsLookupRequest, type SlipstreamQuoteOptions, type StrategyPosition, type SurroundingTicks, type SwapQuote, type SwapQuoteRequest, type TheGraphIndexerConfig, type TickLiquidity, type TickPoolState, type TickRange, type TokenPairAmounts, type UserVaultDiscoveryRequest, type UserVaultListRequest, type UserVaultPage, type V3Contracts, type V3PoolFees, type V3PoolLookupRequest, type V3PoolState, type V3PoolsLookupRequest, type V4Contracts, type V4DirectionalFees, type V4PoolFees, type V4PoolKey, type V4PoolLookupRequest, type V4PoolReference, type V4PoolState, type V4PoolsLookupRequest, type V4ReadOptions, type V4SwapQuoteRequest, type V4VaultPool, type VaultAmmFilter, type VaultDiscoveryRequest, type VaultListRequest, type VaultMetadata, type VaultRewardPayout, type VaultUnderlying, type VaultUserPosition, type WithdrawPlan, type WithdrawPreview, type WithdrawRequest, type WithdrawRewards, ethereumContracts as mainnetContracts };
|
|
3653
3674
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -386,6 +386,7 @@ export type ProtocolBinding = {
|
|
|
386
386
|
};
|
|
387
387
|
export interface ResolvedVaultContext extends VaultReadContext {
|
|
388
388
|
readonly underlying: readonly VaultUnderlying[];
|
|
389
|
+
readonly metadata: VaultMetadata;
|
|
389
390
|
}
|
|
390
391
|
/** Exact implementation-specific readers and constructors, supplied by SDK integration code. */
|
|
391
392
|
export interface VaultImplementationBinding {
|
|
@@ -448,7 +449,7 @@ export declare class SteerNetwork {
|
|
|
448
449
|
get contracts(): SteerContracts;
|
|
449
450
|
get subgraphUrl(): string | undefined;
|
|
450
451
|
listUserVaults(request: UserVaultListRequest, options?: DataAdapterRequestOptions): Promise<UserVaultPage>;
|
|
451
|
-
listVaults(request?: VaultListRequest, options?: DataAdapterRequestOptions): Promise<Page
|
|
452
|
+
listVaults(request?: VaultListRequest, options?: DataAdapterRequestOptions): Promise<Page<VaultMetadata>>;
|
|
452
453
|
getVault(address: Address, options?: ReadOptions): Promise<KnownSteerVault>;
|
|
453
454
|
getVaults(addresses: readonly Address[], options?: ReadOptions): Promise<readonly KnownSteerVault[]>;
|
|
454
455
|
getVaultSnapshots(addresses: readonly Address[], options?: ReadOptions): Promise<readonly LiquidityVaultSnapshot<LiquidityPool>[]>;
|
|
@@ -465,7 +466,8 @@ export declare abstract class SteerVault {
|
|
|
465
466
|
readonly steer: SteerNetwork;
|
|
466
467
|
abstract readonly kind: VaultKind;
|
|
467
468
|
readonly underlying: readonly VaultUnderlying[];
|
|
468
|
-
|
|
469
|
+
readonly metadata: VaultMetadata;
|
|
470
|
+
constructor(address: Address, chain: ChainContext, steer: SteerNetwork, underlying: readonly VaultUnderlying[], metadata: VaultMetadata);
|
|
469
471
|
abstract getShareBalance(account: Address, options?: ReadOptions): Promise<bigint>;
|
|
470
472
|
abstract getPositions(options?: ReadOptions): Promise<readonly StrategyPosition[]>;
|
|
471
473
|
/** SDK request shape; contract implementations encode their own ABI and enforce asset rules. */
|
|
@@ -500,6 +502,24 @@ export declare abstract class CompositeVault extends SteerVault {
|
|
|
500
502
|
//#endregion
|
|
501
503
|
//#region src/vault/types.d.ts
|
|
502
504
|
type VaultAmmFilter = { [Protocol in AmmProtocol]: Omit<AmmLookupRequest<Protocol>, "chainId">; }[AmmProtocol];
|
|
505
|
+
/** Indexed descriptive data. This record does not establish current onchain identity. */
|
|
506
|
+
interface VaultMetadata {
|
|
507
|
+
readonly id: Address;
|
|
508
|
+
readonly name: string | null;
|
|
509
|
+
readonly symbol: string | null;
|
|
510
|
+
readonly decimals: string | null;
|
|
511
|
+
readonly beaconName: string;
|
|
512
|
+
readonly createdAt: string;
|
|
513
|
+
readonly state: string | null;
|
|
514
|
+
readonly pool: Address | null;
|
|
515
|
+
readonly poolKey?: string | null;
|
|
516
|
+
readonly token0: Address | null;
|
|
517
|
+
readonly token1: Address | null;
|
|
518
|
+
readonly payloadIpfs: string | null;
|
|
519
|
+
readonly strategyToken: {
|
|
520
|
+
readonly id: string;
|
|
521
|
+
} | null;
|
|
522
|
+
}
|
|
503
523
|
interface VaultListRequest extends PageRequest {
|
|
504
524
|
/** Select a configured AMM using the same protocol/version rules as getAmm(). */
|
|
505
525
|
readonly amm?: VaultAmmFilter;
|
|
@@ -761,7 +781,8 @@ export declare abstract class LendingDataAdapter<TMarketRef> extends DataAdapter
|
|
|
761
781
|
}
|
|
762
782
|
export declare abstract class SteerDataAdapter extends DataAdapter {
|
|
763
783
|
listUserVaults(_request: UserVaultListRequest, _options?: DataAdapterRequestOptions): Promise<UserVaultPage>;
|
|
764
|
-
|
|
784
|
+
getVaultMetadata(_addresses: readonly Address[], _options?: DataAdapterRequestOptions): Promise<readonly VaultMetadata[]>;
|
|
785
|
+
abstract listVaults(request?: VaultListRequest, options?: DataAdapterRequestOptions): Promise<Page<VaultMetadata>>;
|
|
765
786
|
}
|
|
766
787
|
//#endregion
|
|
767
788
|
//#region src/amm/adapters/aerodrome/types.d.ts
|
|
@@ -3529,7 +3550,7 @@ export declare class SteerClient {
|
|
|
3529
3550
|
getVaultSnapshots(chainId: number, addresses: readonly Address[], options?: ReadOptions): Promise<readonly LiquidityVaultSnapshot<LiquidityPool>[]>;
|
|
3530
3551
|
getVaultUserPositions(chainId: number, addresses: readonly Address[], account: Address, options?: ReadOptions): Promise<readonly VaultUserPosition[]>;
|
|
3531
3552
|
listUserVaults(request: UserVaultDiscoveryRequest, options?: DataAdapterRequestOptions): Promise<UserVaultPage>;
|
|
3532
|
-
listVaults(request: VaultDiscoveryRequest, options?: DataAdapterRequestOptions): Promise<Page
|
|
3553
|
+
listVaults(request: VaultDiscoveryRequest, options?: DataAdapterRequestOptions): Promise<Page<VaultMetadata>>;
|
|
3533
3554
|
getLiquidityVault(chainId: number, address: Address, options?: ReadOptions): Promise<LiquidityVault<AmmAdapter<unknown, unknown, Readonly<Record<string, ContractDeployment>>, unknown>, LiquidityPool>>;
|
|
3534
3555
|
getLendingVault(chainId: number, address: Address, options?: ReadOptions): Promise<LendingVault<LendingAdapter<unknown, unknown, Readonly<Record<string, ContractDeployment>>>>>;
|
|
3535
3556
|
getCompositeVault(chainId: number, address: Address, options?: ReadOptions): Promise<CompositeVault>;
|
|
@@ -3649,5 +3670,5 @@ export declare class UniswapV4Vault extends LiquidityVault<UniswapV4Adapter, V4V
|
|
|
3649
3670
|
prepareDeposit(request: PrepareDepositRequest, options?: ReadOptions): Promise<DepositPlan>;
|
|
3650
3671
|
}
|
|
3651
3672
|
//#endregion
|
|
3652
|
-
export { type AerodromeDepositPlan, type AerodromeDepositPreview, type AerodromeVaultSnapshot, type AerodromeWithdrawPlan, type AerodromeWithdrawPreview, type AlgebraContracts, type AlgebraIntegralContracts, type AlgebraIntegralPoolState, type AlgebraLegacyContracts, type AlgebraLegacyPoolLookupRequest, type AlgebraLegacyPoolState, type AlgebraLegacyPoolsLookupRequest, type AlgebraPoolLookupRequest, type AlgebraPoolReference, type AlgebraPoolState, type AlgebraPoolsLookupRequest, type AlgebraSwapFee, type AmmLookupRequest, type AmmProtocolAdapter, type AmmProtocolAdapters, type AmmProtocolVersion, type AmmVersion, type AssetAmount, type ConcentratedPoolState, type DepositPlan, type DepositPreview, type DepositQuote, type DepositRequest, type DiscoveredPool, type IndexerConfig, type InfinityCLContracts, type InfinityCLDirectionalFees, type InfinityCLPoolFees, type InfinityCLPoolIdReference, type InfinityCLPoolKey, type InfinityCLPoolKeyInput, type InfinityCLPoolLookupRequest, type InfinityCLPoolReference, type InfinityCLPoolState, type InfinityCLPoolsLookupRequest, type InfinityCLSwapQuoteRequest, type KnownSteerVault, type LiquidityDepositPreview, type LiquidityDepth, type LiquidityDepthRequest, type LiquidityDistribution, type LiquidityFees, type LiquidityInterval, type LiquidityPool, type LiquidityPosition, type LiquidityPositionRange, type LiquidityVaultRewards, type LiquidityVaultSnapshot, type LiquidityVaultUserPosition, type LogEvent, type Logger, type PoolLookupRequest, type PoolPrice, type PoolReadOptions, type PoolState, type PoolTicks, type PoolTokenBalance, type PoolsLookupRequest, type PrepareDepositRequest, type PrepareWithdrawRequest, type SlipstreamContracts, type SlipstreamPoolFees, type SlipstreamPoolLookupRequest, type SlipstreamPoolState, type SlipstreamPoolsLookupRequest, type SlipstreamQuoteOptions, type StrategyPosition, type SurroundingTicks, type SwapQuote, type SwapQuoteRequest, type TheGraphIndexerConfig, type TickLiquidity, type TickPoolState, type TickRange, type TokenPairAmounts, type UserVaultDiscoveryRequest, type UserVaultListRequest, type UserVaultPage, type V3Contracts, type V3PoolFees, type V3PoolLookupRequest, type V3PoolState, type V3PoolsLookupRequest, type V4Contracts, type V4DirectionalFees, type V4PoolFees, type V4PoolKey, type V4PoolLookupRequest, type V4PoolReference, type V4PoolState, type V4PoolsLookupRequest, type V4ReadOptions, type V4SwapQuoteRequest, type V4VaultPool, type VaultAmmFilter, type VaultDiscoveryRequest, type VaultListRequest, type VaultRewardPayout, type VaultUnderlying, type VaultUserPosition, type WithdrawPlan, type WithdrawPreview, type WithdrawRequest, type WithdrawRewards, ethereumContracts as mainnetContracts };
|
|
3673
|
+
export { type AerodromeDepositPlan, type AerodromeDepositPreview, type AerodromeVaultSnapshot, type AerodromeWithdrawPlan, type AerodromeWithdrawPreview, type AlgebraContracts, type AlgebraIntegralContracts, type AlgebraIntegralPoolState, type AlgebraLegacyContracts, type AlgebraLegacyPoolLookupRequest, type AlgebraLegacyPoolState, type AlgebraLegacyPoolsLookupRequest, type AlgebraPoolLookupRequest, type AlgebraPoolReference, type AlgebraPoolState, type AlgebraPoolsLookupRequest, type AlgebraSwapFee, type AmmLookupRequest, type AmmProtocolAdapter, type AmmProtocolAdapters, type AmmProtocolVersion, type AmmVersion, type AssetAmount, type ConcentratedPoolState, type DepositPlan, type DepositPreview, type DepositQuote, type DepositRequest, type DiscoveredPool, type IndexerConfig, type InfinityCLContracts, type InfinityCLDirectionalFees, type InfinityCLPoolFees, type InfinityCLPoolIdReference, type InfinityCLPoolKey, type InfinityCLPoolKeyInput, type InfinityCLPoolLookupRequest, type InfinityCLPoolReference, type InfinityCLPoolState, type InfinityCLPoolsLookupRequest, type InfinityCLSwapQuoteRequest, type KnownSteerVault, type LiquidityDepositPreview, type LiquidityDepth, type LiquidityDepthRequest, type LiquidityDistribution, type LiquidityFees, type LiquidityInterval, type LiquidityPool, type LiquidityPosition, type LiquidityPositionRange, type LiquidityVaultRewards, type LiquidityVaultSnapshot, type LiquidityVaultUserPosition, type LogEvent, type Logger, type PoolLookupRequest, type PoolPrice, type PoolReadOptions, type PoolState, type PoolTicks, type PoolTokenBalance, type PoolsLookupRequest, type PrepareDepositRequest, type PrepareWithdrawRequest, type SlipstreamContracts, type SlipstreamPoolFees, type SlipstreamPoolLookupRequest, type SlipstreamPoolState, type SlipstreamPoolsLookupRequest, type SlipstreamQuoteOptions, type StrategyPosition, type SurroundingTicks, type SwapQuote, type SwapQuoteRequest, type TheGraphIndexerConfig, type TickLiquidity, type TickPoolState, type TickRange, type TokenPairAmounts, type UserVaultDiscoveryRequest, type UserVaultListRequest, type UserVaultPage, type V3Contracts, type V3PoolFees, type V3PoolLookupRequest, type V3PoolState, type V3PoolsLookupRequest, type V4Contracts, type V4DirectionalFees, type V4PoolFees, type V4PoolKey, type V4PoolLookupRequest, type V4PoolReference, type V4PoolState, type V4PoolsLookupRequest, type V4ReadOptions, type V4SwapQuoteRequest, type V4VaultPool, type VaultAmmFilter, type VaultDiscoveryRequest, type VaultListRequest, type VaultMetadata, type VaultRewardPayout, type VaultUnderlying, type VaultUserPosition, type WithdrawPlan, type WithdrawPreview, type WithdrawRequest, type WithdrawRewards, ethereumContracts as mainnetContracts };
|
|
3653
3674
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -2062,6 +2062,7 @@ var AerodromeSlipstreamAdapter = class extends AmmAdapter {
|
|
|
2062
2062
|
blockNumber: context.blockNumber,
|
|
2063
2063
|
...captured.account ? { account: captured.account } : {}
|
|
2064
2064
|
});
|
|
2065
|
+
if (result[1] <= sqrtRatioAtTick(-887272) + 1n || result[1] >= sqrtRatioAtTick(887272) - 1n) throw new Error("Slipstream quote reached the price limit; full input consumption is not established");
|
|
2065
2066
|
return Object.freeze({
|
|
2066
2067
|
amountIn: input.amountIn,
|
|
2067
2068
|
amountOut: result[0]
|
|
@@ -2102,6 +2103,9 @@ var SteerDataAdapter = class extends DataAdapter {
|
|
|
2102
2103
|
async listUserVaults(_request, _options) {
|
|
2103
2104
|
throw new Error("User vault discovery is not configured for this data adapter");
|
|
2104
2105
|
}
|
|
2106
|
+
async getVaultMetadata(_addresses, _options) {
|
|
2107
|
+
throw new Error("Vault metadata is not configured for this data adapter");
|
|
2108
|
+
}
|
|
2105
2109
|
};
|
|
2106
2110
|
//#endregion
|
|
2107
2111
|
//#region src/data/subgraph.ts
|
|
@@ -7742,6 +7746,7 @@ var RpcUniswapV3Adapter = class RpcUniswapV3Adapter extends UniswapV3Adapter {
|
|
|
7742
7746
|
fee: pool.fee,
|
|
7743
7747
|
sqrtPriceLimitX96: 0n
|
|
7744
7748
|
}]);
|
|
7749
|
+
if (result[1] <= sqrtRatioAtTick(-887272) + 1n || result[1] >= sqrtRatioAtTick(887272) - 1n) throw new Error("V3 quote reached the price limit; full input consumption is not established");
|
|
7745
7750
|
return {
|
|
7746
7751
|
amountIn: request.amountIn,
|
|
7747
7752
|
amountOut: result[0]
|
|
@@ -11398,6 +11403,36 @@ var DeploymentRegistry = class {
|
|
|
11398
11403
|
}
|
|
11399
11404
|
};
|
|
11400
11405
|
//#endregion
|
|
11406
|
+
//#region src/vault/metadata.ts
|
|
11407
|
+
function nullableString(value) {
|
|
11408
|
+
if (value === null || typeof value === "string") return value;
|
|
11409
|
+
throw new Error("Malformed vault metadata string");
|
|
11410
|
+
}
|
|
11411
|
+
/** Validate and detach indexed data, preserving nulls and optional pool keys. */
|
|
11412
|
+
function vaultMetadata(value) {
|
|
11413
|
+
const row = record(value);
|
|
11414
|
+
if (typeof row.beaconName !== "string" || !row.beaconName || typeof row.createdAt !== "string" || !/^\d+$/.test(row.createdAt)) throw new Error("Malformed vault metadata identity");
|
|
11415
|
+
const decimals = nullableString(row.decimals);
|
|
11416
|
+
if (decimals !== null && !/^\d+$/.test(decimals)) throw new Error("Malformed vault metadata decimals");
|
|
11417
|
+
const strategy = row.strategyToken === null ? null : record(row.strategyToken);
|
|
11418
|
+
if (strategy !== null && (typeof strategy.id !== "string" || !strategy.id)) throw new Error("Malformed vault strategy token");
|
|
11419
|
+
return Object.freeze({
|
|
11420
|
+
id: indexedAddress(row.id),
|
|
11421
|
+
name: nullableString(row.name),
|
|
11422
|
+
symbol: nullableString(row.symbol),
|
|
11423
|
+
decimals,
|
|
11424
|
+
beaconName: row.beaconName,
|
|
11425
|
+
createdAt: row.createdAt,
|
|
11426
|
+
state: nullableString(row.state),
|
|
11427
|
+
pool: row.pool === null ? null : indexedAddress(row.pool, true),
|
|
11428
|
+
...row.poolKey === void 0 ? {} : { poolKey: nullableString(row.poolKey) },
|
|
11429
|
+
token0: row.token0 === null ? null : indexedAddress(row.token0, true),
|
|
11430
|
+
token1: row.token1 === null ? null : indexedAddress(row.token1, true),
|
|
11431
|
+
payloadIpfs: nullableString(row.payloadIpfs),
|
|
11432
|
+
strategyToken: strategy === null ? null : Object.freeze({ id: String(strategy.id) })
|
|
11433
|
+
});
|
|
11434
|
+
}
|
|
11435
|
+
//#endregion
|
|
11401
11436
|
//#region src/vault/resolver-types.ts
|
|
11402
11437
|
let ProtocolContractRole = /* @__PURE__ */ function(ProtocolContractRole) {
|
|
11403
11438
|
ProtocolContractRole["AmmFactory"] = "amm-factory";
|
|
@@ -11785,18 +11820,25 @@ async function filterVaultsByFactory(context, vaults, factory, blockNumber) {
|
|
|
11785
11820
|
//#endregion
|
|
11786
11821
|
//#region src/vault/data-adapter.ts
|
|
11787
11822
|
const nonShareBeacons = ["ScheduledJobs", "DynamicJobs"];
|
|
11788
|
-
const
|
|
11823
|
+
const metadataFields = `id name symbol decimals beaconName createdAt state pool poolKey token0 token1 payloadIpfs strategyToken { id }`;
|
|
11824
|
+
const metadataQuery = `query VaultMetadata($ids: [ID!]!, $first: Int!) {
|
|
11825
|
+
vaults(first: $first, orderBy: id, orderDirection: asc, where: {id_in: $ids}) { ${metadataFields} }
|
|
11826
|
+
_meta { ${metaFields} }
|
|
11827
|
+
}`;
|
|
11828
|
+
const vaultsQuery = (balances) => `query Vaults($first: Int!, $where: Vault_filter!, $block: Int!) {
|
|
11789
11829
|
vaults(first: $first, orderBy: id, orderDirection: asc, where: $where, block: {number: $block}) {
|
|
11790
|
-
id beaconName token0 token1
|
|
11830
|
+
${balances ? "id beaconName token0 token1" : metadataFields}
|
|
11831
|
+
token0Symbol token1Symbol token0Name token1Name
|
|
11791
11832
|
}
|
|
11792
11833
|
_meta(block: {number: $block}) { ${metaFields} }
|
|
11793
11834
|
}`;
|
|
11794
11835
|
function matchesToken(row, token, side) {
|
|
11795
|
-
|
|
11836
|
+
if (row[`token${side}`] === null) return false;
|
|
11837
|
+
const address = indexedAddress(row[`token${side}`], true);
|
|
11796
11838
|
const symbol = row[`token${side}Symbol`];
|
|
11797
11839
|
const name = row[`token${side}Name`];
|
|
11798
|
-
if (typeof symbol !== "string" || typeof name !== "string") throw new Error("Malformed vault token metadata");
|
|
11799
|
-
return (!token.address || token.address === address) && (!token.symbol || symbol.toLowerCase().includes(token.symbol)) && (!token.name || name.toLowerCase().includes(token.name));
|
|
11840
|
+
if (symbol !== null && typeof symbol !== "string" || name !== null && typeof name !== "string") throw new Error("Malformed vault token metadata");
|
|
11841
|
+
return (!token.address || token.address === address) && (!token.symbol || typeof symbol === "string" && symbol.toLowerCase().includes(token.symbol)) && (!token.name || typeof name === "string" && name.toLowerCase().includes(token.name));
|
|
11800
11842
|
}
|
|
11801
11843
|
function vaultFilter(token, after, beacons, balances) {
|
|
11802
11844
|
const base = {
|
|
@@ -11885,7 +11927,7 @@ var CatalogSteerDataAdapter = class extends SteerDataAdapter {
|
|
|
11885
11927
|
...cursor === void 0 ? {} : { cursor },
|
|
11886
11928
|
limit: input.limit ?? 1e3
|
|
11887
11929
|
}, options, true);
|
|
11888
|
-
const items = await scanVaultBalances(this.#context, page.items, input.account, page.indexedBlock);
|
|
11930
|
+
const items = await scanVaultBalances(this.#context, page.items.map((row) => indexedAddress(row.id)), input.account, page.indexedBlock);
|
|
11889
11931
|
return Object.freeze({
|
|
11890
11932
|
items,
|
|
11891
11933
|
indexedBlock: page.indexedBlock,
|
|
@@ -11896,9 +11938,44 @@ var CatalogSteerDataAdapter = class extends SteerDataAdapter {
|
|
|
11896
11938
|
}) } : {}
|
|
11897
11939
|
});
|
|
11898
11940
|
}
|
|
11941
|
+
async #metadataQuery(query, variables, options) {
|
|
11942
|
+
try {
|
|
11943
|
+
return await this.#query(query, variables, options);
|
|
11944
|
+
} catch (error) {
|
|
11945
|
+
const errors = error instanceof Error ? error.cause : void 0;
|
|
11946
|
+
if (!query.includes("poolKey") || !Array.isArray(errors) || !errors.length || !errors.every((value) => typeof value?.message === "string" && /^Cannot query field "poolKey" on type "Vault"\.(?: Did you mean .*\?)?$/.test(value.message))) throw error;
|
|
11947
|
+
return this.#query(query.replace(/\bpoolKey\b/g, ""), variables, options);
|
|
11948
|
+
}
|
|
11949
|
+
}
|
|
11950
|
+
async getVaultMetadata(addresses, options = {}) {
|
|
11951
|
+
const ids = addresses.map((address) => indexedAddress(address));
|
|
11952
|
+
const unique = [...new Set(ids)];
|
|
11953
|
+
if (!unique.length) return Object.freeze([]);
|
|
11954
|
+
if (unique.length > 1e3) throw new Error("Vault metadata lookup supports at most 1000 addresses");
|
|
11955
|
+
const data = await this.#metadataQuery(metadataQuery, {
|
|
11956
|
+
ids: unique,
|
|
11957
|
+
first: unique.length
|
|
11958
|
+
}, options);
|
|
11959
|
+
snapshot(data);
|
|
11960
|
+
if (!Array.isArray(data.vaults) || data.vaults.length > unique.length) throw new Error("Malformed vault metadata response");
|
|
11961
|
+
const records = /* @__PURE__ */ new Map();
|
|
11962
|
+
for (const value of data.vaults) {
|
|
11963
|
+
const metadata = vaultMetadata(value);
|
|
11964
|
+
if (!unique.includes(metadata.id) || records.has(metadata.id)) throw new Error("Unexpected or duplicate vault metadata");
|
|
11965
|
+
records.set(metadata.id, metadata);
|
|
11966
|
+
}
|
|
11967
|
+
return Object.freeze(ids.map((id) => {
|
|
11968
|
+
const metadata = records.get(id);
|
|
11969
|
+
if (!metadata) throw new Error("Vault metadata is not indexed");
|
|
11970
|
+
return metadata;
|
|
11971
|
+
}));
|
|
11972
|
+
}
|
|
11899
11973
|
async listVaults(request = {}, options = {}) {
|
|
11900
|
-
const { indexedBlock: _, ...page } = await this.#listVaults(request, options, false);
|
|
11901
|
-
return Object.freeze(
|
|
11974
|
+
const { indexedBlock: _, items, ...page } = await this.#listVaults(request, options, false);
|
|
11975
|
+
return Object.freeze({
|
|
11976
|
+
...page,
|
|
11977
|
+
items: Object.freeze(items.map(vaultMetadata))
|
|
11978
|
+
});
|
|
11902
11979
|
}
|
|
11903
11980
|
async #listVaults(request = {}, options = {}, balances = false) {
|
|
11904
11981
|
const limit = request.limit ?? 100;
|
|
@@ -11931,7 +12008,7 @@ var CatalogSteerDataAdapter = class extends SteerDataAdapter {
|
|
|
11931
12008
|
} });
|
|
11932
12009
|
} else expected = snapshot(await this.#query(snapshotQuery, {}, options));
|
|
11933
12010
|
const beacons = amm ? this.#beacons.get(amm) : void 0;
|
|
11934
|
-
const data = await this.#
|
|
12011
|
+
const data = await this.#metadataQuery(vaultsQuery(balances), {
|
|
11935
12012
|
first: limit,
|
|
11936
12013
|
where: vaultFilter(token, after, beacons, balances),
|
|
11937
12014
|
block: expected.block
|
|
@@ -11948,13 +12025,15 @@ var CatalogSteerDataAdapter = class extends SteerDataAdapter {
|
|
|
11948
12025
|
if (balances && (typeof row.beaconName !== "string" || nonShareBeacons.includes(row.beaconName))) throw new Error("User vault listing returned a non-share deployment");
|
|
11949
12026
|
if (beacons && (typeof row.beaconName !== "string" || !beacons.includes(row.beaconName))) throw new Error("Vault listing does not match the AMM beacon mapping");
|
|
11950
12027
|
if (token && !matchesToken(row, token, 0) && !matchesToken(row, token, 1)) throw new Error("Vault listing does not match the token filter");
|
|
11951
|
-
|
|
12028
|
+
if (!balances) vaultMetadata(row);
|
|
12029
|
+
return row;
|
|
11952
12030
|
});
|
|
11953
|
-
const last = items.at(-1);
|
|
12031
|
+
const last = items.at(-1)?.id;
|
|
11954
12032
|
const factory = amm ? this.#factories.get(amm) : void 0;
|
|
11955
|
-
const filtered = factory ? await filterVaultsByFactory(this.#context, items, factory, BigInt(expected.block)) : items;
|
|
12033
|
+
const filtered = factory ? await filterVaultsByFactory(this.#context, items.map((row) => indexedAddress(row.id)), factory, BigInt(expected.block)) : items.map((row) => indexedAddress(row.id));
|
|
12034
|
+
const included = new Set(filtered);
|
|
11956
12035
|
return Object.freeze({
|
|
11957
|
-
items: Object.freeze(
|
|
12036
|
+
items: Object.freeze(items.filter((row) => included.has(indexedAddress(row.id)))),
|
|
11958
12037
|
indexedBlock: BigInt(expected.block),
|
|
11959
12038
|
...items.length === limit && last ? { nextCursor: JSON.stringify({
|
|
11960
12039
|
version: 1,
|
|
@@ -13758,10 +13837,13 @@ var SteerVault = class {
|
|
|
13758
13837
|
chain;
|
|
13759
13838
|
steer;
|
|
13760
13839
|
underlying;
|
|
13761
|
-
|
|
13840
|
+
metadata;
|
|
13841
|
+
constructor(address, chain, steer, underlying, metadata) {
|
|
13762
13842
|
this.address = address;
|
|
13763
13843
|
this.chain = chain;
|
|
13764
13844
|
this.steer = steer;
|
|
13845
|
+
this.metadata = vaultMetadata(metadata);
|
|
13846
|
+
if (this.metadata.id !== address.toLowerCase()) throw new Error("Vault metadata belongs to another vault");
|
|
13765
13847
|
this.underlying = Object.freeze([...underlying]);
|
|
13766
13848
|
}
|
|
13767
13849
|
};
|
|
@@ -14423,7 +14505,7 @@ var AerodromeVault = class extends LiquidityVault {
|
|
|
14423
14505
|
#positionManager;
|
|
14424
14506
|
/** @internal */
|
|
14425
14507
|
constructor(context, identity) {
|
|
14426
|
-
super(context.address, context.steer.context, context.steer, context.underlying);
|
|
14508
|
+
super(context.address, context.steer.context, context.steer, context.underlying, context.metadata);
|
|
14427
14509
|
const underlying = context.underlying[0];
|
|
14428
14510
|
if (context.underlying.length !== 1 || underlying?.kind !== "liquidity" || !(underlying.amm instanceof AerodromeSlipstreamAdapter) || typeof underlying.pool !== "string") identityMismatch("Expected one Aerodrome vault pool");
|
|
14429
14511
|
requireAddress(underlying.pool);
|
|
@@ -14527,6 +14609,7 @@ async function readAerodromeBulkSnapshot(vault, data, rpc, beacon) {
|
|
|
14527
14609
|
steer: vault.steer,
|
|
14528
14610
|
address: vault.address,
|
|
14529
14611
|
underlying: vault.underlying,
|
|
14612
|
+
metadata: vault.metadata,
|
|
14530
14613
|
blockNumber: rpc.blockNumber
|
|
14531
14614
|
}, identity, {
|
|
14532
14615
|
raw: decodeAerodromeSnapshot(data),
|
|
@@ -15566,6 +15649,7 @@ async function readIntegralBulkSnapshot(vault, data, rpc) {
|
|
|
15566
15649
|
steer: vault.steer,
|
|
15567
15650
|
address: vault.address,
|
|
15568
15651
|
underlying: vault.underlying,
|
|
15652
|
+
metadata: vault.metadata,
|
|
15569
15653
|
blockNumber: rpc.blockNumber
|
|
15570
15654
|
}, {
|
|
15571
15655
|
raw,
|
|
@@ -15579,7 +15663,7 @@ var AlgebraIntegralVault = class extends LiquidityVault {
|
|
|
15579
15663
|
amm;
|
|
15580
15664
|
pool;
|
|
15581
15665
|
constructor(context) {
|
|
15582
|
-
super(context.address, context.steer.context, context.steer, context.underlying);
|
|
15666
|
+
super(context.address, context.steer.context, context.steer, context.underlying, context.metadata);
|
|
15583
15667
|
const underlying = context.underlying[0];
|
|
15584
15668
|
if (context.underlying.length !== 1 || underlying?.kind !== "liquidity" || !isAlgebraIntegralAdapter(underlying.amm) || typeof underlying.pool !== "string") identityMismatch("Expected one Integral vault pool");
|
|
15585
15669
|
requireAddress(underlying.pool);
|
|
@@ -17178,6 +17262,7 @@ async function readV3BulkSnapshot(vault, data, rpc) {
|
|
|
17178
17262
|
steer: vault.steer,
|
|
17179
17263
|
address: vault.address,
|
|
17180
17264
|
underlying: vault.underlying,
|
|
17265
|
+
metadata: vault.metadata,
|
|
17181
17266
|
blockNumber: rpc.blockNumber
|
|
17182
17267
|
}, {
|
|
17183
17268
|
raw,
|
|
@@ -17191,7 +17276,7 @@ var UniswapV3Vault = class extends LiquidityVault {
|
|
|
17191
17276
|
amm;
|
|
17192
17277
|
pool;
|
|
17193
17278
|
constructor(context) {
|
|
17194
|
-
super(context.address, context.steer.context, context.steer, context.underlying);
|
|
17279
|
+
super(context.address, context.steer.context, context.steer, context.underlying, context.metadata);
|
|
17195
17280
|
const underlying = context.underlying[0];
|
|
17196
17281
|
if (context.underlying.length !== 1 || underlying?.kind !== "liquidity" || !isUniswapV3Adapter(underlying.amm) || typeof underlying.pool !== "string") identityMismatch("Expected one V3 vault pool");
|
|
17197
17282
|
requireAddress(underlying.pool);
|
|
@@ -18824,7 +18909,7 @@ var UniswapV4Vault = class extends LiquidityVault {
|
|
|
18824
18909
|
amm;
|
|
18825
18910
|
pool;
|
|
18826
18911
|
constructor(context) {
|
|
18827
|
-
super(context.address, context.steer.context, context.steer, context.underlying);
|
|
18912
|
+
super(context.address, context.steer.context, context.steer, context.underlying, context.metadata);
|
|
18828
18913
|
const underlying = context.underlying[0];
|
|
18829
18914
|
if (context.underlying.length !== 1 || underlying?.kind !== "liquidity" || !(underlying.amm instanceof UniswapV4Adapter) || !isLiquidityPool(underlying.pool) || typeof underlying.pool === "string") identityMismatch("Expected one standalone V4 vault pool");
|
|
18830
18915
|
this.amm = underlying.amm;
|
|
@@ -20204,6 +20289,7 @@ async function readLegacyBulkSnapshot(vault, data, rpc, beacon) {
|
|
|
20204
20289
|
steer: vault.steer,
|
|
20205
20290
|
address: vault.address,
|
|
20206
20291
|
underlying: vault.underlying,
|
|
20292
|
+
metadata: vault.metadata,
|
|
20207
20293
|
blockNumber: rpc.blockNumber
|
|
20208
20294
|
}, {
|
|
20209
20295
|
raw,
|
|
@@ -20217,7 +20303,7 @@ var AlgebraLegacyVault = class extends LiquidityVault {
|
|
|
20217
20303
|
amm;
|
|
20218
20304
|
pool;
|
|
20219
20305
|
constructor(context) {
|
|
20220
|
-
super(context.address, context.steer.context, context.steer, context.underlying);
|
|
20306
|
+
super(context.address, context.steer.context, context.steer, context.underlying, context.metadata);
|
|
20221
20307
|
const underlying = context.underlying[0];
|
|
20222
20308
|
if (context.underlying.length !== 1 || underlying?.kind !== "liquidity" || !isAlgebraLegacyAdapter(underlying.amm) || typeof underlying.pool !== "string") identityMismatch("Expected one Legacy vault pool");
|
|
20223
20309
|
requireAddress(underlying.pool);
|
|
@@ -20824,7 +20910,7 @@ var VaultResolver = class {
|
|
|
20824
20910
|
if (!vault) throw new Error("Missing resolved vault");
|
|
20825
20911
|
return vault;
|
|
20826
20912
|
}
|
|
20827
|
-
async #createVault(context, identity, verified) {
|
|
20913
|
+
async #createVault(context, identity, loadMetadata, verified) {
|
|
20828
20914
|
const { steer, address } = context;
|
|
20829
20915
|
if (!identity) throw new VaultResolutionError("not-registered", "Vault is not registered with Steer");
|
|
20830
20916
|
if (identity.chainId !== steer.context.chainId || addressKey(identity.vaultAddress) !== addressKey(address) || addressKey(identity.registryAddress) !== addressKey(steer.contracts.VaultRegistry.address) || addressKey(identity.beaconAddress) !== addressKey(identity.proxyBeaconAddress)) throw new VaultResolutionError("identity-mismatch", "Vault identity does not match the request");
|
|
@@ -20836,9 +20922,12 @@ var VaultResolver = class {
|
|
|
20836
20922
|
lending: /* @__PURE__ */ new Map()
|
|
20837
20923
|
};
|
|
20838
20924
|
const resolvedUnderlying = Object.freeze(underlying.map((position) => this.#resolveUnderlying(position, adapters)));
|
|
20925
|
+
const metadata = await loadMetadata();
|
|
20926
|
+
if (metadata.id.toLowerCase() !== address.toLowerCase()) throw new Error("Vault metadata belongs to another vault");
|
|
20839
20927
|
const resolved = Object.freeze({
|
|
20840
20928
|
...context,
|
|
20841
|
-
underlying: resolvedUnderlying
|
|
20929
|
+
underlying: resolvedUnderlying,
|
|
20930
|
+
metadata
|
|
20842
20931
|
});
|
|
20843
20932
|
const vault = binding.createVault(resolved);
|
|
20844
20933
|
this.#validateVault(vault, binding, resolved);
|
|
@@ -20858,11 +20947,21 @@ var VaultResolver = class {
|
|
|
20858
20947
|
steer: vault.steer,
|
|
20859
20948
|
address: vault.address,
|
|
20860
20949
|
underlying: vault.underlying,
|
|
20950
|
+
metadata: vault.metadata,
|
|
20861
20951
|
blockNumber
|
|
20862
20952
|
});
|
|
20863
20953
|
if (snapshot.blockNumber !== blockNumber || !vault.underlying.some((position) => position.kind === "liquidity" && sameLiquidityPool(position.pool, snapshot.pool))) throw new Error("Vault returned another accounting snapshot");
|
|
20864
20954
|
return readValidatedVaultSnapshot(vault, snapshot, vault.steer.context);
|
|
20865
20955
|
}
|
|
20956
|
+
#metadata(steer, addresses) {
|
|
20957
|
+
let pending;
|
|
20958
|
+
return async (address) => {
|
|
20959
|
+
pending ??= steer.dataAdapter.getVaultMetadata(addresses);
|
|
20960
|
+
const metadata = (await pending).find((record) => record.id.toLowerCase() === address.toLowerCase());
|
|
20961
|
+
if (!metadata) throw new Error("Vault metadata is not indexed");
|
|
20962
|
+
return metadata;
|
|
20963
|
+
};
|
|
20964
|
+
}
|
|
20866
20965
|
/** Bounded bulk identity pages at one block; compatibility uses four active loads. */
|
|
20867
20966
|
async resolveMany(steer, addresses, options) {
|
|
20868
20967
|
const inputs = [...addresses];
|
|
@@ -20873,6 +20972,7 @@ var VaultResolver = class {
|
|
|
20873
20972
|
let bulkSupported = !!this.#reader.readMany;
|
|
20874
20973
|
for (let start = 0; start < inputs.length; start += 64) {
|
|
20875
20974
|
const batch = inputs.slice(start, start + 64);
|
|
20975
|
+
const loadMetadata = this.#metadata(steer, batch);
|
|
20876
20976
|
const contexts = batch.map((address) => Object.freeze({
|
|
20877
20977
|
steer,
|
|
20878
20978
|
address,
|
|
@@ -20884,13 +20984,13 @@ var VaultResolver = class {
|
|
|
20884
20984
|
for (const [i, context] of contexts.entries()) {
|
|
20885
20985
|
const read = reads[i];
|
|
20886
20986
|
if (!read) throw new VaultResolutionError("identity-mismatch", "Missing bulk vault identity");
|
|
20887
|
-
result.push((await this.#createVault(context, read.identity, read)).vault);
|
|
20987
|
+
result.push((await this.#createVault(context, read.identity, () => loadMetadata(context.address), read)).vault);
|
|
20888
20988
|
}
|
|
20889
20989
|
} else {
|
|
20890
20990
|
bulkSupported = false;
|
|
20891
20991
|
for (let i = 0; i < batch.length; i += 4) result.push(...await Promise.all(contexts.slice(i, i + 4).map(async (context) => {
|
|
20892
20992
|
const identity = await this.#reader.readIdentity(context);
|
|
20893
|
-
return (await this.#createVault(context, identity)).vault;
|
|
20993
|
+
return (await this.#createVault(context, identity, () => loadMetadata(context.address))).vault;
|
|
20894
20994
|
})));
|
|
20895
20995
|
}
|
|
20896
20996
|
}
|
|
@@ -20906,6 +21006,7 @@ var VaultResolver = class {
|
|
|
20906
21006
|
let bulkSupported = !!this.#reader.readSnapshots;
|
|
20907
21007
|
for (let start = 0; start < inputs.length; start += 16) {
|
|
20908
21008
|
const batch = inputs.slice(start, start + 16);
|
|
21009
|
+
const loadMetadata = this.#metadata(steer, batch);
|
|
20909
21010
|
const contexts = batch.map((address) => Object.freeze({
|
|
20910
21011
|
steer,
|
|
20911
21012
|
address,
|
|
@@ -20917,7 +21018,7 @@ var VaultResolver = class {
|
|
|
20917
21018
|
for (const [i, context] of contexts.entries()) {
|
|
20918
21019
|
const read = reads[i];
|
|
20919
21020
|
if (!read) throw new Error("Missing bulk vault snapshot");
|
|
20920
|
-
const { vault } = await this.#createVault(context, read.identity, read);
|
|
21021
|
+
const { vault } = await this.#createVault(context, read.identity, () => loadMetadata(context.address), read);
|
|
20921
21022
|
if (vault.kind !== "liquidity") throw new VaultResolutionError("invalid-vault", "Vault does not support liquidity snapshots");
|
|
20922
21023
|
result.push(await read.readSnapshot(vault));
|
|
20923
21024
|
}
|
|
@@ -20930,7 +21031,7 @@ var VaultResolver = class {
|
|
|
20930
21031
|
blockNumber
|
|
20931
21032
|
});
|
|
20932
21033
|
const identity = await this.#reader.readIdentity(context);
|
|
20933
|
-
const { vault, binding, context: resolved } = await this.#createVault(context, identity);
|
|
21034
|
+
const { vault, binding, context: resolved } = await this.#createVault(context, identity, () => loadMetadata(context.address));
|
|
20934
21035
|
if (vault.kind !== "liquidity") throw new VaultResolutionError("invalid-vault", "Vault does not support liquidity snapshots");
|
|
20935
21036
|
if (!binding.readSnapshot) throw new VaultResolutionError("not-configured", "No verified snapshot reader configured for vault implementation");
|
|
20936
21037
|
const snapshot = await binding.readSnapshot(resolved);
|