Bid on Auction
You can bid on any auction. The only thing you need is an Auction ID
and the funds you want to use for your bid.
- OTR
- HTTPS
To bid on an Auction, you must call bid
on dataset(Dataset.AUCTION)
.
bid
takes an object of type AuctionBidTangleRequest
as parameter.
const otrBidRequest = otr(otrAddress).dataset(Dataset.AUCTION).bid({
auction: auctionUid,
});
bid
returns an oject of type OtrRequest
<
AuctionBidTangleRequest
>
.
The SDK provides the helper functions getFireflyDeepLink()
and getBloomDeepLink()
to generate deep links for OTR requests.
With the Deeplink you can then send your bid assets for the auction.
To bid on an Auction, you must call bid
on dataset(Dataset.AUCTION)
.
bid
takes an object of type AuctionBidRequest
as parameter.
const transction = await https(origin)
.project(SoonaverseApiKey[origin])
.dataset(Dataset.AUCTION)
.bid({
address: address.bech32,
signature: userSign.signature,
publicKey: {
hex: userSign.publicKey,
network: Network.RMS,
},
body: { auction: 'auction id' },
});
bid
returns an oject of type Transaction
.
If you are interested in more details about a specific auction, you can check out this how-to.
Full How-To Code
- OTR
- HTTPS
import { Dataset } 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 {
const auctionUid = 'auction id';
const otrBidRequest = otr(otrAddress).dataset(Dataset.AUCTION).bid({
auction: auctionUid,
});
// Use this deepling to send funds and bid on the auction
console.log(otrBidRequest.getFireflyDeepLink());
} catch (error) {
console.error('Error: ', error);
}
}
main().then(() => process.exit());
import { Dataset, Network } from '@build-5/interfaces';
import { Build5, SoonaverseApiKey, https } from '@build-5/sdk';
import { address } from '../../utils/secret';
import { walletSign } from '../../utils/utils';
async function main() {
const origin = Build5.TEST;
const userSign = await walletSign(address.bech32, address);
try {
const transction = await https(origin)
.project(SoonaverseApiKey[origin])
.dataset(Dataset.AUCTION)
.bid({
address: address.bech32,
signature: userSign.signature,
publicKey: {
hex: userSign.publicKey,
network: Network.RMS,
},
body: { auction: 'auction id' },
});
console.log('Target address ', transction.payload.targetAddress);
} catch (error) {
console.error('Error: ', error);
}
}
main().then(() => process.exit());