[solved] Stream with Filter won't filter and will fail deliveries

Hi,

I am trying to replicate what I was doing with Servers in Streams. I basically have a number of NFT’s sitting in MATIC (OpenSea) and want to monitor every time any of my NFT’s is sold/transferred. As contract address for OpenSea NFT’s is shared, I need to filter out the ones that are not mine.

This is how my configuration for the stream looks like:

Address: 0x2953399124f0cbb46d2cbacd8a89cf0599974963

Stream Configuration: I have put in a webhook url, description, and tag, and switched on Prod

Selected Network: Polygon

Stream Options: Contract Interactions, Native Transactions
Note, I didn’t check or uncheck anything here, it’s the default and I made no changes.

ABI: I copy pasted the whole ABI.

Topic0: TransferSingle(address, address,address,uint256,uint256)

Filter: I added id in [comma separated list of token ids] filter (to capture only my NFT’s)

I have 2 issues;

  1. When I start the stream it starts populating with NFT’s that are supposed to be filtered out.
  2. I have over 12K failed deliveries but can’t see why they failed. Not that it matters as none of those transaction captures are mine but where do I see the failure reasons, if possible?

Any help appreciated.

you can edit the filter directly in docs/swagger interface, you can also see there the error message in history

for get history to see the error message: https://docs.moralis.io/streams-api/evm/reference/get-history

to get current stream configs: https://docs.moralis.io/streams-api/evm/reference/get-streams

to update a stream config better to use the swagger interface: https://api.moralis-streams.com/api-docs/

Thank for the links provided, they are helpful.

Although I am not sure what updating streams through API would change. Do you see why my filter is not working?

can you paste your actual filter configuration that you get from the stream config with docs interface or with the swagger interface?

Here’s my filter config from Swagger. Sorry I had to strip actual token ids.

"filter": {
		"in": [
			"id",
			[
				<token1>,
				<token2>,
				<token3>,
				...,
			]
		]
	}

and that id is a field in the abi?

were these in lowercase?

but if this filter works then you should not receive any data or only the data that you want

Yes it is in the ABI, I am sharing only relevant part of it although I have pasted the whole ABI in the section:

 {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "operator",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "id",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "TransferSingle",
    "type": "event"
  }

To your second question, all token ids are all numeric, there are no letters in any of them. And yeah, I am receiving thousands of transactions; I haven’t confirmed this as there is no easy way to do but I think it’s all the data for the contract (0x2953399124f0cbb46d2cbacd8a89cf0599974963).

You should be able to use the filter for this case, you can also try to edit the abi to give it a different name for that field named id like id_from_abi and use this new name in the filter

I tried that and filter still not working. My backend literally gets bombarded with requests :frustrating:

can you write me on discord?

we found out that the stream config had "includeNativeTxs": true and that is why it was sending a webhook request for every transaction

Resolved, it’s now working as expected after unchecking “Native Transactions” as per your suggestion on Discord.

1 Like