I have a contract which I want to call using the polkadot{.js} extension. To call the method successfully, you have to sign it. When I am now signing a method, I have trouble reading out the value the method should give me, when executed properly.
If I would not have to sign the method, I would read the output the follwing way:
const { output } = await contract.query.method(
account.address,
{
gasLimit,
storageDepositLimit,
},
variables
)
console.log(output.toHuman())
And the output would look smth like that:
Ok('result here')
Now I have to sign the method first, and the code looks the following way:
const { output } = await contract.tx
.method({ storageDepositLimit, gasLimit }, variables)
.signAndSend(account.address, {signer: injector.signer}, result => {
if (result.status.isInBlock) {
console.log('in a block');
} else if (result.status.isFinalized) {
console.log('finalized');
console.log(result.toHuman())
}
})
The 'result.toHuman()' part does not give me the output of the method. And when I try to call 'output.toHuman()' it tells me that output is undefined.
How can I access the output of the method, when signing the execution prior?