Skip to main content

Function Signature

Future<bool> doesWalletExist([String? chainId])

Description

Checks if a wallet exists for the client. Can optionally check for a specific chain.

Parameters

ParameterTypeRequiredDescription
chainIdStringNoOptional chain ID to check. If null, checks for any wallet.

Returns

bool - true if a wallet exists, false otherwise.

Example

import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

// Check if any wallet exists
final exists = await portal.doesWalletExist();

if (exists) {
  print('Wallet exists');
} else {
  print('No wallet found');
}

Check Specific Chain

// Check if EVM wallet exists
final evmExists = await portal.doesWalletExist('eip155:1');

// Check if Solana wallet exists
final solExists = await portal.doesWalletExist('solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp');

Errors

CodeDescription
NOT_INITIALIZEDPortal was not initialized