Shield Swap is a decentralized AMM exchange that enables private swaps between asset pairs. This guide introduces the SDKs, CLIs, and APIs available for Shield Swap and provides installation and configuration steps for each option.The table below lists the available trading options and when to use each.A newly generated account exists only in memory. Save
The sections below show how to set up your chosen trading tools for mainnet. To begin trading on testnet, use the Developer Quickstart.
Install
Use the latest SDK and CLI releases. These commands install or upgrade the packages in your environment.- Typescript
- Python
- CLI
Configure
1. Setup an account
Shield Swap runs on the Aleo network to enable private trades. The guide below shows how to setup an Aleo account for private trading.Your private key controls your account and its funds. Never share it or include it in source control or logs. Keep a secure backup of your private key or saved account files so you can restore the account later. Aleo’s account keys guide explains the private key, view key, compute key, and address.
- Typescript
- Python
- CLI
Services, scripts, and agents
Load an existing mnemonic or private key to set up an account, or generate a new account if neither is available.account.privateKey in your application’s secret manager before ending the session so you can load the same account next time.Browser apps
Browser apps use a connected wallet to manage the account and its private key. Select an existing account in the wallet, or create one there, then connect it from the app:2. Setup a trading client
- Typescript
- Python
- CLI
Client setup for services, scripts, and agents
The Typescript SDK uses viem-likeClient and Action semantics and allows clients to be extended with arbitrary actions. The step below uses the account created above to create a Wallet Client and extends it with Shield-Swap trading actions. In detail, createAleoClient creates a WalletClient configured with Aleo RPC and gas payment services. The example then extends it with shieldSwapActions, which provides actions for quoting, swapping, inventory management, and accessors to the Shield Swap API.Continue with aleo and account from step 1:Browser client setup
When building a web or browser application, a wallet manages the account, all token inventory records, and transaction signing. In this case, anRPC account must be created to request these services from a browser or embedded wallet.publicClient reads chain state, including the transaction checks in Swap. The connected wallet authorizes trades.3. Configure optional storage
Persistent storage retains swap history and the secret data needed to claim an output after a restart. Configure it before submitting swaps if the application needs this recovery path.- Typescript
- Python
- CLI
Client setup for services, scripts, and agents
For faster trading, it’s recommended to persist recovery data. To enable this, configure a swap file store before authenticating or submitting swaps. If this step is skipped, recovery data and swap history are lost when the process exits.Browser client setup
All browser configurations persist history and recovery data within the configured wallet. No storage configuration is required for browser applications.4. Authenticate with the API
The Shield Swap API requires authentication via a signature over a challenge containing the current Terms of Use. The step below performs this signature and grants API access.- Typescript
- Python
- CLI
Get or redeem a referral code (optional)
Optional referral code redemption can be redeemed via traders participating in Shield Swap incentive program.- Typescript
- Python
- CLI
Get the account’s referral codeRedeem another trader’s codeReplace
getMyReferralCode() calls GET /referral/my-code to retrieve your shareable code or create one if permitted:REFERRAL_CODE with the code another trader shared with you:Next Steps
Fund the trading accountFollow the Fund guide to add assets to the configured Shield Swap trading account.Run full examplesThe Typescript examples in the Shield Swap Typescript SDK and Python examples in the Shield Swap SDK cover account setup, funding, quoting, submission, and claiming. Follow the run instructions to try them with test tokens on testnet.In the app
Shield Wallet holds the account you use with Shield Swap and approves every connection and transaction before it is sent. This section installs the extension, sets up an account, and connects it to the app. For what the app can do with and without a wallet, see Get started.Before you startYou’ll need: Chrome or a Chromium-based desktop browser, such as Brave.Install Shield Wallet
- Open the Shield extension in the Chrome Web Store. Check that the publisher is Provable Inc.
- Install the extension and complete the browser prompts.
- Open Shield from your browser’s extensions menu.
- Follow the setup prompts to create a new wallet or import an existing one. For a new wallet, Shield Wallet walks you through backing up the seed phrase, naming the account, and setting a password. The Shield extension setup guide covers each screen, and the wallet import guide covers bringing in an account you already have.
Connect to Shield Swap
Before you startYou’ll need: Shield Wallet installed and unlocked, with the account you want to use selected.- Open Shield Swap in the same browser. From shield.fi, Launch App opens it in a new tab.
- Select Connect Wallet at the top right.
- In the Connect Shield Wallet dialog, read the Terms of Use and Privacy Policy notice, then select Agree and Connect.
- In the Connect to this site? prompt in Shield Wallet, check that the site is swap.shield.fi. If the prompt says your wallet is on a different network, selecting Connect switches it to the network Shield Swap uses.
- Select Connect.
- In the Sign message panel in Shield Wallet, select Sign. The message records your acceptance of the current Terms of Use and related disclosures. Signing it is free and creates no transaction.
- If a referral prompt appears, enter a code or select Skip for now. The prompt appears once per wallet. You can add a code later from the wallet menu under Referral.