Timelock

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

Response Interface

export interface TimelockResponse<T> {
  timelock: T;
}

queryTimelockLockedFunds

Queries a timelock contract for locked funds given an owner/recipient tuple.

export async function queryTimelockLockedFunds(
  contractAddress: string,
  owner: string,
  recipient: string
) {
  const resp = await query<
    QueryTimelockLockedFunds,
    QueryTimelockLockedFundsResponse
  >(QUERY_TIMELOCK_LOCKED_FUNDS, { contractAddress, owner, recipient });

  return resp.timelock.getLockedFunds;
}
NameTypeDescription

contractAddress

string

The contract address of the timelock we want to query.

owner

string

The owner of the funds.

recipient

string

The recipient of the funds.

QueryTimelockLockedFunds

export interface QueryTimelockLockedFunds extends ContractAddressQuery {
  owner: string;
  recipient: string;
}

QueryTimelockLockedFundsResponse

export type QueryTimelockLockedFundsResponse = TimelockResponse<{
  getLockedFunds: Escrow;
}>;
NameTypeDescription

getLockedFunds

The locked funds of the specified owner for the specified recipient.

queryRecipientLockedFunds

Query the locked funds for the specified recipient.

export async function queryRecipientLockedFunds(
  contractAddress: string,
  recipient: string,
  options: AndrSearchOptions
): Promise<Escrow[]> {
  const resp = await query<
    QueryTimelockRecipientLockedFunds,
    QueryTimelockRecipientLockedFundsResponse
  >(QUERY_TIMELOCK_RECIPIENT_LOCKED_FUNDS, {
    contractAddress,
    options,
    recipient,
  });

  return resp.timelock.getLockedFundsForRecipient;
}
NameTypeDescription

contractAddress

string

The contract address of the timelock we want to query.

recipient

string

The address of the recipient of funds.

options?

Optional additional options for the query. Mostly used for pagination.

QueryTimelockRecipientLockedFunds

export interface QueryTimelockRecipientLockedFunds
  extends ContractAddressQuery,
    PaginatedRequiredQuery {
  recipient: string;
}

QueryTimelockRecipientLockedFundsResponse

export type QueryTimelockRecipientLockedFundsResponse = TimelockResponse<{
  getLockedFundsForRecipient: Escrow[];
}>;
NameTypeDescription

getLockedFundsForRecipient

Escrow with the held funds and related information.

Escrow

export interface Escrow {
  coins: Coin[];
  condition: EscrowCondition;
  recipient: Recipient;
}
NameTypeDescription

coins

Funds being held within the Escrow.

condition

EscrowCondition

The condition to release the funds. Can be either a set time or amount of funds.

recipient

The recipients of the locked funds

Last updated