I'm trying to make a simple swap from 10 USDC to 10 USDT using 0x API quote.
I'm doing this:
import type { UnsignedTransaction } from '@ethersproject/transactions'
import { Web3Provider } from '@ethersproject/providers'
const provider = new Web3Provider(window.ethereum)
const [address] = await window.ethereum.request({ method: 'eth_accounts' })
const res = await fetch('https://api.0x.org/swap/v1/quote?buyAmount=1000000&buyToken=USDT&sellToken=USDC')
const quote = await res.json()
// not sure what to do next?
What should be the next step to perform a swap? Using a Web3Provider
.
Reference: https://0x.org/docs/guides/swap-tokens-with-0x-api#selling-erc20-tokens