I currently have a couple of NFTs in my wallet and I’m trying to figure out how to move one of them to someone else’s account. Here’s what I’m working with:
I need to transfer just one of these NFTs to another account. What’s the proper way to accomplish this transfer in scrypto? I’m looking for the specific steps or method calls needed to make this happen.
Hey! Cool NFT setup you’ve got there. Quick question - are you doing this transfer inside a blueprint or through transaction manifests? The approach changes depending on what you’re building.
If it’s inside a blueprint, you’d want to grab the specific NFT using take_non_fungible like Hugo said. Do you already have the recipient’s account component reference? And are you doing direct deposit or building some escrow system?
What kind of collectible NFTs are these? The data structure with those enums looks interesting. Building a game or trading system? Knowing the bigger picture would help us give better advice!
just call withdraw_non_fungible on ur bucket, then use try_deposit_or_abort on the target account. make sure to specify the exact NFT ID like “#2#” when withdrawing - u’ll get an error otherwise. this worked for me last week when i moved some NFTs between accounts.
To transfer an NFT using scrypto, you need to first take the specific NFT from your wallet by calling the take_non_fungible method with the appropriate NonFungibleLocalId, such as #2# or #3#. After you retrieve the NFT, you can transfer it to the recipient’s account by utilizing the deposit method on their account component. Ensure you have the correct local ID and proper access to the recipient’s account for a successful transaction.