View as Markdown

Auctions

Read more about the Auctions system in Hiro here .

Creating a New Auction #

To create a new auction, use the auctionsCreate function.

1
2
3
4
5
6
7
const request = new AuctionCreateRequest();
request.template_id = "template_auction_001";
request.condition_id = "condition_001";
request.instance_ids = ["item_instance_001"];

const auction = await hiroClient.auctionsCreate(session, request);
console.log(auction);

To restrict the listing to specific players, for example a guild, a friends list, or a single player for a one-to-one trade, set allowed_user_ids to the list of user IDs allowed to see, follow, and bid on the auction.

1
2
3
4
5
6
7
8
const request = new AuctionCreateRequest();
request.template_id = "template_auction_001";
request.condition_id = "condition_001";
request.instance_ids = ["item_instance_001"];
request.allowed_user_ids = ["user_id_456"];

const auction = await hiroClient.auctionsCreate(session, request);
console.log(auction);

Placing a Bid on an Auction #

You can place a bid on an auction using the auctionsBid function. A bid amount is set through the bid field on the request, and currencies is optional if the bid is made with items instead of, or alongside, currency.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
const request = new AuctionBidRequest();
request.id = "auction_instance_123";
request.version = "1.0";
request.bid = new AuctionBidAmount();
request.bid.currencies = {
    "gold": "1000"
};

const auction = await hiroClient.auctionsBid(session, request);
console.log(auction);

To bid with items from the player’s inventory, set instance_ids on the bid to the item instance IDs being escrowed. You can combine instance_ids with currencies, or omit currencies entirely for an items-only bid.

1
2
3
4
5
6
7
8
const request = new AuctionBidRequest();
request.id = "auction_instance_123";
request.version = "1.0";
request.bid = new AuctionBidAmount();
request.bid.instance_ids = ["item_instance_789"];

const auction = await hiroClient.auctionsBid(session, request);
console.log(auction);

Canceling an Auction #

If an auction needs to be canceled before it ends, the auctionsCancel method can be used.

1
2
3
4
5
const request = new AuctionsCancelRequest();
request.id = "auction_instance_123";

const auctionCancel = await hiroClient.auctionsCancel(session, request);
console.log(auctionCancel);

Claiming a Winning Bid #

Once an auction has ended, the winning bidder can claim their item using auctionsClaimBid.

1
2
3
4
5
const request = new AuctionClaimBidRequest();
request.id = "auction_instance_123";

const auctionClaimBid = await hiroClient.auctionsClaimBid(session, request);
console.log(auctionClaimBid);

Listing Available Auctions #

You can list the currently available auctions using the auctionsList function.

1
2
3
4
const request = new AuctionListRequest();

const auctionList = await hiroClient.auctionsList(session, request);
console.log(auctionList);

Set allowed_only to true to return only auctions where the caller is on the allowed users list for a directed auction, instead of the default public listings. A standard call (allowed_only false or omitted) and a restricted call (allowed_only true) return disjoint results, so use both to show a player the public marketplace and the restricted auctions they’ve been invited to as separate views.

1
2
3
4
5
const request = new AuctionListRequest();
request.allowed_only = true;

const directedAuctions = await hiroClient.auctionsList(session, request);
console.log(directedAuctions);