【发布时间】:2023-02-12 17:31:41
【问题描述】:
我正在尝试通过 Web3.js 使用 Polygon 测试网络来集成事务。相同的代码在以太坊上运行良好。但是如何使用 Polygon 测试网络发送交易呢?我需要修改任何代码吗?我在 Metamask 中创建了多边形孟买测试网络。
const initPayButton = () =>{
sendTransaction({
to: paymentAddress,
value: toWei(amountEth, 'ether')
}, (err, transactionId)=>{
if(err){
console.log("Payment Failed", err)
$('#status').html("Payment failed")
}else{
console.log("Payment Successful", transactionId)
$('#status').html("Payment Successful")
}
}
)
}
)
}
【问题讨论】:
标签: web3js