kodadot/workers

Deploy farcaster frame worker

yangwao opened this issue · 10 comments

no rush, we are already have one working from Complexlity so using then one hopefully won't put it down upcoming month, jk I believe next week we will have it up :)

Originally posted by @yangwao in #265 (comment)

Can you please deploy our frame cc @preschian ?

sure, will preparing

bummer
cc @preschian @Complexlity

seems even Complexlity one doesn't work, I sense there is issue somewhere else?

https://warpcast.com/yangwao/0x65a7834a

used https://frame.kodadot.workers.dev/gallery/ahp/115

image

Hey man. It does work for me

image

Probably something to do with the deployment. Use this link instead:

https://kodadot-collections.complexlity.workers.dev/gallery/ahp/115

Oh hold. I tried to navigate and couldn't. Will check it out

Update: I found out why. The code assumes the art would have chronological numbering (1 - max-supply). But checking that item on kodadot, it does not.

image
Fig: Art used for testing that follows the number system from 1 to max supply

image
Fig: Art you're trying to get. The number is off.

I'm not super experienced with the kodadot queries but I'm sure there's a way to get the items contained in a collection (without passing an item id). Surely that's what the frontend uses.
Maybe @vikiival can help with the query?

The number is off.

You are completely correct.

Maybe @vikiival can help with the query?

Best I could help now

export async function getItemByOffset(chain: string, collection: string, offset: string | number) {
  const client = getClient(chain as any)
  const query = client.itemListByCollectionId(collection, {
    limit: 1,
    offset: Number(offset),
    orderBy: 'createdAt_ASC',
  })

  console.log(query)

  try {
    const result = await client.fetch<any>(query)
    return result.data?.items
  } catch (error) {
    console.error(error)
    return null
  }
}

The number is off.

You are completely correct.

Maybe @vikiival can help with the query?

Best I could help now

export async function getItemByOffset(chain: string, collection: string, offset: string | number) {
  const client = getClient(chain as any)
  const query = client.itemListByCollectionId(collection, {
    limit: 1,
    offset: Number(offset),
    orderBy: 'createdAt_ASC',
  })

  console.log(query)

  try {
    const result = await client.fetch<any>(query)
    return result.data?.items
  } catch (error) {
    console.error(error)
    return null
  }
}

Thanks. I solved it a different way (by fetching all the items). This looks more efficient (for a collection with to many item. I'll test and add it in

by fetching all the items

Please do not use this

Here:
#271

I used the one you made. It should work well now

Test deployment here @yangwao :
https://kodadot-collections.complexlity.workers.dev/gallery/ahp/115

Test deployment here @yangwao :

Yes, the testing works well. Thank you!

image

seems view button doesn't work as numbering has changed too

image

can do in separate issue to not confuse in this one.