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

时间:2020-12-22 06:44:16

标签: javascript reactjs ethereum ether etherscan

<块引用>

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 中工作但在我的代码中抛出错误,我不知道出了什么问题

1 个答案:

答案 0 :(得分:0)

我有类似的情况,参考 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