[SOLVED] What's wrong with my query for contract event?

Hi, I’m brand new. Can anyone tell me what is wrong with this query for USDC Transfer events? It just returns empty data. Maybe I’m not entering the topic properly? Thank you.

curl -X 'POST' \
  'https://deep-index.moralis.io/api/v2/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/events?chain=eth&topic=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' \
  -H 'accept: application/json' \
  -H 'X-API-Key: ................ \
  -H 'Content-Type: application/json' \
  -d '{
	"anonymous": false,
	"inputs": [
		{
			"indexed": false,
			"internalType": "address",
			"name": "word",
			"type": "address"
		},
		{
			"indexed": false,
			"internalType": "address",
			"name": "next",
			"type": "address"
		},
		{
			"indexed": false,
			"internalType": "uint256",
			"name": "another",
			"type": "uint256"
		}
	],
	"name": "Transfer",
	"type": "event"
}'

The topic seems fine. Maybe you can find a working example in another forum post

Is it required for me to enter a starting date or block number?

no, that is not required.

does this example work for you?

No, it doesn’t, it returns
{"code":"invalid_post_request","message":"Invalid POST Request"}

Thanks, this has been reported to the dev team.

Try it with a block interval. Because there are so many events for that address it will generate a timeout when we try to get the entire list.

Unfortunately that didn’t help.

Can you supply ANY working query for events?

this works without issues, you didn’t have the right abi for that transfer event:

curl -X 'POST' \
  'https://deep-index.moralis.io/api/v2/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/events?chain=eth&from_block=15691279&to_block=15691280&topic=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' \
  -H 'accept: application/json' \
  -H 'X-API-Key: API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
	"anonymous": false,
	"inputs": [
		{
			"indexed": true,
			"internalType": "address",
			"name": "word",
			"type": "address"
		},
		{
			"indexed": true,
			"internalType": "address",
			"name": "next",
			"type": "address"
		},
		{
			"indexed": false,
			"internalType": "uint256",
			"name": "another",
			"type": "uint256"
		}
	],
	"name": "Transfer",
	"type": "event"
}'

Yes, that works, thank you so much!

1 Like