Skip to main content

Get Auction by ID

To get more infos about a specific auction you can find the auction by ID and get info like highest bid, highest bidder and more.

Get Auctions

If you are interested in getting Auctions by other filters, have a loot at the get how-tos.

To get infos about a specific Auction, you must call id on dataset(Dataset.AUCTION) followed by a get(). id takes an object of type AuctionBidRequest as parameter.

    const auction = await https(origin)
.project(SoonaverseApiKey[origin])
.dataset(Dataset.AUCTION)
.id(auctionUid)
.get();

get() returns an oject of type Auction.

Auction Info

If you are interested about more details about a specific auction, you can check out this how-to.

Full How-To Code

import { Dataset } from '@build-5/interfaces';
import { Build5, SoonaverseApiKey, SoonaverseOtrAddress, https } from '@build-5/sdk';

async function main() {
const origin = Build5.TEST;
// @ts-ignore
const otrAddress = SoonaverseOtrAddress[origin];

try {
const auctionUid = 'auction id retrieved from tangle';
const auction = await https(origin)
.project(SoonaverseApiKey[origin])
.dataset(Dataset.AUCTION)
.id(auctionUid)
.get();
console.log('Highest bid ', auction.auctionHighestBid);
console.log('Highest bidder ', auction.auctionHighestBidder);
} catch (error) {
console.error('Error: ', error);
}
}

main().then(() => process.exit());