Swap Guide
Step-by-step guide to swapping tokens with the Notus API.
Steps
Install viem
We’ll use viem, a library for blockchain interactions, to simplify our integration. Install it by running:
Initialize Wallet Account
Use your private key to initialize a wallet account. This will allow you to sign messages and interact with the blockchain.
Register a Smart Wallet Address
Before initiating a swap, register and retrieve the smart wallet address used for Account Abstraction.
Create a Swap Quote
Query a swap quote for token swaps on the same chain (e.g., USDC to UNI on Polygon).
If you are swapping from a native token (e.g., ETH, BNB, AVAX), use the following address as tokenIn: 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
. This ensures that the Notus API recognizes the asset as a native token.