Create Bid

One of the key features of the Rarible SDK is the ability to create bids on NFTs. This article provides a step-by-step guide for developers on how to create a bid using the Rarible SDK.

Prerequisite

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

Creating 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 want to make bid on
  3. Obtain ERC-20 to make a bid (as on EVMs bids are possible only in ERC-20)
  4. Create a bid using Rarible SDK
// Replace X with contract address and Y with tokenId
const bidId = await sdk.order.bid({
  itemId: toItemId("POLYGON:X:Y"),
  amount: 1, // optional, specify it for multiple NFTs (e.g. ERC-1155) if you want to buy more than 1
  price: "0.1", // price for each NFT
  currency: toCurrencyId("POLYGON:0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270") //blockchain and ERC-20 contract address
})
  1. Confirm approval transaction using you wallet and sign order to make a bid.
  2. Check bid. As soon as order is signed you should be able to fetch the order using API

*Please note that bid must be at least 75% for the floor price to avoid spam.

Conclusion

Creating a bid on the Rarible platform using the Rarible SDK is straightforward. By following the steps outlined in this guide, developers can easily integrate bidding functionality into their applications. Remember to handle errors and exceptions in a production environment for a robust implementation.