How a swap settles
Every swap finishes in two steps. The swap trades your input asset through the pool and leaves the output waiting to be collected. The claim then delivers the output to your wallet, along with any unused input. In the app, the claim runs on its own after the swap confirms, and the price is final as soon as the swap confirms. If anything interrupts the claim, the output waits for you. In the app, open Portfolio, then Pending Claims. With the SDKs or CLI, recover the existing swap and finish its claim. You do not need to start another trade, and a second swap opens a new trade instead of finishing the first one. The settled amounts can differ from the quote. A trade can stop before it spends the full input when the price reaches your limit, and the claim returns the unused amount alongside the output. On a route through two pools, any unused input comes back in the asset you sold, never in the intermediate asset. The assets traded, the amount, the route, the output, any refund, the price movement, and the timing of each swap are public. Your wallet address stays out of the public market data. See Public data.In the app
Before you startYou’ll need:- Shield Wallet connected to Shield Swap, with a confidential balance of the asset you want to sell. See Fund your wallet.
- A quote on the Trade or Swap page. See Quote.
Submit the trade
- With your quote showing, select the main button. On Trade it names the action and asset, such as Buy ALEO or Sell ETH. On Swap it reads Swap.
- In Review buy, Review sell, or Review Swap, check the amounts, Max Slippage, Price Impact, Swap Fee, and You Receive At Least. On Swap, the Quote refresh bar counts down; if it runs out, select Review Updated Quote and check the new amounts.
- Select Confirm & Swap.
- In the Transaction request in Shield Wallet, check that the request is from swap.shield.fi and that the amounts match your review, then select Confirm. Your assets do not move until you confirm.
Check the result
Open Portfolio, then History. The newest row shows the trade with its status, route, and amounts. On the Trade page, Your Trades under the chart lists the same trades for the current market. See Swap history and recovery for the full table and what each status means.Troubleshooting
Quote, submit, and claim
Prerequisites: Your authenticated mainnetclient for TypeScript, dex for Python, or CLI profile from Setup. Your account needs one spendable token record covering 1 USDCx, plus funds for transaction fees. Fund your account or prepare a covering record if needed.For services, scripts, and agents, the optional storage setup saves the data needed to resume after a restart. Without it, your application must retain the swap handle returned on submission. A handle contains the identifiers and claim data needed to finish that trade.These examples trade 1 USDCx for ETH on mainnet. To practice with test assets, use the Quickstart.1. Review a quote
Your quote gives you an estimated output and the minimum you’ll accept for 1 USDCx on mainnet. The examples allow 50 basis points (0.5%) below the estimate. Use your authenticated client from Setup; Quote explains the parameter types and defaults.- TypeScript
- Python
- CLI
expectedOutput and minimumOutput are decimal strings in ETH units. Review both before submitting. If the time in quote.expiresAt has passed, request a fresh quote.2. Submit the reviewed quote
Once you’re satisfied with the quote, you can submit the swap. The SDK examples use the mainnetquote from Review a quote and preserve its route and minimum output. The CLI requests a fresh quote when you execute the command.- TypeScript
- Python
- CLI
handle.transactionId identifies the submitted transaction, and handle.swapId identifies the swap to claim. Keep the handle until the claim finishes; a configured file store retains it for recovery.3. Claim the output
After the swap is accepted, its output becomes available to collect. The claim delivers the output and any unused input to your account. Continue with the mainnet account andhandle from Submit the reviewed quote, or the saved CLI account and swap ID.If a claim attempt was interrupted, check its transaction status before submitting another claim.- TypeScript
- Python
- CLI
timeout is a polling limit in milliseconds; this example allows 60 seconds instead of the default 15 seconds. Waiting does not submit a transaction. Once the output is available, the claim call submits the transaction that delivers it.claim.transactionId identifies the claim. claim.amountOut and claim.amountRemaining are bigint amounts in output-token and input-token base units, respectively. The latter is zero when no input is refunded.Check the result
Your swap and claim each have a transaction ID. Checking both confirms whether the ledger accepted the trade and its collection. Your account’s balance then shows whether record scanning has found the received funds.The SDK examples use thehandle and claim from the mainnet steps above. They also use publicClient for TypeScript or aleo for Python, alongside the trading client from Setup. These checks read existing state and do not submit another transaction.- TypeScript
- Python
- CLI
status: "accepted". balances[quote.to.id]?.private reports your ETH record balance as a base-unit bigint. Use formatUnits from the quote example with quote.to.decimals to display it in ETH units.