Closed Kunkka0822 closed 1 year ago
@Kunkka0822 why can't we be using https://github.com/neume-network/strategies/tree/main/src/strategy-factories/call-tokenuri ?
As you can see, we need more functions and in my opinion, these are not designed to be extensible.
Extractor is trying to fetch all tokenURIs for all tokenIDs. Good.
It relies on the nextTokenId
function to get all tokenIds. If the nextTokenId
is 100, the extractor will fetch all tokenURIs from 1 to 100.
My preferred way to get all tokenIds would be call-block-logs. We can track the Transfer
event.
@Kunkka0822 also tries to transform the output from extractor using a write
function. Such transforms can be done in the transformer file.
The output of the write
function strips all the essential metadata such as contract address and block number. This information will be useful later. The final NFT output should be according to our defined schema and it has fields such as createdAt
.
I didn't understand the need of the current transformer. Instead of writing two tokenURIs such as ar://b2dea../1
and ar://b2dea../2
. It only writes ar://b2dea../[1-2]
. It minimises the data to be written but I don't think it is enough reason to implement it. Such notation will increase our logic in subsequent sound-protocol strategies where we have to decode this first. An example of subsequent sound-protocol strategy is sound-protocol-get-tokenuri
which fetches the ar://
URI.
Actionable advice from my side:
tokenURI
function on the contract. By convention, this strategy will be called sound-protocol-call-tokenuri
. If nothing goes wrong this strategy should be exactly like other call-tokenuri strategies and can also use the call-tokenuri factory.I talked with @Kunkka0822 over Discord and explained my above comment. We have decided to:
nextTokenId
contract function. Where the output after transforming it with logs-to-subgraph will be like.
[
{"address":"0x3bf96afe2291d76f2934350624080faefeec9a46","tokenId":"1","createdAtBlockNumber":"13761051","platform":{"name":"sound-protocol"}},
{"address":"0x3bf96afe2291d76f2934350624080faefeec9a46","tokenId":"2","createdAtBlockNumber":"13761051","platform":{"name":"sound-protocol"}}
...
]
{"metadata":{"block":{"number":"13761051"},"contract":{"address":"0x3bf96afe2291d76f2934350624080faefeec9a46"},"tokenId":"1"},"results":"ar://-bLbFg-u3BraSe7oQ90IbW3603C7VCSkS4LomfFR5V0/1"}
{"metadata":{"block":{"number":"13761051"},"contract":{"address":"0x3bf96afe2291d76f2934350624080faefeec9a46"},"tokenId":"2"},"results":"ar://-bLbFg-u3BraSe7oQ90IbW3603C7VCSkS4LomfFR5V0/2"}
ok good makes sense
@Kunkka0822 why can't we be using https://github.com/neume-network/strategies/tree/main/src/strategy-factories/call-tokenuri ?