@steerprotocol/sdk 4.0.0-next.10 → 4.0.0-next.11
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 +70 -0
- package/dist/index.cjs +172 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -1
- package/dist/index.d.mts +43 -1
- package/dist/index.mjs +172 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -525,6 +525,8 @@ export declare abstract class LiquidityVault<TAmm extends AmmAdapter = AmmAdapte
|
|
|
525
525
|
abstract readonly amm: TAmm;
|
|
526
526
|
abstract getPositions(options?: ReadOptions): Promise<readonly LiquidityPosition<TPool>[]>;
|
|
527
527
|
abstract getSnapshot(options?: ReadOptions): Promise<LiquidityVaultSnapshot<TPool>>;
|
|
528
|
+
/** Read strategy inputs at an explicit block, with timestamp-bounded indexed execution history. */
|
|
529
|
+
getExecutionContext(request: VaultExecutionContextRequest, options?: DataAdapterRequestOptions): Promise<VaultExecutionContext>;
|
|
528
530
|
/** Calculate the other token maximum at the vault's current deposit ratio. Does not swap. */
|
|
529
531
|
abstract quoteDeposit(input: AssetAmount, options?: ReadOptions): Promise<DepositQuote>;
|
|
530
532
|
abstract previewDeposit(request: DepositRequest, options?: ReadOptions): Promise<LiquidityDepositPreview>;
|
|
@@ -565,6 +567,44 @@ interface VaultMetadata {
|
|
|
565
567
|
readonly id: string;
|
|
566
568
|
} | null;
|
|
567
569
|
}
|
|
570
|
+
interface VaultExecutionContextRequest {
|
|
571
|
+
readonly blockNumber: bigint;
|
|
572
|
+
/** Explicit execution epoch in Unix seconds, never inferred from the wall clock. */
|
|
573
|
+
readonly epochTimestamp: bigint;
|
|
574
|
+
}
|
|
575
|
+
interface VaultExecutionHistoryRequest {
|
|
576
|
+
readonly vaultAddress: Address;
|
|
577
|
+
readonly blockNumber: bigint;
|
|
578
|
+
readonly timestamp: bigint;
|
|
579
|
+
}
|
|
580
|
+
type VaultExecutionPoolFamily = "uniswap-v3-compatible" | "algebra" | "algebra-directional" | "algebra-integral" | "aerodrome-cl" | "uniswap-v4";
|
|
581
|
+
/** JSON-safe strategy inputs. Totals follow the original contract's unpoked semantics. */
|
|
582
|
+
interface VaultExecutionContext {
|
|
583
|
+
readonly chainId: number;
|
|
584
|
+
readonly blockNumber: string;
|
|
585
|
+
readonly epochTimestamp: string;
|
|
586
|
+
readonly vaultAddress: Address;
|
|
587
|
+
readonly protocol: AmmProtocol;
|
|
588
|
+
readonly beaconName: string;
|
|
589
|
+
readonly beaconAddress: Address;
|
|
590
|
+
readonly poolFamily: VaultExecutionPoolFamily;
|
|
591
|
+
readonly poolAddress: Address | null;
|
|
592
|
+
readonly factoryAddress: Address | null;
|
|
593
|
+
readonly poolId: Hex | null;
|
|
594
|
+
readonly poolManagerAddress: Address | null;
|
|
595
|
+
readonly poolKey: V4PoolKey | null;
|
|
596
|
+
readonly currentTick: number;
|
|
597
|
+
readonly tickSpacing: number;
|
|
598
|
+
readonly positions: readonly {
|
|
599
|
+
readonly lowerTick: number;
|
|
600
|
+
readonly upperTick: number;
|
|
601
|
+
readonly relativeWeight: number;
|
|
602
|
+
}[];
|
|
603
|
+
readonly totalAmount0: string;
|
|
604
|
+
readonly totalAmount1: string;
|
|
605
|
+
readonly lastExecutionTimestamp: string | null;
|
|
606
|
+
readonly lastExecutionTimeSeconds: string | null;
|
|
607
|
+
}
|
|
568
608
|
/** Loading options. Supplied indexed metadata never replaces onchain identity checks. */
|
|
569
609
|
interface VaultLoadOptions extends ReadOptions {
|
|
570
610
|
/** Complete records for the requested addresses; omit to fetch from the subgraph. */
|
|
@@ -879,6 +919,8 @@ export declare abstract class LendingDataAdapter<TMarketRef> extends DataAdapter
|
|
|
879
919
|
abstract listMarkets(request?: PageRequest): Promise<Page<TMarketRef>>;
|
|
880
920
|
}
|
|
881
921
|
export declare abstract class SteerDataAdapter extends DataAdapter {
|
|
922
|
+
/** Latest indexed execution through the requested block and timestamp, or null if absent. */
|
|
923
|
+
getLastVaultExecution(_request: VaultExecutionHistoryRequest, _options?: DataAdapterRequestOptions): Promise<bigint | null>;
|
|
882
924
|
listUserVaults(_request: UserVaultListRequest, _options?: DataAdapterRequestOptions): Promise<UserVaultPage>;
|
|
883
925
|
getVaultMetadata(_addresses: readonly Address[], _options?: DataAdapterRequestOptions): Promise<readonly VaultMetadata[]>;
|
|
884
926
|
abstract listVaults(request?: VaultListRequest, options?: DataAdapterRequestOptions): Promise<Page<VaultMetadata>>;
|
|
@@ -3857,5 +3899,5 @@ export declare class UniswapV4Vault extends LiquidityVault<UniswapV4Adapter, V4V
|
|
|
3857
3899
|
prepareDeposit(request: PrepareDepositRequest, options?: ReadOptions): Promise<DepositPlan>;
|
|
3858
3900
|
}
|
|
3859
3901
|
//#endregion
|
|
3860
|
-
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 BlackholeNativeUnwrapPlan, type BlackholePosition, type BlackholeVaultSnapshot, type BlackholeWithdrawPlan, type BlackholeWithdrawPreview, 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 PoolBatchReadOptions, type PoolLookupRequest, type PoolPrice, type PoolReadOptions, type PoolReadResult, 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 VaultLoadOptions, type VaultLoadResult, type VaultMetadata, type VaultRewardAsset, type VaultRewardFee, type VaultRewardPayout, type VaultSnapshotResult, type VaultUnderlying, type VaultUserPosition, type WithdrawPlan, type WithdrawPreview, type WithdrawRequest, type WithdrawRewards, ethereumContracts as mainnetContracts };
|
|
3902
|
+
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 BlackholeNativeUnwrapPlan, type BlackholePosition, type BlackholeVaultSnapshot, type BlackholeWithdrawPlan, type BlackholeWithdrawPreview, 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 PoolBatchReadOptions, type PoolLookupRequest, type PoolPrice, type PoolReadOptions, type PoolReadResult, 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 VaultExecutionContext, type VaultExecutionContextRequest, type VaultExecutionHistoryRequest, type VaultExecutionPoolFamily, type VaultListRequest, type VaultLoadOptions, type VaultLoadResult, type VaultMetadata, type VaultRewardAsset, type VaultRewardFee, type VaultRewardPayout, type VaultSnapshotResult, type VaultUnderlying, type VaultUserPosition, type WithdrawPlan, type WithdrawPreview, type WithdrawRequest, type WithdrawRewards, ethereumContracts as mainnetContracts };
|
|
3861
3903
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -525,6 +525,8 @@ export declare abstract class LiquidityVault<TAmm extends AmmAdapter = AmmAdapte
|
|
|
525
525
|
abstract readonly amm: TAmm;
|
|
526
526
|
abstract getPositions(options?: ReadOptions): Promise<readonly LiquidityPosition<TPool>[]>;
|
|
527
527
|
abstract getSnapshot(options?: ReadOptions): Promise<LiquidityVaultSnapshot<TPool>>;
|
|
528
|
+
/** Read strategy inputs at an explicit block, with timestamp-bounded indexed execution history. */
|
|
529
|
+
getExecutionContext(request: VaultExecutionContextRequest, options?: DataAdapterRequestOptions): Promise<VaultExecutionContext>;
|
|
528
530
|
/** Calculate the other token maximum at the vault's current deposit ratio. Does not swap. */
|
|
529
531
|
abstract quoteDeposit(input: AssetAmount, options?: ReadOptions): Promise<DepositQuote>;
|
|
530
532
|
abstract previewDeposit(request: DepositRequest, options?: ReadOptions): Promise<LiquidityDepositPreview>;
|
|
@@ -565,6 +567,44 @@ interface VaultMetadata {
|
|
|
565
567
|
readonly id: string;
|
|
566
568
|
} | null;
|
|
567
569
|
}
|
|
570
|
+
interface VaultExecutionContextRequest {
|
|
571
|
+
readonly blockNumber: bigint;
|
|
572
|
+
/** Explicit execution epoch in Unix seconds, never inferred from the wall clock. */
|
|
573
|
+
readonly epochTimestamp: bigint;
|
|
574
|
+
}
|
|
575
|
+
interface VaultExecutionHistoryRequest {
|
|
576
|
+
readonly vaultAddress: Address;
|
|
577
|
+
readonly blockNumber: bigint;
|
|
578
|
+
readonly timestamp: bigint;
|
|
579
|
+
}
|
|
580
|
+
type VaultExecutionPoolFamily = "uniswap-v3-compatible" | "algebra" | "algebra-directional" | "algebra-integral" | "aerodrome-cl" | "uniswap-v4";
|
|
581
|
+
/** JSON-safe strategy inputs. Totals follow the original contract's unpoked semantics. */
|
|
582
|
+
interface VaultExecutionContext {
|
|
583
|
+
readonly chainId: number;
|
|
584
|
+
readonly blockNumber: string;
|
|
585
|
+
readonly epochTimestamp: string;
|
|
586
|
+
readonly vaultAddress: Address;
|
|
587
|
+
readonly protocol: AmmProtocol;
|
|
588
|
+
readonly beaconName: string;
|
|
589
|
+
readonly beaconAddress: Address;
|
|
590
|
+
readonly poolFamily: VaultExecutionPoolFamily;
|
|
591
|
+
readonly poolAddress: Address | null;
|
|
592
|
+
readonly factoryAddress: Address | null;
|
|
593
|
+
readonly poolId: Hex | null;
|
|
594
|
+
readonly poolManagerAddress: Address | null;
|
|
595
|
+
readonly poolKey: V4PoolKey | null;
|
|
596
|
+
readonly currentTick: number;
|
|
597
|
+
readonly tickSpacing: number;
|
|
598
|
+
readonly positions: readonly {
|
|
599
|
+
readonly lowerTick: number;
|
|
600
|
+
readonly upperTick: number;
|
|
601
|
+
readonly relativeWeight: number;
|
|
602
|
+
}[];
|
|
603
|
+
readonly totalAmount0: string;
|
|
604
|
+
readonly totalAmount1: string;
|
|
605
|
+
readonly lastExecutionTimestamp: string | null;
|
|
606
|
+
readonly lastExecutionTimeSeconds: string | null;
|
|
607
|
+
}
|
|
568
608
|
/** Loading options. Supplied indexed metadata never replaces onchain identity checks. */
|
|
569
609
|
interface VaultLoadOptions extends ReadOptions {
|
|
570
610
|
/** Complete records for the requested addresses; omit to fetch from the subgraph. */
|
|
@@ -879,6 +919,8 @@ export declare abstract class LendingDataAdapter<TMarketRef> extends DataAdapter
|
|
|
879
919
|
abstract listMarkets(request?: PageRequest): Promise<Page<TMarketRef>>;
|
|
880
920
|
}
|
|
881
921
|
export declare abstract class SteerDataAdapter extends DataAdapter {
|
|
922
|
+
/** Latest indexed execution through the requested block and timestamp, or null if absent. */
|
|
923
|
+
getLastVaultExecution(_request: VaultExecutionHistoryRequest, _options?: DataAdapterRequestOptions): Promise<bigint | null>;
|
|
882
924
|
listUserVaults(_request: UserVaultListRequest, _options?: DataAdapterRequestOptions): Promise<UserVaultPage>;
|
|
883
925
|
getVaultMetadata(_addresses: readonly Address[], _options?: DataAdapterRequestOptions): Promise<readonly VaultMetadata[]>;
|
|
884
926
|
abstract listVaults(request?: VaultListRequest, options?: DataAdapterRequestOptions): Promise<Page<VaultMetadata>>;
|
|
@@ -3857,5 +3899,5 @@ export declare class UniswapV4Vault extends LiquidityVault<UniswapV4Adapter, V4V
|
|
|
3857
3899
|
prepareDeposit(request: PrepareDepositRequest, options?: ReadOptions): Promise<DepositPlan>;
|
|
3858
3900
|
}
|
|
3859
3901
|
//#endregion
|
|
3860
|
-
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 BlackholeNativeUnwrapPlan, type BlackholePosition, type BlackholeVaultSnapshot, type BlackholeWithdrawPlan, type BlackholeWithdrawPreview, 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 PoolBatchReadOptions, type PoolLookupRequest, type PoolPrice, type PoolReadOptions, type PoolReadResult, 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 VaultLoadOptions, type VaultLoadResult, type VaultMetadata, type VaultRewardAsset, type VaultRewardFee, type VaultRewardPayout, type VaultSnapshotResult, type VaultUnderlying, type VaultUserPosition, type WithdrawPlan, type WithdrawPreview, type WithdrawRequest, type WithdrawRewards, ethereumContracts as mainnetContracts };
|
|
3902
|
+
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 BlackholeNativeUnwrapPlan, type BlackholePosition, type BlackholeVaultSnapshot, type BlackholeWithdrawPlan, type BlackholeWithdrawPreview, 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 PoolBatchReadOptions, type PoolLookupRequest, type PoolPrice, type PoolReadOptions, type PoolReadResult, 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 VaultExecutionContext, type VaultExecutionContextRequest, type VaultExecutionHistoryRequest, type VaultExecutionPoolFamily, type VaultListRequest, type VaultLoadOptions, type VaultLoadResult, type VaultMetadata, type VaultRewardAsset, type VaultRewardFee, type VaultRewardPayout, type VaultSnapshotResult, type VaultUnderlying, type VaultUserPosition, type WithdrawPlan, type WithdrawPreview, type WithdrawRequest, type WithdrawRewards, ethereumContracts as mainnetContracts };
|
|
3861
3903
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -2302,6 +2302,10 @@ var DataAdapter = class {
|
|
|
2302
2302
|
var PoolDataAdapter = class extends DataAdapter {};
|
|
2303
2303
|
var LendingDataAdapter = class extends DataAdapter {};
|
|
2304
2304
|
var SteerDataAdapter = class extends DataAdapter {
|
|
2305
|
+
/** Latest indexed execution through the requested block and timestamp, or null if absent. */
|
|
2306
|
+
async getLastVaultExecution(_request, _options) {
|
|
2307
|
+
throw new Error("Vault execution history is not configured for this data adapter");
|
|
2308
|
+
}
|
|
2305
2309
|
async listUserVaults(_request, _options) {
|
|
2306
2310
|
throw new Error("User vault discovery is not configured for this data adapter");
|
|
2307
2311
|
}
|
|
@@ -12777,6 +12781,29 @@ var CatalogSteerDataAdapter = class extends SteerDataAdapter {
|
|
|
12777
12781
|
#factories = /* @__PURE__ */ new Map();
|
|
12778
12782
|
#identity;
|
|
12779
12783
|
#context;
|
|
12784
|
+
async getLastVaultExecution(request, options) {
|
|
12785
|
+
const vaultAddress = indexedAddress(request.vaultAddress);
|
|
12786
|
+
const { blockNumber, timestamp } = request;
|
|
12787
|
+
if (typeof blockNumber !== "bigint" || blockNumber < 0n || blockNumber > 2147483647n) throw new Error("Execution history block must fit a nonnegative GraphQL Int");
|
|
12788
|
+
if (typeof timestamp !== "bigint" || timestamp < 0n) throw new Error("Execution history timestamp must be nonnegative");
|
|
12789
|
+
const data = await this.#query(`query VaultExecutionHistory($vault: String!, $timestamp: BigInt!, $block: Int!) {
|
|
12790
|
+
vaultSnapshots(first: 1, orderBy: timestamp, orderDirection: desc,
|
|
12791
|
+
block: {number: $block}, where: {vaultAddress: $vault, timestamp_lte: $timestamp}) {
|
|
12792
|
+
timestamp
|
|
12793
|
+
}
|
|
12794
|
+
_meta(block: {number: $block}) { ${metaFields} }
|
|
12795
|
+
}`, {
|
|
12796
|
+
vault: vaultAddress,
|
|
12797
|
+
timestamp: timestamp.toString(),
|
|
12798
|
+
block: Number(blockNumber)
|
|
12799
|
+
}, options);
|
|
12800
|
+
if (BigInt(snapshot$1(data).block) !== blockNumber) throw new Error("Execution history returned another block");
|
|
12801
|
+
if (!Array.isArray(data.vaultSnapshots) || data.vaultSnapshots.length > 1) throw new Error("Malformed vault execution history");
|
|
12802
|
+
if (data.vaultSnapshots.length === 0) return null;
|
|
12803
|
+
const value = record(data.vaultSnapshots[0]).timestamp;
|
|
12804
|
+
if (typeof value !== "string" || !/^\d+$/.test(value) || BigInt(value) > timestamp) throw new Error("Invalid vault execution timestamp");
|
|
12805
|
+
return BigInt(value);
|
|
12806
|
+
}
|
|
12780
12807
|
constructor(definition, context, mappings) {
|
|
12781
12808
|
super(definition.dataAdapter);
|
|
12782
12809
|
if (definition.dataAdapter.kind !== "subgraph") throw new Error("Steer vault listing requires a subgraph endpoint");
|
|
@@ -13427,7 +13454,7 @@ function captureAsset$1({ asset, amount }, allowNative = false) {
|
|
|
13427
13454
|
amount
|
|
13428
13455
|
});
|
|
13429
13456
|
}
|
|
13430
|
-
function captureRequest(input, allowNative) {
|
|
13457
|
+
function captureRequest$1(input, allowNative) {
|
|
13431
13458
|
const { account, receiver } = input;
|
|
13432
13459
|
requireAddress(account);
|
|
13433
13460
|
requireAddress(receiver);
|
|
@@ -13485,7 +13512,7 @@ function buildPreview(snapshot, state, desired0, desired1, minimumInitialShares,
|
|
|
13485
13512
|
});
|
|
13486
13513
|
}
|
|
13487
13514
|
async function previewLiquidityDeposit(vault, input, minimumInitialShares, options, accounting = defaultAccounting) {
|
|
13488
|
-
const request = captureRequest(input, accounting.allowNative);
|
|
13515
|
+
const request = captureRequest$1(input, accounting.allowNative);
|
|
13489
13516
|
const { snapshot, state, desired0, desired1 } = await readDepositInput(vault, request.assets, options, void 0, accounting, request.receiver);
|
|
13490
13517
|
return buildPreview(snapshot, state, desired0, desired1, minimumInitialShares, accounting.singleSidedRounding);
|
|
13491
13518
|
}
|
|
@@ -13507,7 +13534,7 @@ async function quoteLiquidityDeposit(vault, input, options, accounting = default
|
|
|
13507
13534
|
});
|
|
13508
13535
|
}
|
|
13509
13536
|
async function prepareLiquidityDeposit(vault, input, minimumInitialShares, options, accounting = defaultAccounting) {
|
|
13510
|
-
const request = captureRequest(input, accounting.allowNative);
|
|
13537
|
+
const request = captureRequest$1(input, accounting.allowNative);
|
|
13511
13538
|
const slippageBps = input.slippageBps;
|
|
13512
13539
|
if (!Number.isInteger(slippageBps) || slippageBps < 0 || slippageBps > 1e4) throw new Error("Deposit slippageBps must be an integer from 0 through 10000");
|
|
13513
13540
|
const { snapshot, state, desired0, desired1 } = await readDepositInput(vault, request.assets, options, request.account, accounting, request.receiver);
|
|
@@ -14102,6 +14129,10 @@ var SteerVault = class {
|
|
|
14102
14129
|
};
|
|
14103
14130
|
var LiquidityVault = class extends SteerVault {
|
|
14104
14131
|
kind = "liquidity";
|
|
14132
|
+
/** Read strategy inputs at an explicit block, with timestamp-bounded indexed execution history. */
|
|
14133
|
+
getExecutionContext(request, options) {
|
|
14134
|
+
return this.steer.readVaultExecutionContext(this, request, options);
|
|
14135
|
+
}
|
|
14105
14136
|
/** Simulates the original withdrawal as account at one verified block. Never submits. */
|
|
14106
14137
|
previewWithdraw(request, options) {
|
|
14107
14138
|
return previewLiquidityWithdraw(this, request, options);
|
|
@@ -25384,6 +25415,133 @@ function createIndexerRequest(config, defaults) {
|
|
|
25384
25415
|
});
|
|
25385
25416
|
}
|
|
25386
25417
|
//#endregion
|
|
25418
|
+
//#region src/vault/adapters/blackhole/execution.ts
|
|
25419
|
+
/** Custom-pool routing comes from the qualified vault layout, never an address-only guess. */
|
|
25420
|
+
async function readBlackholeExecutionPool(vault, blockNumber) {
|
|
25421
|
+
const { target } = await readBlackholePool({
|
|
25422
|
+
steer: vault.steer,
|
|
25423
|
+
address: vault.address,
|
|
25424
|
+
blockNumber
|
|
25425
|
+
});
|
|
25426
|
+
if (!sameAddress(target.address, vault.pool)) throw new Error("Blackhole vault pool changed");
|
|
25427
|
+
const pool = await vault.amm.getPool(Object.freeze({ ...target }), Object.freeze({ blockNumber }));
|
|
25428
|
+
if (!sameAddress(pool.deployer, target.deployer)) throw new Error("Blackhole execution pool deployer does not match the vault");
|
|
25429
|
+
return pool;
|
|
25430
|
+
}
|
|
25431
|
+
//#endregion
|
|
25432
|
+
//#region src/vault/execution-pool.ts
|
|
25433
|
+
function validatePoolState(block, tick, spacing, expected) {
|
|
25434
|
+
if (block !== expected || !Number.isInteger(tick) || tick < -887272 || tick > 887272 || !Number.isInteger(spacing) || spacing <= 0 || spacing > 8388607) throw new Error("Invalid execution pool state or block");
|
|
25435
|
+
}
|
|
25436
|
+
/** Dispatch actual registered adapters, then check the result against the verified vault pool. */
|
|
25437
|
+
async function readExecutionPool(vault, snapshot) {
|
|
25438
|
+
const amm = vault.amm;
|
|
25439
|
+
const options = Object.freeze({ blockNumber: snapshot.blockNumber });
|
|
25440
|
+
if (amm.context.chainId !== vault.chain.chainId || amm.context.transport !== vault.chain.transport) throw new Error("Execution AMM belongs to another chain or transport");
|
|
25441
|
+
if (typeof snapshot.pool !== "string") {
|
|
25442
|
+
if (!isUniswapV4Adapter(amm)) throw new Error("Execution pool requires a V4 adapter");
|
|
25443
|
+
const pool = await amm.getPool(snapshot.pool.key, options);
|
|
25444
|
+
validatePoolState(pool.blockNumber, pool.tick, pool.key.tickSpacing, snapshot.blockNumber);
|
|
25445
|
+
if (!sameLiquidityPool(snapshot.pool, {
|
|
25446
|
+
poolId: pool.poolId,
|
|
25447
|
+
poolManager: pool.poolManager,
|
|
25448
|
+
key: pool.key
|
|
25449
|
+
}) || !sameAddress(pool.poolManager, amm.contracts.poolManager.address) || !sameAddress(pool.key.currency0, snapshot.token0) || !sameAddress(pool.key.currency1, snapshot.token1)) throw new Error("Execution pool identity does not match the vault");
|
|
25450
|
+
return Object.freeze({
|
|
25451
|
+
poolFamily: "uniswap-v4",
|
|
25452
|
+
poolAddress: null,
|
|
25453
|
+
factoryAddress: null,
|
|
25454
|
+
poolId: pool.poolId,
|
|
25455
|
+
poolManagerAddress: pool.poolManager,
|
|
25456
|
+
poolKey: Object.freeze({ ...pool.key }),
|
|
25457
|
+
currentTick: pool.tick,
|
|
25458
|
+
tickSpacing: pool.key.tickSpacing
|
|
25459
|
+
});
|
|
25460
|
+
}
|
|
25461
|
+
if (!isUniswapV3Adapter(amm) && !isAlgebraLegacyAdapter(amm) && !isAlgebraIntegralAdapter(amm) && !(amm instanceof AerodromeSlipstreamAdapter)) throw new Error("Unsupported execution pool family");
|
|
25462
|
+
const factory = amm.contracts.factory.address;
|
|
25463
|
+
const pool = vault instanceof BlackholeVault ? await readBlackholeExecutionPool(vault, snapshot.blockNumber) : await amm.getPool(snapshot.pool, options);
|
|
25464
|
+
validatePoolState(pool.blockNumber, pool.tick, pool.tickSpacing, snapshot.blockNumber);
|
|
25465
|
+
if (!sameAddress(pool.address, snapshot.pool) || !sameAddress(pool.factory, factory) || !sameAddress(pool.token0, snapshot.token0) || !sameAddress(pool.token1, snapshot.token1)) throw new Error("Execution pool identity does not match the vault");
|
|
25466
|
+
const poolFamily = isUniswapV3Adapter(amm) ? "uniswap-v3-compatible" : isAlgebraLegacyAdapter(amm) ? amm instanceof AlgebraDirectionalAdapter ? "algebra-directional" : "algebra" : isAlgebraIntegralAdapter(amm) ? "algebra-integral" : "aerodrome-cl";
|
|
25467
|
+
return Object.freeze({
|
|
25468
|
+
poolFamily,
|
|
25469
|
+
poolAddress: pool.address,
|
|
25470
|
+
factoryAddress: pool.factory,
|
|
25471
|
+
poolId: null,
|
|
25472
|
+
poolManagerAddress: null,
|
|
25473
|
+
poolKey: null,
|
|
25474
|
+
currentTick: pool.tick,
|
|
25475
|
+
tickSpacing: pool.tickSpacing
|
|
25476
|
+
});
|
|
25477
|
+
}
|
|
25478
|
+
//#endregion
|
|
25479
|
+
//#region src/vault/execution-context.ts
|
|
25480
|
+
function captureRequest(request) {
|
|
25481
|
+
const { blockNumber, epochTimestamp } = request;
|
|
25482
|
+
if (typeof blockNumber !== "bigint" || blockNumber < 0n || blockNumber > 2147483647n) throw new Error("Execution block must fit a nonnegative GraphQL Int");
|
|
25483
|
+
if (typeof epochTimestamp !== "bigint" || epochTimestamp < 0n) throw new Error("Execution timestamp must be nonnegative Unix seconds");
|
|
25484
|
+
return Object.freeze({
|
|
25485
|
+
blockNumber,
|
|
25486
|
+
epochTimestamp
|
|
25487
|
+
});
|
|
25488
|
+
}
|
|
25489
|
+
function executionPositions(snapshot) {
|
|
25490
|
+
const seen = /* @__PURE__ */ new Set();
|
|
25491
|
+
return Object.freeze((snapshot.configuredPositions ?? snapshot.positions).map(({ lowerTick, upperTick, relativeWeight }) => {
|
|
25492
|
+
const key = `${lowerTick}:${upperTick}`;
|
|
25493
|
+
if (!Number.isInteger(lowerTick) || !Number.isInteger(upperTick) || lowerTick < -887272 || upperTick > 887272 || lowerTick >= upperTick || !Number.isInteger(relativeWeight) || relativeWeight < 0 || relativeWeight > 65535 || seen.has(key)) throw new Error("Invalid configured execution ranges");
|
|
25494
|
+
seen.add(key);
|
|
25495
|
+
return Object.freeze({
|
|
25496
|
+
lowerTick,
|
|
25497
|
+
upperTick,
|
|
25498
|
+
relativeWeight
|
|
25499
|
+
});
|
|
25500
|
+
}));
|
|
25501
|
+
}
|
|
25502
|
+
/** Keep original contract totals separate from the SDK's net-fee accounting snapshot. */
|
|
25503
|
+
async function readLiquidityExecutionContext(vault, beaconAddress, input, options) {
|
|
25504
|
+
const { blockNumber, epochTimestamp } = captureRequest(input);
|
|
25505
|
+
const { address: vaultAddress, chain, steer, metadata, amm } = vault;
|
|
25506
|
+
const beaconName = metadata.beaconName;
|
|
25507
|
+
const protocol = amm.protocol;
|
|
25508
|
+
const rpc = await vaultReadContext(chain, { blockNumber });
|
|
25509
|
+
const client = rpcClient(rpc.transport);
|
|
25510
|
+
const snapshot = await steer.readVaultSnapshot(vault, { blockNumber });
|
|
25511
|
+
const positions = executionPositions(snapshot);
|
|
25512
|
+
const pool = await readExecutionPool(vault, snapshot);
|
|
25513
|
+
const totals = await client.readContract({
|
|
25514
|
+
address: vaultAddress,
|
|
25515
|
+
abi: depositAbi,
|
|
25516
|
+
functionName: "getTotalAmounts",
|
|
25517
|
+
blockNumber
|
|
25518
|
+
});
|
|
25519
|
+
const block = await client.getBlock({ blockNumber });
|
|
25520
|
+
if (block.number !== blockNumber || typeof block.timestamp !== "bigint" || block.timestamp < 0n) throw new Error("Execution RPC returned an invalid block");
|
|
25521
|
+
const timestamp = block.timestamp < epochTimestamp ? block.timestamp : epochTimestamp;
|
|
25522
|
+
const lastExecution = await steer.dataAdapter.getLastVaultExecution({
|
|
25523
|
+
vaultAddress,
|
|
25524
|
+
blockNumber,
|
|
25525
|
+
timestamp
|
|
25526
|
+
}, options);
|
|
25527
|
+
if (lastExecution !== null && (typeof lastExecution !== "bigint" || lastExecution < 0n || lastExecution > timestamp)) throw new Error("Invalid vault execution timestamp");
|
|
25528
|
+
return Object.freeze({
|
|
25529
|
+
chainId: rpc.chainId,
|
|
25530
|
+
blockNumber: blockNumber.toString(),
|
|
25531
|
+
epochTimestamp: epochTimestamp.toString(),
|
|
25532
|
+
vaultAddress,
|
|
25533
|
+
protocol,
|
|
25534
|
+
beaconName,
|
|
25535
|
+
beaconAddress,
|
|
25536
|
+
...pool,
|
|
25537
|
+
positions,
|
|
25538
|
+
totalAmount0: totals[0].toString(),
|
|
25539
|
+
totalAmount1: totals[1].toString(),
|
|
25540
|
+
lastExecutionTimestamp: lastExecution?.toString() ?? null,
|
|
25541
|
+
lastExecutionTimeSeconds: lastExecution === null ? null : (epochTimestamp - lastExecution).toString()
|
|
25542
|
+
});
|
|
25543
|
+
}
|
|
25544
|
+
//#endregion
|
|
25387
25545
|
//#region src/vault/resolver.ts
|
|
25388
25546
|
function addressKey(address) {
|
|
25389
25547
|
if (!/^0x[0-9a-fA-F]{40}$/.test(address) || /^0x0{40}$/i.test(address)) throw new VaultResolutionError("identity-mismatch", "Invalid identity address");
|
|
@@ -25483,6 +25641,12 @@ var VaultResolver = class {
|
|
|
25483
25641
|
if (snapshot.blockNumber !== blockNumber || !vault.underlying.some((position) => position.kind === "liquidity" && sameLiquidityPool(position.pool, snapshot.pool))) throw new Error("Vault returned another accounting snapshot");
|
|
25484
25642
|
return readValidatedVaultSnapshot(vault, snapshot, vault.steer.context);
|
|
25485
25643
|
}
|
|
25644
|
+
/** @internal The native snapshot reader revalidates this binding at the requested block. */
|
|
25645
|
+
executionContext(vault, request, options) {
|
|
25646
|
+
const binding = this.#snapshotBindings.get(vault);
|
|
25647
|
+
if (!binding?.readSnapshot) throw new Error("No verified execution reader configured for vault");
|
|
25648
|
+
return readLiquidityExecutionContext(vault, binding.beaconAddress, request, options);
|
|
25649
|
+
}
|
|
25486
25650
|
#snapshotImplementation(snapshot, binding, beaconName) {
|
|
25487
25651
|
const { implementation: _implementation, ...accounting } = snapshot;
|
|
25488
25652
|
return Object.freeze({
|
|
@@ -25760,6 +25924,11 @@ var SteerNetwork = class {
|
|
|
25760
25924
|
if (vault.steer !== this) throw new VaultResolutionError("identity-mismatch", "Vault belongs to another Steer deployment");
|
|
25761
25925
|
return this.#vaultResolver().snapshot(vault, options);
|
|
25762
25926
|
}
|
|
25927
|
+
/** @internal Retain the resolved vault's exact binding and registered overrides. */
|
|
25928
|
+
readVaultExecutionContext(vault, request, options) {
|
|
25929
|
+
if (vault.steer !== this) throw new Error("Vault belongs to another Steer deployment");
|
|
25930
|
+
return this.#vaultResolver().executionContext(vault, request, options);
|
|
25931
|
+
}
|
|
25763
25932
|
#vaultResolver() {
|
|
25764
25933
|
if (!this.#resolver) throw new VaultResolutionError("not-configured", "No vault resolver configured for this Steer deployment");
|
|
25765
25934
|
return this.#resolver;
|