Your agent's treasury sits on one chain. The counterparty settles on another. Every other part of the payment flow is automated, and then a human has to move USDC from Base to Polygon by hand while the agent waits.
There are three ways teams usually patch this, and all three are annoying:
- A human bridges the funds each time. Safe, and not autonomous at all.
- A wallet on every chain. It works, but now there are more keys to leak and more balances to sweep.
- Ask the other side to accept a different chain. That is not your call to make.
The cross-chain bridge endpoints in the OpenClawCash API take a fourth path: the wallet stays where it is, the API does the move, and the same policy layer that guards a normal transfer guards the bridge too.
Quote first, execute second
POST /api/agent/bridge/quote returns a routing quote before anything touches a chain. The quote is routed through LiFi, and the aggregator picks the underlying bridge, announcing it as bridgeName, so you can see which route and which fee you are agreeing to. The response carries amountOut, amountOutMin, providerFeeBaseUnits and estimatedDurationSeconds, and the quote expires about 60 seconds after it is issued.
curl -X POST https://openclawcash.com/api/agent/bridge/quote \
-H "Content-Type: application/json" \
-H "X-Agent-Key: occ_your_api_key" \
-d '{
"walletId": "Q7X2K9P",
"fromNetwork": "base-mainnet",
"fromToken": "USDC",
"toNetwork": "polygon-mainnet",
"toToken": "USDC",
"amountIn": "1000000"
}'
amountIn is an integer string in base units, and fromNetwork, fromToken, toNetwork, toToken and amountIn are all required. slippagePercent is optional.
The same call from an agent loop:
const response = await fetch("https://openclawcash.com/api/agent/bridge/quote", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Agent-Key": "occ_your_api_key"
},
body: JSON.stringify({
walletId: "Q7X2K9P",
fromNetwork: "base-mainnet",
fromToken: "USDC",
toNetwork: "polygon-mainnet",
toToken: "USDC",
amountIn: "1000000"
})
});
const quote = await response.json();
console.log(quote.quoteId, quote.bridgeName, quote.amountOut);
Execute the quote you accepted
Nothing moves until you send the quoteId back to POST /api/agent/bridge/execute. The server signs the source-side transaction with the wallet's key, submits it to chain and collects the platform fee. The agent still only ever holds an API key, never a private key, so a leaked agent environment is not a drained wallet.
curl -X POST https://openclawcash.com/api/agent/bridge/execute \
-H "Content-Type: application/json" \
-H "X-Agent-Key: occ_your_api_key" \
-H "Idempotency-Key: ${MY_UNIQUE_KEY}" \
-d '{
"walletId": "Q7X2K9P",
"quoteId": "quote_abc123"
}'
Send the Idempotency-Key header so a retry after a timeout cannot fund the same bridge twice. The response gives you bridgeTxId and sourceTxHash, which is the moment the source side is real and the destination side is not yet.
Follow it to the other chain
A bridge is not finished when the source transaction confirms. GET /api/agent/bridge/status tracks the rest, keyed by bridgeTxId, and reports sourceTxHash, destinationTxHash and amountReceived once each side confirms.
curl "https://openclawcash.com/api/agent/bridge/status?bridgeTxId=btx_789xyz" \
-H "X-Agent-Key: occ_your_api_key"
The states are submitted, source_confirmed, destination_confirmed, completed and failed. Poll that endpoint instead of assuming delivery, and write the terminal state into your own ledger when it arrives.
What is still rough
Being straight about the limits, because the docs are:
- EVM to EVM is fully supported. EVM and Solana quoting works, but the Solana source-side execute is gated to a follow-up, so do not build a Solana-funded bridge into your critical path yet.
- The quote TTL is short. Quote, then execute immediately, rather than caching a quote between agent steps.
- Bridging answers to the same spending limits, allow-lists and approvals as any other send, checked before anything is signed. Test with a small amount first to see how your policy treats it.
The full endpoint reference, including the exact request and response fields, is at https://openclawcash.com/docs.
Top comments (0)