6

contract.methods.delegate(delegateValue).send(accounts);提示地址错误? | 登链社...

 2 years ago
source link: https://learnblockchain.cn/question/2788
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

30 contract.methods.delegate(delegateValue).send(accounts);提示地址错误?

这个是我用来调用delegate写变量的句子,提示没有获得调用者的地址吗?

image.png

contract,delegateValue,accounts初始化都成功

image.png

网页也显示变量delegateValue成功显示,说明delegateValue的数据是正确的

image.png

最后提示没有获得地址,大神们,帮帮忙!

image.png

最佳答案 3小时前

accounts 是一个数组, 你应该是用accounts[0] 吧?

感谢你,解决了,是这个问题 ,正确的格式是 send({ from: accounts[0] })

Tiny熊 - 布道者
擅长:智能合约,以太坊 | 采纳率 40% | 回答于 14小时前

其它 1 个回答

Aquaman 3小时前

依然是这个错误,但是可以确定的是accounts是有调用者的地址的,下面的两图可以说明。不是道是不是调用合约的问题。

  onClickDelegate = async () => {
    const { accounts, contract,delegateValue} = this.state;
  await contract.methods.delegate(delegateValue).send(accounts[0]);
  }

![image.png](https://img.learnblockchain.cn/attachments/2021/11/BM3WcK4O619b80d594114.png)

![image.png](https://img.learnblockchain.cn/attachments/2021/11/t7dwLsmh619b80e5af99b.png)
您需要登录后才可以回答问题,登录 或者 注册

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK