I'm new and I'm trying to get the transaction hash but I'm only getting undefined
. I used this tutorial and this and below is my code.
const txHash = await polkadot.tx.balances
.transfer('5F1pZe.....GmZRSZuK', 100000000000)
.signAndSend(SENDER, { signer: injector.signer }, (status) => {
if (status.isInBlock) {
console.log(`Completed at block hash #${status.isInBlock}`);
} else {
console.log(`Current status: ${status.type}`);
}
}).catch((error) => {
console.log(':( transaction failed', error);
});
console.log("Submitted with hash", txHash.hash);
I'm getting undefined
for txHash.hash
, status.type
. I have another code that works but I wonder what's wrong with the above.