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.
getAddresses
Function Signature
Future<PortalGetAddressesResult> getAddresses()
Description
Get wallet addresses if a wallet exists on device. This method is useful for checking if a wallet exists and retrieving addresses without creating or recovering a wallet.
Parameters
This method takes no parameters.
Returns
PortalGetAddressesResult - An object containing:
| Property | Type | Description |
|---|
hasWallet | bool | Whether a wallet exists |
addresses | PortalAddresses | The wallet addresses |
PortalAddresses
| Property | Type | Description |
|---|
ethereum | String? | The EVM wallet address |
solana | String? | The Solana wallet address |
Example
import 'package:portal_flutter/portal_flutter.dart';
final portal = Portal();
final result = await portal.getAddresses();
if (result.hasWallet) {
print('EVM address: ${result.addresses.ethereum}');
print('Solana address: ${result.addresses.solana}');
} else {
print('No wallet found');
}
getAddress
Function Signature
Future<String?> getAddress(String chainId)
Description
Get the wallet address for a specific chain.
Parameters
| Parameter | Type | Required | Description |
|---|
chainId | String | Yes | The chain ID in CAIP-2 format |
Returns
String? - The wallet address for the specified chain, or null if no wallet exists.
Example
import 'package:portal_flutter/portal_flutter.dart';
final portal = Portal();
// Get Ethereum mainnet address
final ethAddress = await portal.getAddress('eip155:1');
// Get Solana mainnet address
final solAddress = await portal.getAddress('solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp');
print('ETH address: $ethAddress');
print('SOL address: $solAddress');
Errors
| Code | Description |
|---|
NOT_INITIALIZED | Portal was not initialized |