ecash cash addr specific script hash convert

This commit is contained in:
julian 2023-11-14 09:56:07 -06:00
parent 9269835a95
commit 226617c4c1

View file

@ -82,6 +82,23 @@ class Ecash extends Bip39HDCurrency {
}
}
@override
String addressToScriptHash({required String address}) {
try {
if (bitbox.Address.detectFormat(address) ==
bitbox.Address.formatCashAddr &&
_validateCashAddr(address)) {
address = bitbox.Address.toLegacyAddress(address);
}
final addr = coinlib.Address.fromString(address, networkParams);
return Bip39HDCurrency.convertBytesToScriptHash(
addr.program.script.compiled);
} catch (e) {
rethrow;
}
}
@override
String constructDerivePath({
required DerivePathType derivePathType,