Hi everyone,
So I am trying to return a Signature based on the account address that is connected. Like so,
const { account, Moralis } = useMoralis()
console.log(account)
function findSignature(address, mintSignature) {
let data = responseData
for (var i = 0; i < data.length; i++) {
if (data[i]._id == address) {
if (mintSignature in data[i]) {
return data[i][mintSignature]
} else {
return "No Signature found"
}
}
}
return "No such address"
}
let keyValue = findSignature(account, "mintSignature")
console.log(keyValue)
If I let this bit of code try to find the Signature associated with the account, it wonât work, return âNo such addressâ, when there is the address in the given object. But if I directly input the key Address in order to find the signature, it will work and return the expected signature. What I find confusing is that I can console.log(account) and it will return the account in the console.
And here if I hardcode the account address instead of using the account variable, it will work as expectedâŚ
So instead of
let keyValue = findSignature(account, "mintSignature")
I will have to write
let keyValue = findSignature("0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", "mintSignature")
and then it returns the proper signatureâŚ
Does anyone know what might be the issue here ? Or how to use account as a variable for other functions ?