Listing an asset
In order to list an asset of a Player you need to give us some information about the listing.
const transaction = await beam.marketplace.listAsset('profile-seller-id', {
assetAddress: '0x...',
assetId: '1',
quantity: 1 // You can list multiple 1155 assets from the same token, defaults to 1
price: '1000', // Listing price in BEAM token
sellType: 'FixedPrice' // AscendingAuction, DescendingAuction or FixedPrice
currency: 'USDC' // Defaults to BEAM. Find all available options through the getCurrencies() method;
});
// {
// "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": [
// (...)
// ]
// }
Operation returned by the method needs to be signed. Learn more about Operations here: Operations introduction.
Different intricacies on the different selling types will be provided at a later date. To keep things simple, we advise you to start listing with the 'FixedPrice' sell type only.
Accessing listed items for your game
At the moment, we provide a method that allows you to retrieve all the listed items of a Player. Since we just listed an item, you can now verify whenever the item is actually for sale by calling getListedAssetsForProfile
method.
const listings = await beam.marketplace.getListedAssetsForProfile(
"profile-seller-id",
{
offset: 0, // optional, defaults to 0
limit: 10, // optional, defaults to 10
}
);
// {
// "data": [
// {
// "marketplaceId": "string",
// "price": "string",
// "sellType": "string",
// "startPrice": "string",
// "endPrice": "string",
// "platformFee": 0,
// "royaltyFee": 0,
// "currency": "string",
// "startTime": "string",
// "endTime": "string",
// "quantityListed": 0,
// "orderId": "string",
// "expiresAt": "string",
// "sellerAddress": "string",
// "contractId": "string",
// "nft": {
// "marketplaceId": "string",
// "name": "string",
// "imageUrl": "string",
// "assetType": "string",
// "assetAddress": "string",
// "assetId": "string"
// }
// }
// ],
// "pagination": {
// "count": 0,
// "limit": 10,
// "offset": 0
// }
// }