This flow gets a quote, builds the swap payload, then either sends an on-chain transaction or signs and submits a gasless order.
Create a free merchant account, create a project, then copy the Client ID and API Key.
export TENFI_CLIENT_ID="ci_your_client_id"
export TENFI_API_KEY="sk_your_api_key"
curl "https://api.10fi.org/v1/quote?chain=bsc&from=USDT&to=BNB&amount=100&gasless=true" \
-H "X-Client-Id: $TENFI_CLIENT_ID" \
-H "X-API-Key: $TENFI_API_KEY"
curl -X POST "https://api.10fi.org/v1/swap" \
-H "Content-Type: application/json" \
-H "X-Client-Id: $TENFI_CLIENT_ID" \
-H "X-API-Key: $TENFI_API_KEY" \
-d '{
"chain":"bsc",
"from":"USDT",
"to":"BNB",
"amount":"100",
"userAddress":"0xYourWallet",
"preferGasless":true,
"slippageBps":50
}'
type is delta, ask the wallet to sign toSign with eth_signTypedData_v4, then call /v1/submit.type is onchain, send tx from the user wallet.type is solana, decode and sign the base64 transaction with a Solana wallet.await fetch("https://api.10fi.org/v1/submit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Client-Id": process.env.TENFI_CLIENT_ID!,
"X-API-Key": process.env.TENFI_API_KEY!,
},
body: JSON.stringify({ toSign, signature, chainId, userAddress }),
});