getContractEvents not returning the expected event

Moralis.Web3API.native.getContractEvents was meant to return all my events on a contract but it says array is zero even though I know the event has been emitted ones.

I checked my explorer and have 1 event emitted…

I get this as reply

{total: 0, page: 0, page_size: 500, result: Array(0)}
page: 0
page_size: 500
result: []
total: 0

do you have an exact example? it can happen that if that event was not really from the contract address then not to be included

it is from the contract, i even went to the explorer, collected the address and hardcoded it but still got nothing

can you paste that link from the explorer, and the contract address that you used for that web3api call?


the function that you are trying to use may be a little more complicated to use, you will have to specify the event that you want to get, this is an easier way to get that event:

logs = await Moralis.Web3API.native.getLogsByAddress({address: “0x2986b3db87d479b3e273424bdff9e973edb75ba3”, chain: “avalanche testnet”})

okay let me try this

this works but my response is in hex and I’m wondering if there’s a tool to convert that in moralis or anywhere else

You mean in how to interpret the event parameters?

I get this

page: 0
page_size: 500
result: Array(1)
address: "0x2986b3db87d479b3e273424bdff9e973edb75ba3"
block_hash: "0x68438adfc98343de44cce5e22fbe3015008f20ef25f146536776002d77e901c0"
block_number: "4792360"
block_timestamp: "2022-01-13T11:18:09.000Z"
data: "0x0000000000000000000000002986b3db87d479b3e273424bdff9e973edb75ba30000000000000000000000000000000000000000000000000000000000000001000000000000000000000000140d36b05111b1108abdafdef2cd03359fa239ff00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000061e15bf10000000000000000000000000000000000000000000000000000000061e2ad7100000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000114c65742075732074616b65206f7665722e000000000000000000000000000000"
topic0: "0xe0e9d60fa48a3206c11e8385f853bc1576d663ec8ed4ad96cc84b05da29775ac"
topic1: null
topic2: null
topic3: null
transaction_hash: "0x022fcd0c94d05ecf2ca1a1e735035fa9de5b9e85596dbf90f3ad9f66e9df3ed8"
[[Prototype]]: Object
length: 1
[[Prototype]]: Array(0)
total: 1
[[Prototype]]: Object

but the data is in hex

you are interested in particular in that data field? that data field may not always be easy to interpret even when you have the abi