reactjs - 未处理的拒绝(错误):调用恢复异常
问题描述
尝试在我的反应前端与我的智能合约交互时收到此错误消息。我正在运行 localhost3000 并且需要元掩码才能登录。
Unhandled Rejection (Error): call revert exception (method="symbol()", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.8)
Logger.makeError
/Users/username/Desktop/final-4/src.ts/index.ts:205
Logger.throwError
/Users/username/Desktop/final-4/src.ts/index.ts:217
Interface.decodeFunctionResult
/Users/username/Desktop/final-4/src.ts/interface.ts:326
323 | eventFragment = this.getEvent(eventFragment);
324 | }
325 | const topics = [];
> 326 | const dataTypes = [];
| ^ 327 | const dataValues = [];
328 | if (!eventFragment.anonymous) {
329 | topics.push(this.getEventTopic(eventFragment));
View compiled
Contract.<anonymous>
/Users/username/Desktop/final-4/src.ts/index.ts:309
fulfilled
http://localhost:3000/static/js/0.chunk.js:5079:24
同样来自检查中的源选项卡:
未捕获(承诺中)错误:调用恢复异常(method="symbol()",errorSignature=null,errorArgs=[null],reason=null,code=CALL_EXCEPTION,版本=abi/5.0.8)未捕获(承诺中)错误:调用恢复异常(method="balanceOf(address)", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.8)
这是我的目录结构:
client
|--node_modules
|-—public
|—-src
|—-contracts
|—-Address.json
|—-Context.json
|—-ERC20.json
|—-IERC20.json
|—-Migrations.json
|—-PreciousChicken.json
|——SafeMath.json
|—-App.css
|—-App.js
|—-App.test.js
|—-index.css
|—-logo.svg
|—-reportWebVitalls.js
|—-setupTests.js
|—-gitignore
|—-package-lock.json
|—-package.json
|—-yarn.lock
|—-contracts
|—-Migrations.sol
|—-MyPreciousToken
|—-migrations
|—-1_initial_migations.js
|—-2_deploy_contracts.js
|—-node-modules
|—-test
解决方案
当您的智能合约尚未部署时,会发生此错误(CALL_EXCEPTION)。
等待交易结束:
await contract.deployTransaction.wait()
推荐阅读
- symfony - 如何在 Symfony 4 中使用 JWT 实现角色
- python - PyQt5 从模型中获取数据以在 QListView 中显示自定义小部件
- java - 我应该在包装类中使用 Java 8 的 Optional 还是在不使用某些属性时使用 null?
- android-layout - Android制作可重复使用的布局
- cakephp-2.0 - 如何创建一个只有在我清除浏览器中的缓存时才能删除的变量?蛋糕PHP
- flutter - 使用通用 BLoC 提供程序和继承小部件有什么区别?
- r - 如何为strsplit匹配一个字符的单个实例?
- html - 尝试添加 css 横幅图像,以便可以在多个页面上轻松更改它
- opentok - 带有带有多个视频聊天的事件的 tokbox 会在每次聊天后结束相机权限吗?
- c - 找不到非标准标题包括