ethers.js: Error: invalid transaction object when attempting to deploy contract
here is my code:
var bytecode = contractjson.bytecode
var transaction = ethers.Contract.getDeployTransaction(bytecode, abi);
var signedTx = wallet.sign(transaction)
var deployTx = await wallet.sendTransaction(signedTx)
let tx = await provider.waitForTransaction(deployTx)
this causes the following unhandled promise rejection error:
Error: invalid transaction object
at Wallet.sendTransaction
not sure what’s going wrong here - perhaps the bytecode isn’t formatted correctly? any help is much appeciated 😃
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (7 by maintainers)
I’m initializing the wallet with an encrypted JSON keystore:
var wallet = await Wallet.fromEncryptedWallet(walletJson, password)
walletJson is an imported UTC file generated with gethhere’s the entire error message:
it seems to be the wallet.sendTransaction line that generates the error; all the code before that works ok.
also, I’m able to send transactions to interact with a contract, so I think the wallet is set up ok. only deployment isn’t working
This resolved my issue! Thanks!