Merge pull request #473 from cypherstack/ui-fixes

UI fixes
This commit is contained in:
Diego Salazar 2023-04-11 13:29:20 -06:00 committed by GitHub
commit a12b9c07ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 467 additions and 396 deletions

45
lib/models/tx_info.dart Normal file
View file

@ -0,0 +1,45 @@
import 'package:stackwallet/models/isar/models/blockchain_data/utxo.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
// TODO use something like this instead of Map<String, dynamic> transactionObject
class TxInfo {
final String hex;
final List<TxRecipient> recipients;
final Amount fee;
final int vSize;
final List<UTXO>? usedUTXOs;
TxInfo({
required this.hex,
required this.recipients,
required this.fee,
required this.vSize,
required this.usedUTXOs,
});
TxInfo copyWith({
String? hex,
List<TxRecipient>? recipients,
Amount? fee,
int? vSize,
List<UTXO>? usedUTXOs,
}) =>
TxInfo(
hex: hex ?? this.hex,
fee: fee ?? this.fee,
vSize: vSize ?? this.vSize,
usedUTXOs: usedUTXOs ?? this.usedUTXOs,
recipients: recipients ?? this.recipients,
);
}
class TxRecipient {
final String address;
final Amount amount;
TxRecipient({
required this.address,
required this.amount,
});
}

View file

@ -265,11 +265,13 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
title: "Coins",
entities: filter(_searchTerm, coinEntities),
initialState: ExpandableState.expanded,
animationDurationMultiplier: 0.5,
),
ExpandingSubListItem(
title: "Tokens",
entities: filter(_searchTerm, tokenEntities),
initialState: ExpandableState.expanded,
animationDurationMultiplier: 0.5,
trailing: AddCustomTokenSelector(
addFunction: _addToken,
),

View file

@ -544,10 +544,8 @@ class _ConfirmTransactionViewState
(value) => value.coin,
),
);
final amount = Amount(
rawValue: BigInt.from(
transactionInfo["recipientAmt"] as int),
fractionDigits: coin.decimals);
final amount =
transactionInfo["recipientAmt"] as Amount;
final externalCalls = ref.watch(
prefsChangeNotifierProvider.select(
(value) => value.externalCalls));
@ -924,10 +922,7 @@ class _ConfirmTransactionViewState
localeServiceChangeNotifierProvider
.select((value) => value.locale),
);
final amount = Amount(
rawValue: BigInt.from(
transactionInfo["recipientAmt"] as int),
fractionDigits: coin.decimals);
final amount = transactionInfo["recipientAmt"] as Amount;
return Text(
"${(amount + fee).localizedStringAsFixed(
locale: locale,

View file

@ -12,6 +12,7 @@ import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/show_loading.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/icon_widgets/eth_token_icon.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -117,6 +118,11 @@ class _MyTokenSelectItemState extends ConsumerState<MyTokenSelectItem> {
widget.token.name,
style: isDesktop
? STextStyles.desktopTextExtraSmall(context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark,
)
: STextStyles.titleBold12(context),
),
const Spacer(),
@ -131,6 +137,11 @@ class _MyTokenSelectItemState extends ConsumerState<MyTokenSelectItem> {
"${widget.token.symbol}",
style: isDesktop
? STextStyles.desktopTextExtraSmall(context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark,
)
: STextStyles.itemSubtitle(context),
),
],

View file

@ -162,10 +162,10 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
@override
Widget build(BuildContext context) {
return Background(
child: ConditionalParent(
return ConditionalParent(
condition: !isDesktop,
builder: (child) => Scaffold(
builder: (child) => Background(
child: Scaffold(
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar(
@ -182,6 +182,7 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
),
),
),
),
child: Column(
children: [
ClipRRect(
@ -302,7 +303,6 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
),
],
),
),
);
}
}

View file

