mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-10 12:44:31 +00:00
strip prefixes for cashaddrs before generating uris
This commit is contained in:
parent
b64b5cdb9b
commit
7b160b9a55
1 changed files with 11 additions and 1 deletions
|
@ -126,7 +126,17 @@ class AddressUtils {
|
||||||
String address,
|
String address,
|
||||||
Map<String, String> params,
|
Map<String, String> params,
|
||||||
) {
|
) {
|
||||||
String uriString = "${coin.uriScheme}:$address";
|
// TODO: other sanitation as well ?
|
||||||
|
String sanitizedAddress = address;
|
||||||
|
if (coin == Coin.bitcoincash ||
|
||||||
|
coin == Coin.bitcoincashTestnet ||
|
||||||
|
coin == Coin.eCash) {
|
||||||
|
final prefix = "${coin.uriScheme}:";
|
||||||
|
if (address.startsWith(prefix)) {
|
||||||
|
sanitizedAddress = address.replaceFirst(prefix, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String uriString = "${coin.uriScheme}:$sanitizedAddress";
|
||||||
if (params.isNotEmpty) {
|
if (params.isNotEmpty) {
|
||||||
uriString += Uri(queryParameters: params).toString();
|
uriString += Uri(queryParameters: params).toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue