ethereum - 使用 Web3js 检索合同信息
问题描述
我无法使用 Web3JS 从智能合约中检索合约余额。我也没有收到错误。
除了 balanceOf 之外,我还尝试调用其他几个函数,它们都返回以下内容:
[符号(kWeak)]:弱引用 {}。
这是我正在使用的代码:
contract.methods.balanceOf(address).call((err, result) => {console.log(result)})
Promise {
<pending>,
domain:
Domain {
domain: null,
_events:
[Object: null prototype] {
removeListener: [Function: updateExceptionCapture],
newListener: [Function: updateExceptionCapture],
error: [Function: debugDomainError] },
_eventsCount: 3,
_maxListeners: undefined,
members: [],
[Symbol(kWeak)]: WeakReference {} } }
预期结果应该是给定地址的账户余额。
解决方案
推荐阅读
- mysql - Kubernetes MySQL pod 不断崩溃并显示 Unable to lock ./ibdata1 错误:11
- amazon-web-services - 如何将一个服务器 doc 文件移动到另一个 s3 存储桶?
- python - Netmiko send_config_set - 解析响应 - 检测错误?
- python - Tensorboard:如何查看模型摘要?
- php - 如何设置某个值但不通过它?
- algorithm - QBasic 中狐狸追逐模拟的最佳方法
- arrays - DolphinDB 数据库中的向量和数组有什么区别?
- python - using functions with variables from other python files at notebook's directory
- python - 如何检查组中的最大值并返回产品名称
- oracle - 我的问题是关于在 oracle 9i 上查询的 exportdump