@ -35,11 +35,13 @@ class _DesktopWalletAddressesViewState
static const _headerHeight = 70.0;
static const _columnWidth0 = 489.0;
late final Stream<void> addressCollectionWatcher;
Stream<void>? addressCollectionWatcher;
void _onAddressCollectionWatcherEvent() {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
setState(() {});
}
});
}
@ -50,13 +52,14 @@ class _DesktopWalletAddressesViewState
.isar
.addresses
.watchLazy(fireImmediately: true);
addressCollectionWatcher.listen((_) => _onAddressCollectionWatcherEvent());
addressCollectionWatcher!.listen((_) => _onAddressCollectionWatcherEvent());
super.initState();
}
@override
void dispose() {
addressCollectionWatcher = null;
super.dispose();
}

View file

@ -8,11 +8,14 @@ import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'desktop_all_trades_view.dart';
class DesktopExchangeView extends ConsumerStatefulWidget {
const DesktopExchangeView({Key? key}) : super(key: key);
@ -106,27 +109,53 @@ class _DesktopExchangeViewState extends ConsumerState<DesktopExchangeView> {
right: 24,
bottom: 24,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
child: Column(
children: [
Row(
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
child: Text(
"Exchange details",
style: STextStyles.desktopTextExtraExtraSmall(context),
),
),
const SizedBox(
width: 16,
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Recent trades",
style:
STextStyles.desktopTextExtraExtraSmall(context),
),
CustomTextButton(
text: "See all",
onTap: () {
Navigator.of(context).pushNamed(
DesktopAllTradesView.routeName,
);
},
),
],
),
),
],
),
const SizedBox(
height: 16,
),
const RoundedWhiteContainer(
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Expanded(
child: RoundedWhiteContainer(
padding: EdgeInsets.all(24),
child: ExchangeForm(),
),
],
),
),
const SizedBox(
width: 16,
@ -143,6 +172,9 @@ class _DesktopExchangeViewState extends ConsumerState<DesktopExchangeView> {
],
),
),
],
),
),
),
);
}

View file

