mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-25 04:49:36 +00:00
commit
26460c782c
10 changed files with 54 additions and 21 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 66c311b9c9799d3d81e2297a9982797603ee989f
|
Subproject commit 8e3afd002968d21a3de788569356587a70818022
|
|
@ -59,6 +59,8 @@ class _NewWalletRecoveryPhraseWarningViewState
|
||||||
|
|
||||||
final _numberOfPhraseWords = coin == Coin.monero
|
final _numberOfPhraseWords = coin == Coin.monero
|
||||||
? Constants.seedPhraseWordCountMonero
|
? Constants.seedPhraseWordCountMonero
|
||||||
|
: coin == Coin.wownero
|
||||||
|
? 14
|
||||||
: Constants.seedPhraseWordCountBip39;
|
: Constants.seedPhraseWordCountBip39;
|
||||||
|
|
||||||
return MasterScaffold(
|
return MasterScaffold(
|
||||||
|
|
|
@ -85,7 +85,7 @@ class _SendFromViewState extends ConsumerState<SendFromView> {
|
||||||
height: 8,
|
height: 8,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"You need to send ${amount.toStringAsFixed(coin == Coin.monero || coin == Coin.wownero ? 12 : 8)} ${coin.ticker}",
|
"You need to send ${amount.toStringAsFixed(coin == Coin.monero ? Constants.satsPerCoinMonero : coin == Coin.wownero ? Constants.satsPerCoinWownero : Constants.satsPerCoin)} ${coin.ticker}",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -307,10 +307,11 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
|
||||||
"${Format.localizedStringAsFixed(
|
"${Format.localizedStringAsFixed(
|
||||||
value: snapshot.data!,
|
value: snapshot.data!,
|
||||||
locale: locale,
|
locale: locale,
|
||||||
decimalPlaces:
|
decimalPlaces: coin == Coin.monero
|
||||||
coin == Coin.monero || coin == Coin.wownero
|
? Constants.satsPerCoinMonero
|
||||||
? 12
|
: coin == Coin.wownero
|
||||||
: 8,
|
? Constants.satsPerCoinWownero
|
||||||
|
: Constants.satsPerCoin,
|
||||||
)} ${coin.ticker}",
|
)} ${coin.ticker}",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
);
|
);
|
||||||
|
|
|
@ -239,8 +239,10 @@ class _TransactionDetailsViewState
|
||||||
children: [
|
children: [
|
||||||
SelectableText(
|
SelectableText(
|
||||||
"$amountPrefix${Format.localizedStringAsFixed(
|
"$amountPrefix${Format.localizedStringAsFixed(
|
||||||
value: coin == Coin.monero || coin == Coin.wownero
|
value: coin == Coin.monero
|
||||||
? (amount / 10000.toDecimal()).toDecimal()
|
? (amount / 10000.toDecimal()).toDecimal()
|
||||||
|
: coin == Coin.wownero
|
||||||
|
? (amount / 1000.toDecimal()).toDecimal()
|
||||||
: amount,
|
: amount,
|
||||||
locale: ref.watch(
|
locale: ref.watch(
|
||||||
localeServiceChangeNotifierProvider
|
localeServiceChangeNotifierProvider
|
||||||
|
@ -254,7 +256,7 @@ class _TransactionDetailsViewState
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
SelectableText(
|
SelectableText(
|
||||||
"${Format.localizedStringAsFixed(value: (coin == Coin.monero || coin == Coin.wownero ? (amount / 10000.toDecimal()).toDecimal() : amount) * ref.watch(priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin).item1)), locale: ref.watch(
|
"${Format.localizedStringAsFixed(value: (coin == Coin.monero ? (amount / 10000.toDecimal()).toDecimal() : coin == Coin.wownero ? (amount / 1000.toDecimal()).toDecimal() : amount) * ref.watch(priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin).item1)), locale: ref.watch(
|
||||||
localeServiceChangeNotifierProvider
|
localeServiceChangeNotifierProvider
|
||||||
.select((value) => value.locale),
|
.select((value) => value.locale),
|
||||||
), decimalPlaces: 2)} ${ref.watch(
|
), decimalPlaces: 2)} ${ref.watch(
|
||||||
|
@ -462,8 +464,11 @@ class _TransactionDetailsViewState
|
||||||
showFeePending
|
showFeePending
|
||||||
? _transaction.confirmedStatus
|
? _transaction.confirmedStatus
|
||||||
? Format.localizedStringAsFixed(
|
? Format.localizedStringAsFixed(
|
||||||
value: coin == Coin.monero || coin == Coin.wownero
|
value: coin == Coin.monero
|
||||||
? (fee / 10000.toDecimal()).toDecimal()
|
? (fee / 10000.toDecimal()).toDecimal()
|
||||||
|
: coin == Coin.wownero
|
||||||
|
? (fee / 1000.toDecimal())
|
||||||
|
.toDecimal()
|
||||||
: fee,
|
: fee,
|
||||||
locale: ref.watch(
|
locale: ref.watch(
|
||||||
localeServiceChangeNotifierProvider
|
localeServiceChangeNotifierProvider
|
||||||
|
@ -471,8 +476,10 @@ class _TransactionDetailsViewState
|
||||||
decimalPlaces: Constants.decimalPlaces)
|
decimalPlaces: Constants.decimalPlaces)
|
||||||
: "Pending"
|
: "Pending"
|
||||||
: Format.localizedStringAsFixed(
|
: Format.localizedStringAsFixed(
|
||||||
value: coin == Coin.monero || coin == Coin.wownero
|
value: coin == Coin.monero
|
||||||
? (fee / 10000.toDecimal()).toDecimal()
|
? (fee / 10000.toDecimal()).toDecimal()
|
||||||
|
: coin == Coin.wownero
|
||||||
|
? (fee / 1000.toDecimal()).toDecimal()
|
||||||
: fee,
|
: fee,
|
||||||
locale: ref.watch(
|
locale: ref.watch(
|
||||||
localeServiceChangeNotifierProvider
|
localeServiceChangeNotifierProvider
|
||||||
|
|
|
@ -750,11 +750,16 @@ class _TransactionSearchViewState
|
||||||
}
|
}
|
||||||
int? amount;
|
int? amount;
|
||||||
if (amountDecimal != null) {
|
if (amountDecimal != null) {
|
||||||
if (widget.coin == Coin.monero || widget.coin == Coin.wownero) {
|
if (widget.coin == Coin.monero) {
|
||||||
amount = (amountDecimal * Decimal.fromInt(Constants.satsPerCoinMonero))
|
amount = (amountDecimal * Decimal.fromInt(Constants.satsPerCoinMonero))
|
||||||
.floor()
|
.floor()
|
||||||
.toBigInt()
|
.toBigInt()
|
||||||
.toInt();
|
.toInt();
|
||||||
|
} else if (widget.coin == Coin.wownero) {
|
||||||
|
amount = (amountDecimal * Decimal.fromInt(Constants.satsPerCoinWownero))
|
||||||
|
.floor()
|
||||||
|
.toBigInt()
|
||||||
|
.toInt();
|
||||||
} else {
|
} else {
|
||||||
amount = (amountDecimal * Decimal.fromInt(Constants.satsPerCoin))
|
amount = (amountDecimal * Decimal.fromInt(Constants.satsPerCoin))
|
||||||
.floor()
|
.floor()
|
||||||
|
|
|
@ -1452,7 +1452,7 @@ class WowneroWallet extends CoinServiceAPI {
|
||||||
try {
|
try {
|
||||||
Logging.instance
|
Logging.instance
|
||||||
.log("$toAddress $amount $args", level: LogLevel.Info);
|
.log("$toAddress $amount $args", level: LogLevel.Info);
|
||||||
String amountToSend = wowneroAmountToString(amount: amount * 10000);
|
String amountToSend = wowneroAmountToString(amount: amount * 1000);
|
||||||
Logging.instance.log("$amount $amountToSend", level: LogLevel.Info);
|
Logging.instance.log("$amount $amountToSend", level: LogLevel.Info);
|
||||||
|
|
||||||
wownero_output.Output output = wownero_output.Output(walletBase!);
|
wownero_output.Output output = wownero_output.Output(walletBase!);
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_libmonero/monero/monero.dart';
|
import 'package:flutter_libmonero/monero/monero.dart';
|
||||||
|
import 'package:flutter_libmonero/wownero/wownero.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:stackwallet/hive/db.dart';
|
import 'package:stackwallet/hive/db.dart';
|
||||||
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart';
|
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart';
|
||||||
|
@ -367,8 +368,13 @@ class WalletsService extends ChangeNotifier {
|
||||||
await DB.instance.delete<dynamic>(
|
await DB.instance.delete<dynamic>(
|
||||||
boxName: DB.boxNameAllWalletsData,
|
boxName: DB.boxNameAllWalletsData,
|
||||||
key: "${walletId}_mnemonicHasBeenVerified");
|
key: "${walletId}_mnemonicHasBeenVerified");
|
||||||
|
if (coinFromPrettyName(shell['coin'] as String) == Coin.wownero) {
|
||||||
if (coinFromPrettyName(shell['coin'] as String) == Coin.monero) {
|
final wowService =
|
||||||
|
wownero.createWowneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||||
|
await wowService.remove(walletId);
|
||||||
|
Logging.instance
|
||||||
|
.log("monero wallet: $walletId deleted", level: LogLevel.Info);
|
||||||
|
} else if (coinFromPrettyName(shell['coin'] as String) == Coin.monero) {
|
||||||
final xmrService =
|
final xmrService =
|
||||||
monero.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
|
monero.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||||
await xmrService.remove(walletId);
|
await xmrService.remove(walletId);
|
||||||
|
|
|
@ -18,6 +18,7 @@ abstract class Constants {
|
||||||
|
|
||||||
//TODO: correct for monero?
|
//TODO: correct for monero?
|
||||||
static const int satsPerCoinMonero = 1000000000000;
|
static const int satsPerCoinMonero = 1000000000000;
|
||||||
|
static const int satsPerCoinWownero = 100000000000;
|
||||||
static const int satsPerCoin = 100000000;
|
static const int satsPerCoin = 100000000;
|
||||||
static const int decimalPlaces = 8;
|
static const int decimalPlaces = 8;
|
||||||
|
|
||||||
|
|
|
@ -170,8 +170,10 @@ class _TransactionCardState extends ConsumerState<TransactionCard> {
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
final amount = coin == Coin.monero || coin == Coin.wownero
|
final amount = coin == Coin.monero
|
||||||
? (_transaction.amount ~/ 10000)
|
? (_transaction.amount ~/ 10000)
|
||||||
|
: coin == Coin.wownero
|
||||||
|
? (_transaction.amount ~/ 1000)
|
||||||
: _transaction.amount;
|
: _transaction.amount;
|
||||||
return Text(
|
return Text(
|
||||||
"${Format.satoshiAmountToPrettyString(amount, locale)} ${coin.ticker}",
|
"${Format.satoshiAmountToPrettyString(amount, locale)} ${coin.ticker}",
|
||||||
|
@ -210,8 +212,10 @@ class _TransactionCardState extends ConsumerState<TransactionCard> {
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
// TODO: modify Format.<functions> to take optional Coin parameter so this type oif check isn't done in ui
|
// TODO: modify Format.<functions> to take optional Coin parameter so this type oif check isn't done in ui
|
||||||
int value = _transaction.amount;
|
int value = _transaction.amount;
|
||||||
if (coin == Coin.monero || coin == Coin.wownero) {
|
if (coin == Coin.monero) {
|
||||||
value = (value ~/ 10000);
|
value = (value ~/ 10000);
|
||||||
|
} else if (coin == Coin.wownero) {
|
||||||
|
value = (value ~/ 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Text(
|
return Text(
|
||||||
|
|
|
@ -317,6 +317,13 @@ packages:
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
cw_wownero:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: "crypto_plugins/flutter_libmonero/cw_wownero"
|
||||||
|
relative: true
|
||||||
|
source: path
|
||||||
|
version: "0.0.1"
|
||||||
dart_numerics:
|
dart_numerics:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in a new issue