Skip to main content
Verify a submitted swap by checking its transactions and returned token records. The examples default to mainnet and read existing state. For a Quickstart trade, select the testnet lookup and use its original testnet account and recovery store. A completed trade has an accepted swap, an accepted claim for that swap, and returned token records available to the account. Check these separately: Keep the swap transaction ID, claim transaction ID, swap ID, and actual received amount from the execution output. Use the swap ID including its field suffix. Do not substitute the quoted estimate or minimum for the received amount.

Check both transactions

Use the lookup for the network that received the trade. The response includes status, transaction, and finalize. Replace each placeholder with the original transaction ID:
Inspect status in each JSON response. HTTP success alone is not transaction acceptance. For TypeScript SDK 0.12.1, the equivalent lookup is await publicClient.getConfirmedTransaction({ id }). Keep publicClient from aleo.createAleoClient({ privateKey }); the wallet client extended with shieldSwapActions does not expose this method by default. See Swap History & Recovery to check an uncertain transaction before retrying.

Verify the output record

This TypeScript verifier checks a USDCx to ETH trade using the 0.12.1 SDK packages. It uses the network selected by the configured clients. It checks the ETH proceeds; a trade with an input refund also needs its USDCx refund record checked. Run verification before spending or combining the returned ETH record. A later spend can make this unspent-record check fail even though settlement succeeded. The verifier uses the configured ledger gateway and account scanner. It is independent of CLI history summaries, but is not a standalone cryptographic ledger proof. Record plaintext stays in memory and is never printed.

1. Load the existing account

For mainnet, use the client and publicClient initialized in Setup. For testnet, use the clients from the Quickstart. Keep the original private key and recovery store; do not generate a new account. If the trade came from a packaged SDK example, load that example’s account and store instead. The verification snippet also uses transaction types from the core package:
For a CLI trade, load the saved session from the directory containing its .shield-swap/ account:
The session helper requires @provablehq/shield-swap-cli@0.12.1 in the application’s dependencies. It reuses the saved account for the selected network. Pass network: "testnet" for a CLI Quickstart trade.

2. Match the claim to its output record

The following snippet performs one verification pass with the existing clients. Replace the four input placeholders with the original transaction IDs, swap ID, and actual received ETH amount. receivedEth is a decimal string without the token symbol. If confirmation or scanning has not caught up, repeat the checks without submitting a transaction.
The commitment comparison identifies an output created by this claim, even if the account already held ETH. Amounts use bigint base units throughout, avoiding floating-point rounding.

3. Inspect the result

A successful run ends with:
If a check fails, inspect the last completed stage. A scanner delay, wrong account, wrong ID, or later record spend can prevent verification. An empty getUnclaimedSwaps() result or an absent mapping alone is insufficient evidence. Repeat read-only checks or follow Failures and recovery; do not rerun the original swap to obtain a verification result.

Packaged trading examples

The TypeScript example in Veil and Python example in python-sdk include complete trading programs. Their run commands submit new testnet swaps. Use the read-only checks above to verify an existing trade.