Transfer NFTs Using JavaScript
This tutorial shows how to move an NFT from one account to another with buy and sell offers, using a JavaScript sample in your browser. You create offers, accept them, list the offers for an NFT and cancel an offer.
- Section
- Tutorials
What you need
Download the NFT Modular Tutorials archive and open transfer-nfts.html in a browser. Choose a test network, Devnet or Testnet. Then get two test accounts: new ones, or accounts from seeds you already have.
Selling an NFT
Select the owner's account and enter the amount of the sell offer. An amount in XRP is entered in drops, where 1000000 drops equal 1 XRP. For an issued currency, enter the currency code, the issuer's address and the amount. You can add a Destination address, so that only that account may accept the offer, and a number of days until the offer expires. Enter the NFT ID and click Create Sell Offer. Another account can then accept the offer and buy the NFT.
Buying an NFT
Switch to an account that does not own the NFT. Enter the amount of your offer, the NFT ID and the owner's address, then click Create Buy Offer. The owner accepts it by entering the offer's nft_offer_index and clicking Accept Buy Offer.
Listing and cancelling offers
Enter the NFT ID and click Get Offers to list its buy and sell offers. The code sends an nft_sell_offers request and an nft_buy_offers request. The key value is the nft_offer_index, which you use to accept an offer. It is different from the NFTokenID. To cancel an offer you created, enter its index and click Cancel Offer. The code sends an NFTokenCancelOffer transaction.
Good to know
To give the NFT away, set the amount of the sell offer to 0.
Source: xrpl.org. Read 6 December 2026.
Zerpedia states what the source says, in plain words, and gives no opinion. How Zerpedia is made