Accept Bid

One of the key features is the ability to accept bids on NFTs. This article will guide you through the process of accepting a bid using the Rarible SDK.

Prerequisite

Follow our Getting started guide to install needed libraries and instantiate SDK.

Accepting bid

  1. Connect Wallet: Ensure the user's wallet is connected. This can be done using wallet connect protocols.
  2. Find an NFT which you have and there is a bid which can be accepted. Best (highest) bid is in the field bestBidOrder in Item
  3. Accept this bid using SDK
// Fetch NFT which has bid
const item = await sdk.apis.item.getItemById({ itemId: "ETHEREUM:X:Y" })

const tx = await sdk.order.acceptBid({
  orderId: item.bestBidOrder.id,
  amount: 1, //for multiple NFTs you can provide 
})

  1. Confirm approval transaction and confirm "Accept bid" transaction using your wallet
  2. Verify bid was accepted:
    • NFT is transferred to the buyer
    • You got the money

Conclusion

Accepting a bid on an NFT using the Rarible SDK is a straightforward process. By following these steps, you can seamlessly integrate bid acceptance functionality into your application. For more advanced use cases and additional features, refer to the Rarible SDK documentation.