Skip to content

Commit

Permalink
fix _getCryptoCurrencyByScheme
Browse files Browse the repository at this point in the history
  • Loading branch information
sneurlax committed Aug 27, 2024
1 parent 19cae77 commit db5fcde
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions lib/utilities/address_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import 'dart:convert';

import '../app_config.dart';
import '../wallets/crypto_currency/crypto_currency.dart';

class AddressUtils {
Expand Down Expand Up @@ -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');
}
}

Expand Down

0 comments on commit db5fcde

Please sign in to comment.