how to deploy contract with JsonRpcSigner

345 views Asked by At

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?

0

There are 0 answers