useTransferNFT
Description
Hook for transferring an existing wallet.
Parameters
| Name | Type | Description |
|---|---|---|
| from | string | The address of the current token owner. |
| to | string | The address of the new token owner. |
| tokenId | number | The ID of the token to transfer. |
| [overrides] | Overrides | Optional overrides for the contract call. |
Example
import { useContract, useTransferNFT } from "@openformat/react";
// address of a created NFT (ERC721) contract. You can get this from the subgraph.
const address = "0x123...";
const tokenId = 1;
// returns an instance of the NFT.
const { data: nft } = useContract(address);
const { data, transfer } = useTransferNFT(nft);
async function handleTransfer() {
await transfer({ from: "0x123...", to: "0x123...", tokenId: tokenId });
}