@ -5,7 +5,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar/isar.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart';
import 'package:stackwallet/pages/exchange_view/trade_details_view.dart';
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart';
import 'package:stackwallet/providers/exchange/trade_sent_from_stack_lookup_provider.dart';
import 'package:stackwallet/providers/global/trades_service_provider.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart';
@ -13,7 +12,6 @@ import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -65,35 +63,21 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Recent trades",
style: STextStyles.desktopTextExtraExtraSmall(context),
),
CustomTextButton(
text: "See all",
onTap: () {
Navigator.of(context)
.pushNamed(DesktopAllTradesView.routeName);
},
),
],
),
const SizedBox(
height: 16,
),
Expanded(
child: ListView.separated(
shrinkWrap: true,
primary: false,
itemBuilder: (context, index) {
BorderRadius? radius;
if (index == tradeCount - 1) {
radius = _borderRadiusLast;
} else if (index == 0) {
if (index == 0) {
radius = _borderRadiusFirst;
if (tradeCount == 1) {
radius = BorderRadius.circular(
Constants.size.checkboxBorderRadius,
);
}
} else if (index == tradeCount - 1) {
radius = _borderRadiusLast;
}
return Container(

View file

@ -37,10 +37,11 @@ class _WalletTableState extends ConsumerState<WalletSummaryTable> {
return ConditionalParent(
condition: index + 1 == providersByCoin.length,
builder: (child) => const Padding(
padding: EdgeInsets.only(
builder: (child) => Padding(
padding: const EdgeInsets.only(
bottom: 16,
),
child: child,
),
child: DesktopWalletSummaryRow(
key: Key("DesktopWalletSummaryRow_key_${coin.name}"),

View file

@ -21,6 +21,7 @@ import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/background.dart';
@ -104,7 +105,8 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
_shouldDisableAutoSyncOnLogOut = false;
}
if (ref.read(managerProvider).rescanOnOpenVersion == Constants.rescanV1) {
if (ref.read(managerProvider).coin != Coin.ethereum &&
ref.read(managerProvider).rescanOnOpenVersion == Constants.rescanV1) {
_rescanningOnOpen = true;
ref.read(managerProvider).fullRescan(20, 1000).then(
(_) => ref.read(managerProvider).resetRescanOnOpen().then(

View file

@ -2437,7 +2437,10 @@ class BitcoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": amount,
"recipientAmt": Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2566,7 +2569,10 @@ class BitcoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeBeingPaid,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2593,7 +2599,10 @@ class BitcoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2622,7 +2631,10 @@ class BitcoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2651,7 +2663,10 @@ class BitcoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),

View file

@ -2510,7 +2510,10 @@ class BitcoinCashWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": amount,
"recipientAmt": Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoObjectsToUse,
@ -2643,7 +2646,10 @@ class BitcoinCashWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeBeingPaid,
"vSize": txn["vSize"],
"usedUTXOs": utxoObjectsToUse,
@ -2671,7 +2677,10 @@ class BitcoinCashWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoObjectsToUse,
@ -2701,7 +2710,10 @@ class BitcoinCashWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoObjectsToUse,
@ -2731,7 +2743,10 @@ class BitcoinCashWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoObjectsToUse,

View file

@ -2192,7 +2192,10 @@ class DogecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": amount,
"recipientAmt": Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2321,7 +2324,10 @@ class DogecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeBeingPaid,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2348,7 +2354,10 @@ class DogecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2377,7 +2386,10 @@ class DogecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2406,7 +2418,10 @@ class DogecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),

View file

@ -478,8 +478,8 @@ class EpicCashWallet extends CoinServiceAPI
"selectionStrategyIsAll": selectionStrategyIsAll,
"minimumConfirmations": MINIMUM_CONFIRMATIONS,
"message": "",
"amount": txData['recipientAmt'],
"address": txData['addresss']
"amount": (txData['recipientAmt'] as Amount).raw.toInt(),
"address": (txData['addresss'] as Amount).raw.toInt(),
}, name: walletName);
message = await receivePort.first;
@ -496,8 +496,8 @@ class EpicCashWallet extends CoinServiceAPI
ReceivePort receivePort = await getIsolate({
"function": "createTransaction",
"wallet": wallet!,
"amount": txData['recipientAmt'],
"address": txData['addresss'],
"amount": (txData['recipientAmt'] as Amount).raw.toInt(),
"address": (txData['addresss'] as Amount).raw.toInt(),
"secretKeyIndex": 0,
"epicboxConfig": epicboxConfig.toString(),
"minimumConfirmations": MINIMUM_CONFIRMATIONS,
@ -872,7 +872,10 @@ class EpicCashWallet extends CoinServiceAPI
Map<String, dynamic> txData = {
"fee": realfee,
"addresss": address,
"recipientAmt": satAmount,
"recipientAmt": Amount(
rawValue: BigInt.from(satAmount),
fractionDigits: coin.decimals,
),
};
Logging.instance.log("prepare send: $txData", level: LogLevel.Info);
@ -913,7 +916,7 @@ class EpicCashWallet extends CoinServiceAPI
debugPrint(transactionFees);
dynamic decodeData;
final available = balance.spendable;
final available = balance.spendable.raw.toInt();
if (available == satoshiAmount) {
if (transactionFees!.contains("Required")) {

View file

@ -201,7 +201,7 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
Future<String> get currentReceivingAddress async {
final address = await _currentReceivingAddress;
return checksumEthereumAddress(
address?.value ?? _credentials.address.toString());
address?.value ?? _credentials.address.hexEip55);
}
Future<Address?> get _currentReceivingAddress => db
@ -362,7 +362,8 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
_credentials = web3.EthPrivateKey.fromHex(privateKey);
final address = Address(
walletId: walletId, value: _credentials.address.toString(),
walletId: walletId,
value: _credentials.address.hexEip55,
publicKey: [], // maybe store address bytes here? seems a waste of space though
derivationIndex: 0,
derivationPath: DerivationPath()..value = "$hdPathEthereum/0",
@ -566,7 +567,8 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
_credentials = web3.EthPrivateKey.fromHex(privateKey);
final address = Address(
walletId: walletId, value: _credentials.address.toString(),
walletId: walletId,
value: _credentials.address.hexEip55,
publicKey: [], // maybe store address bytes here? seems a waste of space though
derivationIndex: 0,
derivationPath: DerivationPath()..value = "$hdPathEthereum/0",
@ -909,7 +911,7 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
@override
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
final txid = txData["txid"] as String;
final addressString = txData["address"] as String;
final addressString = checksumEthereumAddress(txData["address"] as String);
final response = await EthereumAPI.getEthTransactionByHash(txid);
final transaction = Transaction(

View file

@ -704,6 +704,12 @@ Future<dynamic> isolateCreateJoinSplitTransaction(
final txId = extTx.getId();
Logging.instance.log("txid $txId", level: LogLevel.Info);
Logging.instance.log("txHex: $txHex", level: LogLevel.Info);
final amountAmount = Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
);
return {
"txid": txId,
"txHex": txHex,
@ -720,11 +726,8 @@ Future<dynamic> isolateCreateJoinSplitTransaction(
"height": locktime,
"txType": "Sent",
"confirmed_status": false,
"amount": Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
).decimal.toDouble(),
"recipientAmt": amount,
"amount": amountAmount.decimal.toDouble(),
"recipientAmt": amountAmount,
"address": address,
"timestamp": DateTime.now().millisecondsSinceEpoch ~/ 1000,
"subType": "join",
@ -914,16 +917,8 @@ class FiroWallet extends CoinServiceAPI
type: isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none,
// precision may be lost here hence the following amountString
amount: Amount(
rawValue: BigInt.from(txData["recipientAmt"] as int),
fractionDigits: coin.decimals)
.raw
.toInt(),
amountString: Amount(
rawValue: BigInt.from(txData["recipientAmt"] as int),
fractionDigits: coin.decimals)
.raw
.toString(),
amount: (txData["recipientAmt"] as Amount).raw.toInt(),
amountString: (txData["recipientAmt"] as Amount).toJsonString(),
fee: txData["fee"] as int,
height: null,
isCancelled: false,
@ -1422,7 +1417,10 @@ class FiroWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": amount,
"recipientAmt": Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
};
@ -1549,7 +1547,10 @@ class FiroWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeBeingPaid,
"vSize": txn["vSize"],
};
@ -1575,7 +1576,10 @@ class FiroWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
};
@ -1603,7 +1607,10 @@ class FiroWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
};
@ -1631,7 +1638,10 @@ class FiroWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
};

View file

@ -2387,7 +2387,10 @@ class LitecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": amount,
"recipientAmt": Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2502,7 +2505,10 @@ class LitecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeBeingPaid,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2529,7 +2535,10 @@ class LitecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2558,7 +2567,10 @@ class LitecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2587,7 +2599,10 @@ class LitecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),

View file

@ -2377,7 +2377,10 @@ class NamecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": amount,
"recipientAmt": Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2492,7 +2495,10 @@ class NamecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeBeingPaid,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2519,7 +2525,10 @@ class NamecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2548,7 +2557,10 @@ class NamecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2577,7 +2589,10 @@ class NamecoinWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),

View file

@ -2543,7 +2543,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": amount,
"recipientAmt": Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2658,7 +2661,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeBeingPaid,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2685,7 +2691,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2714,7 +2723,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2743,7 +2755,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = {
"hex": txn["hex"],
"recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0],
"recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput,
"vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),

View file

@ -167,7 +167,7 @@ class EthTokenWallet extends ChangeNotifier with EthTokenCache {
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
final txid = txData["txid"] as String;
final addressString = txData["address"] as String;
final addressString = checksumEthereumAddress(txData["address"] as String);
final response = await EthereumAPI.getEthTransactionByHash(txid);
final transaction = Transaction(

View file

@ -64,6 +64,7 @@ class _CustomTextButtonState extends State<_CustomTextButton>
@override
void dispose() {
controller?.dispose();
controller = null;
super.dispose();
}

View file

@ -22,7 +22,6 @@ class CustomTabView extends StatefulWidget {
}
class _CustomTabViewState extends State<CustomTabView> {
final _key = GlobalKey();
late int _selectedIndex;
static const duration = Duration(milliseconds: 250);
@ -80,17 +79,17 @@ class _CustomTabViewState extends State<CustomTabView> {
: CrossFadeState.showSecond,
duration: const Duration(milliseconds: 250),
),
],
),
),
),
),
),
],
),
const SizedBox(
height: 19,
),
],
),
),
),
),
),
],
),
Stack(
children: [
Container(
@ -117,7 +116,6 @@ class _CustomTabViewState extends State<CustomTabView> {
],
),
AnimatedSwitcher(
key: _key,
duration: duration,
transitionBuilder: (child, animation) {
return FadeTransition(
@ -135,7 +133,7 @@ class _CustomTabViewState extends State<CustomTabView> {
);
},
child: AnimatedAlign(
key: Key(widget.titles[_selectedIndex]),
key: Key("${widget.titles[_selectedIndex]}_customTabKey"),
alignment: Alignment.topCenter,
duration: duration,
child: Padding(

View file

@ -9,6 +9,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -27,7 +28,13 @@ void main() async {
expect(MINIMUM_CONFIRMATIONS, 1);
});
test("bitcoin dust limit", () async {
expect(DUST_LIMIT, 294);
expect(
DUST_LIMIT,
Amount(
rawValue: BigInt.from(294),
fractionDigits: 8,
),
);
});
test("bitcoin mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET,

View file

@ -10,6 +10,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -28,7 +29,13 @@ void main() async {
expect(MINIMUM_CONFIRMATIONS, 0);
});
test("bitcoincash dust limit", () async {
expect(DUST_LIMIT, 546);
expect(
DUST_LIMIT,
Amount(
rawValue: BigInt.from(546),
fractionDigits: 8,
),
);
});
test("bitcoincash mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET,
@ -520,37 +527,6 @@ void main() async {
verifyNoMoreInteractions(cachedClient);
verifyNoMoreInteractions(tracker);
});
test("get maxFee", () async {
when(client?.ping()).thenAnswer((_) async => true);
when(client?.getServerFeatures()).thenAnswer((_) async => {
"hosts": <dynamic, dynamic>{},
"pruning": null,
"server_version": "Unit tests",
"protocol_min": "1.4",
"protocol_max": "1.4.2",
"genesis_hash": GENESIS_HASH_TESTNET,
"hash_function": "sha256",
"services": <dynamic>[]
});
when(client?.estimateFee(blocks: 20))
.thenAnswer((realInvocation) async => Decimal.zero);
when(client?.estimateFee(blocks: 5))
.thenAnswer((realInvocation) async => Decimal.one);
when(client?.estimateFee(blocks: 1))
.thenAnswer((realInvocation) async => Decimal.ten);
final maxFee = await bch?.maxFee;
expect(maxFee, 1000000000);
verify(client?.estimateFee(blocks: 1)).called(1);
verify(client?.estimateFee(blocks: 5)).called(1);
verify(client?.estimateFee(blocks: 20)).called(1);
expect(secureStore.interactions, 0);
verifyNoMoreInteractions(client);
verifyNoMoreInteractions(cachedClient);
verifyNoMoreInteractions(tracker);
});
});
group("BCHWallet service class functions that depend on shared storage", () {

View file

@ -10,6 +10,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -28,7 +29,13 @@ void main() {
expect(MINIMUM_CONFIRMATIONS, 1);
});
test("dogecoin dust limit", () async {
expect(DUST_LIMIT, 1000000);
expect(
DUST_LIMIT,
Amount(
rawValue: BigInt.from(1000000),
fractionDigits: 8,
),
);
});
test("dogecoin mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET,
@ -366,37 +373,6 @@ void main() {
verifyNoMoreInteractions(cachedClient);
verifyNoMoreInteractions(tracker);
});
test("get maxFee", () async {
when(client?.ping()).thenAnswer((_) async => true);
when(client?.getServerFeatures()).thenAnswer((_) async => {
"hosts": <dynamic, dynamic>{},
"pruning": null,
"server_version": "Unit tests",
"protocol_min": "1.4",
"protocol_max": "1.4.2",
"genesis_hash": GENESIS_HASH_TESTNET,
"hash_function": "sha256",
"services": <dynamic>[]
});
when(client?.estimateFee(blocks: 20))
.thenAnswer((realInvocation) async => Decimal.zero);
when(client?.estimateFee(blocks: 5))
.thenAnswer((realInvocation) async => Decimal.one);
when(client?.estimateFee(blocks: 1))
.thenAnswer((realInvocation) async => Decimal.ten);
final maxFee = await doge?.maxFee;
expect(maxFee, 1000000000);
verify(client?.estimateFee(blocks: 1)).called(1);
verify(client?.estimateFee(blocks: 5)).called(1);
verify(client?.estimateFee(blocks: 20)).called(1);
expect(secureStore.interactions, 0);
verifyNoMoreInteractions(client);
verifyNoMoreInteractions(cachedClient);
verifyNoMoreInteractions(tracker);
});
});
group("DogeWallet service class functions that depend on shared storage", () {

View file

@ -83,24 +83,21 @@ void main() {
group("get balances", () {
test("balance", () async {
final CoinServiceAPI wallet = MockFiroWallet();
when(wallet.coin).thenAnswer((_) => Coin.firo);
when(wallet.balance).thenAnswer(
(_) => Balance(
coin: Coin.firo,
final balance = Balance(
total: _a(10),
spendable: _a(1),
blockedTotal: _a(0),
pendingSpendable: _a(9),
),
);
when(wallet.coin).thenAnswer((_) => Coin.firo);
when(wallet.balance).thenAnswer(
(_) => balance,
);
final manager = Manager(wallet);
expect(manager.balance.coin, Coin.firo);
expect(manager.balance.total.raw.toInt(), 10);
expect(manager.balance.spendable.raw.toInt(), 1);
expect(manager.balance.blockedTotal.raw.toInt(), 0);
expect(manager.balance.pendingSpendable.raw.toInt(), 9);
expect(manager.balance, balance);
});
});

View file

@ -9,6 +9,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -27,7 +28,13 @@ void main() {
expect(MINIMUM_CONFIRMATIONS, 2);
});
test("namecoin dust limit", () async {
expect(DUST_LIMIT, 546);
expect(
DUST_LIMIT,
Amount(
rawValue: BigInt.from(546),
fractionDigits: 8,
),
);
});
test("namecoin mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET,

View file

@ -9,6 +9,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/particl/particl_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -28,7 +29,13 @@ void main() {
1); // TODO confirm particl minimum confirmations
});
test("particl dust limit", () async {
expect(DUST_LIMIT, 294); // TODO confirm particl dust limit
expect(
DUST_LIMIT,
Amount(
rawValue: BigInt.from(294),
fractionDigits: 8,
),
); // TODO confirm particl dust limit
});
test("particl mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET,

View file

@ -53,7 +53,6 @@ void main() {
.thenAnswer((realInvocation) => manager);
when(manager.balance).thenAnswer(
(realInvocation) => Balance(
coin: Coin.bitcoin,
total: _a(10),
spendable: _a(10),
blockedTotal: _a(0),
@ -106,7 +105,6 @@ void main() {
.thenAnswer((realInvocation) => manager);
when(manager.balance).thenAnswer(
(realInvocation) => Balance(
coin: Coin.bitcoin,
total: _a(10),
spendable: _a(10),
blockedTotal: _a(0),
@ -177,7 +175,6 @@ void main() {
when(manager.isFavorite).thenAnswer((realInvocation) => true);
when(manager.balance).thenAnswer(
(realInvocation) => Balance(
coin: Coin.bitcoin,
total: _a(10),
spendable: _a(10),
blockedTotal: _a(0),

View file

@ -40,7 +40,6 @@ void main() {
when(wallet.walletId).thenAnswer((_) => "Wallet id 1");
when(wallet.balance).thenAnswer(
(_) => Balance(
coin: Coin.bitcoin,
total: Amount.zero,
spendable: Amount.zero,
blockedTotal: Amount.zero,

View file

@ -2,7 +2,6 @@ import 'package:decimal/decimal.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockingjay/mockingjay.dart' as mockingjay;
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart' as mockito;
import 'package:stackwallet/models/balance.dart';
@ -17,7 +16,6 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/theme/light_colors.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/wallet_card.dart';
import 'package:tuple/tuple.dart';
import 'wallet_card_test.mocks.dart';
@ -30,75 +28,6 @@ Amount _a(int i) => Amount.fromDecimal(
@GenerateMocks([Wallets, BitcoinWallet, LocaleService])
void main() {
testWidgets("Test button pressed", (widgetTester) async {
final CoinServiceAPI wallet = MockBitcoinWallet();
mockito.when(wallet.walletId).thenAnswer((realInvocation) => "wallet id");
mockito.when(wallet.coin).thenAnswer((realInvocation) => Coin.bitcoin);
mockito
.when(wallet.walletName)
.thenAnswer((realInvocation) => "wallet name");
mockito.when(wallet.balance).thenAnswer(
(_) => Balance(
coin: Coin.bitcoin,
total: _a(0),
spendable: _a(0),
blockedTotal: _a(0),
pendingSpendable: _a(0),
),
);
final wallets = MockWallets();
final locale = MockLocaleService();
final manager = Manager(wallet);
final managerProvider = ChangeNotifierProvider((ref) => manager);
mockito
.when(wallets.getManagerProvider("wallet id"))
.thenAnswer((realInvocation) => managerProvider);
mockito.when(locale.locale).thenAnswer((_) => "en_US");
mockito
.when(wallets.getManagerProvider("wallet id"))
.thenAnswer((realInvocation) => managerProvider);
mockito
.when(wallets.getManager("wallet id"))
.thenAnswer((realInvocation) => manager);
final navigator = mockingjay.MockNavigator();
mockingjay
.when(() => navigator.pushNamed("/wallet",
arguments: Tuple2("wallet id", managerProvider)))
.thenAnswer((_) async => {});
await widgetTester.pumpWidget(
ProviderScope(
overrides: [
walletsChangeNotifierProvider.overrideWithValue(wallets),
localeServiceChangeNotifierProvider.overrideWithValue(locale),
],
child: MaterialApp(
theme: ThemeData(
extensions: [
StackColors.fromStackColorTheme(LightColors()),
],
),
home: mockingjay.MockNavigatorProvider(
navigator: navigator,
child: const SimpleWalletCard(
walletId: "wallet id",
)),
),
),
);
await widgetTester.pumpAndSettle();
expect(find.byType(MaterialButton), findsOneWidget);
await widgetTester.tap(find.byType(MaterialButton));
await widgetTester.pumpAndSettle();
});
testWidgets('test widget loads correctly', (widgetTester) async {
final CoinServiceAPI wallet = MockBitcoinWallet();
mockito.when(wallet.walletId).thenAnswer((realInvocation) => "wallet id");
@ -108,7 +37,6 @@ void main() {
.thenAnswer((realInvocation) => "wallet name");
mockito.when(wallet.balance).thenAnswer(
(_) => Balance(
coin: Coin.bitcoin,
total: _a(0),
spendable: _a(0),
blockedTotal: _a(0),

View file

@ -39,7 +39,6 @@ void main() {
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
when(wallet.balance).thenAnswer(
(_) => Balance(
coin: Coin.bitcoin,
total: Amount.zero,
spendable: Amount.zero,
blockedTotal: Amount.zero,

View file

@ -39,7 +39,6 @@ void main() {
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
when(wallet.balance).thenAnswer(
(_) => Balance(
coin: Coin.bitcoin,
total: Amount.zero,
spendable: Amount.zero,
blockedTotal: Amount.zero,