List Intents
Fetch the connected wallet's intent history.
listIntents() returns the connected wallet's intents across all providers. It requires a connected wallet.
Signature
listIntents(params?: ListIntentsParams): Promise<ListIntentsResult>Parameters
| Name | Type | Description |
|---|---|---|
page | number | Optional, default 1. Integer of 1 or more |
status | IntentStatus | Optional. 'created', 'deposited', 'fulfilled', or 'expired' |
IntentStatus is also exported as a value map, e.g. IntentStatus.Fulfilled.
Example
import { IntentStatus } from '@avail-project/nexus-core';
let page = 1;
while (true) {
const { intents } = await client.listIntents({ page, status: IntentStatus.Fulfilled });
if (intents.length === 0) break;
for (const intent of intents) {
console.log(intent.id, intent.provider, intent.status, intent.explorerUrl);
}
page += 1;
}Returns
ListIntentsResult:
| Field | Type | Description |
|---|---|---|
intents | IntentRecord[] | Records on this page, newest createdAt first |
total | number | Total matching records across all history sources |
IntentRecord:
| Field | Type | Description |
|---|---|---|
id | Hex | Intent ID; matches IntentResult.intentId |
provider | 'nexus-v2' | 'mayan' | 'relay' | undefined | Present only when the service identifies the provider |
status | IntentStatus | Lifecycle status |
explorerUrl | string | Intent explorer link |
createdAt, updatedAt | number | undefined | Timestamps from the history service |
total; page until intents is empty.
Errors
WALLET_NOT_CONNECTED: no provider is set.INVALID_INPUT:pageis not an integer of 1 or more.BACKEND_RFF_LIST_FAILEDor anotherBackendError: the history request failed.
How is this guide?