I'm a beginner and trying to learn web3 and want to implement a transfer-button for NFTs (same as you have on Opensea, where you can transfer your NFT to another address).
I have started of by having a React-website where you can connect your Metamask wallet and thereafter I scan the connected wallet for all NFTs using the alchemy-sdk to get contract, ids and so on.
Next step is to do the actual transaction and here I'm a bit lost.
I see that the same library has a method for sending a transaction with
alchemy.transact.sendTransaction()
But here I first need a signed transaction and here I'm a bit stuck.
For a normal ETH-transfer it seems a transaction looks something like this (found when I searched)
let transaction = {
to: "TO-ACCOUNT",
value: Utils.parseEther("0.001"),
gasLimit: "21000",
maxPriorityFeePerGas: Utils.parseUnits("5", "gwei"),
maxFeePerGas: Utils.parseUnits("20", "gwei"),
nonce: nonce,
type: 2,
chainId: 5,
};
But how does a transaction looks like when sending an NFT, and how do I sign it in Metamask before using the sendTransaction method?
Or is there another way I should approach this problem :)