I get the following error:
Error: TypedTransaction with ID 40 unknown at t.TransactionFactory.fromSerializedData
My code:
const txData = {
nonce: "0x" + parseInt(nonce, 10).toString(16),
from: address,
to: to,
gasLimit: "0x" + parseInt(gasAmount, 10).toString(16),
gasPrice: "0x" + parseInt(fee, 10).toString(16),
value: "0x" + parseInt(balance, 10).toString(16),
};
console.log(txData)
let hexObject = new ethereumjs.Tx(txData);
let hexString = '0x' + hexObject.serialize().toString('hex'),
encoded = {
encoding: 'hex'
}
const rawHash = web3.utils.sha3(hexString, encoded);
console.log('rawHash: ' + rawHash)
let txHash = await web3.eth.sign(rawHash, address);
console.log('txHash: ' + txHash)
const createReceipt = await web3.eth.sendSignedTransaction(txHash, function (error, hash) {
if (error) {
console.log(error)
}
else {
console.log(hash)
}
})