mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
fix _getCryptoCurrencyByScheme
This commit is contained in:
parent
19cae77e2b
commit
db5fcde918
1 changed files with 5 additions and 12 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
import 'dart:convert';
|
||||
|
||||
import '../app_config.dart';
|
||||
import '../wallets/crypto_currency/crypto_currency.dart';
|
||||
|
||||
class AddressUtils {
|
||||
|
@ -345,18 +346,10 @@ class AddressUtils {
|
|||
|
||||
/// Method to get CryptoCurrency based on URI scheme.
|
||||
static CryptoCurrency _getCryptoCurrencyByScheme(String scheme) {
|
||||
switch (scheme) {
|
||||
case 'bitcoin':
|
||||
return Bitcoin(CryptoCurrencyNetwork.main);
|
||||
case 'bitcoincash':
|
||||
return Bitcoincash(CryptoCurrencyNetwork.main);
|
||||
case 'ethereum':
|
||||
return Ethereum(CryptoCurrencyNetwork.main);
|
||||
case 'monero':
|
||||
return Monero(CryptoCurrencyNetwork.main);
|
||||
// Add more cases as needed for other coins
|
||||
default:
|
||||
throw UnsupportedError('Unsupported URI scheme: $scheme');
|
||||
if (AppConfig.coins.map((e) => e.uriScheme).toSet().contains(scheme)) {
|
||||
return AppConfig.coins.firstWhere((e) => e.uriScheme == scheme);
|
||||
} else {
|
||||
throw UnsupportedError('Unsupported URI scheme: $scheme');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue