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", title: "Coins",
entities: filter(_searchTerm, coinEntities), entities: filter(_searchTerm, coinEntities),
initialState: ExpandableState.expanded, initialState: ExpandableState.expanded,
animationDurationMultiplier: 0.5,
), ),
ExpandingSubListItem( ExpandingSubListItem(
title: "Tokens", title: "Tokens",
entities: filter(_searchTerm, tokenEntities), entities: filter(_searchTerm, tokenEntities),
initialState: ExpandableState.expanded, initialState: ExpandableState.expanded,
animationDurationMultiplier: 0.5,
trailing: AddCustomTokenSelector( trailing: AddCustomTokenSelector(
addFunction: _addToken, addFunction: _addToken,
), ),

View file

@ -544,10 +544,8 @@ class _ConfirmTransactionViewState
(value) => value.coin, (value) => value.coin,
), ),
); );
final amount = Amount( final amount =
rawValue: BigInt.from( transactionInfo["recipientAmt"] as Amount;
transactionInfo["recipientAmt"] as int),
fractionDigits: coin.decimals);
final externalCalls = ref.watch( final externalCalls = ref.watch(
prefsChangeNotifierProvider.select( prefsChangeNotifierProvider.select(
(value) => value.externalCalls)); (value) => value.externalCalls));
@ -924,10 +922,7 @@ class _ConfirmTransactionViewState
localeServiceChangeNotifierProvider localeServiceChangeNotifierProvider
.select((value) => value.locale), .select((value) => value.locale),
); );
final amount = Amount( final amount = transactionInfo["recipientAmt"] as Amount;
rawValue: BigInt.from(
transactionInfo["recipientAmt"] as int),
fractionDigits: coin.decimals);
return Text( return Text(
"${(amount + fee).localizedStringAsFixed( "${(amount + fee).localizedStringAsFixed(
locale: locale, 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/constants.dart';
import 'package:stackwallet/utilities/show_loading.dart'; import 'package:stackwallet/utilities/show_loading.dart';
import 'package:stackwallet/utilities/text_styles.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/utilities/util.dart';
import 'package:stackwallet/widgets/icon_widgets/eth_token_icon.dart'; import 'package:stackwallet/widgets/icon_widgets/eth_token_icon.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -117,6 +118,11 @@ class _MyTokenSelectItemState extends ConsumerState<MyTokenSelectItem> {
widget.token.name, widget.token.name,
style: isDesktop style: isDesktop
? STextStyles.desktopTextExtraSmall(context) ? STextStyles.desktopTextExtraSmall(context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark,
)
: STextStyles.titleBold12(context), : STextStyles.titleBold12(context),
), ),
const Spacer(), const Spacer(),
@ -131,6 +137,11 @@ class _MyTokenSelectItemState extends ConsumerState<MyTokenSelectItem> {
"${widget.token.symbol}", "${widget.token.symbol}",
style: isDesktop style: isDesktop
? STextStyles.desktopTextExtraSmall(context) ? STextStyles.desktopTextExtraSmall(context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark,
)
: STextStyles.itemSubtitle(context), : STextStyles.itemSubtitle(context),
), ),
], ],

View file

