Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tx to Token1155Holder #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maxmux-xyz
Copy link

TX is useful to have whenever there is a change in token holders.
I allows us to leverage the Zora SDK as such:

const txHash = '0x02a742cc14eedf17b6e93ca16d7d303f69cd3a43048a391205eb7735e7c58fee'
  const txReceipt = await getTxReceipt(txHash, logger)
  if (!txReceipt) {
    return
  }
  console.log(txReceipt)
  const zoraObject = premintClient.getDataFromPremintReceipt(txReceipt)
  const premintUid = zoraObject.premintedLog?.uid
  const minterAddress = zoraObject.premintedLog?.minter
  const zoraCollectionAddress = zoraObject.premintedLog?.contractAddress
  console.log({ premintUid, minterAddress, zoraCollectionAddress })

The premintUID is what we are looking for. With that we can find the post associated the token holder change. Without the TX we knew the minterAddress, the tokenId and the zoraCollectionAddress - but that is not enough to find the post. All posts from same user have the same zoraCollectionAddress, and we don't have any record of the tokenId in our backend.

Example of token_1155_holder webhook:

{
  "op": "INSERT",
  "data_source": "drakula-zora-base-sepolia/0.3.3",
  "data": {
    "old": null,
    "new": {
      "balance": "18",
      "user": "\\x3ca0165c2a3d8aa9ee4f8a8b826a4952598961b6",
      "txn": "0x02a742cc14eedf17b6e93ca16d7d303f69cd3a43048a391205eb7735e7c58fee",
      "token_and_contract": "0x627a509d76498ddd7d80a28ef4cd887b5b6df2cd-40",
      "id": "0x3ca0165c2a3d8aa9ee4f8a8b826a4952598961b6-0x627a509d76498ddd7d80a28ef4cd887b5b6df2cd-40",
      "vid": "237",
      "last_updated_block": "13079149",
      "block_range": "[13079149,)"
    }
  },
  "webhook_name": "token-holder-max-test",
  "webhook_id": "webhook_clz1idx8n0jn80108go0m1tii",
  "id": "7a722573-cf52-4a82-81f7-9227ac6b7e02",
  "delivery_info": {
    "max_retries": 10,
    "current_retry": 0
  },
  "entity": "token_1155_holder"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants