mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
commit
54186520f2
10 changed files with 107 additions and 50 deletions
|
@ -338,6 +338,7 @@ class _ExchangeCurrencySelectionViewState
|
||||||
coin.ticker.toLowerCase() == e.ticker.toLowerCase())
|
coin.ticker.toLowerCase() == e.ticker.toLowerCase())
|
||||||
.isNotEmpty)
|
.isNotEmpty)
|
||||||
.toList(growable: false);
|
.toList(growable: false);
|
||||||
|
items.sort((a, b) => a.name.compareTo(b.name));
|
||||||
|
|
||||||
return RoundedWhiteContainer(
|
return RoundedWhiteContainer(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
|
@ -427,6 +428,7 @@ class _ExchangeCurrencySelectionViewState
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Builder(builder: (context) {
|
child: Builder(builder: (context) {
|
||||||
final filtered = filter(_searchString);
|
final filtered = filter(_searchString);
|
||||||
|
filtered.sort((a, b) => a.name.compareTo(b.name));
|
||||||
return RoundedWhiteContainer(
|
return RoundedWhiteContainer(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
|
|
|
@ -3,8 +3,11 @@ import 'dart:math';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:lottie/lottie.dart';
|
import 'package:lottie/lottie.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/color_theme.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';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
|
import 'package:stackwallet/widgets/rounded_container.dart';
|
||||||
|
|
||||||
class LoadingView extends StatelessWidget {
|
class LoadingView extends StatelessWidget {
|
||||||
const LoadingView({Key? key}) : super(key: key);
|
const LoadingView({Key? key}) : super(key: key);
|
||||||
|
@ -12,18 +15,31 @@ class LoadingView extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final size = MediaQuery.of(context).size;
|
final size = MediaQuery.of(context).size;
|
||||||
|
final width = min(size.width, size.height) * 0.5;
|
||||||
return Background(
|
return Background(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
||||||
body: Container(
|
body: Container(
|
||||||
color: Theme.of(context).extension<StackColors>()!.background,
|
color: Theme.of(context).extension<StackColors>()!.background,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: SizedBox(
|
child: ConditionalParent(
|
||||||
width: min(size.width, size.height) * 0.5,
|
condition:
|
||||||
child: Lottie.asset(
|
Theme.of(context).extension<StackColors>()!.themeType ==
|
||||||
Assets.lottie.test2,
|
ThemeType.oledBlack,
|
||||||
animate: true,
|
builder: (child) => RoundedContainer(
|
||||||
repeat: true,
|
color: const Color(0xFFDEDEDE),
|
||||||
|
radiusMultiplier: 100,
|
||||||
|
width: width * 1.35,
|
||||||
|
height: width * 1.35,
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
width: width,
|
||||||
|
child: Lottie.asset(
|
||||||
|
Assets.lottie.test2,
|
||||||
|
animate: true,
|
||||||
|
repeat: true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// child: Image(
|
// child: Image(
|
||||||
|
|
|
@ -125,14 +125,16 @@ class BitcoinWallet extends CoinServiceAPI
|
||||||
getMnemonicString: () => mnemonicString,
|
getMnemonicString: () => mnemonicString,
|
||||||
getMnemonicPassphrase: () => mnemonicPassphrase,
|
getMnemonicPassphrase: () => mnemonicPassphrase,
|
||||||
getChainHeight: () => chainHeight,
|
getChainHeight: () => chainHeight,
|
||||||
getCurrentChangeAddress: () => currentChangeAddressP2PKH,
|
// getCurrentChangeAddress: () => currentChangeAddressP2PKH,
|
||||||
|
getCurrentChangeAddress: () => currentChangeAddress,
|
||||||
estimateTxFee: estimateTxFee,
|
estimateTxFee: estimateTxFee,
|
||||||
prepareSend: prepareSend,
|
prepareSend: prepareSend,
|
||||||
getTxCount: getTxCount,
|
getTxCount: getTxCount,
|
||||||
fetchBuildTxData: fetchBuildTxData,
|
fetchBuildTxData: fetchBuildTxData,
|
||||||
refresh: refresh,
|
refresh: refresh,
|
||||||
checkChangeAddressForTransactions:
|
checkChangeAddressForTransactions: _checkChangeAddressForTransactions,
|
||||||
_checkP2PKHChangeAddressForTransactions,
|
// checkChangeAddressForTransactions:
|
||||||
|
// _checkP2PKHChangeAddressForTransactions,
|
||||||
addDerivation: addDerivation,
|
addDerivation: addDerivation,
|
||||||
dustLimitP2PKH: DUST_LIMIT_P2PKH,
|
dustLimitP2PKH: DUST_LIMIT_P2PKH,
|
||||||
minConfirms: MINIMUM_CONFIRMATIONS,
|
minConfirms: MINIMUM_CONFIRMATIONS,
|
||||||
|
@ -1016,6 +1018,7 @@ class BitcoinWallet extends CoinServiceAPI
|
||||||
if (currentHeight != storedHeight) {
|
if (currentHeight != storedHeight) {
|
||||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.2, walletId));
|
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.2, walletId));
|
||||||
await _checkChangeAddressForTransactions();
|
await _checkChangeAddressForTransactions();
|
||||||
|
await _checkP2PKHChangeAddressForTransactions();
|
||||||
|
|
||||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.3, walletId));
|
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.3, walletId));
|
||||||
await _checkCurrentReceivingAddressesForTransactions();
|
await _checkCurrentReceivingAddressesForTransactions();
|
||||||
|
|
|
@ -22,8 +22,14 @@ class MajesticBankExchange extends Exchange {
|
||||||
static const exchangeName = "Majestic Bank";
|
static const exchangeName = "Majestic Bank";
|
||||||
|
|
||||||
static const kMajesticBankCurrencyNames = {
|
static const kMajesticBankCurrencyNames = {
|
||||||
|
"BCH": "Bitcoin Cash",
|
||||||
"BTC": "Bitcoin",
|
"BTC": "Bitcoin",
|
||||||
|
"DOGE": "Dogecoin",
|
||||||
|
"EPIC": "Epic Cash",
|
||||||
|
"FIRO": "Firo",
|
||||||
"LTC": "Litecoin",
|
"LTC": "Litecoin",
|
||||||
|
"NMC": "Namecoin",
|
||||||
|
"PART": "Particl",
|
||||||
"WOW": "Wownero",
|
"WOW": "Wownero",
|
||||||
"XMR": "Monero",
|
"XMR": "Monero",
|
||||||
};
|
};
|
||||||
|
|
|
@ -283,7 +283,7 @@ class OledBlackColors extends StackColorTheme {
|
||||||
@override
|
@override
|
||||||
Color get infoItemText => const Color(0xFFDEDEDE);
|
Color get infoItemText => const Color(0xFFDEDEDE);
|
||||||
@override
|
@override
|
||||||
Color get infoItemIcons => const Color(0xFF5C94F4);
|
Color get infoItemIcons => const Color(0xFFF26822); //const Color(0xFF5C94F4);
|
||||||
|
|
||||||
// popup
|
// popup
|
||||||
@override
|
@override
|
||||||
|
@ -321,7 +321,8 @@ class OledBlackColors extends StackColorTheme {
|
||||||
@override
|
@override
|
||||||
Color get myStackContactIconBG => const Color(0xFF747778);
|
Color get myStackContactIconBG => const Color(0xFF747778);
|
||||||
@override
|
@override
|
||||||
Color get textConfirmTotalAmount => const Color(0xFF144D35);
|
Color get textConfirmTotalAmount =>
|
||||||
|
textFieldSuccessLabel; //const Color(0xFF144D35);
|
||||||
@override
|
@override
|
||||||
Color get textSelectedWordTableItem => const Color(0xFF143D8E);
|
Color get textSelectedWordTableItem => const Color(0xFF143D8E);
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,13 @@ 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:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
|
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
|
||||||
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/format.dart';
|
import 'package:stackwallet/utilities/format.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/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/animated_text.dart';
|
|
||||||
|
|
||||||
class WalletInfoRowBalanceFuture extends ConsumerWidget {
|
class WalletInfoRowBalanceFuture extends ConsumerWidget {
|
||||||
const WalletInfoRowBalanceFuture({Key? key, required this.walletId})
|
const WalletInfoRowBalanceFuture({Key? key, required this.walletId})
|
||||||
|
@ -27,44 +28,23 @@ class WalletInfoRowBalanceFuture extends ConsumerWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO redo this widget now that its not actually a future
|
Decimal balance = manager.balance.getTotal();
|
||||||
return FutureBuilder(
|
|
||||||
future: Future(() => manager.balance.getTotal()),
|
if (manager.coin == Coin.firo || manager.coin == Coin.firoTestNet) {
|
||||||
builder: (builderContext, AsyncSnapshot<Decimal> snapshot) {
|
balance += (manager.wallet as FiroWallet).balancePrivate.getTotal();
|
||||||
if (snapshot.connectionState == ConnectionState.done &&
|
}
|
||||||
snapshot.hasData) {
|
|
||||||
return Text(
|
return Text(
|
||||||
"${Format.localizedStringAsFixed(
|
"${Format.localizedStringAsFixed(
|
||||||
value: snapshot.data!,
|
value: balance,
|
||||||
locale: locale,
|
locale: locale,
|
||||||
decimalPlaces: 8,
|
decimalPlaces: Constants.decimalPlacesForCoin(manager.coin),
|
||||||
)} ${manager.coin.ticker}",
|
)} ${manager.coin.ticker}",
|
||||||
style: Util.isDesktop
|
style: Util.isDesktop
|
||||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<StackColors>()!.textSubtitle1,
|
||||||
.extension<StackColors>()!
|
)
|
||||||
.textSubtitle1,
|
: STextStyles.itemSubtitle(context),
|
||||||
)
|
|
||||||
: STextStyles.itemSubtitle(context),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return AnimatedText(
|
|
||||||
stringsToLoopThrough: const [
|
|
||||||
"Loading balance",
|
|
||||||
"Loading balance.",
|
|
||||||
"Loading balance..",
|
|
||||||
"Loading balance..."
|
|
||||||
],
|
|
||||||
style: Util.isDesktop
|
|
||||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textSubtitle1,
|
|
||||||
)
|
|
||||||
: STextStyles.itemSubtitle(context),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:mockito/annotations.dart';
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
import 'package:stackwallet/models/balance.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/my_stack_view/coin_wallets_table.dart';
|
import 'package:stackwallet/pages_desktop_specific/my_stack_view/coin_wallets_table.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||||
|
@ -34,6 +35,15 @@ void main() {
|
||||||
|
|
||||||
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||||
when(wallet.walletId).thenAnswer((_) => "Wallet id 1");
|
when(wallet.walletId).thenAnswer((_) => "Wallet id 1");
|
||||||
|
when(wallet.balance).thenAnswer(
|
||||||
|
(_) => Balance(
|
||||||
|
coin: Coin.bitcoin,
|
||||||
|
total: 0,
|
||||||
|
spendable: 0,
|
||||||
|
blockedTotal: 0,
|
||||||
|
pendingSpendable: 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final manager = Manager(wallet);
|
final manager = Manager(wallet);
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:mockingjay/mockingjay.dart' as mockingjay;
|
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/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||||
import 'package:stackwallet/services/coins/coin_service.dart';
|
import 'package:stackwallet/services/coins/coin_service.dart';
|
||||||
|
@ -29,6 +30,15 @@ void main() {
|
||||||
mockito
|
mockito
|
||||||
.when(wallet.walletName)
|
.when(wallet.walletName)
|
||||||
.thenAnswer((realInvocation) => "wallet name");
|
.thenAnswer((realInvocation) => "wallet name");
|
||||||
|
mockito.when(wallet.balance).thenAnswer(
|
||||||
|
(_) => Balance(
|
||||||
|
coin: Coin.bitcoin,
|
||||||
|
total: 0,
|
||||||
|
spendable: 0,
|
||||||
|
blockedTotal: 0,
|
||||||
|
pendingSpendable: 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final wallets = MockWallets();
|
final wallets = MockWallets();
|
||||||
final locale = MockLocaleService();
|
final locale = MockLocaleService();
|
||||||
|
@ -89,6 +99,15 @@ void main() {
|
||||||
mockito
|
mockito
|
||||||
.when(wallet.walletName)
|
.when(wallet.walletName)
|
||||||
.thenAnswer((realInvocation) => "wallet name");
|
.thenAnswer((realInvocation) => "wallet name");
|
||||||
|
mockito.when(wallet.balance).thenAnswer(
|
||||||
|
(_) => Balance(
|
||||||
|
coin: Coin.bitcoin,
|
||||||
|
total: 0,
|
||||||
|
spendable: 0,
|
||||||
|
blockedTotal: 0,
|
||||||
|
pendingSpendable: 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final wallets = MockWallets();
|
final wallets = MockWallets();
|
||||||
final manager = Manager(wallet);
|
final manager = Manager(wallet);
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:mockito/annotations.dart';
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
import 'package:stackwallet/models/balance.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||||
import 'package:stackwallet/services/coins/coin_service.dart';
|
import 'package:stackwallet/services/coins/coin_service.dart';
|
||||||
|
@ -35,6 +36,15 @@ void main() {
|
||||||
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
||||||
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||||
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
||||||
|
when(wallet.balance).thenAnswer(
|
||||||
|
(_) => Balance(
|
||||||
|
coin: Coin.bitcoin,
|
||||||
|
total: 0,
|
||||||
|
spendable: 0,
|
||||||
|
blockedTotal: 0,
|
||||||
|
pendingSpendable: 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final manager = Manager(wallet);
|
final manager = Manager(wallet);
|
||||||
when(wallets.getManagerProvider("some-wallet-id")).thenAnswer(
|
when(wallets.getManagerProvider("some-wallet-id")).thenAnswer(
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:mockito/annotations.dart';
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
import 'package:stackwallet/models/balance.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||||
import 'package:stackwallet/services/coins/coin_service.dart';
|
import 'package:stackwallet/services/coins/coin_service.dart';
|
||||||
|
@ -35,6 +36,15 @@ void main() {
|
||||||
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
||||||
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||||
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
||||||
|
when(wallet.balance).thenAnswer(
|
||||||
|
(_) => Balance(
|
||||||
|
coin: Coin.bitcoin,
|
||||||
|
total: 0,
|
||||||
|
spendable: 0,
|
||||||
|
blockedTotal: 0,
|
||||||
|
pendingSpendable: 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final manager = Manager(wallet);
|
final manager = Manager(wallet);
|
||||||
when(wallets.getManagerProvider("some-wallet-id")).thenAnswer(
|
when(wallets.getManagerProvider("some-wallet-id")).thenAnswer(
|
||||||
|
|
Loading…
Reference in a new issue