Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/app_config/app_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ const List<String> appWalletOnlyAssetList = [
/// Reduced to only KMD to minimize initial connections and resource usage.
List<String> get enabledByDefaultCoins => [
'KMD', // Komodo ecosystem coin
'BTC-segwit' // Default Fiat Ramps coin
];

List<String> get coinsWithFaucet => ['RICK', 'MORTY', 'DOC', 'MARTY'];
Expand Down
10 changes: 6 additions & 4 deletions lib/bloc/fiat/fiat_onramp_form/fiat_form_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:web_dex/app_config/app_config.dart';
import 'package:web_dex/bloc/fiat/base_fiat_provider.dart';
import 'package:web_dex/bloc/fiat/fiat_order_status.dart';
import 'package:web_dex/bloc/fiat/fiat_repository.dart';
import 'package:web_dex/bloc/coins_bloc/coins_repo.dart';
import 'package:web_dex/bloc/fiat/models/models.dart';
import 'package:web_dex/bloc/fiat/payment_status_type.dart';
import 'package:web_dex/model/forms/fiat/currency_input.dart';
Expand All @@ -31,10 +32,12 @@ part 'fiat_form_state.dart';
class FiatFormBloc extends Bloc<FiatFormEvent, FiatFormState> {
FiatFormBloc({
required FiatRepository repository,
required CoinsRepo coinsRepo,
required KomodoDefiSdk sdk,
int pubkeysMaxRetryAttempts = 20,
Duration pubkeysRetryDelay = const Duration(milliseconds: 500),
}) : _fiatRepository = repository,
_coinsRepo = coinsRepo,
_sdk = sdk,
_pubkeysMaxRetryAttempts = pubkeysMaxRetryAttempts,
_pubkeysRetryDelay = pubkeysRetryDelay,
Expand Down Expand Up @@ -73,6 +76,7 @@ class FiatFormBloc extends Bloc<FiatFormEvent, FiatFormState> {
}

final FiatRepository _fiatRepository;
final CoinsRepo _coinsRepo;
final KomodoDefiSdk _sdk;
final int _pubkeysMaxRetryAttempts;
final Duration _pubkeysRetryDelay;
Expand Down Expand Up @@ -114,11 +118,9 @@ class FiatFormBloc extends Bloc<FiatFormEvent, FiatFormState> {
return emit(state.copyWith(selectedAssetAddress: () => null));
}

// Necessary to add the coin to the wallet coins list for now since
// CoinsRepository is not used here to manually activate the coin -
// which would propagate it to the coins_bloc state.
await _sdk.addActivatedCoins([event.selectedCoin.getAbbr()]);
// Activate the asset via CoinsRepo to ensure broadcasts reach CoinsBloc
final asset = event.selectedCoin.toAsset(_sdk);
await _coinsRepo.activateAssetsSync([asset]);
// TODO: increase the max delay in the SDK or make it adjustable
final assetPubkeys = await retry(
() async => _sdk.pubkeys.getPubkeys(asset),
Expand Down
1 change: 1 addition & 0 deletions lib/views/fiat/fiat_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class _FiatPageState extends State<FiatPage> with TickerProviderStateMixin {
return BlocProvider(
create: (_) => FiatFormBloc(
repository: fiatRepository,
coinsRepo: coinsRepository,
sdk: sdk,
),
child: MultiBlocListener(
Expand Down
Loading