validateCAIP function

bool validateCAIP(
  1. String addressInCAIP
)

Implementation

bool validateCAIP(String addressInCAIP) {
  final List<String> addressComponents = addressInCAIP.split(':');

  if (addressComponents.length != 3) return false;
  final String blockchain = addressComponents[0];
  final String networkId = addressComponents[1];
  final String address = addressComponents[2];
  if (blockchain.isEmpty || networkId.isEmpty || address.isEmpty) return false;

  if (isValidCAIP10NFTAddress(addressInCAIP)) return true;

  final validatorFn =
      addressValidators.validateAddress('eip155', address: address);
  return validatorFn;
}