mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
commit
85456e0df5
5 changed files with 378 additions and 413 deletions
|
@ -57,7 +57,10 @@ class AddressEntryData extends ChangeNotifier {
|
|||
}
|
||||
|
||||
bool get isValidAddress {
|
||||
if (_address == null || coin == null) {
|
||||
if ( coin == null) {
|
||||
return true;
|
||||
}
|
||||
if (_address == null) {
|
||||
return false;
|
||||
}
|
||||
return AddressUtils.validateAddress(_address!, _coin!);
|
||||
|
|
|
@ -384,7 +384,7 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
|
|||
),
|
||||
isDesktop
|
||||
? IconCopyButton(
|
||||
data: utxo!.address!,
|
||||
data: label!.value,
|
||||
)
|
||||
: SimpleCopyButton(
|
||||
data: label!.value,
|
||||
|
@ -426,7 +426,7 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
|
|||
),
|
||||
isDesktop
|
||||
? IconCopyButton(
|
||||
data: utxo!.address!,
|
||||
data: utxo!.txid,
|
||||
)
|
||||
: SimpleCopyButton(
|
||||
data: utxo!.txid,
|
||||
|
@ -493,13 +493,11 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Freeze reason",
|
||||
style:
|
||||
STextStyles.w500_14(context).copyWith(
|
||||
style: STextStyles.w500_14(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textSubtitle1,
|
||||
|
@ -544,7 +542,8 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
|
|||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -282,6 +282,7 @@ abstract class SWB {
|
|||
backupWallet['id'] = manager.walletId;
|
||||
backupWallet['isFavorite'] = manager.isFavorite;
|
||||
backupWallet['mnemonic'] = await manager.mnemonic;
|
||||
backupWallet['mnemonicPassphrase'] = await manager.mnemonicPassphrase;
|
||||
backupWallet['coinName'] = manager.coin.name;
|
||||
backupWallet['storedChainHeight'] = DB.instance
|
||||
.get<dynamic>(boxName: manager.walletId, key: 'storedChainHeight');
|
||||
|
@ -363,6 +364,7 @@ abstract class SWB {
|
|||
walletId: manager.walletId,
|
||||
restoringStatus: StackRestoringStatus.restoring,
|
||||
mnemonic: mnemonic,
|
||||
mnemonicPassphrase: mnemonicPassphrase,
|
||||
);
|
||||
|
||||
if (_shouldCancelRestore) {
|
||||
|
@ -432,6 +434,7 @@ abstract class SWB {
|
|||
address: currentAddress,
|
||||
height: restoreHeight,
|
||||
mnemonic: mnemonic,
|
||||
mnemonicPassphrase: mnemonicPassphrase,
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("$e $s", level: LogLevel.Warning);
|
||||
|
@ -440,6 +443,7 @@ abstract class SWB {
|
|||
restoringStatus: StackRestoringStatus.failed,
|
||||
manager: manager,
|
||||
mnemonic: mnemonic,
|
||||
mnemonicPassphrase: mnemonicPassphrase,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2490,60 +2490,17 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
|
|||
});
|
||||
}
|
||||
|
||||
// final int utxosIntValue = utxos.satoshiBalance;
|
||||
// final Decimal utxosValue =
|
||||
// Format.satoshisToAmount(utxosIntValue, coin: coin);
|
||||
|
||||
// List<Decimal> balances = List.empty(growable: true);
|
||||
//
|
||||
// Decimal lelantusBalance =
|
||||
// Format.satoshisToAmount(intLelantusBalance, coin: coin);
|
||||
|
||||
// balances.add(lelantusBalance); 0
|
||||
//
|
||||
// balances.add(lelantusBalance * price); 1
|
||||
|
||||
// Decimal _unconfirmedLelantusBalance =
|
||||
// Format.satoshisToAmount(unconfirmedLelantusBalance, coin: coin);
|
||||
|
||||
// balances.add(lelantusBalance + utxosValue + _unconfirmedLelantusBalance); 2
|
||||
//
|
||||
// balances.add(
|
||||
// (lelantusBalance + utxosValue + _unconfirmedLelantusBalance) * price); 3
|
||||
|
||||
// int availableSats =
|
||||
// utxos.satoshiBalance - utxos.satoshiBalanceUnconfirmed;
|
||||
// if (availableSats < 0) {
|
||||
// availableSats = 0;
|
||||
// }
|
||||
// balances.add(Format.satoshisToAmount(availableSats, coin: coin)); 4
|
||||
_balancePrivate = Balance(
|
||||
coin: coin,
|
||||
total: intLelantusBalance + unconfirmedLelantusBalance,
|
||||
spendable: intLelantusBalance,
|
||||
blockedTotal: 0,
|
||||
pendingSpendable: unconfirmedLelantusBalance,
|
||||
);
|
||||
await updateCachedBalanceSecondary(_balancePrivate!);
|
||||
|
||||
// wait for updated uxtos to get updated public balance
|
||||
await utxosUpdateFuture;
|
||||
|
||||
// todo: shared total between private and public balances?
|
||||
_balancePrivate = Balance(
|
||||
coin: coin,
|
||||
total: intLelantusBalance + unconfirmedLelantusBalance + balance.total,
|
||||
spendable: intLelantusBalance,
|
||||
blockedTotal: 0,
|
||||
pendingSpendable: unconfirmedLelantusBalance + balance.total,
|
||||
);
|
||||
await updateCachedBalanceSecondary(_balancePrivate!);
|
||||
// _balance = Balance(
|
||||
// coin: coin,
|
||||
// total: utxos.satoshiBalance,
|
||||
// spendable: availableSats,
|
||||
// blockedTotal: 0,
|
||||
// pendingSpendable: utxos.satoshiBalanceUnconfirmed,
|
||||
// );
|
||||
|
||||
// Logging.instance.log("balances $balances", level: LogLevel.Info);
|
||||
// await DB.instance.put<dynamic>(
|
||||
// boxName: walletId,
|
||||
// key: 'totalBalance',
|
||||
// value: balances[2].toString());
|
||||
// return balances;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception rethrown in getFullBalance(): $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
|
|
|
@ -33,22 +33,24 @@ class WalletSheetCard extends ConsumerWidget {
|
|||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
final manager = ref
|
||||
.read(walletsChangeNotifierProvider)
|
||||
.getManager(walletId);
|
||||
if (manager.coin == Coin.monero ||
|
||||
manager.coin == Coin.wownero) {
|
||||
final manager =
|
||||
ref.read(walletsChangeNotifierProvider).getManager(walletId);
|
||||
if (manager.coin == Coin.monero || manager.coin == Coin.wownero) {
|
||||
await manager.initializeExisting();
|
||||
}
|
||||
if (popPrevious) Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed(
|
||||
if (context.mounted) {
|
||||
if (popPrevious && context.mounted) Navigator.of(context).pop();
|
||||
|
||||
await Navigator.of(context).pushNamed(
|
||||
WalletView.routeName,
|
||||
arguments: Tuple2(
|
||||
walletId,
|
||||
ref
|
||||
.read(walletsChangeNotifierProvider)
|
||||
.getManagerProvider(walletId)),
|
||||
.getManagerProvider(walletId),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: WalletInfoRow(
|
||||
walletId: walletId,
|
||||
|
|
Loading…
Reference in a new issue