Auction

The GraphQL queries that can be performed on the Auction ADO.

Response Interface

export interface AuctionResponse<T> {
  auction: T;
}

queryAuctionIds

Queries the Auction Ids for the specified token and contract.

export async function queryAuctionIds(
  contractAddress: string,
  tokenId: string,
  tokenAddress: string
): Promise<number[]> {
  const resp = await query<
    QueryAuctionAuctionIds,
    QueryAuctionAuctionIdsResponse
  >(QUERY_AUCTION_AUCTION_IDS, { contractAddress, tokenId, tokenAddress });

  return resp.auction.auctionIDs.auction_ids;
}
NameTypeDescription

contractAddress

string

The address of the contract to query.

tokenId

string

The Id of the token we want to get Auction Ids for.

tokenAddress

string

The contract address of the NFT contract.

QueryAuctionAuctionIds

export interface QueryAuctionAuctionIds extends ContractAddressQuery {
  tokenAddress: string;
  tokenId: string;
}

QueryAuctionAuctionIdsResponse

export type QueryAuctionAuctionIdsResponse = AuctionResponse<{
  auctionIDs: { auction_ids: number[] };
}>;
NameTypeDescription

auctionIds

number[]

The auction Ids.

queryAuctionInfo

Queries auction information from an auction contract about a particular token contract by address.

export async function queryAuctionInfo(
  contractAddress: string,
  tokenAddress: string
): Promise<QueryAuctionAuctionInfoResponse["auction"]> {
  const resp = await query<
    QueryAuctionAuctionInfo,
    QueryAuctionAuctionInfoResponse
  >(QUERY_AUCTION_AUCTION_INFO, { contractAddress, tokenAddress });

  return resp.auction;
}
NameTypeDescription

contractAddress

string

The address of the contract to query.

tokenAddress

string

The contract address of the NFT contract.

QueryAuctionAuctionInfo

export interface QueryAuctionAuctionInfo extends ContractAddressQuery {
  tokenAddress: string;
}

QueryAuctionAuctionInfoResponse

export type QueryAuctionAuctionInfoResponse = AuctionResponse<{
  auctionInfosForAddress: {
    auction_ids: number[];
    token_address: string;
    token_id: string;
  };
}>;
NameType

auctionIds

number[]

The auction Ids of the auctions that use the specified contractAddress.

contractAddress

string

The contract address of the auction ADO.

tokenId

string

The Id of the token that was auctioned.

queryAuctionState

Queries auction state from an auction contract given an auction ID

export async function queryAuctionState(
  contractAddress: string,
  auctionId: number
): Promise<AuctionState> {
  const resp = await query<
    QueryAuctionAuctionState,
    QueryAuctionAuctionStateResponse
  >(QUERY_AUCTION_AUCTION_STATE, { contractAddress, auctionId });

  return resp.auction.auctionState;
}
NameTypeDescription

contractAddress

string

The address of the contract to query.

auctionId

number

The Id of the auction to get the state of.

QueryAuctionAuctionState

export interface QueryAuctionAuctionState extends ContractAddressQuery {
  auctionId: number;
}

QueryAuctionAuctionStateResponse


export type QueryAuctionAuctionStateResponse = AuctionResponse<{
  auctionState: AuctionState;
}>;

export interface AuctionState {
  auction_id: string;
  coin_denom: string;
  end_time: Record<string, any>;
  high_bidder_addr: string;
  high_bidder_amount: string;
  is_cancelled: boolean;
  start_time: Record<string, any>;
  whitelist: string[];
  min_bid: string;
}
NameTypeDescription

auction_id

string

The Id of the auction.

coin_denom

string

The denom of the funds used in the auction.

end_time

Record<string, any>

When the auction will end.

high_bidder_address

string

The address of the highest bidder.

high_bidder_amount

string

The highest bid.

isCancelled

boolean

Whether the auction was cancelled.

start_time

Record<string, any>

When the auction will start.

whitelist

string[]

Vector of stirngs representing the whitelisted addresses.

min_bid

string

The minimum bid that can be placed on the auctioned token.

queryBids

Queries the bids placed on the specified auctionId.

export async function queryBids(
  contractAddress: string,
  auctionId: number
): Promise<Bid[]> {
  const resp = await query<QueryAuctionBids, QueryAuctionBidsResponse>(
    QUERY_AUCTION_BIDS,
    { auctionId, contractAddress }
  );

  return resp.auction.bids.bids;
}
NameTypeDescription

contractAddress

string

The address of the contract to query.

auctionId

number

The Id of the auction to query bids for.

QueryAuctionBids

export interface QueryAuctionBids extends ContractAddressQuery {
  auctionId: number;
}

QueryAuctionBidsResponse

export type QueryAuctionBidsResponse = AuctionResponse<{
  bids: { bids: Bid[] };
}>;
NameTypeDescription

bids

Bid[]

A vector of Bid containing the bids of the specified auction.

Bid

export interface Bid {
  amount: number;
  bidder: string;
  timestamp: string;
}
NameTypeDescription

amount

number

The amount of coins of the bid.

bidder

string

The bidder address.

timestamp

string

The time of the bid.

queryAuctionLatestState

Queries an auction contract for the latest auction state for a given token address/id tuple

export async function queryAuctionLatestState(
  contractAddress: string,
  tokenAddress: string,
  tokenId: string
): Promise<AuctionState> {
  const resp = await query<
    QueryAuctionLatestAuctionState,
    QueryAuctionLatestAuctionStateResponse
  >(QUERY_AUCTION_LATEST_AUCTION_STATE, {
    contractAddress,
    tokenAddress,
    tokenId,
  });

  return resp.auction.latestAuctionState;
}
NameTypeDescription

contractAddress

string

The address of the contract you want to query.

tokenAddress

string

The contract address of the NFT being auctioned.

tokenId

string

The Id of the token/NFT being auctioned.

QueryAuctionLatestAuctionState

export interface QueryAuctionLatestAuctionState extends ContractAddressQuery {
  tokenAddress: string;
  tokenId: string;
}

QueryAuctionLatestAuctionStateResponse

export interface QueryAuctionLatestAuctionStateResponse {
  latestAuctionState: AuctionState;
}
export interface AuctionState {
  auction_id: string;
  coin_denom: string;
  end_time: Record<string, any>;
  high_bidder_addr: string;
  high_bidder_amount: string;
  is_cancelled: boolean;
  start_time: Record<string, any>;
  whitelist: string[];
  min_bid: string;
}
NameTypeDescription

auction_id

string

The id of the auction.

coin_denom

string

The denom the auction is in.

end_time

Record<string, any>

The end of the auction.

high_bidder_addr

string

The address of the highest bidder.

high_bidder_amount

string

The amount of the highest bid.

is_cancelled

boolean

Whether or not the auction has been cancelled.

start_time

Record<string, any>

The start of the auction.

whitelist

string[]

The whitelisted addresses if they were specified at time of creation.

min_bid

string

The minimum bid that can be placed on the auctioned token.

Last updated