Niftory Docs
Niftory Web3 API
Search…
⌃K
Links

Transfer an NFT

The final core capability of the sample app is the ability to transfer NFTs to users. This is accomplished via the transfer mutation, which:
  • Takes in the ID of the NFT or NFTModel to transfer
  • Mints the NFT if it hasn't already been minted, and
  • Transfers the minted NFT to the user's wallet
Since these can be time-consuming operations, the transfer API schedules the work to happen asynchronously, and returns back the NFT that will be transferred to the user. The NFT's status field tells you what is going on.
Unlike the other APIs we have seen so far that are run in the context of the logged-in user, the transferAPI is privileged. As a result, you will need to call transfer from your application's backend.
const TRANSFER = gql`
mutation transferNFTToUser($nftModelId: ID!, $userId: ID!) {
transfer(nftModelId: $nftModelId, userId: $userId) {
id
}
}
`;
Follow the sample app's structure for an example on how to invoke the transfer mutation, or read further on how to invoke Niftory APIs in your backend.
You now have everything you need to get started—except the NFTs themselves! So let's discuss the Niftory Admin Portal next, where you can set up your NFT collections and manage your app.