Documentation Index
Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
Use this file to discover all available pages before exploring further.
Function Signature
Future<List<PortalTransaction>> getTransactions(
String chainId, {
int? limit,
int? offset,
PortalTransactionOrder? order,
})
Description
Retrieves historical transactions for the wallet on the specified chain.
Parameters
| Parameter | Type | Required | Description |
|---|
chainId | String | Yes | The chain ID in CAIP-2 format |
limit | int | No | Maximum number of transactions to return |
offset | int | No | Number of transactions to skip (pagination) |
order | PortalTransactionOrder | No | Sort order |
PortalTransactionOrder
| Value | Description |
|---|
asc | Ascending order (oldest first) |
desc | Descending order (newest first) |
Returns
List<PortalTransaction> - A list of transaction objects.
PortalTransaction
| Property | Type | Description |
|---|
hash | String? | Transaction hash |
from | String? | Sender address |
to | String? | Recipient address |
value | String? | Transaction value |
blockHash | String? | Block hash |
blockNumber | String? | Block number |
blockTimestamp | String? | Block timestamp |
chainId | String? | Chain ID |
gas | String? | Gas used |
gasPrice | String? | Gas price |
input | String? | Transaction input data |
nonce | String? | Transaction nonce |
transactionIndex | String? | Index in the block |
Example
import 'package:portal_flutter/portal_flutter.dart';
final portal = Portal();
// Get recent transactions
final transactions = await portal.getTransactions(
'eip155:1',
limit: 10,
order: PortalTransactionOrder.desc,
);
for (final tx in transactions) {
print('Hash: ${tx.hash}');
print('From: ${tx.from}');
print('To: ${tx.to}');
print('Value: ${tx.value}');
print('Timestamp: ${tx.blockTimestamp}');
}
// First page
final page1 = await portal.getTransactions(
'eip155:1',
limit: 20,
offset: 0,
);
// Second page
final page2 = await portal.getTransactions(
'eip155:1',
limit: 20,
offset: 20,
);
Errors
| Code | Description |
|---|
NOT_INITIALIZED | Portal was not initialized |
FETCH_FAILED | Failed to fetch transactions |