Skip to main content

Function Signature

Future<PortalGetTransactionDetailsResponse> getTransactionDetails(
  String chain,
  String signature,
)

Description

Retrieves the full details of a specific transaction identified by its chain and signature (transaction hash). Supports EVM, EVM user operations, Solana, Bitcoin, Stellar, and Tron chains.

Parameters

ParameterTypeRequiredDescription
chainStringYesThe chain ID in CAIP-2 format (e.g. eip155:1). Note: this parameter is named chain (not chainId) to match the underlying native SDK API.
signatureStringYesThe transaction hash or signature to look up

Returns

PortalGetTransactionDetailsResponse — An object containing transaction metadata and chain-specific data.

PortalGetTransactionDetailsResponse

PropertyTypeDescription
chainIdStringThe chain ID the transaction belongs to
signatureStringThe transaction hash or signature
evmTransactionJsonString?JSON string of the EVM transaction (present for standard EVM chains)
evmUserOperationJsonString?JSON string of the EVM user operation (present for ERC-4337 account abstraction)
solanaTransactionJsonString?JSON string of the Solana transaction
bitcoinTransactionJsonString?JSON string of the Bitcoin transaction
stellarTransactionJsonString?JSON string of the Stellar transaction
tronTransactionJsonString?JSON string of the Tron transaction
Only one of the chain-specific JSON fields will be non-null, depending on the chain.

Example

import 'dart:convert';
import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

// Look up a specific EVM transaction
final details = await portal.getTransactionDetails(
  'eip155:11155111',
  '0xabc123...',
);

print('Chain: ${details.chainId}');
print('Signature: ${details.signature}');

if (details.evmTransactionJson != null) {
  final tx = jsonDecode(details.evmTransactionJson!);
  print("Value: ${tx['value']}");
  print("Gas: ${tx['gas']}");
  print("Block: ${tx['blockHash']}");
} else if (details.solanaTransactionJson != null) {
  final tx = jsonDecode(details.solanaTransactionJson!);
  print("Slot: ${tx['slot']}");
}

Fetch details for the most recent transaction

// Get the latest transaction hash first
final transactions = await portal.getTransactions(
  'eip155:1',
  limit: 1,
  order: PortalTransactionOrder.desc,
);

if (transactions.isNotEmpty && transactions.first.hash != null) {
  final details = await portal.getTransactionDetails(
    'eip155:1',
    transactions.first.hash!,
  );
  print('Details: ${details.evmTransactionJson}');
}

Errors

CodeDescription
NOT_INITIALIZEDPortal was not initialized
GET_TRANSACTION_DETAILS_ERRORFailed to fetch the transaction details