particl and namecoin refactor skeleton code with some interface clean up

This commit is contained in:
julian 2024-01-08 09:13:44 -06:00
parent 1239fd9a36
commit 72eee46220
16 changed files with 478 additions and 1628 deletions

View file

@ -19,7 +19,6 @@ import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/pages/coin_control/utxo_card.dart';
import 'package:stackwallet/pages/coin_control/utxo_details_view.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/amount/amount_formatter.dart';
@ -28,6 +27,7 @@ import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import 'package:stackwallet/widgets/animated_widgets/rotate_icon.dart';
import 'package:stackwallet/widgets/app_bar_field.dart';
import 'package:stackwallet/widgets/background.dart';
@ -85,7 +85,7 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
Future<void> _refreshBalance() async {
final coinControlInterface =
ref.read(pWallets).getWallet(widget.walletId) as CoinControlInterface;
await coinControlInterface.refreshBalance(notify: true);
await coinControlInterface.updateBalance();
}
@override

View file

@ -32,7 +32,6 @@ import 'package:stackwallet/providers/ui/fee_rate_type_state_provider.dart';
import 'package:stackwallet/providers/ui/preview_tx_button_state_provider.dart';
import 'package:stackwallet/providers/wallet/public_private_balance_state_provider.dart';
import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/address_utils.dart';
@ -54,6 +53,7 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
import 'package:stackwallet/wallets/models/tx_data.dart';
import 'package:stackwallet/wallets/wallet/impl/firo_wallet.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
import 'package:stackwallet/widgets/animated_text.dart';

View file

@ -50,8 +50,6 @@ import 'package:stackwallet/services/event_bus/events/global/node_connection_sta
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/services/mixins/ordinals_interface.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/theme_providers.dart';
@ -67,6 +65,8 @@ import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
import 'package:stackwallet/wallets/wallet/impl/firo_wallet.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
import 'package:stackwallet/widgets/background.dart';

View file

@ -31,7 +31,6 @@ import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/providers/ui/fee_rate_type_state_provider.dart';
import 'package:stackwallet/providers/ui/preview_tx_button_state_provider.dart';
import 'package:stackwallet/providers/wallet/public_private_balance_state_provider.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/address_utils.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
@ -52,6 +51,7 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
import 'package:stackwallet/wallets/models/tx_data.dart';
import 'package:stackwallet/wallets/wallet/impl/firo_wallet.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
import 'package:stackwallet/widgets/animated_text.dart';

View file

@ -29,8 +29,6 @@ import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
import 'package:stackwallet/providers/global/paynym_api_provider.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/services/mixins/ordinals_interface.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/theme_providers.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
@ -41,6 +39,8 @@ import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/wallets/wallet/impl/firo_wallet.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';

View file

@ -13,13 +13,13 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/providers/global/prefs_provider.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/services/mixins/ordinals_interface.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';

View file

