84 lines
2.3 KiB
Dart
84 lines
2.3 KiB
Dart
part of 'wallet_bloc.dart';
|
|
|
|
/// Base class for wallet events handled by [WalletBloc].
|
|
abstract class WalletEvent extends Equatable {
|
|
const WalletEvent();
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
/// Reloads wallet types, balances, and extras (not Activity lists).
|
|
class WalletLoadRequested extends WalletEvent {
|
|
const WalletLoadRequested({this.ifStale = false});
|
|
|
|
/// Skip the network round-trip when a sync finished a few seconds ago.
|
|
final bool ifStale;
|
|
|
|
@override
|
|
List<Object?> get props => [ifStale];
|
|
}
|
|
|
|
/// Loads one Activity tab on demand (deposits / withdrawals / transfers / predictions).
|
|
class WalletActivityRequested extends WalletEvent {
|
|
const WalletActivityRequested({required this.category, this.force = false});
|
|
|
|
final String category;
|
|
final bool force;
|
|
|
|
@override
|
|
List<Object?> get props => [category, force];
|
|
}
|
|
|
|
/// Appends the next Activity page for [category].
|
|
class WalletActivityMoreRequested extends WalletEvent {
|
|
const WalletActivityMoreRequested({required this.category});
|
|
|
|
final String category;
|
|
|
|
@override
|
|
List<Object?> get props => [category];
|
|
}
|
|
|
|
/// Requests a deposit address for the given asset code (e.g. TRX, USDT).
|
|
class WalletDepositAddressRequested extends WalletEvent {
|
|
const WalletDepositAddressRequested({required this.walletTypeCode});
|
|
final String walletTypeCode;
|
|
}
|
|
|
|
/// Submits an on-chain withdrawal requiring 2FA.
|
|
class WalletWithdrawRequested extends WalletEvent {
|
|
const WalletWithdrawRequested({
|
|
required this.walletType,
|
|
required this.toAddress,
|
|
required this.amount,
|
|
this.totpCode,
|
|
this.idempotencyKey,
|
|
});
|
|
final String walletType;
|
|
final String toAddress;
|
|
final String amount;
|
|
final String? totpCode;
|
|
|
|
/// Same value for every retry of one submission (prevents duplicate withdrawals).
|
|
final String? idempotencyKey;
|
|
}
|
|
|
|
/// Transfers balance to another registered user by email.
|
|
class WalletTransferRequested extends WalletEvent {
|
|
const WalletTransferRequested({
|
|
required this.toEmail,
|
|
required this.walletType,
|
|
required this.amount,
|
|
this.totpCode,
|
|
});
|
|
final String toEmail;
|
|
final String walletType;
|
|
final String amount;
|
|
final String? totpCode;
|
|
}
|
|
|
|
/// Clears error / success feedback after the UI has shown it.
|
|
class WalletClearFeedback extends WalletEvent {
|
|
const WalletClearFeedback();
|
|
}
|