Skip to main content

Create Auction

The create Auction functionality allows you to run generic auction without or with an asset. Asset can be an NFT. You can also bid on an Auction or get more infos about a specific Auction.

To create auction, you must call create on dataset(Dataset.AUCTION). create takes an object of type AuctionCreateTangleRequest as parameter.

    const otrCreateRequest = otr(otrAddress).dataset(Dataset.AUCTION).create({
auctionFloorPrice: 1000000,
auctionFrom: new Date(),
auctionLength: 8.64e7, // 1 day in milliseconds
maxBids: 1,
minimalBidIncrement: 1000000,
network: Network.RMS,
space: 'build5spaceid',
});

create returns an oject of type OtrRequest<AuctionCreateTangleRequest>

OTR Request Deep Link

The SDK provides the helper functions getFireflyDeepLink() and getBloomDeepLink() to generate deep links for OTR requests.

The response transaction to your OTR will include an Auction ID which others can use to bid on your auction or to get more info about your Auction.

Full How-To Code

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

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

try {
// To create a generic auction we send an otr request with the needed params
const otrCreateRequest = otr(otrAddress).dataset(Dataset.AUCTION).create({
auctionFloorPrice: 1000000,
auctionFrom: new Date(),
auctionLength: 8.64e7, // 1 day in milliseconds
maxBids: 1,
minimalBidIncrement: 1000000,
network: Network.RMS,
space: 'build5spaceid',
});

const fireflyDeeplink = otrCreateRequest.getFireflyDeepLink();
console.log(fireflyDeeplink);
} catch (error) {
console.error('Error: ', error);
}
}

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