Bid in an optimistic auction
Submit a bid
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://rpc.v1.dev.pod.network");
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);
const AUCTION = "0xeDD0670497E00ded712a398563Ea938A29dD28c7";
const abi = [
"function submitBid(uint256 auction_id, uint64 deadline, uint256 value, bytes data)",
"event BidSubmitted(uint256 indexed auction_id, address indexed bidder, uint64 indexed deadline, uint256 value, bytes data)",
];
const auction = new ethers.Contract(AUCTION, abi, wallet);
const auctionId = 1n;
const deadline = BigInt(Date.now()) * 1000n + 10_000_000n; // 10 seconds from now, in microseconds
const value = ethers.parseEther("100"); // application-defined bid value
const data = "0x"; // opaque payload
const tx = await auction.submitBid(auctionId, deadline, value, data);
console.log("Bid tx:", tx.hash);use pod_sdk::{
auctions::client::AuctionClient,
provider::PodProviderBuilder,
U256,
};
use std::time::{Duration, SystemTime};
let provider = PodProviderBuilder::with_recommended_settings()
.with_private_key(PRIVATE_KEY.parse()?)
.on_url("wss://rpc.v2.pod.network")
.await?;
let auction = AuctionClient::new(
provider,
"0xeDD0670497E00ded712a398563Ea938A29dD28c7".parse()?,
);
let auction_id = U256::from(1);
let deadline = SystemTime::now() + Duration::from_secs(10);
let value = U256::from(100) * U256::from(10).pow(U256::from(18));
let data = vec![];
let receipt = auction
.submit_bid(auction_id, deadline, value, data)
.await?;
println!("Bid tx: {}", receipt.transaction_hash);Wait for the bid set to finalize
Fetch the finalized bid set
Last updated

