I don’t have too much experience with Streams API yet.
I want to watch all my user Eth addresses to watch for changes for specific NFT contracts - (transfers in and out of wallet).
What’s the best way to do this?
I don’t have too much experience with Streams API yet.
I want to watch all my user Eth addresses to watch for changes for specific NFT contracts - (transfers in and out of wallet).
What’s the best way to do this?
So will this in and out of wallets be specific to certain users?
I want to watch every user wallet that connects and gets loaded into the database. Potentially thousands
There are only 6 NFT contracts I want to watch for changes (mints and transfers).
Unless it’s easier to wallet the 6 contract and for every transfer check if TO / FROM address is a user on the app?
Hi @jins
You can use the stream filters for this. This requires you to create a stream to monitor the events of your six contracts and use filters to only send the data when from or to address matches. You can add multiple addresses using an or operator.
Example with using filter
Still very confused about how I use streams.
I setup a stream in the Web UI to watch a contract address for transfers and it’s giving results.
How can I get these results into my app and check if the to-from address is a user on my app?
Where do webhook URLs come from?
nftTransfers": [
{
"operator":NULL
"from":"0x96016d03cb47e289b777eaabcf3b34a04bc54ae8"
"to":"0x0d80a866e82b16117633fc12079730d185fd9518"
"tokenId":"511467"
"amount":"1"
"transactionHash":"0x7f891052af020896472b3e54cc93d44f2e385cb6..."
"logIndex":"279"
"contract":"0x67f4732266c7300cca593c814d46bee72e40659f"
"tokenName":"......."
"tokenSymbol":"......"
"tokenContractType":"ERC721"
}
]
Hi @jins
Webhook URL will be an active post URL using which your server or database can receive data through a post request from Moralis.
So using a webhook URL you can get the stream data to your app via your backend.
You can check this video tutorial on how to set up a simple webhook in your node js app.
If you can share the backend service which you are using I can try to suggest a better tutorial.
Thanks, I watched a few of the Youtube vids and got a better idea.
I’m testing streams on Polygon for Transfer() event and it is extremely slow. Buying an item on Opensea or another marketplace shows up as a txn on Polygon in about 10 seconds as normal but it doesn’t show in the stream for 3-4 minutes.
Even still some transactions show up in the stream as 2-3 separate events.
This showed up as 3 separate stream log items, each of these are the exact same:
Hi @jins
The shared screenshots shows the confirmed value as true. It is expected to have a delay in getting stream with confirmed value as true.
The stream data with confirmed value as false is received as soon as the transaction is registered on a block, so you can also use this to know when the transaction is confirmed.
The stream with confirmed value as true is received when the block is not dropped even after the fixed number of block conformations. It confirms that the block with your transaction is not dropped.
You can find more about the block confirmation data per chain in the below docs table.
Let us know if you have any other questions.
Can you provide more details about this and if it is reproducible?
We only get stream once after the conformation, So it could be a bug in the stream demo ui page.
To reproduce this bug, you’d have to have to create the stream and let it run for a but and just check nftTransfers
with token id for each one until you see repeating txns. In 100 stream events, I’ve seen multiple times where it repeated.
0x67f4732266c7300cca593c814d46bee72e40659f
Polygon
I had Contract Interactions
and Native Interactions
checked at the time.
ABI:
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
]
Choose Transfer
for Topic.
@johnversus, back to your response above about filters…
I’m watching transfer events in a few NFT contract addresses and I’m only concerned with my app users transfers.
Is there any limit to the size of the array for the ‘in’ filter? Would an array of 1000+ strings be problematic?
If not then it probably makes more sense, once a user signs up, the app programmatically updates the ‘in’ filter to add the new eth address to this array for both TO and FROM. I can pull all user addresses from the database into an array.
Also, does the Update Stream API update the entire thing like a PUT request or just the parts you add like PATCH?
There is no limit on using multiple filters. However when your filters are growing it would be better to use api or sdk to add or update rather than using the ui.
It will only update the data that you send in PUT. Existing data will remain the same.
You can test it in the docs.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.