You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I´m having an issue in the Lesson 15. As the Moralis server doesn't work anymore for free, I took the decision to build my own server using the Next.js features for server-side code and MongoDB as a database.
I manage to listen the events occurring in the blockchain. In this case event ItemListing( address seller, address nftAddress, uint256 tokenId, uint256 price );
I wrote the code for the listener inside of getStaticsProps() from react/nextJs. The problem is that the code is running two times. So i get in my database two times the same Object with the same TokenId.
How to avoid this?
Here you have link to the Solidity contract, and nextjs app. Also i let you see my terminal, as you see, it runs twice.
You are connected to the dataBase You are connected to the dataBase
And this comes in my data base
_id
63fe4902353b6ca72b6eb4e4
seller
"0xB227673c8Fb86B8a9178d9E42A22fCF9321aFBBF"
nftAddress
"0x2d475fa54d402C5854c89Ec1A2Ac2F20eA7f80Fa"
tokenId
"35"
price
"0.01"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @!!
I´m having an issue in the Lesson 15. As the Moralis server doesn't work anymore for free, I took the decision to build my own server using the Next.js features for server-side code and MongoDB as a database.
I manage to listen the events occurring in the blockchain. In this case
event ItemListing( address seller, address nftAddress, uint256 tokenId, uint256 price );
I wrote the code for the listener inside of getStaticsProps() from react/nextJs. The problem is that the code is running two times. So i get in my database two times the same Object with the same TokenId.
How to avoid this?
Here you have link to the Solidity contract, and nextjs app. Also i let you see my terminal, as you see, it runs twice.
https://github.com/AGMASO/nextjs-app
https://github.com/AGMASO/contract-solidity
You are connected to the dataBase You are connected to the dataBase
And this comes in my data base
_id
63fe4902353b6ca72b6eb4e4
seller
"0xB227673c8Fb86B8a9178d9E42A22fCF9321aFBBF"
nftAddress
"0x2d475fa54d402C5854c89Ec1A2Ac2F20eA7f80Fa"
tokenId
"35"
price
"0.01"
_id
63fe4902353b6ca72b6eb4e5
seller
"0xB227673c8Fb86B8a9178d9E42A22fCF9321aFBBF"
nftAddress
"0x2d475fa54d402C5854c89Ec1A2Ac2F20eA7f80Fa"
tokenId
"35"
price
"0.01"
Thank you in advance!!
Beta Was this translation helpful? Give feedback.
All reactions