Swap
Init swap from one token to another. It will provide the best route and DEX for the swap.
/swap
This method will find the best route of the swap
-
GET | POST /initSwap
{ chainId, ownerAddress, fromTokenAddress, fromValue }
→{ … }
*POST Data:
{
"chainId" : 1,
"ownerAddress" : "0x1234....1234",
"fromValue" : "100000000000000000",
"fromTokenAddress" : "0x1234....1234",
"toTokenAddress" : "0x1234....1234",
"slippage" : 10
}Where:
- ownerAddress - Address of the owner. Please use 0x0000000000000000000000000000000000000000 for the ETH
- chainId - Got from previous step
- fromValue - fromTokenAddress value
- toTokenAddress - toTokenAddress value
- slippage - slippage from 0 to 50
Response:
{
"metamaskDeepLink" : "https://link-to-request-the-metamask-wallet/...",
"transaction": { ... }
}Please notice! In case when when you have no allowance to swap this method will return allowance transaction first.