I've seen similar questions here with explanations, but can't quite make this work.
Using ethers.js, I have a function that makes a transaction on the smart contract. I am listening to an event below to extract a parameter, but then outside of the Promise it is undefined
:
let orderHash;
myContract.on("MakeOrder", (order, hash) => {
orderHash = hash;
});
console.log(orderHash) // logs undefined
How to properly extract the value?