Skip to main content

getAddresses

Function Signature

Future<PortalGetAddressesResult> getAddresses()

Description

Returns the addresses for the client’s wallet. Addresses come from the client’s wallet metadata (provided by the Portal API), not from the signing shares on the device — so this returns addresses whenever the client has a wallet, regardless of whether its signing shares are on the current device.
A returned address does not mean the wallet can sign on this device — it only tells you the client has a wallet. To check whether the signing shares are on the current device, use isWalletOnDevice.

Parameters

This method takes no parameters.

Returns

PortalGetAddressesResult - An object containing:
PropertyTypeDescription
hasWalletboolWhether the client has a wallet (i.e. addresses are available). This reflects wallet existence, not whether the signing shares are on this device — use isWalletOnDevice for that.
addressesPortalAddressesThe wallet addresses

PortalAddresses

PropertyTypeDescription
ethereumString?The EVM wallet address
solanaString?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. Like getAddresses, it comes from the client’s Portal-provided wallet metadata, not from the on-device signing shares, so a non-null address only indicates the client has a wallet — it does not mean the signing shares are on this device. Use isWalletOnDevice to determine on-device signing availability.

Parameters

ParameterTypeRequiredDescription
chainIdStringYesThe chain ID in CAIP-2 format

Returns

String? - The wallet address for the specified chain, or null if the client has no wallet.

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

CodeDescription
NOT_INITIALIZEDPortal was not initialized