当我调用web3中令牌方法时,metamask一直旋转加载程序

发布于 2025-02-04 18:23:34 字数 417 浏览 5 评论 0原文

我是一个入门级区块链开发人员,所以我经常被卡住,但是这里的社区总是可以帮助您解决问题,但是这次我无法得到我所需要的。 我实际上要完成的工作是,我已经在Ganache上部署了我的ERC20代币智能合约,并试图在我的Web3项目中调用该合同的批准功能,以便用户可以批准某些代币要转让。在混音上工作正常。但无法从Web3调用它。以下是我编写的代码行 this.state.token.methods.approve(地址,'10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

来继续加载。

I'm an entry-level blockchain developer, so I often get stuck, but the community here is always there to help with the already asked questions, but this time I couldn't get what I need.
What I'm actually trying to accomplish is that I have deployed my ERC20 token smart contract on Ganache, and trying to call the approve function of that contract in my web3 project so users can approve some tokens to be transferred. It's working fine on the remix. but not able to call it from web3. Below is the code line I have written
this.state.token.methods.approve(address, '100000000000000000000').send({from:this.state.account})

When I click the button metamask pops up for confirmation but the loader just keeps loading.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文