validateTronAddress function
- required String address,
Implementation
AddressError? validateTronAddress({required String address}) {
if (address.trim().length != address.length) return AddressError.WHITESPACE;
if (address.length != 34) return AddressError.INVALID;
if (!address.startsWith("T")) return AddressError.INVALID;
try {
final bytes = base58CheckDecodeWithVersion(address);
if (bytes.length != 21) return AddressError.INVALID;
return null;
} catch (e) {
return AddressError.INVALID_CHECKSUM;
}
}