kodadot / nft-gallery

Generative Art Marketplace
https://koda.art
MIT License
629 stars 358 forks source link

Programatic drops #7194

Closed vikiival closed 11 months ago

vikiival commented 1 year ago

As you know current drop page is currently hardcoded and makes it super hard to edit therefore I wrote a complete API to get the data and streamline the process.

Some stuff is already in services/waifu

get the list

GET /drops
[
  {
    "id": "sha",
    "chain": "ahk",
    "collection": "32",
    "image": "ipfs://ipfs/bafybeib33vl64635zct7zz6emxsxrbqeytefrdz7wmmb5qd7er4yiy2jke",
    "name": "Shanghai (Unlockable) Waifus",
    "alias": "free-sha-shirt"
  }
]

When you click on particular drop you should navigate by alias aka /${chain}/drops/${alias}

once you open the drop

GET /drops/:alias
{
  "id": "sha",
  "chain": "ahk",
  "collection": "32",
  "image": "ipfs://ipfs/bafybeib33vl64635zct7zz6emxsxrbqeytefrdz7wmmb5qd7er4yiy2jke",
  "name": "Shanghai (Unlockable) Waifus",
  "banner": "ipfs://ipfs/bafybeib33vl64635zct7zz6emxsxrbqeytefrdz7wmmb5qd7er4yiy2jke",
  "content": null
}

to get possible images call base_url + content if content is null call base_url + '/latest' (already there)

if content starts with https:// call that as raw

You obviously need to fetch some data from indexer as it is now.

To make a mint call function doWaifu where request is already done and second argument is campaign (the id you see on response (in this case sha))

If there is something missing please tag me directly

Note: It can happen that you people will drain balance and bot stops working as usual please ping me

yangwao commented 1 year ago

Anyone from @kodadot/internal-dev could pick this up? It would be nice to have it done on https://blockchainweek.berlin/

kodabot commented 1 year ago

ASSIGNED - @Jarsen136 🔒 LOCKED -> Sunday, September 10th 2023, 02:04:22 UTC -> 72 hours

kodabot commented 1 year ago

ASSIGNMENT EXPIRED - @Jarsen136 has been unassigned.

Jarsen136 commented 1 year ago

I'm working on this issue and found a few things missing.

get the list

GET /drops
[
  {
    "id": "sha",
    "chain": "ahk",
    "collection": "32",
    "image": "ipfs://ipfs/bafybeib33vl64635zct7zz6emxsxrbqeytefrdz7wmmb5qd7er4yiy2jke",
    "name": "Shanghai (Unlockable) Waifus",
    "alias": "free-sha-shirt"
  }
]

The get drops api does not return the expected result. The amount of drops would be four, as we have on prod. What's more, I would recommend adding the params type to distinguish different drops. 'free-drop' 'dot-drop' 'vote-drop'

image

cc @vikiival

vikiival commented 1 year ago

The amount of drops would be four, as we have on prod

Will add. Aye vote wasnt merged when i done this.

vikiival commented 1 year ago

I would recommend adding the params type to distinguish different drops. 'free-drop' 'dot-drop' 'vote-drop'

Thats why we have alias or do you have something else in mind?

Jarsen136 commented 1 year ago

I would recommend adding the params type to distinguish different drops. 'free-drop' 'dot-drop' 'vote-drop'

Thats why we have alias or do you have something else in mind?

Yes. You have provided the api to use alias to fetch the details of the specific drop. GET /drops/:alias

This means we will have four kinds of alias for all the drops. However, we do have only three kinds of drop, that have different functionality. 'free-drop' 'dot-drop' 'vote-drop' If we do not add the params type, I have to hard code all the alias id to distinguish them. It's not flexible especially when we decide to add a new drop in the future. wdyt @vikiival

vikiival commented 1 year ago

Ah I see what are you trying to achieve, these will add.

However type is already present in the data as drop == free-drop. I will add paid and vote 🫡. Thank for pointing that out

Jarsen136 commented 12 months ago

Ah I see what are you trying to achieve, these will add.

However type is already present in the data as drop == free-drop. I will add paid and vote 🫡. Thank for pointing that out

Hi @vikiival I'm waiting for your update on the api. 👀

vikiival commented 11 months ago

Hi @vikiival I'm waiting for your update on the api. 👀

Hello, I have been busy with sub0 where I had talk

but as we agreed the GET /drops is returning type where type can be drop, paid, vote

{
  "type": "vote",
  "meta": "93"
}
vikiival commented 11 months ago

cc @Jarsen136 ?

Jarsen136 commented 11 months ago

@vikiival Sorry, I forgot to reply to you about the issue I faced.

The /drops list api still does not return the expected result. It dose not return alias field so that I could not fetch the the details of drop from the /drops/:alias api.

image

Once it got fixed, I could continue the following work.

vikiival commented 11 months ago

Once it got fixed, I could continue the following work.

{
  "id": "copenhagen2",
  "chain": "ahp",
  "collection": "u-8",
  "image": "ipfs://ipfs/bafybeieacobvvgo53y6nllhd2bxc2zwkq4ucqllr4pkqarkvibejembijm",
  "name": "Copenhagen Premium Waifus",
  "banner": "ipfs://ipfs/bafybeieacobvvgo53y6nllhd2bxc2zwkq4ucqllr4pkqarkvibejembijm",
  "alias": "dot-drop",
  "type": "paid",
  "meta": "9000000000"
}

here you go @Jarsen136

Jarsen136 commented 11 months ago

Once it got fixed, I could continue the following work.

{
  "id": "copenhagen2",
  "chain": "ahp",
  "collection": "u-8",
  "image": "ipfs://ipfs/bafybeieacobvvgo53y6nllhd2bxc2zwkq4ucqllr4pkqarkvibejembijm",
  "name": "Copenhagen Premium Waifus",
  "banner": "ipfs://ipfs/bafybeieacobvvgo53y6nllhd2bxc2zwkq4ucqllr4pkqarkvibejembijm",
  "alias": "dot-drop",
  "type": "paid",
  "meta": "9000000000"
}

here you go @Jarsen136

Got it 🚀

Jarsen136 commented 11 months ago

The last two small stuff I found @vikiival

  1. missing alias filed on aye

    image
  2. What is the type generative? We have not supported such a new type IMO. Could we remove it from the drops list?

    image
vikiival commented 11 months ago
  1. missing alias filed on aye

updated as vote-drop

  1. What is the type generative? We have not supported such a new type IMO. Could we remove it from the drops list?

It's a new type i will open issue regarding that, I removed this particular one