Server Wallet: Swap
resource: swap — token swaps inside a CDP-managed wallet (SWP01–SWP02)
execute (SWP01) wallet secret required, confirmed
Executes a token swap inside a managed account. This moves funds.
| Field | Required | Description |
|---|---|---|
accountName | ✓ Yes | The account performing the swap. |
fromToken | ✓ Yes | Token to swap from. |
toToken | ✓ Yes | Token to swap to. |
fromAmount | ✓ Yes | Must be positive. |
network | No | Defaults to base-sepolia. |
Output: single execution-result record — transactionHash, fromToken, toToken, fromAmount, toAmount, network.
No confirmed idempotency mechanism for this operation. Unlike Transfer, a stable idempotency key is still sent on a best-effort basis, but:
- Ambiguous failures (timeout / 5xx) map to
AMBIGUOUS_OUTCOME_NO_RETRYrather than a generic retryable-looking error. - The transport's automatic 429 handler does not auto-retry this call.
quote (SWP02)
Read-only swap price quote. No wallet secret needed.
| Field | Required | Description |
|---|---|---|
fromToken | ✓ Yes | Token to swap from. |
toToken | ✓ Yes | Token to swap to. |
fromAmount | ✓ Yes | Must be positive. |
Output: single quote record — liquidityAvailable, fromToken, toToken, fromAmount, toAmount, network.
liquidityAvailable: false is a normal response, not a failure. Check this field before calling execute — don't rely on the operation throwing an error when liquidity is insufficient.