mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +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
|
||||
///
|
||||
/// 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("");
|
||||
|
|
Loading…
Reference in a new issue