π’GET Price
You can get token trade information from Swapper API by making an HTTP request.
GET Price
NodeJS SDK
import
Swapper from '
Swapper'
const service = new
Swapper({ apiKey: 'Ru31BKdr99rGlsyN69' });
const res = await service.getPrice({ buyTokenAddress: '0x1f35c32cbbf2c175d8f2f8b0d00b41978a5be6c1', sellTokenAddress: '0x3019bf2a2ef8040c242c9a4c5c4bd4c81678b2a1', sellTokenAmount: '1000000000000000000' });
Axios.js
const res = await axios.get("https://api.swapper.com/v1/swap/bsc/price?buyTokenAddress=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&sellTokenAddress=0x0019450b0fb021ad2e9f7928101b171272cd537c&apiKey=Ru31BKdr99rGlsyN69&sellTokenAmount=1000000000000000000");
cURL
Parameters | Description | Value |
chain | You must specify in which chain you want to swap. | eth |
buyTokenAddress | The contract address of the token to be sold as a result of the swap. | 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56 |
sellTokenAddress | The contract address of the token to be purchased as a result of the swap. | 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56 |
sellTokenAmount | The amount of tokens you want to sell. (Number of Tokens x Token Decimals) | 1000000000000000000 (1 ETH) |
buyTokenAmount | The amount of tokens you want to buy. (Number of Tokens x Token Decimals) | 1000000000000000000 (1 ETH) |
slippage | You should set the specified slippage of the token here. | 1 |
feeOwner | The wallet address to which you want the commission rate you earn to be forwarded. | 0x... |
buyTokenFee | The commission rate you want to earn as a result of swap transactions. | 0.005 |
ownerAddress | Taker information should be entered here. The address where the tokens will go as a result of the swap. | 0x... |
Last updated