I want the address of the wallet interacting with the smart contract (the 'from' address in the tx receipt). I can get the smart contract event and parse the event log in the below code but ideally I don't want to have to make another call after getting the smart contract event log. Is it possible to get the address interacting with the smart contract straight from the event log itself?
// use a http provider
async function parseLog(log){
const tx = await web3.eth.getTransactionReceipt(log.transactionHash)
console.log(`from: ${tx.from}`)
}
// use a ws provider
var subscription = web3.eth.subscribe('logs', {
address: address
}, function(error, result){
if (error){
console.log('error: ' + error)
}
})
.on("connected", function(subscriptionId){
console.log("connected " + subscriptionId);
})
.on("data", function(log){
// publish something to the subscriber
parseLog(log)
})
.on("changed", function(log){
console.log("changed " + log);
});