Broker NFTs with React.js
Utilizing a broker to aid in the transfer of NFTs has some powerful applications.
Using a brokered sale instead of a direct NFT transfer
If the creator or owner of an NFT has the time and patience to seek out the right buyers, they can keep all proceeds from the sale. This works fine for someone who sells only a few NFTs at variable prices.
On the other hand, an NFT creator or owner might not want to spend their time selling, especially if they own a large number of NFTs. Instead of handling each individual sale, the sales work can be turned over to a third-party broker account.
Using a broker offers several advantages. For example:
- The broker can act as an agent, working to maximize the selling price of the NFT. If the broker is paid a percentage of the sale price, the higher the price, the more the broker earns.
- The broker can act as a curator, organizing NFT objects based on a niche market, price point, or other criteria. This can attract groups of buyers who might not otherwise discover a creator’s work.
- The broker can act as a marketplace, similar to Opensea.io, to handle the auction process at the application layer.
Like we demonstrated in the ‘transfer NFTs’ lesson, using sell offers is one way to transfer an NFT directly between two accounts. In this lesson we’re going to use one account with a buy offer, one account with a sell offer and a third party account to facilitate the brokered NFT transaction by going through these steps:
- Mint an NFT in our source wallet.
- Set a value to sell the NFT, and create a sell offer.
- Use a different wallet to create a buy offer for the NFT.
- Use a broker account to accept a sell offer and a buy offer and deduct their broker fee from the transaction.
Seeing this in action
- Open the sandbox below to start by minting an NFT into your source account, and wait for the wallets to be funded.
- Customize your NFT by adding a link, or small amount of text to the URI field in the source wallet.
– This field accepts a maximum of 256 bytes to keep the data stored on the ledger to a reasonable size.
– This typically is where links to digital content or metadata would be stored.
- Click the Send button to mint your NFT, and wait for your NFTokenMint transaction to be validated by the XRPL. If it succeeds, you should see a token ID in your account, along with the URI you included.
- From the tokens list on your source account, copy the token ID of the NFT you just minted and paste it into the ID field of the sell offer. Then, enter the Amount of the sell offer in drops (millionths of an XRP).
- On your sell offer, use the ID of the broker wallet because you’re selling the NFT through a broker’s wallet. This will assign the NFT to the broker’s wallet and they will sell it for you if anyone makes a high enough buy offer.
- Once you have created a sell offer for an NFT in your wallet, you will see it appear underneath the token in your wallet. The important piece of information in the response is the NFT Offer Index, labeled as nft_offer_index, which someone would use to accept the sell offer and buy the token.
- Now, let’s create a buy offer. Copy and paste the ID of the NFT you just minted into the appropriate field of the destination wallet.
- Now enter a buy offer amount that includes enough for the broker fee. This is important, because if it’s not enough, the transaction will not go through. Think of it this way: If you are buying through a broker, they will likely just include their fee in the sale price of the NFT.
- To complete the NFT transfer, copy and paste the NFT ID into the first field of the broker wallet and click get offers. You should see both sell and buy offers for the token.
- Now, enter the sell offer index and the buy offer index and include your broker fee. Click Send and watch the token transfer to the destination wallet!