hoodkit
    Preparing search index...

    Interface TwapConfig

    Configuration for a TwapExecutor.

    interface TwapConfig {
        dryRun?: boolean;
        intervalMs?: number;
        onBeforeSlice?: (slice: TwapSlicePlan) => boolean | Promise<boolean>;
        onSlice?: (result: TwapSliceResult) => void;
        recipient?: `0x${string}`;
        signal?: AbortSignal;
        slices?: number;
        slippageBps?: number;
        spendCap?: SpendCap;
        tokenIn: `0x${string}`;
        tokenOut: `0x${string}`;
        totalAmountIn: bigint;
    }
    Index
    dryRun?: boolean

    When true, quote + build + eth_call simulate each slice WITHOUT sending. Defaults to true unless the client has a wallet. Set false explicitly to send real transactions.

    intervalMs?: number

    Delay between slices in ms.

    60_000

    onBeforeSlice?: (slice: TwapSlicePlan) => boolean | Promise<boolean>

    Called before each slice; return false to skip it.

    onSlice?: (result: TwapSliceResult) => void

    Called after each slice with its result.

    recipient?: `0x${string}`

    Output recipient. Defaults to client.account?.address. Required when dry-running a TWAP on a read-only client (no account) — planning and simulating a swap for an address you're merely watching needs no keys.

    signal?: AbortSignal

    Kill switch — abort between slices.

    slices?: number

    Number of equal slices.

    4

    slippageBps?: number

    Per-slice slippage tolerance in basis points.

    50

    spendCap?: SpendCap

    Hard spend cap on tokenIn. Defaults to totalAmountIn.

    tokenIn: `0x${string}`
    tokenOut: `0x${string}`
    totalAmountIn: bigint

    Total input amount to work, in tokenIn raw units.