isValidCAIP10NFTAddress function

bool isValidCAIP10NFTAddress(
  1. String? wallet
)

Implementation

bool isValidCAIP10NFTAddress(String? wallet) {
  if (wallet == null) {
    return false;
  }
  try {
    final walletComponent = wallet.split(':');
    return (walletComponent.length == 5 || walletComponent.length == 6) &&
        walletComponent[0].toLowerCase() == 'nft' &&
        double.tryParse(walletComponent[4]) != null &&
        double.parse(walletComponent[4]) > 0 &&
        double.tryParse(walletComponent[2]) != null &&
        double.parse(walletComponent[2]) > 0 &&
        isAddress(walletComponent[3]) &&
        walletComponent[1] == 'eip155';
  } catch (err) {
    return false;
  }
}