@ -34,7 +34,6 @@ import 'package:stackwallet/services/event_bus/events/global/refresh_percent_cha
import 'package:stackwallet/services/event_bus/events/global/updated_in_background_event.dart';
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/services/mixins/electrum_x_parsing.dart';
import 'package:stackwallet/services/mixins/wallet_cache.dart';
import 'package:stackwallet/services/mixins/wallet_db.dart';
@ -103,8 +102,13 @@ String constructDerivePath({
}
class NamecoinWallet extends CoinServiceAPI
with WalletCache, WalletDB, ElectrumXParsing, CoinControlInterface
implements XPubAble {
with
WalletCache,
WalletDB,
ElectrumXParsing
// , CoinControlInterface
implements
XPubAble {
NamecoinWallet({
required String walletId,
required String walletName,
@ -124,17 +128,17 @@ class NamecoinWallet extends CoinServiceAPI
_secureStore = secureStore;
initCache(walletId, coin);
initWalletDB(mockableOverride: mockableOverride);
initCoinControlInterface(
walletId: walletId,
walletName: walletName,
coin: coin,
db: db,
getChainHeight: () => chainHeight,
refreshedBalanceCallback: (balance) async {
_balance = balance;
await updateCachedBalance(_balance!);
},
);
// initCoinControlInterface(
// walletId: walletId,
// walletName: walletName,
// coin: coin,
// db: db,
// getChainHeight: () => chainHeight,
// refreshedBalanceCallback: (balance) async {
// _balance = balance;
// await updateCachedBalance(_balance!);
// },
// );
}
static const integrationTestFlag =
@ -1903,7 +1907,7 @@ class NamecoinWallet extends CoinServiceAPI
}
Future<void> _updateBalance() async {
await refreshBalance();
// await refreshBalance();
}
@override

View file

@ -34,7 +34,6 @@ import 'package:stackwallet/services/event_bus/events/global/refresh_percent_cha
import 'package:stackwallet/services/event_bus/events/global/updated_in_background_event.dart';
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/services/mixins/wallet_cache.dart';
import 'package:stackwallet/services/mixins/wallet_db.dart';
import 'package:stackwallet/services/mixins/xpubable.dart';
@ -98,8 +97,12 @@ String constructDerivePath({
}
class ParticlWallet extends CoinServiceAPI
with WalletCache, WalletDB, CoinControlInterface
implements XPubAble {
with
WalletCache,
WalletDB
// , CoinControlInterface
implements
XPubAble {
ParticlWallet({
required String walletId,
required String walletName,
@ -119,17 +122,17 @@ class ParticlWallet extends CoinServiceAPI
_secureStore = secureStore;
initCache(walletId, coin);
initWalletDB(mockableOverride: mockableOverride);
initCoinControlInterface(
walletId: walletId,
walletName: walletName,
coin: coin,
db: db,
getChainHeight: () => chainHeight,
refreshedBalanceCallback: (balance) async {
_balance = balance;
await updateCachedBalance(_balance!);
},
);
// initCoinControlInterface(
// walletId: walletId,
// walletName: walletName,
// coin: coin,
// db: db,
// getChainHeight: () => chainHeight,
// refreshedBalanceCallback: (balance) async {
// _balance = balance;
// await updateCachedBalance(_balance!);
// },
// );
}
static const integrationTestFlag =
@ -1790,7 +1793,7 @@ class ParticlWallet extends CoinServiceAPI
}
Future<void> _updateBalance() async {
await refreshBalance();
// await refreshBalance();
}
@override

View file

@ -1,108 +1,108 @@
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
import 'dart:async';
import 'package:isar/isar.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/models/balance.dart';
import 'package:stackwallet/services/event_bus/events/global/balance_refreshed_event.dart';
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
mixin CoinControlInterface {
late final String _walletId;
late final String _walletName;
late final Coin _coin;
late final MainDB _db;
late final Future<int> Function() _getChainHeight;
late final Future<void> Function(Balance) _refreshedBalanceCallback;
void initCoinControlInterface({
required String walletId,
required String walletName,
required Coin coin,
required MainDB db,
required Future<int> Function() getChainHeight,
required Future<void> Function(Balance) refreshedBalanceCallback,
}) {
_walletId = walletId;
_walletName = walletName;
_coin = coin;
_db = db;
_getChainHeight = getChainHeight;
_refreshedBalanceCallback = refreshedBalanceCallback;
}
Future<void> refreshBalance({bool notify = false}) async {
final utxos = await _db.getUTXOs(_walletId).findAll();
final currentChainHeight = await _getChainHeight();
Amount satoshiBalanceTotal = Amount(
rawValue: BigInt.zero,
fractionDigits: _coin.decimals,
);
Amount satoshiBalancePending = Amount(
rawValue: BigInt.zero,
fractionDigits: _coin.decimals,
);
Amount satoshiBalanceSpendable = Amount(
rawValue: BigInt.zero,
fractionDigits: _coin.decimals,
);
Amount satoshiBalanceBlocked = Amount(
rawValue: BigInt.zero,
fractionDigits: _coin.decimals,
);
for (final utxo in utxos) {
final utxoAmount = Amount(
rawValue: BigInt.from(utxo.value),
fractionDigits: _coin.decimals,
);
satoshiBalanceTotal += utxoAmount;
if (utxo.isBlocked) {
satoshiBalanceBlocked += utxoAmount;
} else {
// TODO: [prio=high] Fix this
throw UnimplementedError(
"Fix the following 42 (should be min confirms)");
if (utxo.isConfirmed(
currentChainHeight,
42,
)) {
satoshiBalanceSpendable += utxoAmount;
} else {
satoshiBalancePending += utxoAmount;
}
}
}
final balance = Balance(
total: satoshiBalanceTotal,
spendable: satoshiBalanceSpendable,
blockedTotal: satoshiBalanceBlocked,
pendingSpendable: satoshiBalancePending,
);
await _refreshedBalanceCallback(balance);
if (notify) {
GlobalEventBus.instance.fire(
BalanceRefreshedEvent(
_walletId,
),
);
}
}
}
// /*
// * This file is part of Stack Wallet.
// *
// * Copyright (c) 2023 Cypher Stack
// * All Rights Reserved.
// * The code is distributed under GPLv3 license, see LICENSE file for details.
// * Generated by Cypher Stack on 2023-05-26
// *
// */
//
// import 'dart:async';
//
// import 'package:isar/isar.dart';
// import 'package:stackwallet/db/isar/main_db.dart';
// import 'package:stackwallet/models/balance.dart';
// import 'package:stackwallet/services/event_bus/events/global/balance_refreshed_event.dart';
// import 'package:stackwallet/services/event_bus/global_event_bus.dart';
// import 'package:stackwallet/utilities/amount/amount.dart';
// import 'package:stackwallet/utilities/enums/coin_enum.dart';
//
// mixin CoinControlInterface {
// late final String _walletId;
// late final String _walletName;
// late final Coin _coin;
// late final MainDB _db;
// late final Future<int> Function() _getChainHeight;
// late final Future<void> Function(Balance) _refreshedBalanceCallback;
//
// void initCoinControlInterface({
// required String walletId,
// required String walletName,
// required Coin coin,
// required MainDB db,
// required Future<int> Function() getChainHeight,
// required Future<void> Function(Balance) refreshedBalanceCallback,
// }) {
// _walletId = walletId;
// _walletName = walletName;
// _coin = coin;
// _db = db;
// _getChainHeight = getChainHeight;
// _refreshedBalanceCallback = refreshedBalanceCallback;
// }
//
// Future<void> refreshBalance({bool notify = false}) async {
// final utxos = await _db.getUTXOs(_walletId).findAll();
// final currentChainHeight = await _getChainHeight();
//
// Amount satoshiBalanceTotal = Amount(
// rawValue: BigInt.zero,
// fractionDigits: _coin.decimals,
// );
// Amount satoshiBalancePending = Amount(
// rawValue: BigInt.zero,
// fractionDigits: _coin.decimals,
// );
// Amount satoshiBalanceSpendable = Amount(
// rawValue: BigInt.zero,
// fractionDigits: _coin.decimals,
// );
// Amount satoshiBalanceBlocked = Amount(
// rawValue: BigInt.zero,
// fractionDigits: _coin.decimals,
// );
//
// for (final utxo in utxos) {
// final utxoAmount = Amount(
// rawValue: BigInt.from(utxo.value),
// fractionDigits: _coin.decimals,
// );
//
// satoshiBalanceTotal += utxoAmount;
//
// if (utxo.isBlocked) {
// satoshiBalanceBlocked += utxoAmount;
// } else {
// // TODO: [prio=high] Fix this
// throw UnimplementedError(
// "Fix the following 42 (should be min confirms)");
// if (utxo.isConfirmed(
// currentChainHeight,
// 42,
// )) {
// satoshiBalanceSpendable += utxoAmount;
// } else {
// satoshiBalancePending += utxoAmount;
// }
// }
// }
//
// final balance = Balance(
// total: satoshiBalanceTotal,
// spendable: satoshiBalanceSpendable,
// blockedTotal: satoshiBalanceBlocked,
// pendingSpendable: satoshiBalancePending,
// );
//
// await _refreshedBalanceCallback(balance);
//
// if (notify) {
// GlobalEventBus.instance.fire(
// BalanceRefreshedEvent(
// _walletId,
// ),
// );
// }
// }
// }

View file

@ -1,48 +0,0 @@
mixin OrdinalsInterface {
// late final String _walletId;
// late final Coin _coin;
// late final MainDB _db;
//
// void initOrdinalsInterface({
// required String walletId,
// required Coin coin,
// required MainDB db,
// }) {
// _walletId = walletId;
// _coin = coin;
// _db = db;
// }
//
// final LitescribeAPI litescribeAPI =
// LitescribeAPI(baseUrl: 'https://litescribe.io/api');
//
//
//
//
//
// // // check if an inscription is in a given <UTXO> output
// // Future<bool> inscriptionInOutput(UTXO output) async {
// // if (output.address != null) {
// // var inscriptions =
// // await litescribeAPI.getInscriptionsByAddress("${output.address}");
// // if (inscriptions.isNotEmpty) {
// // return true;
// // } else {
// // return false;
// // }
// // } else {
// // throw UnimplementedError(
// // 'TODO look up utxo without address. utxo->txid:output->address');
// // }
// // }
//
// // check if an inscription is in a given <UTXO> output
// Future<bool> inscriptionInAddress(String address) async {
// var inscriptions = await litescribeAPI.getInscriptionsByAddress(address);
// if (inscriptions.isNotEmpty) {
// return true;
// } else {
// return false;
// }
// }
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,87 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/crypto_currency/intermediate/bip39_hd_currency.dart';
class Namecoin extends Bip39HDCurrency {
Namecoin(super.network) {
switch (network) {
case CryptoCurrencyNetwork.main:
coin = Coin.namecoin;
default:
throw Exception("Unsupported network: $network");
}
}
@override
// TODO: implement minConfirms
int get minConfirms => throw UnimplementedError();
@override
String constructDerivePath({
required DerivePathType derivePathType,
int account = 0,
required int chain,
required int index,
}) {
// TODO: implement constructDerivePath
throw UnimplementedError();
}
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "namecoin.stackwallet.com",
port: 57002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.namecoin),
useSSL: true,
enabled: true,
coinName: Coin.namecoin.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
@override
// TODO: implement dustLimit
Amount get dustLimit => throw UnimplementedError();
@override
// TODO: implement genesisHash
String get genesisHash => throw UnimplementedError();
@override
({coinlib.Address address, AddressType addressType}) getAddressForPublicKey(
{required coinlib.ECPublicKey publicKey,
required DerivePathType derivePathType}) {
// TODO: implement getAddressForPublicKey
throw UnimplementedError();
}
@override
// TODO: implement networkParams
coinlib.NetworkParams get networkParams => throw UnimplementedError();
@override
// TODO: implement supportedDerivationPathTypes
List<DerivePathType> get supportedDerivationPathTypes =>
throw UnimplementedError();
@override
bool validateAddress(String address) {
// TODO: implement validateAddress
throw UnimplementedError();
}
}

View file

@ -0,0 +1,86 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/crypto_currency/intermediate/bip39_hd_currency.dart';
class Particl extends Bip39HDCurrency {
Particl(super.network) {
switch (network) {
case CryptoCurrencyNetwork.main:
coin = Coin.particl;
default:
throw Exception("Unsupported network: $network");
}
}
@override
// TODO: implement minConfirms
int get minConfirms => throw UnimplementedError();
@override
String constructDerivePath(
{required DerivePathType derivePathType,
int account = 0,
required int chain,
required int index}) {
// TODO: implement constructDerivePath
throw UnimplementedError();
}
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "particl.stackwallet.com",
port: 58002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.particl),
useSSL: true,
enabled: true,
coinName: Coin.particl.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
@override
// TODO: implement dustLimit
Amount get dustLimit => throw UnimplementedError();
@override
// TODO: implement genesisHash
String get genesisHash => throw UnimplementedError();
@override
({coinlib.Address address, AddressType addressType}) getAddressForPublicKey(
{required coinlib.ECPublicKey publicKey,
required DerivePathType derivePathType}) {
// TODO: implement getAddressForPublicKey
throw UnimplementedError();
}
@override
// TODO: implement networkParams
coinlib.NetworkParams get networkParams => throw UnimplementedError();
@override
// TODO: implement supportedDerivationPathTypes
List<DerivePathType> get supportedDerivationPathTypes =>
throw UnimplementedError();
@override
bool validateAddress(String address) {
// TODO: implement validateAddress
throw UnimplementedError();
}
}

View file

@ -0,0 +1,71 @@
import 'package:isar/isar.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/namecoin.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart';
class NamecoinWallet extends Bip39HDWallet
with ElectrumXInterface, CoinControlInterface {
@override
int get isarTransactionVersion => 2;
NamecoinWallet(CryptoCurrencyNetwork network) : super(Namecoin(network));
// TODO: double check these filter operations are correct and do not require additional parameters
@override
FilterOperation? get changeAddressFilterOperation =>
FilterGroup.and(standardChangeAddressFilters);
@override
FilterOperation? get receivingAddressFilterOperation =>
FilterGroup.and(standardReceivingAddressFilters);
// ===========================================================================
@override
Future<List<Address>> fetchAddressesForElectrumXScan() async {
final allAddresses = await mainDB
.getAddresses(walletId)
.filter()
.not()
.group(
(q) => q
.typeEqualTo(AddressType.nonWallet)
.or()
.subTypeEqualTo(AddressSubType.nonWallet),
)
.findAll();
return allAddresses;
}
// ===========================================================================
@override
Future<({bool blocked, String? blockedReason, String? utxoLabel})>
checkBlockUTXO(Map<String, dynamic> jsonUTXO, String? scriptPubKeyHex,
Map<String, dynamic> jsonTX, String? utxoOwnerAddress) {
// TODO: implement checkBlockUTXO
throw UnimplementedError();
}
@override
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
// TODO: implement estimateTxFee
throw UnimplementedError();
}
@override
Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
// TODO: implement roughFeeEstimate
throw UnimplementedError();
}
@override
Future<void> updateTransactions() {
// TODO: implement updateTransactions
throw UnimplementedError();
}
}

View file

@ -0,0 +1,71 @@
import 'package:isar/isar.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/particl.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart';
class ParticlWallet extends Bip39HDWallet
with ElectrumXInterface, CoinControlInterface {
@override
int get isarTransactionVersion => 2;
ParticlWallet(CryptoCurrencyNetwork network) : super(Particl(network));
// TODO: double check these filter operations are correct and do not require additional parameters
@override
FilterOperation? get changeAddressFilterOperation =>
FilterGroup.and(standardChangeAddressFilters);
@override
FilterOperation? get receivingAddressFilterOperation =>
FilterGroup.and(standardReceivingAddressFilters);
// ===========================================================================
@override
Future<List<Address>> fetchAddressesForElectrumXScan() async {
final allAddresses = await mainDB
.getAddresses(walletId)
.filter()
.not()
.group(
(q) => q
.typeEqualTo(AddressType.nonWallet)
.or()
.subTypeEqualTo(AddressSubType.nonWallet),
)
.findAll();
return allAddresses;
}
// ===========================================================================
@override
Future<({bool blocked, String? blockedReason, String? utxoLabel})>
checkBlockUTXO(Map<String, dynamic> jsonUTXO, String? scriptPubKeyHex,
Map<String, dynamic> jsonTX, String? utxoOwnerAddress) {
// TODO: implement checkBlockUTXO
throw UnimplementedError();
}
@override
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
// TODO: implement estimateTxFee
throw UnimplementedError();
}
@override
Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
// TODO: implement roughFeeEstimate
throw UnimplementedError();
}
@override
Future<void> updateTransactions() {
// TODO: implement updateTransactions
throw UnimplementedError();
}
}

View file

@ -30,7 +30,9 @@ import 'package:stackwallet/wallets/wallet/impl/ecash_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/epiccash_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/firo_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/litecoin_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/namecoin_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/nano_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/particl_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/tezos_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/wownero_wallet.dart';
import 'package:stackwallet/wallets/wallet/private_key_based_wallet.dart';
@ -279,9 +281,15 @@ abstract class Wallet<T extends CryptoCurrency> {
case Coin.litecoinTestNet:
return LitecoinWallet(CryptoCurrencyNetwork.test);
case Coin.namecoin:
return NamecoinWallet(CryptoCurrencyNetwork.main);
case Coin.nano:
return NanoWallet(CryptoCurrencyNetwork.main);
case Coin.particl:
return ParticlWallet(CryptoCurrencyNetwork.main);
case Coin.tezos:
return TezosWallet(CryptoCurrencyNetwork.main);