@ -162,10 +162,10 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Background( return ConditionalParent(
child: ConditionalParent( condition: !isDesktop,
condition: !isDesktop, builder: (child) => Background(
builder: (child) => Scaffold( child: Scaffold(
backgroundColor: backgroundColor:
Theme.of(context).extension<StackColors>()!.background, Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar( appBar: AppBar(
@ -182,126 +182,126 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
), ),
), ),
), ),
child: Column( ),
children: [ child: Column(
ClipRRect( children: [
borderRadius: BorderRadius.circular( ClipRRect(
Constants.size.circularBorderRadius, borderRadius: BorderRadius.circular(
), Constants.size.circularBorderRadius,
child: TextField( ),
autocorrect: !isDesktop, child: TextField(
enableSuggestions: !isDesktop, autocorrect: !isDesktop,
controller: _searchController, enableSuggestions: !isDesktop,
focusNode: searchFieldFocusNode, controller: _searchController,
onChanged: (value) { focusNode: searchFieldFocusNode,
setState(() { onChanged: (value) {
_searchString = value; setState(() {
}); _searchString = value;
}, });
style: isDesktop },
? STextStyles.desktopTextExtraSmall(context).copyWith( style: isDesktop
color: Theme.of(context) ? STextStyles.desktopTextExtraSmall(context).copyWith(
.extension<StackColors>()! color: Theme.of(context)
.textFieldActiveText, .extension<StackColors>()!
height: 1.8, .textFieldActiveText,
) height: 1.8,
: STextStyles.field(context), )
decoration: standardInputDecoration( : STextStyles.field(context),
"Search...", decoration: standardInputDecoration(
searchFieldFocusNode, "Search...",
context, searchFieldFocusNode,
desktopMed: isDesktop, context,
).copyWith( desktopMed: isDesktop,
prefixIcon: Padding( ).copyWith(
padding: EdgeInsets.symmetric( prefixIcon: Padding(
horizontal: isDesktop ? 12 : 10, padding: EdgeInsets.symmetric(
vertical: isDesktop ? 18 : 16, horizontal: isDesktop ? 12 : 10,
), vertical: isDesktop ? 18 : 16,
child: SvgPicture.asset( ),
Assets.svg.search, child: SvgPicture.asset(
width: isDesktop ? 20 : 16, Assets.svg.search,
height: isDesktop ? 20 : 16, width: isDesktop ? 20 : 16,
), height: isDesktop ? 20 : 16,
), ),
suffixIcon: _searchController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_searchController.text = "";
_searchString = "";
});
},
),
],
),
),
)
: null,
), ),
suffixIcon: _searchController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_searchController.text = "";
_searchString = "";
});
},
),
],
),
),
)
: null,
), ),
), ),
const SizedBox( ),
height: 16, const SizedBox(
), height: 16,
Expanded( ),
child: Builder( Expanded(
builder: (context) { child: Builder(
final data = _filter(_searchString); builder: (context) {
return ListView.separated( final data = _filter(_searchString);
itemBuilder: (_, index) { return ListView.separated(
final element = data[index]; itemBuilder: (_, index) {
final element = data[index];
if (element.item1.hasTokenSupport) { if (element.item1.hasTokenSupport) {
if (isDesktop) { if (isDesktop) {
return DesktopExpandingWalletCard( return DesktopExpandingWalletCard(
key: Key( key: Key(
"${element.item1.walletName}_${element.item2.map((e) => e.address).join()}"), "${element.item1.walletName}_${element.item2.map((e) => e.address).join()}"),
data: element, data: element,
navigatorState: widget.navigatorState!, navigatorState: widget.navigatorState!,
); );
} else {
return MasterWalletCard(
walletId: element.item1.walletId,
);
}
} else { } else {
return ConditionalParent( return MasterWalletCard(
condition: isDesktop, walletId: element.item1.walletId,
builder: (child) => RoundedWhiteContainer(
padding: const EdgeInsets.symmetric(
vertical: 14,
horizontal: 20,
),
borderColor: Theme.of(context)
.extension<StackColors>()!
.backgroundAppBar,
child: child,
),
child: SimpleWalletCard(
walletId: element.item1.walletId,
popPrevious: isDesktop,
desktopNavigatorState:
isDesktop ? widget.navigatorState : null,
),
); );
} }
}, } else {
separatorBuilder: (_, __) => SizedBox( return ConditionalParent(
height: isDesktop ? 10 : 8, condition: isDesktop,
), builder: (child) => RoundedWhiteContainer(
itemCount: data.length, padding: const EdgeInsets.symmetric(
); vertical: 14,
}, horizontal: 20,
), ),
borderColor: Theme.of(context)
.extension<StackColors>()!
.backgroundAppBar,
child: child,
),
child: SimpleWalletCard(
walletId: element.item1.walletId,
popPrevious: isDesktop,
desktopNavigatorState:
isDesktop ? widget.navigatorState : null,
),
);
}
},
separatorBuilder: (_, __) => SizedBox(
height: isDesktop ? 10 : 8,
),
itemCount: data.length,
);
},
), ),
], ),
), ],
), ),
); );
} }

View file

