{"uid":"cap_zO0Gzp1r2DSqrrn2LHY9y","slug":"base-swap-conditional-validity-transaction-800efdcf","name":"Base Swap — Conditional (Validity Transaction)","description":"The base-swap 0x trade as a Cobalt validity transaction: Base includes your signed tx only while your conditions hold — a conditional order with no limit-order contract and nobody holding the trade. We never hold funds or keys; you sign and submit. Every request carries the deadline Base requires (at most 60 s out; set for you if omitted). Optional conditions: fromBlock, flashblockIndex (1-10), minNativeBalanceWei, or a caller-supplied storage predicate for price.","url":"https://402.com.tr/api/x402/base-swap-validity?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"pathParams":{"type":"object"},"queryParams":{"type":"object","required":["sell","buy","amount","taker"],"properties":{"buy":{"type":"string","description":"Token you buy"},"sell":{"type":"string","description":"Token you sell"},"taker":{"type":"string","description":"Your wallet (signs the swap)"},"amount":{"type":"string","description":"Amount you sell"},"slippage":{"type":"string","description":"Slippage in bps (optional, default 100)"},"fromBlock":{"type":"string","description":"Earliest block (optional)"},"storageOp":{"type":"string","description":"Advanced: operator (< <= = != > >=)"},"beforeBlock":{"type":"string","description":"Deadline block (optional; at most 60 s out, set for you if omitted)"},"storageMask":{"type":"string","description":"Advanced: mask (hex, optional)"},"storageSlot":{"type":"string","description":"Advanced: storage slot (hex)"},"storageValue":{"type":"string","description":"Advanced: compare value (hex)"},"storageAddress":{"type":"string","description":"Advanced: pool/token for a storage condition"},"flashblockIndex":{"type":"string","description":"Flashblock index 1-10 (optional)"},"minNativeBalanceWei":{"type":"string","description":"Min taker ETH balance in wei (optional)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_5sHAimLnQDhQsywdPsAC8","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns a signed, dormant 0x swap transaction on Base that is only included by the sequencer when user-defined conditions (block range, ETH balance, storage/price predicate) are met.","exampleAgentPrompt":"Set up a conditional swap on Base: sell 500 USDC for ETH from my wallet 0xABC…, valid only before block 12500000, with 50 bps slippage, and only if my ETH balance is at least 0.01 ETH — give me the signed validity transaction I can submit.","exampleUseCases":[{"title":"Good-till-block token swap","prompt":"I want to swap 1000 USDC for WETH on Base from my wallet 0xABC… but only if it gets included before block 13000000 — can you set that up with 100 bps slippage so the trade cancels itself if the deadline passes?"},{"title":"ETH-balance-gated DCA purchase","prompt":"Buy 200 USDC worth of cbETH on Base from 0xDEF… but only execute the swap if my wallet still has at least 0.05 ETH in it — I don't want the swap to drain my gas reserve."},{"title":"On-chain price predicate swap","prompt":"Set up a conditional swap on Base: sell 500 DAI for ETH from wallet 0x123…, but only trigger it when the Uniswap V3 USDC/ETH pool storage slot 0x0 on contract 0x456… reads less than 0x186A0 — use 150 bps slippage and a deadline of block 14000000."}],"resultDescription":"A signed validity transaction payload wrapping the 0x-routed swap. The transaction is inert until the Base sequencer evaluates the attached conditions (beforeBlock, fromBlock, flashblockIndex, minNativeBalanceWei, or storage predicate). When conditions are satisfied the transaction is included; if they are never met it simply expires. No funds or keys are custodied by the service.","failureModes":["Missing required condition — at least one of beforeBlock, fromBlock, flashblockIndex, minNativeBalanceWei, or storageSlot must be provided","Invalid taker address format returns a 400 error","0x routing failure if no liquidity path exists for the sell/buy pair on Base","beforeBlock already passed at request time — transaction would be immediately invalid","storageOp provided without storageSlot/storageAddress/storageValue — incomplete predicate rejected","Slippage too tight causing 0x quote failure","Amount of zero or negative rejected"],"whenToPreferThis":"Choose this endpoint when you need a conditional or time-bounded swap on Base without deploying a limit-order contract and without custodying funds. It is ideal for good-till-block orders, balance-gated trades, flashblock-targeted execution, or on-chain price-predicate triggers. Prefer the plain Base Swap endpoint for immediate unconditional execution. Use this endpoint when you want the swap to self-cancel if conditions are never met, and when you want the taker to retain custody of keys throughout.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-17T18:54:22.092Z","isFirstParty":false,"canonicalSlug":"base-swap-conditional-validity-transaction-800efdcf"}