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<PortalNftAsset>> getNftAssets(String chainId)
Description
Retrieves all NFTs owned by the wallet on the specified chain.
Parameters
| Parameter | Type | Required | Description |
|---|
chainId | String | Yes | The chain ID in CAIP-2 format |
Returns
List<PortalNftAsset> - A list of NFT assets.
PortalNftAsset
| Property | Type | Description |
|---|
tokenId | String? | The NFT token ID |
contractAddress | String? | The NFT contract address |
name | String? | NFT name |
description | String? | NFT description |
imageUrl | String? | NFT image URL |
tokenType | String? | Token type (e.g., “ERC721”, “ERC1155”) |
metadata | PortalNftMetadata? | Additional NFT metadata |
| Property | Type | Description |
|---|
name | String? | NFT name from metadata |
description | String? | NFT description from metadata |
image | String? | NFT image URL from metadata |
Example
import 'package:portal_flutter/portal_flutter.dart';
final portal = Portal();
final nfts = await portal.getNftAssets('eip155:1');
for (final nft in nfts) {
print('NFT: ${nft.name ?? nft.metadata?.name}');
print('Token ID: ${nft.tokenId}');
print('Contract: ${nft.contractAddress}');
print('Image: ${nft.imageUrl ?? nft.metadata?.image}');
print('Type: ${nft.tokenType}');
}
Errors
| Code | Description |
|---|
NOT_INITIALIZED | Portal was not initialized |
FETCH_FAILED | Failed to fetch NFT assets |