@ -35,11 +35,13 @@ class _DesktopWalletAddressesViewState
static const _headerHeight = 70.0; static const _headerHeight = 70.0;
static const _columnWidth0 = 489.0; static const _columnWidth0 = 489.0;
late final Stream<void> addressCollectionWatcher; Stream<void>? addressCollectionWatcher;
void _onAddressCollectionWatcherEvent() { void _onAddressCollectionWatcherEvent() {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {}); if (mounted) {
setState(() {});
}
}); });
} }
@ -50,13 +52,14 @@ class _DesktopWalletAddressesViewState
.isar .isar
.addresses .addresses
.watchLazy(fireImmediately: true); .watchLazy(fireImmediately: true);
addressCollectionWatcher.listen((_) => _onAddressCollectionWatcherEvent()); addressCollectionWatcher!.listen((_) => _onAddressCollectionWatcherEvent());
super.initState(); super.initState();
} }
@override @override
void dispose() { void dispose() {
addressCollectionWatcher = null;
super.dispose(); 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/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/conditional_parent.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/custom_loading_overlay.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart'; import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart'; import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'desktop_all_trades_view.dart';
class DesktopExchangeView extends ConsumerStatefulWidget { class DesktopExchangeView extends ConsumerStatefulWidget {
const DesktopExchangeView({Key? key}) : super(key: key); const DesktopExchangeView({Key? key}) : super(key: key);
@ -106,36 +109,65 @@ class _DesktopExchangeViewState extends ConsumerState<DesktopExchangeView> {
right: 24, right: 24,
bottom: 24, bottom: 24,
), ),
child: Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Row(
child: Column( children: [
mainAxisSize: MainAxisSize.min, Expanded(
crossAxisAlignment: CrossAxisAlignment.start, child: Text(
children: [
Text(
"Exchange details", "Exchange details",
style: STextStyles.desktopTextExtraExtraSmall(context), style: STextStyles.desktopTextExtraExtraSmall(context),
), ),
const SizedBox( ),
height: 16, 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 RoundedWhiteContainer( ),
padding: EdgeInsets.all(24), ],
child: ExchangeForm(),
),
],
),
), ),
const SizedBox( const SizedBox(
width: 16, height: 16,
), ),
Expanded( Expanded(
child: Row( child: Row(
children: const [ crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Expanded(
child: RoundedWhiteContainer(
padding: EdgeInsets.all(24),
child: ExchangeForm(),
),
),
const SizedBox(
width: 16,
),
Expanded( Expanded(
child: DesktopTradeHistory(), child: Row(
children: const [
Expanded(
child: DesktopTradeHistory(),
),
],
),
), ),
], ],
), ),

View file

@ -5,7 +5,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.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/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/exchange/trade_sent_from_stack_lookup_provider.dart';
import 'package:stackwallet/providers/global/trades_service_provider.dart'; import 'package:stackwallet/providers/global/trades_service_provider.dart';
import 'package:stackwallet/providers/global/wallets_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/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.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.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart'; import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -65,35 +63,21 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ 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( Expanded(
child: ListView.separated( child: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
primary: false, primary: false,
itemBuilder: (context, index) { itemBuilder: (context, index) {
BorderRadius? radius; BorderRadius? radius;
if (index == tradeCount - 1) { if (index == 0) {
radius = _borderRadiusLast;
} else if (index == 0) {
radius = _borderRadiusFirst; radius = _borderRadiusFirst;
if (tradeCount == 1) {
radius = BorderRadius.circular(
Constants.size.checkboxBorderRadius,
);
}
} else if (index == tradeCount - 1) {
radius = _borderRadiusLast;
} }
return Container( return Container(

View file

@ -37,10 +37,11 @@ class _WalletTableState extends ConsumerState<WalletSummaryTable> {
return ConditionalParent( return ConditionalParent(
condition: index + 1 == providersByCoin.length, condition: index + 1 == providersByCoin.length,
builder: (child) => const Padding( builder: (child) => Padding(
padding: EdgeInsets.only( padding: const EdgeInsets.only(
bottom: 16, bottom: 16,
), ),
child: child,
), ),
child: DesktopWalletSummaryRow( child: DesktopWalletSummaryRow(
key: Key("DesktopWalletSummaryRow_key_${coin.name}"), 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/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/backup_frequency_type.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/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
@ -104,7 +105,8 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
_shouldDisableAutoSyncOnLogOut = false; _shouldDisableAutoSyncOnLogOut = false;
} }
if (ref.read(managerProvider).rescanOnOpenVersion == Constants.rescanV1) { if (ref.read(managerProvider).coin != Coin.ethereum &&
ref.read(managerProvider).rescanOnOpenVersion == Constants.rescanV1) {
_rescanningOnOpen = true; _rescanningOnOpen = true;
ref.read(managerProvider).fullRescan(20, 1000).then( ref.read(managerProvider).fullRescan(20, 1000).then(
(_) => ref.read(managerProvider).resetRescanOnOpen().then( (_) => ref.read(managerProvider).resetRescanOnOpen().then(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2543,7 +2543,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = { Map<String, dynamic> transactionObject = {
"hex": txn["hex"], "hex": txn["hex"],
"recipient": recipientsArray[0], "recipient": recipientsArray[0],
"recipientAmt": amount, "recipientAmt": Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput, "fee": feeForOneOutput,
"vSize": txn["vSize"], "vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2658,7 +2661,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = { Map<String, dynamic> transactionObject = {
"hex": txn["hex"], "hex": txn["hex"],
"recipient": recipientsArray[0], "recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0], "recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeBeingPaid, "fee": feeBeingPaid,
"vSize": txn["vSize"], "vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2685,7 +2691,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = { Map<String, dynamic> transactionObject = {
"hex": txn["hex"], "hex": txn["hex"],
"recipient": recipientsArray[0], "recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0], "recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend, "fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"], "vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2714,7 +2723,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = { Map<String, dynamic> transactionObject = {
"hex": txn["hex"], "hex": txn["hex"],
"recipient": recipientsArray[0], "recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0], "recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": satoshisBeingUsed - satoshiAmountToSend, "fee": satoshisBeingUsed - satoshiAmountToSend,
"vSize": txn["vSize"], "vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -2743,7 +2755,10 @@ class ParticlWallet extends CoinServiceAPI
Map<String, dynamic> transactionObject = { Map<String, dynamic> transactionObject = {
"hex": txn["hex"], "hex": txn["hex"],
"recipient": recipientsArray[0], "recipient": recipientsArray[0],
"recipientAmt": recipientsAmtArray[0], "recipientAmt": Amount(
rawValue: BigInt.from(recipientsAmtArray[0]),
fractionDigits: coin.decimals,
),
"fee": feeForOneOutput, "fee": feeForOneOutput,
"vSize": txn["vSize"], "vSize": txn["vSize"],
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), "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 { Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
final txid = txData["txid"] as String; 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 response = await EthereumAPI.getEthTransactionByHash(txid);
final transaction = Transaction( final transaction = Transaction(

View file

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

View file

@ -22,7 +22,6 @@ class CustomTabView extends StatefulWidget {
} }
class _CustomTabViewState extends State<CustomTabView> { class _CustomTabViewState extends State<CustomTabView> {
final _key = GlobalKey();
late int _selectedIndex; late int _selectedIndex;
static const duration = Duration(milliseconds: 250); static const duration = Duration(milliseconds: 250);
@ -80,6 +79,9 @@ class _CustomTabViewState extends State<CustomTabView> {
: CrossFadeState.showSecond, : CrossFadeState.showSecond,
duration: const Duration(milliseconds: 250), duration: const Duration(milliseconds: 250),
), ),
const SizedBox(
height: 19,
),
], ],
), ),
), ),
@ -88,9 +90,6 @@ class _CustomTabViewState extends State<CustomTabView> {
), ),
], ],
), ),
const SizedBox(
height: 19,
),
Stack( Stack(
children: [ children: [
Container( Container(
@ -117,7 +116,6 @@ class _CustomTabViewState extends State<CustomTabView> {
], ],
), ),
AnimatedSwitcher( AnimatedSwitcher(
key: _key,
duration: duration, duration: duration,
transitionBuilder: (child, animation) { transitionBuilder: (child, animation) {
return FadeTransition( return FadeTransition(
@ -135,7 +133,7 @@ class _CustomTabViewState extends State<CustomTabView> {
); );
}, },
child: AnimatedAlign( child: AnimatedAlign(
key: Key(widget.titles[_selectedIndex]), key: Key("${widget.titles[_selectedIndex]}_customTabKey"),
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
duration: duration, duration: duration,
child: Padding( 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/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart'; import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -27,7 +28,13 @@ void main() async {
expect(MINIMUM_CONFIRMATIONS, 1); expect(MINIMUM_CONFIRMATIONS, 1);
}); });
test("bitcoin dust limit", () async { 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 { test("bitcoin mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET, 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/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart'; import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -28,7 +29,13 @@ void main() async {
expect(MINIMUM_CONFIRMATIONS, 0); expect(MINIMUM_CONFIRMATIONS, 0);
}); });
test("bitcoincash dust limit", () async { 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 { test("bitcoincash mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET, expect(GENESIS_HASH_MAINNET,
@ -520,37 +527,6 @@ void main() async {
verifyNoMoreInteractions(cachedClient); verifyNoMoreInteractions(cachedClient);
verifyNoMoreInteractions(tracker); 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", () { 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/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart'; import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -28,7 +29,13 @@ void main() {
expect(MINIMUM_CONFIRMATIONS, 1); expect(MINIMUM_CONFIRMATIONS, 1);
}); });
test("dogecoin dust limit", () async { 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 { test("dogecoin mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET, expect(GENESIS_HASH_MAINNET,
@ -366,37 +373,6 @@ void main() {
verifyNoMoreInteractions(cachedClient); verifyNoMoreInteractions(cachedClient);
verifyNoMoreInteractions(tracker); 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", () { group("DogeWallet service class functions that depend on shared storage", () {

View file

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

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/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'; import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -27,7 +28,13 @@ void main() {
expect(MINIMUM_CONFIRMATIONS, 2); expect(MINIMUM_CONFIRMATIONS, 2);
}); });
test("namecoin dust limit", () async { 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 { test("namecoin mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET, 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/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/particl/particl_wallet.dart'; import 'package:stackwallet/services/coins/particl/particl_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
@ -28,7 +29,13 @@ void main() {
1); // TODO confirm particl minimum confirmations 1); // TODO confirm particl minimum confirmations
}); });
test("particl dust limit", () async { 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 { test("particl mainnet genesis block hash", () async {
expect(GENESIS_HASH_MAINNET, expect(GENESIS_HASH_MAINNET,

View file

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

View file

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

View file

@ -2,7 +2,6 @@ import 'package:decimal/decimal.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:mockingjay/mockingjay.dart' as mockingjay;
import 'package:mockito/annotations.dart'; import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart' as mockito; import 'package:mockito/mockito.dart' as mockito;
import 'package:stackwallet/models/balance.dart'; 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/light_colors.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/wallet_card.dart'; import 'package:stackwallet/widgets/wallet_card.dart';
import 'package:tuple/tuple.dart';
import 'wallet_card_test.mocks.dart'; import 'wallet_card_test.mocks.dart';
@ -30,75 +28,6 @@ Amount _a(int i) => Amount.fromDecimal(
@GenerateMocks([Wallets, BitcoinWallet, LocaleService]) @GenerateMocks([Wallets, BitcoinWallet, LocaleService])
void main() { 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 { testWidgets('test widget loads correctly', (widgetTester) async {
final CoinServiceAPI wallet = MockBitcoinWallet(); final CoinServiceAPI wallet = MockBitcoinWallet();
mockito.when(wallet.walletId).thenAnswer((realInvocation) => "wallet id"); mockito.when(wallet.walletId).thenAnswer((realInvocation) => "wallet id");
@ -108,7 +37,6 @@ void main() {
.thenAnswer((realInvocation) => "wallet name"); .thenAnswer((realInvocation) => "wallet name");
mockito.when(wallet.balance).thenAnswer( mockito.when(wallet.balance).thenAnswer(
(_) => Balance( (_) => Balance(
coin: Coin.bitcoin,
total: _a(0), total: _a(0),
spendable: _a(0), spendable: _a(0),
blockedTotal: _a(0), blockedTotal: _a(0),

View file

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

View file

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