NFT transfer data CURL

My objective is to create a webhook with transfer data from NFTs. I manage to make Streams work in the documentation till this point:

curl --request PUT \
     --url 'https://api.moralis-streams.com/streams/evm' \
     --header 'accept: application/json' \
     --header 'X-API-Key: xxx' \
     --header 'content-type: application/json' \
     --data '
{
  "webhookUrl": "https://webhook.site/fe519dd7-b23f-4b79-af5c-24c3648e8ce8",
  "description": "aaa",
  "tag": "aaa",
  "includeContractLogs": true,
  "chainIds": [
    "0x89"
  ]
}

Now, I want to be able to include this ABI in the code such that I get only Transfer data:

[
  {
    "type": "event",
    "anonymous": false,
    "name": "Transfer",
    "inputs": [
      {
        "type": "address",
        "name": "from",
        "indexed": true
      },
      {
        "type": "address",
        "name": "to",
        "indexed": true
      },
      {
        "type": "uint256",
        "name": "tokenId",
        "indexed": true
      }
    ]
  },
  {
    "type": "event",
    "anonymous": false,
    "name": "Approval",
    "inputs": [
      {
        "type": "address",
        "name": "owner",
        "indexed": true
      },
      {
        "type": "address",
        "name": "approved",
        "indexed": true
      },
      {
        "type": "uint256",
        "name": "tokenId",
        "indexed": true
      }
    ]
  },
  {
    "type": "event",
    "anonymous": false,
    "name": "ApprovalForAll",
    "inputs": [
      {
        "type": "address",
        "name": "owner",
        "indexed": true
      },
      {
        "type": "address",
        "name": "operator",
        "indexed": true
      },
      {
        "type": "bool",
        "name": "approved"
      }
    ]
  }
]

I tried to enter some values in the CURL in the documentation but I get the error Could not match the union against any of the items

Does somebody have an input on this?

1 Like

try directly with the swagger interface:

https://api.moralis-streams.com/api-docs/

you can add the entire config there and see current config, you can also see the curl command there

you can also add a stream config with admin interface and then see the config in the swagger interface

I try but in vain. I dont know what I am actually doing :sweat_smile:. I enter this:

{
  "webhookUrl": "https://webhook.site/fe519dd7-b23f-4b79-af5c-24c3648e8ce8",
  "description": "string",
  "tag": "string",
  "topic0": [
    "Transfer"
  ],
  "allAddresses": true,
  "includeNativeTxs": false,
  "includeContractLogs": true,
  "includeInternalTxs": false,
  "getNativeBalances": [
    {
      "selectors": [
        "string"
      ],
      "type": "event"
    }
  ],
  "abi":[
  {
    "type": "event",
    "anonymous": false,
    "name": "Transfer",
    "inputs": [
      {
        "type": "address",
        "name": "from",
        "indexed": true
      },
      {
        "type": "address",
        "name": "to",
        "indexed": true
      },
      {
        "type": "uint256",
        "name": "tokenId",
        "indexed": true
      }
    ]
  },
  {
    "type": "event",
    "anonymous": false,
    "name": "Approval",
    "inputs": [
      {
        "type": "address",
        "name": "owner",
        "indexed": true
      },
      {
        "type": "address",
        "name": "approved",
        "indexed": true
      },
      {
        "type": "uint256",
        "name": "tokenId",
        "indexed": true
      }
    ]
  },
  {
    "type": "event",
    "anonymous": false,
    "name": "ApprovalForAll",
    "inputs": [
      {
        "type": "address",
        "name": "owner",
        "indexed": true
      },
      {
        "type": "address",
        "name": "operator",
        "indexed": true
      },
      {
        "type": "bool",
        "name": "approved"
      }
    ]
  }
],
  "advancedOptions": [
    {
      "topic0": "Transfer",
      "filter": {},
      "includeNativeTxs": true
    }
  ],
  "chainIds": [
    "0x89"
  ],
  "demo": true,
  "triggers": [
    {
      "type": "tx",
      "contractAddress": "string",
      "inputs": [
        "string",
        [
          "string"
        ]
      ],
      "functionAbi": {},
      "topic0": "string",
      "callFrom": "string"
    }
  ]
}

but errors appear

I don’t know what you want to do
you can use the admin interface initially to create a stream config and after that to see in the swagger interface how the config looks like

you don’t have to use all those fields from that config example

how can i move the config that i made in the admin interface to swagger?

you can get all the configs in the swagger from here:

https://api.moralis-streams.com/api-docs/#/EVM%20Streams/GetStreams

or with a stream id from here:
https://api.moralis-streams.com/api-docs/#/EVM%20Streams/GetStream

1 Like