Skip to content
Merged

Salvium #1144

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b1cc8d7
chore: add cs_salvium to pubspec
sneurlax May 22, 2025
1369d8f
feat: add wip salvium wallet files
sneurlax May 22, 2025
b8cbffd
chore: ignore working theme dir(s)
sneurlax May 22, 2025
04f0d78
Merge remote-tracking branch 'origin/staging' into salvium
sneurlax May 23, 2025
b570d6e
feat: add libSalviumWallet workaround
sneurlax May 23, 2025
8029116
fix: add optional pendingSalviumTransaction to TxData
sneurlax May 23, 2025
c6cba7e
fix: HACK salvium wallets are "just" monero wallets--is probably bad
sneurlax May 23, 2025
078a709
fix: add Salvium to SW app config
sneurlax May 23, 2025
604fd8c
fix: use monero wordlist for salvium, too
sneurlax May 23, 2025
fa262c1
fix: sort Salvium alphabetically in the coins list
sneurlax May 23, 2025
5c41864
fix: add Salvium wallet handling
sneurlax May 23, 2025
27b6193
fix: add Salvium wallet handling
sneurlax May 23, 2025
dfbbc33
fix: handle Salvium wallets
sneurlax May 23, 2025
7749c0f
fix: only use 25 word salvium mnemonics
sneurlax May 23, 2025
bb0401c
fix: rip compat out
sneurlax May 23, 2025
3703127
fix: handle salvium wallets in more places
sneurlax May 23, 2025
554e898
fix: add missing import
sneurlax May 23, 2025
1cf6989
fix: more salvium stuff
sneurlax May 23, 2025
8d51d90
autosave and organise
julian-CStack May 26, 2025
f24adaa
fix file exists error
julian-CStack May 26, 2025
97f5995
temporarily (lol) copy paste sync status stuff to quickly integrate s…
julian-CStack May 26, 2025
0872e72
hook up salvium wallet files deletion
julian-CStack May 26, 2025
aaac3e7
use published salvium
julian-CStack May 28, 2025
88931fa
Merge remote-tracking branch 'origin/staging' into salvium
julian-CStack May 28, 2025
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
2 changes: 2 additions & 0 deletions asset_sources/default_themes/stack_wallet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
light/
dark/
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import '../../../utilities/util.dart';
import '../../../wallets/crypto_currency/crypto_currency.dart';
import '../../../wallets/isar/models/wallet_info.dart';
import '../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../wallets/wallet/wallet.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
Expand Down Expand Up @@ -183,7 +184,7 @@ class _NewWalletRecoveryPhraseWarningViewState

