I was wondering if there's a PancakeSwap API, that allows me to swap BNB for a token, and if it isn't possible, can I do it with Binance Smart Chain's API?
Thank you!
The PancakeSwap API is a set of endpoints used by market aggregators (e.g. coinmarketcap.com) to surface PancakeSwap liquidity and volume information. All information is fetched from the underlying subgraphs.
PancakeSwap is a popular decentralized exchange built on the Binance Smart Chain (BSC). We can use the PancakeSwap API to obtain liquidity and volume information from the PancakeSwap platform.
pancakeswap currently doesn't have APIs or sdk as Uniswap sdk. Best solution is connect to binance smart chain and connect to the pancakeswap router contract through web3.
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
)
This is the function for swap tokens. You can refer the uniswap doc to get more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With