mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
wownero node and ui fixes
This commit is contained in:
parent
edc9c11c95
commit
7b3b7554b0
10 changed files with 46 additions and 19 deletions
|
@ -85,7 +85,7 @@ class _SendFromViewState extends ConsumerState<SendFromView> {
|
||||||
height: 8,
|
height: 8,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"You need to send ${amount.toStringAsFixed(coin == Coin.monero ? 12 : 8)} ${coin.ticker}",
|
"You need to send ${amount.toStringAsFixed(coin == Coin.monero || coin == Coin.wownero ? 12 : 8)} ${coin.ticker}",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -307,7 +307,10 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
|
||||||
"${Format.localizedStringAsFixed(
|
"${Format.localizedStringAsFixed(
|
||||||
value: snapshot.data!,
|
value: snapshot.data!,
|
||||||
locale: locale,
|
locale: locale,
|
||||||
decimalPlaces: coin == Coin.monero ? 12 : 8,
|
decimalPlaces:
|
||||||
|
coin == Coin.monero || coin == Coin.wownero
|
||||||
|
? 12
|
||||||
|
: 8,
|
||||||
)} ${coin.ticker}",
|
)} ${coin.ticker}",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
);
|
);
|
||||||
|
|
|
@ -90,6 +90,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Coin.monero:
|
case Coin.monero:
|
||||||
|
case Coin.wownero:
|
||||||
try {
|
try {
|
||||||
final uri = Uri.parse(formData.host!);
|
final uri = Uri.parse(formData.host!);
|
||||||
if (uri.scheme.startsWith("http")) {
|
if (uri.scheme.startsWith("http")) {
|
||||||
|
@ -384,6 +385,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
|
||||||
// strip unused path
|
// strip unused path
|
||||||
String address = formData.host!;
|
String address = formData.host!;
|
||||||
if (coin == Coin.monero ||
|
if (coin == Coin.monero ||
|
||||||
|
coin == Coin.wownero ||
|
||||||
coin == Coin.epicCash) {
|
coin == Coin.epicCash) {
|
||||||
if (address.startsWith("http")) {
|
if (address.startsWith("http")) {
|
||||||
final uri = Uri.parse(address);
|
final uri = Uri.parse(address);
|
||||||
|
@ -700,7 +702,9 @@ class _NodeFormState extends ConsumerState<NodeForm> {
|
||||||
focusNode: _hostFocusNode,
|
focusNode: _hostFocusNode,
|
||||||
style: STextStyles.field(context),
|
style: STextStyles.field(context),
|
||||||
decoration: standardInputDecoration(
|
decoration: standardInputDecoration(
|
||||||
(widget.coin != Coin.monero && widget.coin != Coin.epicCash)
|
(widget.coin != Coin.monero &&
|
||||||
|
widget.coin != Coin.wownero &&
|
||||||
|
widget.coin != Coin.epicCash)
|
||||||
? "IP address"
|
? "IP address"
|
||||||
: "Url",
|
: "Url",
|
||||||
_hostFocusNode,
|
_hostFocusNode,
|
||||||
|
@ -881,7 +885,9 @@ class _NodeFormState extends ConsumerState<NodeForm> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8,
|
height: 8,
|
||||||
),
|
),
|
||||||
if (widget.coin != Coin.monero && widget.coin != Coin.epicCash)
|
if (widget.coin != Coin.monero &&
|
||||||
|
widget.coin != Coin.wownero &&
|
||||||
|
widget.coin != Coin.epicCash)
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
@ -932,11 +938,15 @@ class _NodeFormState extends ConsumerState<NodeForm> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (widget.coin != Coin.monero && widget.coin != Coin.epicCash)
|
if (widget.coin != Coin.monero &&
|
||||||
|
widget.coin != Coin.wownero &&
|
||||||
|
widget.coin != Coin.epicCash)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8,
|
height: 8,
|
||||||
),
|
),
|
||||||
if (widget.coin != Coin.monero && widget.coin != Coin.epicCash)
|
if (widget.coin != Coin.monero &&
|
||||||
|
widget.coin != Coin.wownero &&
|
||||||
|
widget.coin != Coin.epicCash)
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
|
|
@ -81,6 +81,7 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Coin.monero:
|
case Coin.monero:
|
||||||
|
case Coin.wownero:
|
||||||
try {
|
try {
|
||||||
final uri = Uri.parse(node!.host);
|
final uri = Uri.parse(node!.host);
|
||||||
if (uri.scheme.startsWith("http")) {
|
if (uri.scheme.startsWith("http")) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_net
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart';
|
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart';
|
||||||
import 'package:stackwallet/services/coins/monero/monero_wallet.dart';
|
import 'package:stackwallet/services/coins/monero/monero_wallet.dart';
|
||||||
|
import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart';
|
||||||
import 'package:stackwallet/services/event_bus/events/global/blocks_remaining_event.dart';
|
import 'package:stackwallet/services/event_bus/events/global/blocks_remaining_event.dart';
|
||||||
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
|
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
|
||||||
import 'package:stackwallet/services/event_bus/events/global/refresh_percent_changed_event.dart';
|
import 'package:stackwallet/services/event_bus/events/global/refresh_percent_changed_event.dart';
|
||||||
|
@ -205,7 +206,7 @@ class _WalletNetworkSettingsViewState
|
||||||
.getManager(widget.walletId)
|
.getManager(widget.walletId)
|
||||||
.coin;
|
.coin;
|
||||||
|
|
||||||
if (coin == Coin.monero || coin == Coin.epicCash) {
|
if (coin == Coin.monero || coin == Coin.wownero || coin == Coin.epicCash) {
|
||||||
_blocksRemainingSubscription = eventBus.on<BlocksRemainingEvent>().listen(
|
_blocksRemainingSubscription = eventBus.on<BlocksRemainingEvent>().listen(
|
||||||
(event) async {
|
(event) async {
|
||||||
if (event.walletId == widget.walletId) {
|
if (event.walletId == widget.walletId) {
|
||||||
|
@ -271,6 +272,15 @@ class _WalletNetworkSettingsViewState
|
||||||
if (_percent < highestPercent) {
|
if (_percent < highestPercent) {
|
||||||
_percent = highestPercent.clamp(0.0, 1.0);
|
_percent = highestPercent.clamp(0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
} else if (coin == Coin.wownero) {
|
||||||
|
double highestPercent = (ref
|
||||||
|
.read(walletsChangeNotifierProvider)
|
||||||
|
.getManager(widget.walletId)
|
||||||
|
.wallet as WowneroWallet)
|
||||||
|
.highestPercentCached;
|
||||||
|
if (_percent < highestPercent) {
|
||||||
|
_percent = highestPercent.clamp(0.0, 1.0);
|
||||||
|
}
|
||||||
} else if (coin == Coin.epicCash) {
|
} else if (coin == Coin.epicCash) {
|
||||||
double highestPercent = (ref
|
double highestPercent = (ref
|
||||||
.read(walletsChangeNotifierProvider)
|
.read(walletsChangeNotifierProvider)
|
||||||
|
@ -545,6 +555,7 @@ class _WalletNetworkSettingsViewState
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (coin == Coin.monero ||
|
if (coin == Coin.monero ||
|
||||||
|
coin == Coin.wownero ||
|
||||||
coin == Coin.epicCash)
|
coin == Coin.epicCash)
|
||||||
Text(
|
Text(
|
||||||
" (Blocks to go: ${_blocksRemaining == -1 ? "?" : _blocksRemaining})",
|
" (Blocks to go: ${_blocksRemaining == -1 ? "?" : _blocksRemaining})",
|
||||||
|
|
|
@ -239,7 +239,7 @@ class _TransactionDetailsViewState
|
||||||
children: [
|
children: [
|
||||||
SelectableText(
|
SelectableText(
|
||||||
"$amountPrefix${Format.localizedStringAsFixed(
|
"$amountPrefix${Format.localizedStringAsFixed(
|
||||||
value: coin == Coin.monero
|
value: coin == Coin.monero || coin == Coin.wownero
|
||||||
? (amount / 10000.toDecimal()).toDecimal()
|
? (amount / 10000.toDecimal()).toDecimal()
|
||||||
: amount,
|
: amount,
|
||||||
locale: ref.watch(
|
locale: ref.watch(
|
||||||
|
@ -254,7 +254,7 @@ class _TransactionDetailsViewState
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
SelectableText(
|
SelectableText(
|
||||||
"${Format.localizedStringAsFixed(value: (coin == Coin.monero ? (amount / 10000.toDecimal()).toDecimal() : amount) * ref.watch(priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin).item1)), locale: ref.watch(
|
"${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(
|
||||||
localeServiceChangeNotifierProvider
|
localeServiceChangeNotifierProvider
|
||||||
.select((value) => value.locale),
|
.select((value) => value.locale),
|
||||||
), decimalPlaces: 2)} ${ref.watch(
|
), decimalPlaces: 2)} ${ref.watch(
|
||||||
|
@ -298,14 +298,14 @@ class _TransactionDetailsViewState
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!(coin == Coin.monero &&
|
if (!((coin == Coin.monero || coin == Coin.wownero) &&
|
||||||
_transaction.txType.toLowerCase() == "sent") &&
|
_transaction.txType.toLowerCase() == "sent") &&
|
||||||
!((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
!((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||||
_transaction.subType == "mint"))
|
_transaction.subType == "mint"))
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (!(coin == Coin.monero &&
|
if (!((coin == Coin.monero || coin == Coin.wownero) &&
|
||||||
_transaction.txType.toLowerCase() == "sent") &&
|
_transaction.txType.toLowerCase() == "sent") &&
|
||||||
!((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
!((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||||
_transaction.subType == "mint"))
|
_transaction.subType == "mint"))
|
||||||
|
@ -462,7 +462,7 @@ class _TransactionDetailsViewState
|
||||||
showFeePending
|
showFeePending
|
||||||
? _transaction.confirmedStatus
|
? _transaction.confirmedStatus
|
||||||
? Format.localizedStringAsFixed(
|
? Format.localizedStringAsFixed(
|
||||||
value: coin == Coin.monero
|
value: coin == Coin.monero || coin == Coin.wownero
|
||||||
? (fee / 10000.toDecimal()).toDecimal()
|
? (fee / 10000.toDecimal()).toDecimal()
|
||||||
: fee,
|
: fee,
|
||||||
locale: ref.watch(
|
locale: ref.watch(
|
||||||
|
@ -471,7 +471,7 @@ class _TransactionDetailsViewState
|
||||||
decimalPlaces: Constants.decimalPlaces)
|
decimalPlaces: Constants.decimalPlaces)
|
||||||
: "Pending"
|
: "Pending"
|
||||||
: Format.localizedStringAsFixed(
|
: Format.localizedStringAsFixed(
|
||||||
value: coin == Coin.monero
|
value: coin == Coin.monero || coin == Coin.wownero
|
||||||
? (fee / 10000.toDecimal()).toDecimal()
|
? (fee / 10000.toDecimal()).toDecimal()
|
||||||
: fee,
|
: fee,
|
||||||
locale: ref.watch(
|
locale: ref.watch(
|
||||||
|
|
|
@ -750,7 +750,7 @@ class _TransactionSearchViewState
|
||||||
}
|
}
|
||||||
int? amount;
|
int? amount;
|
||||||
if (amountDecimal != null) {
|
if (amountDecimal != null) {
|
||||||
if (widget.coin == Coin.monero) {
|
if (widget.coin == Coin.monero || widget.coin == Coin.wownero) {
|
||||||
amount = (amountDecimal * Decimal.fromInt(Constants.satsPerCoinMonero))
|
amount = (amountDecimal * Decimal.fromInt(Constants.satsPerCoinMonero))
|
||||||
.floor()
|
.floor()
|
||||||
.toBigInt()
|
.toBigInt()
|
||||||
|
|
|
@ -223,7 +223,7 @@ class Wallets extends ChangeNotifier {
|
||||||
final shouldSetAutoSync = shouldAutoSyncAll ||
|
final shouldSetAutoSync = shouldAutoSyncAll ||
|
||||||
walletIdsToEnableAutoSync.contains(manager.walletId);
|
walletIdsToEnableAutoSync.contains(manager.walletId);
|
||||||
|
|
||||||
if (manager.coin == Coin.monero) {
|
if (manager.coin == Coin.monero || manager.coin == Coin.wownero) {
|
||||||
walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
||||||
} else {
|
} else {
|
||||||
walletInitFutures.add(manager.initializeExisting().then((value) {
|
walletInitFutures.add(manager.initializeExisting().then((value) {
|
||||||
|
@ -312,7 +312,7 @@ class Wallets extends ChangeNotifier {
|
||||||
final shouldSetAutoSync = shouldAutoSyncAll ||
|
final shouldSetAutoSync = shouldAutoSyncAll ||
|
||||||
walletIdsToEnableAutoSync.contains(manager.walletId);
|
walletIdsToEnableAutoSync.contains(manager.walletId);
|
||||||
|
|
||||||
if (manager.coin == Coin.monero) {
|
if (manager.coin == Coin.monero || manager.coin == Coin.wownero) {
|
||||||
walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
||||||
} else {
|
} else {
|
||||||
walletInitFutures.add(manager.initializeExisting().then((value) {
|
walletInitFutures.add(manager.initializeExisting().then((value) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ abstract class DefaultNodes {
|
||||||
epicCash,
|
epicCash,
|
||||||
bitcoincash,
|
bitcoincash,
|
||||||
namecoin,
|
namecoin,
|
||||||
|
wownero,
|
||||||
bitcoinTestnet,
|
bitcoinTestnet,
|
||||||
bitcoincashTestnet,
|
bitcoincashTestnet,
|
||||||
dogecoinTestnet,
|
dogecoinTestnet,
|
||||||
|
@ -86,7 +87,7 @@ abstract class DefaultNodes {
|
||||||
// TODO: eventually enable ssl and set scheme to https
|
// TODO: eventually enable ssl and set scheme to https
|
||||||
// currently get certificate failure
|
// currently get certificate failure
|
||||||
static NodeModel get wownero => NodeModel(
|
static NodeModel get wownero => NodeModel(
|
||||||
host: "eu-west-2.wow.xmr.pm",
|
host: "http://eu-west-2.wow.xmr.pm",
|
||||||
port: 34568,
|
port: 34568,
|
||||||
name: defaultName,
|
name: defaultName,
|
||||||
id: _nodeId(Coin.wownero),
|
id: _nodeId(Coin.wownero),
|
||||||
|
|
|
@ -85,6 +85,7 @@ class NodeOptionsSheet extends ConsumerWidget {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Coin.monero:
|
case Coin.monero:
|
||||||
|
case Coin.wownero:
|
||||||
try {
|
try {
|
||||||
final uri = Uri.parse(node.host);
|
final uri = Uri.parse(node.host);
|
||||||
if (uri.scheme.startsWith("http")) {
|
if (uri.scheme.startsWith("http")) {
|
||||||
|
|
|
@ -170,7 +170,7 @@ class _TransactionCardState extends ConsumerState<TransactionCard> {
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
final amount = coin == Coin.monero
|
final amount = coin == Coin.monero || coin == Coin.wownero
|
||||||
? (_transaction.amount ~/ 10000)
|
? (_transaction.amount ~/ 10000)
|
||||||
: _transaction.amount;
|
: _transaction.amount;
|
||||||
return Text(
|
return Text(
|
||||||
|
@ -210,7 +210,7 @@ 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) {
|
if (coin == Coin.monero || coin == Coin.wownero) {
|
||||||
value = (value ~/ 10000);
|
value = (value ~/ 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue