Crowdfund

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

Response Interface

export interface CrowdfundResponse<T> {
  crowdfund: T;
}

queryCrowdfundAvailableTokens

Queries all available token IDs to be sold from a crowdfund contract.

export async function queryCrowdfundAvailableTokens(
  contractAddress: string
): Promise<string[]> {
  const resp = await query<
    QueryCrowdfundAvailableTokens,
    QueryCrowdfundAvailableTokensResponse
  >(QUERY_CROWDFUND_AVAILABLE_TOKENS, { contractAddress });

  return resp.crowdfund.availableTokens;
}

QueryCrowdfundAvailableTokens

export interface QueryCrowdfundAvailableTokens extends ContractAddressQuery {}

QueryCrowdfundAvailableTokensResponse

export type QueryCrowdfundAvailableTokensResponse = CrowdfundResponse<{
  availableTokens: string[];
}>;

queryCrowdfundConfig

Queries the config of the crowdfund contract.

export async function queryCrowdfundConfig(
  contractAddress: string
): Promise<CrowdfundConfig> {
  const resp = await query<QueryCrowdfundConfig, QueryCrowdfundConfigResponse>(
    QUERY_CROWDFUND_CONFIG,
    { contractAddress }
  );

  return resp.crowdfund.config;
}

QueryCrowdfundConfig

export interface QueryCrowdfundConfig extends ContractAddressQuery {}

QueryCrowdfundConfigResponse

export type QueryCrowdfundConfigResponse = CrowdfundResponse<{
  config: CrowdfundConfig;
}>;

CrowdfundConfig

export interface CrowdfundConfig {
  can_mint_after_sale: boolean;
  token_address: string;
}

queryCrowdfundTokenAvailable

Queries a crowdfund contract for the availability of a given token ID.

export async function queryCrowdfundTokenAvailable(
  contractAddress: string,
  tokenId: string
): Promise<boolean> {
  const resp = await query<
    QueryCrowdfundTokenAvailable,
    QueryCrowdfundTokenAvailableResponse
  >(QUERY_CROWDFUND_TOKEN_AVAILABLE, { contractAddress, tokenId });

  return resp.crowdfund.isTokenAvailable;
}

QueryCrowdfundTokenAvailable

export interface QueryCrowdfundConfig extends ContractAddressQuery {}

QueryCrowdfundTokenAvailableResponse

export type QueryCrowdfundTokenAvailableResponse = CrowdfundResponse<{
  isTokenAvailable: boolean;
}>;

queryCrowdfundState

Queries the state of the crowdfund.

export async function queryCrowdfundState(
  contractAddress: string
): Promise<CrowdfundState> {
  const resp = await query<QueryCrowdfundState, QueryCrowdfundStateResponse>(
    QUERY_CROWDFUND_STATE,
    { contractAddress }
  );

  return resp.crowdfund.state;
}

QueryCrowdfundState

export interface QueryCrowdfundState extends ContractAddressQuery {}

QueryCrowdfundStateResponse

export type QueryCrowdfundStateResponse = CrowdfundResponse<{
  state: CrowdfundState;
}>;

CrowdfundState

export interface CrowdfundState {
  amount_sold: number;
  amount_to_send: number;
  amount_transferred: number;
  expiration: Expiry;
  max_amount_per_wallet: number;
  min_tokens_sold: number;
  price: Coin;
  recipient: Recipient;
}

Coin

export interface Coin {
    readonly denom: string;
    readonly amount: string;
}

Last updated