alephium / alephium-nft

Prototype for NFT Marketplace on Alephium
6 stars 7 forks source link

Frontend backend separation #27

Closed Lbqds closed 1 year ago

Lbqds commented 1 year ago

Now we can run NFT on the devnet using the following commands:

  1. Build images: ./build-docker-images devnet
  2. Start services: cd docker && docker compose up -d
  3. Deploy contracts: yarn && yarn run deploy:contracts
h0ngcha0 commented 1 year ago

Awesome work, thanks! :fire:

h0ngcha0 commented 1 year ago

After we have the event subscription to the backend, there potentially is a small UX issue:

Since everything is asynchronous, after we list/unlist a collection, there might be a lag between user finishing the tx and API returning the matching state. Concretely, a user might cancel a listing for a NFT and then go to my NFT page, still seeing the NFT being listed even after refresh. There are potentially a few ways to address it but maybe we should have a discussion about it.

Lbqds commented 1 year ago

After we have the event subscription to the backend, there potentially is a small UX issue:

Since everything is asynchronous, after we list/unlist a collection, there might be a lag between user finishing the tx and API returning the matching state. Concretely, a user might cancel a listing for a NFT and then go to my NFT page, still seeing the NFT being listed even after refresh. There are potentially a few ways to address it but maybe we should have a discussion about it.

Indeed, perhaps we can start by reducing the polling interval here(currently 100s). But this doesn't solve the fundamental issue. Maybe we should consider the following approachs when a user queries my-nfts:

  1. Sync events from the full node
  2. Check the existence of the NFTListing contract based on the NFT id. But this approach might be slow if the user has numerous NFTs.

BTW, even if our full node has WebSocket support, is it possible that similar situations could arise due to latency?

h0ngcha0 commented 1 year ago

Maybe we should consider the following approachs when a user queries my-nfts:

  1. Sync events from the full node
  2. Check the existence of the NFTListing contract based on the NFT id. But this approach might be slow if the user has numerous NFTs.

Yeah, maybe we should try to sync if we discover that the events are not caught up. If the events has catched up I guess we don't need to check the existence of the NFTListings contract. WDYT?

BTW, even if our full node has WebSocket support, is it possible that similar situations could arise due to latency?

Yeah we will have the same issue, to a lesser extent I guess.

Lbqds commented 1 year ago

If the events has catched up I guess we don't need to check the existence of the NFTListings contract. WDYT?

Sounds good to me!

h0ngcha0 commented 1 year ago

If the events has catched up I guess we don't need to check the existence of the NFTListings contract. WDYT?

Sounds good to me!

Do you think this commit looks ok?

Lbqds commented 1 year ago

Do you think this commit looks ok?

LGTM 👍

h0ngcha0 commented 1 year ago

Close since everything is in https://github.com/alephium/alephium-nft/pull/28 now