Query Types

Andromeda has a large variety of queries, each of which require a speific set of parameters.In this section we will go over some of the interfaces in Andromeda.js to set up for these queries.

ContractAddressQuery

Queries that require the contract address to be specified.

export interface ContractAddressQuery {
  contractAddress: string;
}
NameTypeDescription

contractAddress

string

The contract address to query.

AndrSearchOptions

Options to setup pagination for queries.

export interface AndrSearchOptions {
  limit?: number;
  orderBy?: "Asc" | "Desc";
  startAfter?: number;
}
NameTypeDescription

limit?

number

Optional limit to the number of results for a query. For example if I query user accounts and set the limit to 10, then 10 user accounts would be queried.

orderBy?

string

Optional way to order the results. Can be set to ascending order "Asc" or descending order "Desc".

startAfter?

number

Optional id to start after. Used for pagination.

PaginatedQuery

Queries that have optional pagination.

export interface PaginatedQuery {
  options?: AndrSearchOptions;
}
NameTypeDescription

options?

Optional parameters for the query that has optional pagination.

PaginatedRequiredQuery

Queries that have required paginations.

export interface PaginatedRequiredQuery {
  options: AndrSearchOptions;
}
NameTypeDescription

options

Parameters for the query that requires pagination.

Expiry

export interface Expiry {
  at_time?: number;
  at_height?: number;
}
NameTypeDescription

at_time?

number

The timestamp to be used in the query.

at_height?

number

The block_height to be used in the query.

RecipientADO

export interface RecipientADO {
  a_d_o: {
    address: AndrAddress;
    msg?: string;
  };
}
NameTypeDescription

address

The anddress of the ado defined using AndrAddress.

msg?

string

Optional message to attach to the ADO.

RecipientAddress

Interface for recipient addresses.

export interface RecipientAddress {
  addr: string;
}

Recipient

Type that contains all recipient options which are either ADOs or Addresses.

export type Recipient = RecipientADO | RecipientAddress;

ChainIdQuery

Queries that require the chain Id.

export interface ChainIdQuery {
  chainId: string;
}

TxQuery

Interface if a minimum or maximum height are required in the query.

export interface TxQuery extends ChainIdQuery {
  minHeight?: number;
  maxHeight?: number;
}

Last updated