Buy NFT
This is a guide used to buy an NFT in DripVerse.
Get Contract Signer
Make sure you've contractSigner object before proceeding.
Please make sure your contractSigner
from previous step is derived from the right contract and call the functions below accordingly.
const price = 25; //add a small adjustment if needed to cover the gas fees
The price is in native tokens. For example, if your network is Polygon, the above will represent 25 MATIC tokens. To successfully buy, you need to provide the asking price or more of the NFT.
Buy Data:
const buyData = {
nftId: "1",
};
In case of ERC1155, you'd need to add amount:
buyData.amount = 4; // If you want to buy 4 tokens.
Finally, call buy
method:
drip.buy(buyData, price, contractSigner);