API
Trade with the CEXISWAP API
Trade with the CEXISWAP API
// Buy one WBTC with USDT
const params = {
toAddr: MY_WALLET_ADDR,
chain: 'ETH',
buyToken: 'WBTC',
sellToken: 'USDT',
buyAmount: '100000000',
}
const unsignedTx = await fetch(
`https://api.cexiswap.io/swap/v1/quote?${qs.stringify(params)}`
)
const signer = new ethers.Wallet(YOUR_PRIVATE_KEY_STRING, provider)
await signer.sendTransaction({
to: unsignedTx.to,
chainId: unsignedTx.chainId,
value: unsignedTx.value === '0' ? '0x0' : unsignedTx.value,
data: unsignedTx.data,
})Endpoint
Request
Response
Allowance Targets
Last updated
