mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 05:04:35 +00:00
add optional prefix param to address to script conversion
This commit is contained in:
parent
5e592f8d29
commit
9388885047
1 changed files with 7 additions and 2 deletions
|
@ -20,9 +20,14 @@ class AddressUtils {
|
||||||
/// attempts to convert a string to a valid scripthash
|
/// attempts to convert a string to a valid scripthash
|
||||||
///
|
///
|
||||||
/// Returns the scripthash or throws an exception on invalid firo address
|
/// 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 {
|
try {
|
||||||
final output = Address.addressToOutputScript(address, network);
|
final output =
|
||||||
|
Address.addressToOutputScript(address, network, overridePrefix);
|
||||||
final hash = sha256.convert(output.toList(growable: false)).toString();
|
final hash = sha256.convert(output.toList(growable: false)).toString();
|
||||||
|
|
||||||
final chars = hash.split("");
|
final chars = hash.split("");
|
||||||
|
|
Loading…
Reference in a new issue