Filter stream for transfers from Null Address

I have set up a Moralis Stream to listen to all ERC721 transfers using following standard ABI:

{
  anonymous: false,
  inputs: [
    { indexed: true, name: "from", type: "address" },
    { indexed: true, name: "to", type: "address" },
    { indexed: true, name: "tokenId", type: "uint256" },
  ],
  name: "Transfer",
  type: "event",
};

I am trying to filter the stream by transfers from the null address only (mints). I am using a statement like this:

{
 topic0: "Transfer(address,address,uint256)",
     filter: {
        eq: ["from", "0x0000000000000000000000000000000000000000"],
  },
},

However, this kills my stream (nothing propagates at all). I have tried a few things:

  1. Using the longer variant of the null address from raw topic data (0x0000000000000000000000000000000000000000000000000000000000000000)
  2. Using the sender keyword as defined in the burn/mints example.

However, neither result in a live stream that actually propagates events. My current workaround is to just listen for all transfers and then filter in the webhook listener code, but this is wasteful and results in being significantly overcharged for records.

Any help here would be much appreciated.

You used the topic here or this syntax?

Sorry, this is from the TS code I’m using. This var resolves to "Transfer(address,address,uint256)" at runtime (I am standing up multiple streams for ERC721, 1155 in tandem).

I’ve edited the OP!

It should work what you try there.

What is the stream config?

You can get it with the api key and the swagger interface.

Thanks for getting back to me.

 {
      "id": "ac18168d-4146-4336-8adc-00463e24c430",
      "webhookUrl": "https://dnhgy8tmn0.execute-api.us-east-1.amazonaws.com/receiveMoralisWebhook",
      "description": "ERC721 on stage hmprt",
      "tag": "hmprt-ERC721",
      "demo": false,
      "topic0": [
        "Transfer(address,address,uint256)"
      ],
      "allAddresses": true,
      "includeNativeTxs": false,
      "includeContractLogs": true,
      "includeInternalTxs": false,
      "getNativeBalances": [],
      "triggers": [],
      "abi": [
        {
          "anonymous": false,
          "inputs": [
            {
              "indexed": true,
              "name": "from",
              "type": "address"
            },
            {
              "indexed": true,
              "name": "to",
              "type": "address"
            },
            {
              "indexed": true,
              "name": "tokenId",
              "type": "uint256"
            }
          ],
          "name": "Transfer",
          "type": "event"
        }
      ],
      "advancedOptions": [
        {
          "topic0": "Transfer(address,address,uint256)",
          "filter": {
            "eq": [
              "from",
              "0x0000000000000000000000000000000000000000"
            ]
          }
        }
      ],
      "chainIds": [
        "0x1"
      ],
      "status": "active",
      "statusMessage": "Stream is active"
    }
  ],

at a first look I would expect it to work, we have to check more

did you also try without listen to all addresses and to add a contract address to see if it works in that case?

this stream config works as expected for me:

{
  "id": "d72c8b49-1b63-4041-8144-188ce13d66db",
  "webhookUrl": "https://webhook.site/e2e211d4-86d5-4cc5-b345-fba62a86771f",
  "description": "test_filter",
  "tag": "test_filter",
  "demo": false,
  "topic0": [
    "Transfer(address,address,uint256)"
  ],
  "allAddresses": true,
  "includeNativeTxs": false,
  "includeContractLogs": true,
  "includeInternalTxs": false,
  "getNativeBalances": [],
  "triggers": [],
  "abi": [
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "from",
          "type": "address"
        },
        {
          "indexed": true,
          "name": "to",
          "type": "address"
        },
        {
          "indexed": true,
          "name": "tokenId",
          "type": "uint256"
        }
      ],
      "name": "Transfer",
      "type": "event"
    }
  ],
  "advancedOptions": [
    {
      "topic0": "Transfer(address,address,uint256)",
      "filter": {
        "eq": [
          "from",
          "0x0000000000000000000000000000000000000000"
        ]
      }
    }
  ],
  "chainIds": [
    "0x1"
  ],
  "status": "active",
  "statusMessage": "Stream is active"
}

these are the stats for you stream:

{
  "totalWebhooksDelivered": 63,
  "totalWebhooksFailed": 0,
  "totalLogsProcessed": 662,
  "totalTxsProcessed": 0,
  "totalTxsInternalProcessed": 0,
  "createdAt": "2022-12-08T19:26:40.431Z",
  "updatedAt": "2022-12-08T20:45:28.826Z"
}

try to create a new stream, with the same abi, topic, filter, and wait few minutes after that and you should receive filtered requests