Buying a listed item
If a user shows interest in a listing for sale by another profile, it's possible to buy the listed asset with a profile by simply calling the buyListedAsset
method. Note that in order to actually buy the asset, the buyer-profile needs to be funded with enough BEAM based on the listing price set by the seller profile.
const response = await beam.marketplace.buyListedAsset('buyer-profile-id', {
orderId: '' // data[0].orderId from the getListedAssetsForProfile method,
quantity: 1 // the amount of NFTs to buy, only relevant for ERC-1155 based tokens, defaults to 1
});
// {
// "status": "success",
// "type": "custodial",
// "transactionHash": '0x71f3f259568e9875c41a4350a3912a3a7650d9321ccd1d57641241128b4e504f',
// "explorerUrl": "https://subnets.avax.network/beam/0x71f3f259568e9875c41a4350a3912a3a7650d9321ccd1d57641241128b4e504f"
// }