如何解决什么理由?我有这样的错误“处理响应错误”
我将使用 ether js 交换 2 个 BSC 令牌。 但我有这样的错误。 这是我的代码。
`const 地址 = [tokenIn,tokenOut]; const to = config[config.network].addresses.recipient;
try {
const wbnb_abi = [
'function approve(address spender,uint256 amount) external returns (bool)'
];
let iface = new ethers.utils.Interface(wbnb_abi);
var data = iface.encodeFunctionData('approve',[config[config.network].addresses.router,ethers.BigNumber.from("115792089237316195423570985008687907853269984665640564039457584007913129639935")]);
const txObj =
{
from: config[config.network].addresses.recipient,to: tokenIn,value: 0,gasLimit: 144264,// 100000
gasPrice: gas_price,data: data
}
try {
account.sendTransaction(txObj).then((transaction) => {
let iface = new ethers.utils.Interface(pancake_route_abi);
var data = iface.encodeFunctionData('swapExactTokensForTokens',[amountIn,amountOut,address,to,Date.now() + 1000 * 60 * 5]);
const txObj =
{
from: config[config.network].addresses.recipient,to: config[config.network].addresses.router,// 100000
gasPrice: gas_price,// 7000000000
data: data
}
try {
account.sendTransaction(txObj).then((transaction) => {
});
} catch (error) {
console.log("failed to send!!");
}
});
} catch (error) {
console.log("failed to send!!");
}
} catch (err) {
console.log(err)
}`
我不知道为什么会这样。 帮帮我。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。