List Intents
Fetch a user's historical Nexus intents with pagination and optional status filtering.
Note
SET UP THE SDK BEFORE YOU START:Install and initialize the client first — see Installation and SDK Setup.
listIntents() function to fetch a user's historical intents, with pagination and an optional status filter.
Note
listIntents() replaces the v1 getMyIntents(page) method. It returns a structured { intents, total } result instead of a bare array, and accepts an optional status filter.Method signature
listIntents(
params?: ListIntentsParams,
): Promise<ListIntentsResult>Parameters
export type ListIntentsParams = {
page?: number;
status?: IntentStatus;
};
export type IntentStatus = 'created' | 'deposited' | 'fulfilled' | 'expired';ListIntentsParams(optional): Filters for the intent query.page(number, optional): The page number for pagination. Page size is fixed at 20 records — paginate by incrementingpage.status(IntentStatus, optional): Restrict results to a single lifecycle status —'created','deposited','fulfilled', or'expired'.
Note
IntentStatus is exported both as a value map (IntentStatus.Fulfilled) and as a type. Use the value map to avoid hardcoding the string literals.Example
import { IntentStatus, type ListIntentsResult } from '@avail-project/nexus-core';
// First page of all intents
const { intents, total }: ListIntentsResult = await client.listIntents();
console.log(`Showing ${intents.length} of ${total} intents`);
// Second page, filtered to fulfilled intents
const fulfilled = await client.listIntents({
page: 2,
status: IntentStatus.Fulfilled,
});
for (const intent of fulfilled.intents) {
console.log(intent.requestHash, intent.status, intent.explorerUrl);
}Return Value
ListIntentsResult object.
export type ListIntentsResult = {
intents: IntentRecord[];
total: number;
};
export type IntentRecord = {
requestHash: Hex;
explorerUrl: string;
status: IntentStatus;
solver: Hex | null;
createdAt?: number;
updatedAt?: number;
expiry: number;
recipientAddress: Hex;
destinationChain: {
id: number;
name: string;
logo: string;
universe: Universe;
};
destinations: Array<{
token: {
contractAddress: Hex;
symbol: string;
name: string;
logo: string;
decimals: number;
};
amount: string;
amountRaw: bigint;
}>;
sources: Array<{
chain: {
id: number;
name: string;
logo: string;
universe: Universe;
};
amountRaw: bigint;
amount: string;
feeRaw: bigint;
fee: string;
token: {
contractAddress: Hex;
symbol: string;
name: string;
logo: string;
decimals: number;
};
}>;
};How is this guide?