neume-network / strategies

Indexing strategies for the neume network.
GNU General Public License v3.0
11 stars 7 forks source link

Implement sound-protocol-get-tokenuri #319

Closed Kunkka0822 closed 1 year ago

Kunkka0822 commented 1 year ago

@TimDaub I have implemented basic feature of get-tokenuri to fetch JSON objects from tokenURI.

But I didn't filter unique songs yet.

Still thinking where could be best to do this feature.

@TimDaub @il3ven If you have any ideas, please let me know

il3ven commented 1 year ago

@Kunkka0822 The transformer of this strategy is a good place to filter unique songs. That is what I would have done but we can create a new strategy too. Upto you.

Kunkka0822 commented 1 year ago

Yeah, I see. I would like to implement this feature in new strategy. Anyway, let's see @TimDaub's opinion.

Kunkka0822 commented 1 year ago

@Kunkka0822 The transformer of this strategy is a good place to filter unique songs. That is what I would have done but we can create a new strategy too. Upto you.

@il3ven If I do this in transformer, do you think what type of input and output data for transformer should be? It is my opinion :

Input data

[
  {
    ...
    "erc721": {
      "version": "0.1.0",
      "createdAt": 15665995,
      "tokenId": "1",
      "address": "0xf0701a661363f463c8de5bd6b009c0e9ceaba51a",
      "tokenURI": "ar://-bLbFg-u3BraSe7oQ90IbW3603C7VCSkS4LomfFR5V0/1",
      "metadata": {
        ...
        "**trackNumber**": 2
      }
    }
    ...
  }, 
  {
    ...
    "erc721": {
      "version": "0.1.0",
      "createdAt": 15665995,
      "tokenId": "1",
      "address": "0xf0701a661363f463c8de5bd6b009c0e9ceaba51a",
      "tokenURI": "ar://-bLbFg-u3BraSe7oQ90IbW3603C7VCSkS4LomfFR5V0/2",
      "metadata": {
        ...
        "**trackNumber**": 3
      }
    }
    ...
  },
  {
    ...
    "erc721": {
      "version": "0.1.0",
      "createdAt": 15665995,
      "tokenId": "1",
      "address": "0xf0701a661363f463c8de5bd6b009c0e9ceaba51a",
      "tokenURI": "ar://-bLbFg-u3BraSe7oQ90IbW3603C7VCSkS4LomfFR5V0/3",
      "metadata": {
        ...
        "**trackNumber**": 2
      }
    }
    ...
  }
]

Output Data:

[
  [
    {
      ...
      "erc721": {
        "version": "0.1.0",
        "createdAt": 15665995,
        "tokenId": "1",
        "address": "0xf0701a661363f463c8de5bd6b009c0e9ceaba51a",
        "tokenURI": "ar://-bLbFg-u3BraSe7oQ90IbW3603C7VCSkS4LomfFR5V0/1",
        "metadata": {
          ...
          "**trackNumber**": 2
        }
      }
      ...
    }, 
    {
      ...
      "erc721": {
        "version": "0.1.0",
        "createdAt": 15665995,
        "tokenId": "1",
        "address": "0xf0701a661363f463c8de5bd6b009c0e9ceaba51a",
        "tokenURI": "ar://-bLbFg-u3BraSe7oQ90IbW3603C7VCSkS4LomfFR5V0/3",
        "metadata": {
          ...
          "**trackNumber**": 2
        }
      }
      ...
    }
  ],
  [
    {
      ...
      "erc721": {
        "version": "0.1.0",
        "createdAt": 15665995,
        "tokenId": "1",
        "address": "0xf0701a661363f463c8de5bd6b009c0e9ceaba51a",
        "tokenURI": "ar://-bLbFg-u3BraSe7oQ90IbW3603C7VCSkS4LomfFR5V0/2",
        "metadata": {
          ...
          "**trackNumber**": 3
        }
      }
      ...
    },
  ]
]
TimDaub commented 1 year ago

I think the problem with filtering by track number in the transformer is that we'd have to keep track of state, e.g. which track number we've already seen. So I'm currently not exactly sure what would be an elegant solution as I feel like having state anywhere is pretty fragile, especially if we're considering that this strategy must work with the current neume-network/data crawl approach where we may invoke it to only crawl a single block at the time.

TimDaub commented 1 year ago

just added this to the main branch in 0c988d19b710bf180e2bf558d318b549bd7ffae6 but no idea why github didn't pick it up and tagged this PR as merged, hence closing. But great work @Kunkka0822!

Kunkka0822 commented 1 year ago

just added this to the main branch in 0c988d1 but no idea why github didn't pick it up and tagged this PR as merged, hence closing. But great work @Kunkka0822!

Okay, thanks But I didn't fix the version problem yet

TimDaub commented 1 year ago

But I didn't fix the version problem yet

I think it's fine. We call one thing "Sound Protocol" and the other "Sound" so we can differentiate.