Cleave for Agents: token swaps, cross-chain swaps and gas top-ups

v1.0.1
fi.cleave/swap Checked 2 days ago Published 24 days ago

Swap, bridge and get gas on 6 EVM chains.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

cleave_plan_swap Plan a swap, bridge or gas top-up

Plans a token swap on one chain, a cross-chain swap or bridge, or a native-gas top-up on Ethereum, Arbitrum, Base, BNB Chain, Polygon or Optimism, and returns unsigned transactions for the given wallet to sign. It fits when the user wants to exchange tokens, move them between these chains, or get ETH, BNB or POL for gas. It sends nothing and moves no funds. The answer leads with blocking notices and warnings, then gives the route's outcome kind (an exact amount or one that can vary; with a swap on arrival, the token or, possibly, a named fallback; where a transfer can go unfilled, a possible r…

ParameterTypeDescription
amount *stringA decimal amount in token units
buyToken *stringA listed symbol or a contract address
fromChainId *integerThe chain of the token to sell
sellToken *stringA listed symbol or a contract address
wallet *stringThe wallet that sells the token and signs the returned calls
maxSlippageBpsintegerThe maximum slippage in basis points, from 0 to 5000, and at least 1 for a cross-chain plan that swaps on both chains; 50 when omitted
recipientstringThe address that receives the bought token; the wallet when omitted. If your wallet pays for a person, ask them for it; use your own only for your own tokens
toChainIdintegerThe chain of the token to buy; fromChainId when omitted

cleave_track_swap Track a planned swap or transfer

Reports the status of a swap, bridge or gas top-up that was planned with cleave_plan_swap and then sent, or ordered with cleave_get_gas: its state (for example pending, in flight, delivered, refund pending or refunded), what arrived against the plan and on which chain, and the next action or when to check again. It takes the chain and transaction hash, plus the plan's requestId when known, or for a gas top-up the requestId alone; a transaction to a contract outside Cleave's published list is reported as such. It fits when the user asks whether such a transfer arrived, and before any re-send, b…

ParameterTypeDescription
chainIdintegerThe chain the transaction was sent on; required unless requestId is a gas order's, in g:<chainId>:<orderHash> form
requestIdstringThe requestId of the plan, used to compare the transaction with it, or of a gas order, in g:<chainId>:<orderHash> form, which is enough alone
txHashstringThe transaction hash, also while it is pending; required unless requestId is a gas order's, in g:<chainId>:<orderHash> form

cleave_find_token Find a token's contract address

Finds a token by symbol or contract address on Ethereum, Arbitrum, Base, BNB Chain, Polygon or Optimism and returns its address, decimals and whether it is on Cleave's token list, with a flag when it resembles a listed token. A symbol shared by several listed tokens returns up to ten candidates by address instead of picking one. An unlisted token is found only by its address and comes back flagged, without a name or symbol. It fits before cleave_plan_swap when the user names a token by symbol and the address is unknown.

ParameterTypeDescription
chainId *integerThe chain to search on
query *stringA symbol or a contract address

cleave_get_gas Order native gas with USDC

Offers orders for native gas (ETH, BNB or POL) on Ethereum, Arbitrum, Base, BNB Chain, Polygon or Optimism for a wallet that holds USDC on Ethereum, Arbitrum, Base, Optimism or Polygon but has no gas to send transactions. Called with the paying chain, the receiving chain, the recipient, a USDC amount and the paying wallet (without it the offer has nothing to sign), it returns an offer: the minimum native amount, the deadline, the order and one USDC authorization for the wallet to sign; signing costs no gas. If your wallet pays for a person, ask them for the recipient; if theirs pays, it can be…

ParameterTypeDescription
amountstringA decimal amount in token units
chainIdintegerThe chain the native gas is for; required without offer, not accepted with it
offerstringThe offer value from the answer to a call without offer; when given, the signed order is submitted and only offer, signature and wallet are accepted
payChainIdintegerThe chain the USDC is paid on; required without offer, not accepted with it
recipientstringThe wallet that receives the gas: if your wallet pays for a person, ask them for it; use your own only for your own gas; required without offer, not accepted with it
refundTostringThe refund address on the paying chain; a cross-chain order needs refundTo or wallet, and a one-chain order with neither uses recipient; not accepted with offer
signaturestringThe wallet's hex signature of the offer's USDC authorization; required with offer, not accepted without it
walletstringThe paying wallet; it does not set the recipient. Required with offer. Without offer, the answer holds an authorization to sign only when it is given, and it is the refund address when refundTo is not…