Token Ownership Claiming
Explains the recommended user experience for how a user should claim something based on ownership.
In this example, let's assume a user wants to claim a Ticket to an event based on ownership of a NFT. Your goal is to:
List out all NFTs that have been delegated to a particular wallet
Process that NFT Token ID as claimed by:
Checking ownership of that NFT
If the wallet does not own the NFT, check to make sure the NFT has been delegated to that user
Give the wallet the Ticket
User experience steps
The first step is to get all the incoming delegations from the wallet that wants to claim the ticket. You can do this the following ways:
Contract/Javascript SDK:
getIncomingDelegations(address)
REST API: Delegations by wallet where
to
is the wallet address in questionFilter out these delegations to only include the NFT Contact you are looking to claim tickets for.
Get all the NFT's of each unique
from
address in the above list.For each
delegatedWallet
, list all of their NFT's that are from the contract you are claiming for. Then the user can decide which Token ID to claim the ticket for. There are many external API's to accomplish this. Alchemy offers a simple solution here called getNFTsForOwner.Once the user has selected a token they want to claim a ticket for, the user will most likely send this selection to a backend request. We need to double check that the user has actually delegated this token to the wallet or that the wallet owns this NFT token.
Make sure the token id has not been claimed before.
Does the wallet submitting the request own this NFT? You can do this by checking the
ownerOf(tokenId)
on the contract level.If not, double check that the wallet who delegated this token owns the NFT
If so, double check that this specific token id has been delegated to the requestor. Contract/Javascript SDK: Use the
checkDelegateForERC721
in the SDK or contract REST API: Use the v2/check/erc721 endpoint
Process the ticket! You'll want to mark this specific token id as claimed so no one else can claim this token.
Last updated