如何与JSONRPCSIGNER部署合同
我正在尝试通过Ether.js函数部署合同。 提供者是Moralis提供商,签名者是通过getigner()从其衍生而来的。
const bytecode = res.data.evm.bytecode.object;
const abi = res.data.abi;
const factory = new ethers.ContractFactory(abi, bytecode, signer);
factory.deploy(args).then(contract=>{
console.log(contract);
}).catch(err=>console.log(err));
上述代码会导致错误如下。
> TypeError: this.signer.sendTransaction is not a function
> at ContractFactory.<anonymous> (index.ts:1249:1)
> at Generator.next (<anonymous>)
> at fulfilled (index.ts:1:1)
Ethers官员文档说JSONRPCSIGNERS继承了签名类。 然后,它应该具有sendTransaction函数。但是错误是什么? 谁能帮我吗?
I'm trying to deploy a contract with ether.js functions.
the provider is Moralis provider and Signer is derived from it via getSigner().
const bytecode = res.data.evm.bytecode.object;
const abi = res.data.abi;
const factory = new ethers.ContractFactory(abi, bytecode, signer);
factory.deploy(args).then(contract=>{
console.log(contract);
}).catch(err=>console.log(err));
The above code results in the error as follows.
> TypeError: this.signer.sendTransaction is not a function
> at ContractFactory.<anonymous> (index.ts:1249:1)
> at Generator.next (<anonymous>)
> at fulfilled (index.ts:1:1)
The Ethers official docs say that JsonRpcSigners inherit the Signer class.
Then it should have the sendTransaction function. But what is the error about?
Can anyone help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论