6

ethers连接合约,调用name(),报sending a transaction requires a signer

 3 years ago
source link: https://learnblockchain.cn/question/1983
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.
ethers连接合约,调用name(),报sending a transaction requires a signer

ethers连接合约,调用name(),报sending a transaction requires a signer

请问
var contract = new ethers.Contract(address, abi, provider);
var name = await contract .name();
这里报sending a transaction requires a signer,这是为什么?name是view,应该不需要签名的
如果连接钱包的话
var contract = new ethers.Contract(address, abi, wallet);
var name = await contract .name();
这里会直接发送交易


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK