gpt4 book ai didi

javascript - 错误 : sending a transaction requires a signer while calling aggregate function of Multicall Contract Ethereum

转载 作者:行者123 更新时间:2023-12-05 00:36:32 33 4
gpt4 key购买 nike

index.js:1 Failed to fetch multicall chunk [{…}] 1 Error: sending a transaction requires a signer (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=contracts/5.0.2)


多重调用合约地址 - https://etherscan.io/address/0xeefba1e63905ef1d7acba5a8513c70307c1ce441#writeContract
在 Uniswap 接口(interface)中工作,但在我的代码中引发错误,我不知道出了什么问题

最佳答案

您必须提供签名者才能执行solidity 方法。
您可以从您的 web3 提供商处获得签名者。
您可以像这样将签名者绑定(bind)到契约(Contract)

import Contract from './artifacts/contracts/Contract.sol/Contract.json'
const contractDeployedAddress = "0xblah";

const provider = new ethers.providers.Web3Provider(window.ethereum)
const signer = provider.getSigner();
const contract = new ethers.Contract(contractDeployedAddress, Contract.abi, signer)

await contract.someMethodThatRequiresSigning();

关于javascript - 错误 : sending a transaction requires a signer while calling aggregate function of Multicall Contract Ethereum,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65404281/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com