Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions assets/svg/coin_icons/Wownero.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion crypto_plugins/flutter_libmonero
Submodule flutter_libmonero updated 103 files
8 changes: 6 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_libmonero/monero/monero.dart';
import 'package:flutter_libmonero/wownero/wownero.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hive_flutter/hive_flutter.dart';
Expand Down Expand Up @@ -84,7 +85,6 @@ void main() async {
appDirectory = (await getLibraryDirectory());
}
// FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
await Hive.initFlutter(appDirectory.path);
if (!(Logging.isArmLinux || Logging.isTestEnv)) {
final isar = await Isar.open(
[LogSchema],
Expand Down Expand Up @@ -128,11 +128,14 @@ void main() async {

Hive.registerAdapter(NodeAdapter());

Hive.registerAdapter(WalletInfoAdapter());
if (!Hive.isAdapterRegistered(WalletInfoAdapter().typeId)) {
Hive.registerAdapter(WalletInfoAdapter());
}

Hive.registerAdapter(WalletTypeAdapter());

Hive.registerAdapter(UnspentCoinsInfoAdapter());
await Hive.initFlutter(appDirectory.path);

await Hive.openBox<dynamic>(DB.boxNameDBInfo);
int dbVersion = DB.instance.get<dynamic>(
Expand All @@ -143,6 +146,7 @@ void main() async {
}

monero.onStartup();
wownero.onStartup();

await Hive.openBox<dynamic>(DB.boxNameTheme);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ class _NewWalletRecoveryPhraseWarningViewState

final _numberOfPhraseWords = coin == Coin.monero
? Constants.seedPhraseWordCountMonero
: Constants.seedPhraseWordCountBip39;
: coin == Coin.wownero
? 14
: Constants.seedPhraseWordCountBip39;

return MasterScaffold(
isDesktop: isDesktop,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {

// TODO: do actual check to make sure it is a valid mnemonic for monero
if (bip39.validateMnemonic(mnemonic) == false &&
!(widget.coin == Coin.monero)) {
!(widget.coin == Coin.monero || widget.coin == Coin.wownero)) {
unawaited(showFloatingFlushBar(
type: FlushBarType.warning,
message: "Invalid seed phrase!",
Expand Down
8 changes: 6 additions & 2 deletions lib/pages/exchange_view/send_from_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class _SendFromViewState extends ConsumerState<SendFromView> {
height: 8,
),
Text(
"You need to send ${amount.toStringAsFixed(coin == Coin.monero ? 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),
),
const SizedBox(
Expand Down Expand Up @@ -307,7 +307,11 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
"${Format.localizedStringAsFixed(
value: snapshot.data!,
locale: locale,
decimalPlaces: coin == Coin.monero ? 12 : 8,
decimalPlaces: coin == Coin.monero
? Constants.satsPerCoinMonero
: coin == Coin.wownero
? Constants.satsPerCoinWownero
: Constants.satsPerCoin,
)} ${coin.ticker}",
style: STextStyles.itemSubtitle(context),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
break;

case Coin.monero:
case Coin.wownero:
try {
final uri = Uri.parse(formData.host!);
if (uri.scheme.startsWith("http")) {
Expand Down Expand Up @@ -384,6 +385,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
// strip unused path
String address = formData.host!;
if (coin == Coin.monero ||
coin == Coin.wownero ||
coin == Coin.epicCash) {
if (address.startsWith("http")) {
final uri = Uri.parse(address);
Expand Down Expand Up @@ -539,6 +541,7 @@ class _NodeFormState extends ConsumerState<NodeForm> {

case Coin.epicCash:
case Coin.monero:
case Coin.wownero:
return true;
}
}
Expand Down Expand Up @@ -699,7 +702,9 @@ class _NodeFormState extends ConsumerState<NodeForm> {
focusNode: _hostFocusNode,
style: STextStyles.field(context),
decoration: standardInputDecoration(
(widget.coin != Coin.monero && widget.coin != Coin.epicCash)
(widget.coin != Coin.monero &&
widget.coin != Coin.wownero &&
widget.coin != Coin.epicCash)
? "IP address"
: "Url",
_hostFocusNode,
Expand Down Expand Up @@ -880,7 +885,9 @@ class _NodeFormState extends ConsumerState<NodeForm> {
const SizedBox(
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(
children: [
GestureDetector(
Expand Down Expand Up @@ -931,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(
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(
children: [
GestureDetector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
break;

case Coin.monero:
case Coin.wownero:
try {
final uri = Uri.parse(node!.host);
if (uri.scheme.startsWith("http")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_net
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/coins/epiccash/epiccash_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/node_connection_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/events/global/refresh_percent_changed_event.dart';
Expand Down Expand Up @@ -205,7 +206,7 @@ class _WalletNetworkSettingsViewState
.getManager(widget.walletId)
.coin;

if (coin == Coin.monero || coin == Coin.epicCash) {
if (coin == Coin.monero || coin == Coin.wownero || coin == Coin.epicCash) {
_blocksRemainingSubscription = eventBus.on<BlocksRemainingEvent>().listen(
(event) async {
if (event.walletId == widget.walletId) {
Expand Down Expand Up @@ -271,6 +272,15 @@ class _WalletNetworkSettingsViewState
if (_percent < highestPercent) {
_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) {
double highestPercent = (ref
.read(walletsChangeNotifierProvider)
Expand Down Expand Up @@ -545,6 +555,7 @@ class _WalletNetworkSettingsViewState
),
),
if (coin == Coin.monero ||
coin == Coin.wownero ||
coin == Coin.epicCash)
Text(
" (Blocks to go: ${_blocksRemaining == -1 ? "?" : _blocksRemaining})",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ class _TransactionDetailsViewState
"$amountPrefix${Format.localizedStringAsFixed(
value: coin == Coin.monero
? (amount / 10000.toDecimal()).toDecimal()
: amount,
: coin == Coin.wownero
? (amount / 1000.toDecimal()).toDecimal()
: amount,
locale: ref.watch(
localeServiceChangeNotifierProvider
.select((value) => value.locale),
Expand All @@ -254,7 +256,7 @@ class _TransactionDetailsViewState
height: 2,
),
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 ? (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
.select((value) => value.locale),
), decimalPlaces: 2)} ${ref.watch(
Expand Down Expand Up @@ -298,14 +300,14 @@ class _TransactionDetailsViewState
],
),
),
if (!(coin == Coin.monero &&
if (!((coin == Coin.monero || coin == Coin.wownero) &&
_transaction.txType.toLowerCase() == "sent") &&
!((coin == Coin.firo || coin == Coin.firoTestNet) &&
_transaction.subType == "mint"))
const SizedBox(
height: 12,
),
if (!(coin == Coin.monero &&
if (!((coin == Coin.monero || coin == Coin.wownero) &&
_transaction.txType.toLowerCase() == "sent") &&
!((coin == Coin.firo || coin == Coin.firoTestNet) &&
_transaction.subType == "mint"))
Expand Down Expand Up @@ -464,7 +466,10 @@ class _TransactionDetailsViewState
? Format.localizedStringAsFixed(
value: coin == Coin.monero
? (fee / 10000.toDecimal()).toDecimal()
: fee,
: coin == Coin.wownero
? (fee / 1000.toDecimal())
.toDecimal()
: fee,
locale: ref.watch(
localeServiceChangeNotifierProvider
.select((value) => value.locale)),
Expand All @@ -473,7 +478,9 @@ class _TransactionDetailsViewState
: Format.localizedStringAsFixed(
value: coin == Coin.monero
? (fee / 10000.toDecimal()).toDecimal()
: fee,
: coin == Coin.wownero
? (fee / 1000.toDecimal()).toDecimal()
: fee,
locale: ref.watch(
localeServiceChangeNotifierProvider
.select((value) => value.locale)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,11 @@ class _TransactionSearchViewState
.floor()
.toBigInt()
.toInt();
} else if (widget.coin == Coin.wownero) {
amount = (amountDecimal * Decimal.fromInt(Constants.satsPerCoinWownero))
.floor()
.toBigInt()
.toInt();
} else {
amount = (amountDecimal * Decimal.fromInt(Constants.satsPerCoin))
.floor()
Expand Down
9 changes: 9 additions & 0 deletions lib/services/coins/coin_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart';
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart';
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/services/coins/monero/monero_wallet.dart';
import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart';
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
Expand Down Expand Up @@ -145,6 +146,14 @@ abstract class CoinServiceAPI {
// tracker: tracker,
);

case Coin.wownero:
return WowneroWallet(
walletId: walletId,
walletName: walletName,
coin: coin,
// tracker: tracker,
);

case Coin.namecoin:
return NamecoinWallet(
walletId: walletId,
Expand Down
Loading