Making an offer
Assets in the Beam marketplace are listed in specific currencies, for specific listing prices. That price might just not be right based on the current market value. Via the SDK, it is possible to create offers on both listed and unlisted assets in the marketplace.
Currencies
As mentioned in the currencies page for the Marketplace, depending on the chain you’re implementing on, you’re limited to the available currencies for the chain available in Sphere. Offers are scoped to the same flexibility as the listing and buying process itself: The supported currencies for the chain you use are the same currencies you can use for creating an offer.
Making an offer
Based on the available currencies, you can create an offer for items which are listed, but also items which are not. Keep in mind that it’s up to the seller (whether that’s a Marketplace user or a profile created through the SDK) to accept the offer.
const transaction = await beam.marketplace.createAssetOffer('profile-offerer-id', {
assetAddress: '0x...',
assetId: '1',
quantity: 1 // You can make an offer for multiple 1155 assets from the same token
price: '1000', // Listing price
currency: 'USDC' // Defaults to WBEAM. Find all available options through the getCurrencies() method; You cannot use native(BEAM) to make offers.
});
// {
// "status": "Pending",
// "id": "string",
// "createdAt": "2024-06-06T10:48:36.627Z",
// "updatedAt": "2024-06-06T10:48:36.627Z",
// "gameId": "string",
// "userId": "string",
// "chainId": 0,
// "url": "string",
// "transactions": [
// (...)
// ]
// }
The Operation returned by the method needs to be signed. Learn more about Operations here: Operations introduction.
Canceling offers
If you want to cancel the offer, you can use the following snippet:
const transaction = await beam.marketplace.cancelAssetOffer("profile-offerer-id", {
offerId: 'offer-id-you-created'
}
);
// {
// "status": "Pending",
// "id": "string",
// "createdAt": "2024-06-06T10:48:36.627Z",
// "updatedAt": "2024-06-06T10:48:36.627Z",
// "gameId": "string",
// "userId": "string",
// "chainId": 0,
// "url": "string",
// "transactions": [
// (...)
// ]
// }
Listing offers
If you want to list all the offers made for an NFT, you are able to do so as follows:
// Get all offers for an asset
const transaction = await beam.marketplace.getAssetOffers(
"asset-address",
"asset-id"
);
// Get all offers that player created
const transaction = await beam.marketplace.getPlayerOffers(
"profile-offerer-id"
);
//Get all asset offers that player created
const transaction = await beam.marketplace.getPlayerAssetOffers(
"profile-offerer-id",
"asset-address",
"asset-id"
);
Accepting an offer
If an item is listed by a user that has a Player profile created by you through the SDK, it’s possible to accept an offer through the SDK as well. Keep in mind that not every listing is managed through the SDK. Accepting offers to an asset on Sphere can only be done if you manage the Player that listed it in the first place.
const transaction = await beam.marketplace.acceptAssetOffer(
"player-seller-entity-id",
{
offerId: 'offer-id-that-you-accept'
quantity: 1, // You can accept multiple 1155 assets from the same token
}
);
// {
// "status": "Pending",
// "id": "string",
// "createdAt": "2024-06-06T10:48:36.627Z",
// "updatedAt": "2024-06-06T10:48:36.627Z",
// "gameId": "string",
// "userId": "string",
// "chainId": 0,
// "url": "string",
// "transactions": [
// (...)
// ]
// }
The Operation returned by the method needs to be signed. Learn more about Operations here: Operations introduction.