错误:在调用多调用合约以太坊的聚合函数时发送交易需要签名者

问题描述

index.js:1 Failed to fetch multicall chunk [{…}] 1 Error: 发送交易需要签名者 (operation="sendTransaction",code=UNSUPPORTED_OPERATION,version=contracts/5.0.2)

多呼叫合约地址 - https://etherscan.io/address/0xeefba1e63905ef1d7acba5a8513c70307c1ce441#writeContract

在 Uniswap-interface 中工作但在我的代码中抛出错误,我不知道出了什么问题

解决方法

我有类似的情况,参考 uniswap 接口代码使用 @web3-react

@web3-react 基于 ethers.js,我们必须使用 signer 执行状态更改方法。 我发布了一个我解决的示例。

const { library,account } = useActiveWeb3React();

const contract = getContract(
      CONTRACT_ADDRESS,abi,library
    );
const signer = contract.connect(library.getSigner());
signer.someStateChangingMethods();

这可能对您有所帮助。 https://docs.ethers.io/v5/getting-started/#getting-started--writing

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...