add optional prefix param to address to script conversion

This commit is contained in:
julian 2023-01-16 09:17:32 -06:00
parent 5e592f8d29
commit 9388885047

View file

@ -20,9 +20,14 @@ class AddressUtils {
/// attempts to convert a string to a valid scripthash
///
/// Returns the scripthash or throws an exception on invalid firo address
static String convertToScriptHash(String address, NetworkType network) {
static String convertToScriptHash(
String address,
NetworkType network, [
String overridePrefix = "",
]) {
try {
final output = Address.addressToOutputScript(address, network);
final output =
Address.addressToOutputScript(address, network, overridePrefix);
final hash = sha256.convert(output.toList(growable: false)).toString();
final chars = hash.split("");