checkBtcAddress static method
Implementation
static bool checkBtcAddress(String address, [NetworkType? networkType]) {
try {
final cashAddressPrefix = networkType?.prefix;
if (cashAddressPrefix != null) {
// BTC and BCH testnet legacy P2PKH addresses share version 0x6f, so
// they cannot be classified by address bytes alone. Require the
// network-qualified CashAddr form for BCH.
return bitcoin.Address.validateCashAddress(address, cashAddressPrefix);
}
bitcoin.Address.addressToOutputScript(address, networkType);
return true;
} catch (error) {
return false;
}
}