// TODO: Refactor these to generate each coin in their respective classes
// This code should not be in a random view page file
if (coin is Monero || coin is Wownero || coin is Xelis) {
if (coin is Monero || coin is Wownero || coin is Xelis || coin is Salvium) {
// currently a special case due to the
// xmr/wow libraries handling their
// own mnemonic generation
Expand Down Expand Up @@ -230,6 +231,8 @@ class _NewWalletRecoveryPhraseWarningViewState

if (wallet is LibMoneroWallet) {
await wallet.init(wordCount: wordCount);
} else if (wallet is LibSalviumWallet) {
await wallet.init(wordCount: wordCount);
} else {
await wallet.init();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@ class _SeedRestoreOptionState extends ConsumerState<SeedRestoreOption> {

final currentLength = ref.watch(mnemonicWordCountStateProvider);

final isMoneroAnd25 = widget.coin is Monero && currentLength == 25;
final isWowneroAnd25 = widget.coin is Wownero && currentLength == 25;
final isCnAnd25 = widget.coin is CryptonoteCurrency && currentLength == 25;

final bool supportsPassphrase;
if (widget.coin.hasMnemonicPassphraseSupport) {
Expand All @@ -432,7 +431,7 @@ class _SeedRestoreOptionState extends ConsumerState<SeedRestoreOption> {

return Column(
children: [
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
if (isCnAnd25 || widget.coin is Epiccash)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand All @@ -459,9 +458,9 @@ class _SeedRestoreOptionState extends ConsumerState<SeedRestoreOption> {
),
],
),
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
if (isCnAnd25 || widget.coin is Epiccash)
SizedBox(height: Util.isDesktop ? 16 : 8),
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
if (isCnAnd25 || widget.coin is Epiccash)
ref.watch(_pIsUsingDate)
? RestoreFromDatePicker(
onTap: widget.dateChooserFunction,
Expand Down Expand Up @@ -518,9 +517,8 @@ class _SeedRestoreOptionState extends ConsumerState<SeedRestoreOption> {
),
),
),
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
const SizedBox(height: 8),
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
if (isCnAnd25 || widget.coin is Epiccash) const SizedBox(height: 8),
if (isCnAnd25 || widget.coin is Epiccash)
RoundedWhiteContainer(
child: Center(
child: Text(
Expand All @@ -541,7 +539,7 @@ class _SeedRestoreOptionState extends ConsumerState<SeedRestoreOption> {
),
),
),
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
if (isCnAnd25 || widget.coin is Epiccash)
SizedBox(height: Util.isDesktop ? 24 : 16),
Text(
"Choose recovery phrase length",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import '../../../wallets/crypto_currency/crypto_currency.dart';
import '../../../wallets/isar/models/wallet_info.dart';
import '../../../wallets/wallet/impl/epiccash_wallet.dart';
import '../../../wallets/wallet/impl/monero_wallet.dart';
import '../../../wallets/wallet/impl/salvium_wallet.dart';
import '../../../wallets/wallet/impl/wownero_wallet.dart';
import '../../../wallets/wallet/impl/xelis_wallet.dart';
import '../../../wallets/wallet/intermediate/external_wallet.dart';
Expand Down Expand Up @@ -189,7 +190,8 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
// TODO: check for wownero wordlist?
bool _isValidMnemonicWord(String word) {
// TODO: get the actual language
if (widget.coin is Monero) {
if (widget.coin is Monero || widget.coin is Salvium) {
// Salvium use's Monero's wordlists.
switch (widget.seedWordsLength) {
case 25:
return lib_monero.getMoneroWordList("English").contains(word);
Expand Down Expand Up @@ -258,6 +260,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
if (bip39.validateMnemonic(mnemonic) == false &&
!(widget.coin is Monero ||
widget.coin is Wownero ||
widget.coin is Salvium ||
widget.coin is Xelis)) {
unawaited(
showFloatingFlushBar(
Expand Down Expand Up @@ -342,6 +345,10 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
await (wallet as WowneroWallet).init(isRestore: true);
break;

case const (SalviumWallet):
await (wallet as SalviumWallet).init(isRestore: true);
break;

case const (XelisWallet):
await (wallet as XelisWallet).init(isRestore: true);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import 'dart:math';

import 'package:cs_monero/src/deprecated/get_height_by_date.dart'
as cs_monero_deprecated;
import 'package:cs_salvium/src/deprecated/get_height_by_date.dart'
as cs_salvium_deprecated;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
Expand All @@ -40,6 +42,7 @@ import '../../../wallets/wallet/impl/monero_wallet.dart';
import '../../../wallets/wallet/impl/wownero_wallet.dart';
import '../../../wallets/wallet/impl/xelis_wallet.dart';
import '../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../wallets/wallet/wallet.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart';
Expand Down Expand Up @@ -121,7 +124,8 @@ class _VerifyRecoveryPhraseViewState
});
}
viewOnlyWalletType = ViewOnlyWalletType.xPub;
} else if (widget.wallet is LibMoneroWallet) {
} else if (widget.wallet is LibMoneroWallet ||
widget.wallet is LibSalviumWallet) {
if (widget.wallet.cryptoCurrency is Monero) {
height = cs_monero_deprecated.getMoneroHeightByDate(
date: DateTime.now().subtract(const Duration(days: 7)),
Expand All @@ -132,6 +136,11 @@ class _VerifyRecoveryPhraseViewState
date: DateTime.now().subtract(const Duration(days: 7)),
);
}
if (widget.wallet.cryptoCurrency is Salvium) {
height = cs_salvium_deprecated.getSalviumHeightByDate(
date: DateTime.now().subtract(const Duration(days: 7)),
);
}
if (height < 0) height = 0;

viewOnlyWalletType = ViewOnlyWalletType.cryptonote;
Expand Down Expand Up @@ -188,6 +197,22 @@ class _VerifyRecoveryPhraseViewState

await w.exit();

viewOnlyData = CryptonoteViewOnlyWalletData(
walletId: voInfo.walletId,
address: address,
privateViewKey: privateViewKey,
);
} else if (widget.wallet is LibSalviumWallet) {
final w = widget.wallet as LibSalviumWallet;

final info =
await w
.hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing();
final address = info.$1;
final privateViewKey = info.$2;

await w.exit();

viewOnlyData = CryptonoteViewOnlyWalletData(
walletId: voInfo.walletId,
address: address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import '../../../../utilities/util.dart';
import '../../../../wallets/crypto_currency/crypto_currency.dart';
import '../../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../../widgets/background.dart';
import '../../../../widgets/conditional_parent.dart';
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
Expand Down Expand Up @@ -228,7 +229,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {

// strip unused path
String address = formData.host!;
if (coin is LibMoneroWallet) {
if (coin is LibMoneroWallet || coin is LibSalviumWallet) {
if (address.startsWith("http")) {
final uri = Uri.parse(address);
address = "${uri.scheme}://${uri.host}";
Expand Down Expand Up @@ -1069,7 +1070,7 @@ class _NodeFormState extends ConsumerState<NodeForm> {
} else {
enableSSLCheckbox = true;
}
} else if (widget.coin is LibMoneroWallet) {
} else if (widget.coin is LibMoneroWallet || widget.coin is LibSalviumWallet) {
if (newValue.startsWith("https://")) {
_useSSL = true;
} else if (newValue.startsWith("http://")) {
Expand Down Expand Up @@ -1276,7 +1277,7 @@ class _NodeFormState extends ConsumerState<NodeForm> {
),
],
),
if (widget.coin is LibMoneroWallet)
if (widget.coin is LibMoneroWallet || widget.coin is LibSalviumWallet)
Row(
children: [
GestureDetector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import '../../../../../wallets/wallet/impl/monero_wallet.dart';
import '../../../../../wallets/wallet/impl/wownero_wallet.dart';
import '../../../../../wallets/wallet/impl/xelis_wallet.dart';
import '../../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../../../wallets/wallet/wallet.dart';
import '../../../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../../../../wallets/wallet/wallet_mixin_interfaces/private_key_interface.dart';
Expand Down Expand Up @@ -505,7 +506,7 @@ abstract class SWB {

int restoreHeight = walletbackup['restoreHeight'] as int? ?? 0;
if (restoreHeight <= 0) {
if (wallet is EpiccashWallet || wallet is LibMoneroWallet) {
if (wallet is EpiccashWallet || wallet is LibMoneroWallet || wallet is LibSalviumWallet) {
restoreHeight = 0;
} else {
restoreHeight = walletbackup['storedChainHeight'] as int? ?? 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import '../../../wallets/crypto_currency/intermediate/nano_currency.dart';
import '../../../wallets/wallet/impl/bitcoin_frost_wallet.dart';
import '../../../wallets/wallet/impl/epiccash_wallet.dart';
import '../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart';
Expand Down Expand Up @@ -316,21 +317,23 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
}
}

KeyDataInterface? keyData;
if (wallet
is ViewOnlyOptionInterface &&
wallet.isViewOnly) {
keyData =
await wallet
.getViewOnlyWalletData();
} else if (wallet
is ExtendedKeysInterface) {
keyData =
await wallet.getXPrivs();
} else if (wallet
is LibMoneroWallet) {
keyData = await wallet.getKeys();
}
KeyDataInterface? keyData;
if (wallet
is ViewOnlyOptionInterface &&
wallet.isViewOnly) {
keyData =
await wallet
.getViewOnlyWalletData();
} else if (wallet
is ExtendedKeysInterface) {
keyData = await wallet.getXPrivs();
} else if (wallet
is LibMoneroWallet) {
keyData = await wallet.getKeys();
} else if (wallet
is LibSalviumWallet) {
keyData = await wallet.getKeys();
}

if (context.mounted) {
if (keyData != null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import '../../../../utilities/text_styles.dart';
import '../../../../wallets/isar/models/wallet_info.dart';
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/lelantus_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/multi_address_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/rbf_interface.dart';
Expand Down Expand Up @@ -423,8 +424,8 @@ class _WalletSettingsWalletSettingsViewState
),
),
),
if (wallet is LibMoneroWallet) const SizedBox(height: 8),
if (wallet is LibMoneroWallet)
if (wallet is LibMoneroWallet || wallet is LibSalviumWallet) const SizedBox(height: 8),
if (wallet is LibMoneroWallet || wallet is LibSalviumWallet)
RoundedWhiteContainer(
padding: const EdgeInsets.all(0),
child: RawMaterialButton(
Expand Down
3 changes: 3 additions & 0 deletions lib/pages/special/firo_rescan_recovery_error_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import '../../utilities/text_styles.dart';
import '../../utilities/util.dart';
import '../../wallets/isar/providers/wallet_info_provider.dart';
import '../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../widgets/background.dart';
Expand Down Expand Up @@ -283,6 +284,8 @@ class _FiroRescanRecoveryErrorViewState
keyData = await wallet.getXPrivs();
} else if (wallet is LibMoneroWallet) {
keyData = await wallet.getKeys();
} else if (wallet is LibSalviumWallet) {
keyData = await wallet.getKeys();
}

if (context.mounted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import '../../../../wallets/isar/models/spark_coin.dart';
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../../wallets/wallet/impl/epiccash_wallet.dart';
import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/rbf_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
import '../../../../widgets/background.dart';
Expand Down Expand Up @@ -186,7 +187,7 @@ class _TransactionV2DetailsViewState
final wallet = ref.read(pWallets).getWallet(walletId);

hasTxKeyProbably =
wallet is LibMoneroWallet &&
(wallet is LibMoneroWallet || wallet is LibSalviumWallet) &&
(_transaction.type == TransactionType.outgoing ||
_transaction.type == TransactionType.sentToSelf);

Expand Down
3 changes: 2 additions & 1 deletion lib/pages/wallet_view/wallet_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import '../../wallets/wallet/impl/bitcoin_frost_wallet.dart';
import '../../wallets/wallet/impl/firo_wallet.dart';
import '../../wallets/wallet/impl/namecoin_wallet.dart';
import '../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart';
Expand Down Expand Up @@ -1295,7 +1296,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
);
},
),
if (wallet is LibMoneroWallet && !viewOnly)
if ((wallet is LibMoneroWallet || wallet is LibSalviumWallet) && !viewOnly)
WalletNavigationBarItemData(
label: "Churn",
icon: const ChurnNavIcon(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import '../../../../wallets/crypto_currency/coins/firo.dart';
import '../../../../wallets/wallet/impl/firo_wallet.dart';
import '../../../../wallets/wallet/impl/namecoin_wallet.dart';
import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../../wallets/wallet/wallet.dart' show Wallet;
import '../../../../wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
Expand Down Expand Up @@ -442,7 +443,7 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
if (!isViewOnly && wallet is CashFusionInterface)
(WalletFeature.fusion, Assets.svg.cashFusion, _onFusionPressed),

if (!isViewOnly && wallet is LibMoneroWallet)
if (!isViewOnly && (wallet is LibMoneroWallet || wallet is LibSalviumWallet))
(WalletFeature.churn, Assets.svg.churn, _onChurnPressed),

if (wallet is NamecoinWallet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import '../../../../utilities/constants.dart';
import '../../../../utilities/text_styles.dart';
import '../../../../wallets/wallet/impl/bitcoin_frost_wallet.dart';
import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart';
Expand Down Expand Up @@ -118,6 +119,8 @@ class _UnlockWalletKeysDesktopState
keyData = await wallet.getXPrivs();
} else if (wallet is LibMoneroWallet) {
keyData = await wallet.getKeys();
} else if (wallet is LibSalviumWallet) {
keyData = await wallet.getKeys();
}

if (mounted) {
Expand Down
Loading
Loading