Execute a large swap as a Time-Weighted Average Price schedule: split
totalAmountIn into equal slices spaced intervalMs apart, each quoted and
slippage-bounded independently. Enforces a hard SpendCap, honors an
AbortSignal kill switch between slices, and defaults to dry-run
(simulate via eth_call, send nothing) until you opt into live execution.
Example: Dry-run a 1000-USDG TWAP over 5 slices
consttwap = createTwapExecutor(hood, { tokenIn:usdg, tokenOut:weth, totalAmountIn:parseUsdg('1000'), slices:5, }) constresults = awaittwap.run() // dryRun defaults on with no wallet
Execute a large swap as a Time-Weighted Average Price schedule: split
totalAmountIninto equal slices spacedintervalMsapart, each quoted and slippage-bounded independently. Enforces a hard SpendCap, honors anAbortSignalkill switch between slices, and defaults to dry-run (simulate viaeth_call, send nothing) until you opt into live execution.Example: Dry-run a 1000-USDG TWAP over 5 slices