PancakeSwap API/使用币安智能链的 API 交换 BNB [英] PancakeSwap API / Swaping BNB with Binance Smart Chain's API

查看:212
本文介绍了PancakeSwap API/使用币安智能链的 API 交换 BNB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有 PancakeSwap API 允许我用 BNB 交换代币,如果不可能,我可以使用 Binance Smart Chain 的 API 来做吗?

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?

谢谢!

推荐答案

pancakeswap 目前没有像 Uniswap sdk 那样的 API 或 sdk.最好的方案是连接币安智能链,通过web3连接pancakeswap路由器合约.

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
)

这是交换代币的功能.您可以参考 uniswap 文档以获取更多信息.

This is the function for swap tokens. You can refer the uniswap doc to get more information.

这篇关于PancakeSwap API/使用币安智能链的 API 交换 BNB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