mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
btc testnet4
This commit is contained in:
parent
b7b28115b2
commit
1495eaa6d2
24 changed files with 115 additions and 66 deletions
|
@ -63,7 +63,7 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
|||
String _searchTerm = "";
|
||||
|
||||
final _coinsTestnet = [
|
||||
...AppConfig.coins.where((e) => e.network == CryptoCurrencyNetwork.test),
|
||||
...AppConfig.coins.where((e) => e.network.isTestNet),
|
||||
];
|
||||
final _coins = [
|
||||
...AppConfig.coins.where((e) => e.network == CryptoCurrencyNetwork.main),
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
import '../../app_config.dart';
|
||||
import '../../models/isar/models/blockchain_data/address.dart';
|
||||
import '../../models/isar/models/contact_entry.dart';
|
||||
import 'subviews/add_address_book_entry_view.dart';
|
||||
import 'subviews/address_book_filter_view.dart';
|
||||
import '../../providers/db/main_db_provider.dart';
|
||||
import '../../providers/global/address_book_service_provider.dart';
|
||||
import '../../providers/providers.dart';
|
||||
|
@ -35,6 +34,8 @@ import '../../widgets/icon_widgets/x_icon.dart';
|
|||
import '../../widgets/rounded_white_container.dart';
|
||||
import '../../widgets/stack_text_field.dart';
|
||||
import '../../widgets/textfield_icon_button.dart';
|
||||
import 'subviews/add_address_book_entry_view.dart';
|
||||
import 'subviews/address_book_filter_view.dart';
|
||||
|
||||
class AddressBookView extends ConsumerStatefulWidget {
|
||||
const AddressBookView({
|
||||
|
@ -67,7 +68,7 @@ class _AddressBookViewState extends ConsumerState<AddressBookView> {
|
|||
if (widget.coin == null) {
|
||||
final coins = [...AppConfig.coins];
|
||||
coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
(e) => e is Firo && e.network.isTestNet,
|
||||
);
|
||||
|
||||
final bool showTestNet =
|
||||
|
|
|
@ -43,7 +43,7 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
|
|||
void initState() {
|
||||
final coins = [...AppConfig.coins];
|
||||
coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
(e) => e is Firo && e.network.isTestNet,
|
||||
);
|
||||
|
||||
final showTestNet = ref.read(prefsChangeNotifierProvider).showTestNetCoins;
|
||||
|
|
|
@ -13,8 +13,9 @@ import 'dart:io';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import '../../../providers/global/prefs_provider.dart';
|
||||
|
||||
import '../../../app_config.dart';
|
||||
import '../../../providers/global/prefs_provider.dart';
|
||||
import '../../../themes/coin_image_provider.dart';
|
||||
import '../../../themes/stack_colors.dart';
|
||||
import '../../../utilities/constants.dart';
|
||||
|
@ -29,7 +30,7 @@ class CoinSelectSheet extends StatelessWidget {
|
|||
final maxHeight = MediaQuery.of(context).size.height * 0.60;
|
||||
final coins_ = [...AppConfig.coins];
|
||||
coins_.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
(e) => e is Firo && e.network.isTestNet,
|
||||
);
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
|
|
|
@ -15,11 +15,11 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'coin_select_sheet.dart';
|
||||
|
||||
import '../../../app_config.dart';
|
||||
import '../../../providers/providers.dart';
|
||||
// import 'package:stackwallet/providers/global/should_show_lockscreen_on_resume_state_provider.dart';
|
||||
import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart';
|
||||
import '../../../app_config.dart';
|
||||
import '../../../themes/coin_icon_provider.dart';
|
||||
import '../../../themes/stack_colors.dart';
|
||||
import '../../../utilities/address_utils.dart';
|
||||
|
@ -36,6 +36,7 @@ import '../../../widgets/icon_widgets/qrcode_icon.dart';
|
|||
import '../../../widgets/icon_widgets/x_icon.dart';
|
||||
import '../../../widgets/stack_text_field.dart';
|
||||
import '../../../widgets/textfield_icon_button.dart';
|
||||
import 'coin_select_sheet.dart';
|
||||
|
||||
class NewContactAddressEntryForm extends ConsumerStatefulWidget {
|
||||
const NewContactAddressEntryForm({
|
||||
|
@ -92,7 +93,7 @@ class _NewContactAddressEntryFormState
|
|||
if (isDesktop) {
|
||||
coins = [...AppConfig.coins];
|
||||
coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
(e) => e is Firo && e.network.isTestNet,
|
||||
);
|
||||
|
||||
final showTestNet =
|
||||
|
|
|
@ -392,8 +392,7 @@ class _SendViewState extends ConsumerState<SendView> {
|
|||
ref.read(pValidSparkSendToAddress.notifier).state =
|
||||
SparkInterface.validateSparkAddress(
|
||||
address: address ?? "",
|
||||
isTestNet:
|
||||
wallet.cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: wallet.cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class _ManageNodesViewState extends ConsumerState<ManageNodesView> {
|
|||
void initState() {
|
||||
_coins = _coins.toList();
|
||||
_coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
(e) => e is Firo && e.network.isTestNet,
|
||||
);
|
||||
super.initState();
|
||||
}
|
||||
|
|
|
@ -377,7 +377,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
Future<void> _onExchangePressed(BuildContext context) async {
|
||||
final CryptoCurrency coin = ref.read(pWalletCoin(walletId));
|
||||
|
||||
if (coin.network == CryptoCurrencyNetwork.test) {
|
||||
if (coin.network.isTestNet) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => const StackOkDialog(
|
||||
|
@ -423,7 +423,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
Future<void> _onBuyPressed(BuildContext context) async {
|
||||
final CryptoCurrency coin = ref.read(pWalletCoin(walletId));
|
||||
|
||||
if (coin.network == CryptoCurrencyNetwork.test) {
|
||||
if (coin.network.isTestNet) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => const StackOkDialog(
|
||||
|
|
|
@ -11,13 +11,12 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
import '../../app_config.dart';
|
||||
import '../../models/isar/models/blockchain_data/address.dart';
|
||||
import '../../models/isar/models/contact_entry.dart';
|
||||
import '../../pages/address_book_views/subviews/add_address_book_entry_view.dart';
|
||||
import '../../pages/address_book_views/subviews/address_book_filter_view.dart';
|
||||
import 'subwidgets/desktop_address_book_scaffold.dart';
|
||||
import 'subwidgets/desktop_contact_details.dart';
|
||||
import '../../providers/db/main_db_provider.dart';
|
||||
import '../../providers/global/address_book_service_provider.dart';
|
||||
import '../../providers/providers.dart';
|
||||
|
@ -40,6 +39,8 @@ import '../../widgets/rounded_container.dart';
|
|||
import '../../widgets/rounded_white_container.dart';
|
||||
import '../../widgets/stack_text_field.dart';
|
||||
import '../../widgets/textfield_icon_button.dart';
|
||||
import 'subwidgets/desktop_address_book_scaffold.dart';
|
||||
import 'subwidgets/desktop_contact_details.dart';
|
||||
|
||||
class DesktopAddressBook extends ConsumerStatefulWidget {
|
||||
const DesktopAddressBook({super.key});
|
||||
|
@ -99,7 +100,7 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
|
|||
// if (widget.coin == null) {
|
||||
final coins = AppConfig.coins.toList();
|
||||
coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
(e) => e is Firo && e.network.isTestNet,
|
||||
);
|
||||
|
||||
final bool showTestNet =
|
||||
|
|
|
@ -704,8 +704,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
ref.read(pValidSparkSendToAddress.notifier).state =
|
||||
SparkInterface.validateSparkAddress(
|
||||
address: address ?? "",
|
||||
isTestNet:
|
||||
wallet.cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: wallet.cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1468,7 +1467,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
if (_data != null && _data!.contactLabel == _address) {
|
||||
error = SparkInterface.validateSparkAddress(
|
||||
address: _data!.address,
|
||||
isTestNet: coin.network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: coin.network.isTestNet,
|
||||
)
|
||||
? "Lelantus to Spark not supported"
|
||||
: null;
|
||||
|
|
|
@ -69,7 +69,7 @@ class _NodesSettings extends ConsumerState<NodesSettings> {
|
|||
void initState() {
|
||||
_coins = _coins.toList();
|
||||
_coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
(e) => e is Firo && e.network.isTestNet,
|
||||
);
|
||||
|
||||
searchNodeController = TextEditingController();
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'package:frostdart/frostdart.dart';
|
|||
import 'package:frostdart/frostdart_bindings_generated.dart';
|
||||
import 'package:frostdart/output.dart';
|
||||
import 'package:frostdart/util.dart';
|
||||
|
||||
import '../models/isar/models/blockchain_data/utxo.dart';
|
||||
import '../utilities/amount/amount.dart';
|
||||
import '../utilities/extensions/extensions.dart';
|
||||
|
@ -83,9 +84,8 @@ abstract class Frost {
|
|||
required CryptoCurrency coin,
|
||||
}) {
|
||||
try {
|
||||
final network = coin.network == CryptoCurrencyNetwork.test
|
||||
? Network.Testnet
|
||||
: Network.Mainnet;
|
||||
final network =
|
||||
coin.network.isTestNet ? Network.Testnet : Network.Mainnet;
|
||||
final signConfigPointer = decodedSignConfig(
|
||||
encodedConfig: signConfig,
|
||||
network: network,
|
||||
|
|
|
@ -11,7 +11,6 @@ import '../../utilities/extensions/impl/string.dart';
|
|||
import '../../utilities/extensions/impl/uint8_list.dart';
|
||||
import '../../utilities/format.dart';
|
||||
import '../../utilities/logger.dart';
|
||||
import '../crypto_currency/crypto_currency.dart';
|
||||
import '../crypto_currency/intermediate/bip39_hd_currency.dart';
|
||||
import '../models/tx_data.dart';
|
||||
|
||||
|
@ -92,7 +91,7 @@ abstract final class LelantusFfiWrapper {
|
|||
mintKeyPair.privateKey!.toHex,
|
||||
currentIndex,
|
||||
mintKeyPair.identifier.toHex,
|
||||
isTestnet: args.cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestnet: args.cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
|
||||
for (int setId = 1; setId <= args.latestSetId; setId++) {
|
||||
|
@ -117,8 +116,7 @@ abstract final class LelantusFfiWrapper {
|
|||
amount,
|
||||
mintKeyPair.privateKey!.toHex,
|
||||
currentIndex,
|
||||
isTestnet:
|
||||
args.cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestnet: args.cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
final bool isUsed = args.usedSerialNumbers.contains(serialNumber);
|
||||
|
||||
|
@ -162,8 +160,7 @@ abstract final class LelantusFfiWrapper {
|
|||
amount,
|
||||
aesPrivateKey,
|
||||
currentIndex,
|
||||
isTestnet:
|
||||
args.cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestnet: args.cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
final bool isUsed = args.usedSerialNumbers.contains(serialNumber);
|
||||
|
||||
|
@ -314,7 +311,7 @@ abstract final class LelantusFfiWrapper {
|
|||
spendAmount: spendAmount,
|
||||
subtractFeeFromAmount: arg.subtractFeeFromAmount,
|
||||
lelantusEntries: arg.lelantusEntries,
|
||||
isTestNet: arg.cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: arg.cryptoCurrency.network.isTestNet,
|
||||
),
|
||||
);
|
||||
final changeToMint = estimateJoinSplitFee.changeToMint;
|
||||
|
@ -364,7 +361,7 @@ abstract final class LelantusFfiWrapper {
|
|||
changeToMint,
|
||||
jmintprivatekey,
|
||||
arg.index,
|
||||
isTestnet: arg.cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestnet: arg.cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
|
||||
final _derivePath = "${arg.partialDerivationPath}$JMINT_INDEX/$keyPath";
|
||||
|
@ -378,7 +375,7 @@ abstract final class LelantusFfiWrapper {
|
|||
arg.index,
|
||||
Format.uint8listToString(jmintKeyPair.identifier),
|
||||
aesPrivateKey,
|
||||
isTestnet: arg.cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestnet: arg.cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
|
||||
tx.addOutput(
|
||||
|
@ -434,7 +431,7 @@ abstract final class LelantusFfiWrapper {
|
|||
anonymitySets,
|
||||
anonymitySetHashes,
|
||||
groupBlockHashes,
|
||||
isTestnet: arg.cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestnet: arg.cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
|
||||
final finalTx = bitcoindart.TransactionBuilder(network: _network);
|
||||
|
|
|
@ -24,6 +24,10 @@ class Bitcoin extends Bip39HDCurrency
|
|||
_id = "bitcoinTestNet";
|
||||
_name = "tBitcoin";
|
||||
_ticker = "tBTC";
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
_id = "bitcoinTestNet4";
|
||||
_name = "t4Bitcoin";
|
||||
_ticker = "t4BTC";
|
||||
default:
|
||||
throw Exception("Unsupported network: $network");
|
||||
}
|
||||
|
@ -71,6 +75,8 @@ class Bitcoin extends Bip39HDCurrency
|
|||
return "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f";
|
||||
case CryptoCurrencyNetwork.test:
|
||||
return "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943";
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
return "00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043";
|
||||
default:
|
||||
throw Exception("Unsupported network: $network");
|
||||
}
|
||||
|
@ -99,6 +105,7 @@ class Bitcoin extends Bip39HDCurrency
|
|||
feePerKb: BigInt.from(1), // Not used in stack wallet currently
|
||||
);
|
||||
case CryptoCurrencyNetwork.test:
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
return coinlib.Network(
|
||||
wifPrefix: 0xef,
|
||||
p2pkhPrefix: 0x6f,
|
||||
|
@ -247,6 +254,19 @@ class Bitcoin extends Bip39HDCurrency
|
|||
isDown: false,
|
||||
);
|
||||
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
return NodeModel(
|
||||
host: "bitcoin-testnet4.stackwallet.com",
|
||||
port: 50002,
|
||||
name: DefaultNodes.defaultName,
|
||||
id: DefaultNodes.buildId(this),
|
||||
useSSL: true,
|
||||
enabled: true,
|
||||
coinName: identifier,
|
||||
isFailover: true,
|
||||
isDown: false,
|
||||
);
|
||||
|
||||
default:
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
@ -286,6 +306,8 @@ class Bitcoin extends Bip39HDCurrency
|
|||
return Uri.parse("https://mempool.space/tx/$txid");
|
||||
case CryptoCurrencyNetwork.test:
|
||||
return Uri.parse("https://mempool.space/testnet/tx/$txid");
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
return Uri.parse("https://mempool.space/testnet4/tx/$txid");
|
||||
default:
|
||||
throw Exception(
|
||||
"Unsupported network for defaultBlockExplorer(): $network",
|
||||
|
|
|
@ -24,6 +24,10 @@ class BitcoinFrost extends FrostCurrency {
|
|||
_id = "bitcoinFrostTestNet";
|
||||
_name = "tBitcoin Frost";
|
||||
_ticker = "tBTC";
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
_id = "bitcoinFrostTestNet4";
|
||||
_name = "t4Bitcoin Frost";
|
||||
_ticker = "t4BTC";
|
||||
default:
|
||||
throw Exception("Unsupported network: $network");
|
||||
}
|
||||
|
@ -84,6 +88,19 @@ class BitcoinFrost extends FrostCurrency {
|
|||
isDown: false,
|
||||
);
|
||||
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
return NodeModel(
|
||||
host: "bitcoin-testnet4.stackwallet.com",
|
||||
port: 50002,
|
||||
name: DefaultNodes.defaultName,
|
||||
id: DefaultNodes.buildId(this),
|
||||
useSSL: true,
|
||||
enabled: true,
|
||||
coinName: identifier,
|
||||
isFailover: true,
|
||||
isDown: false,
|
||||
);
|
||||
|
||||
default:
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
@ -96,6 +113,8 @@ class BitcoinFrost extends FrostCurrency {
|
|||
return "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f";
|
||||
case CryptoCurrencyNetwork.test:
|
||||
return "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943";
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
return "00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043";
|
||||
default:
|
||||
throw Exception("Unsupported network: $network");
|
||||
}
|
||||
|
@ -132,6 +151,7 @@ class BitcoinFrost extends FrostCurrency {
|
|||
feePerKb: BigInt.from(1), // Not used in stack wallet currently
|
||||
);
|
||||
case CryptoCurrencyNetwork.test:
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
return coinlib.Network(
|
||||
wifPrefix: 0xef,
|
||||
p2pkhPrefix: 0x6f,
|
||||
|
@ -195,6 +215,8 @@ class BitcoinFrost extends FrostCurrency {
|
|||
return Uri.parse("https://mempool.space/tx/$txid");
|
||||
case CryptoCurrencyNetwork.test:
|
||||
return Uri.parse("https://mempool.space/testnet/tx/$txid");
|
||||
case CryptoCurrencyNetwork.test4:
|
||||
return Uri.parse("https://mempool.space/testnet4/tx/$txid");
|
||||
default:
|
||||
throw Exception(
|
||||
"Unsupported network for defaultBlockExplorer(): $network",
|
||||
|
|
|
@ -211,7 +211,7 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
|||
// 0 for bitcoincash: address scheme, 1 for legacy address
|
||||
final format = bitbox.Address.detectFormat(address);
|
||||
|
||||
if (network == CryptoCurrencyNetwork.test) {
|
||||
if (network.isTestNet) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
|||
bool validateSparkAddress(String address) {
|
||||
return SparkInterface.validateSparkAddress(
|
||||
address: address,
|
||||
isTestNet: network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: network.isTestNet,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,11 @@ export 'coins/wownero.dart';
|
|||
enum CryptoCurrencyNetwork {
|
||||
main,
|
||||
test,
|
||||
stage;
|
||||
stage,
|
||||
test4;
|
||||
|
||||
bool get isTestNet =>
|
||||
this == CryptoCurrencyNetwork.test || this == CryptoCurrencyNetwork.test4;
|
||||
}
|
||||
|
||||
abstract class CryptoCurrency {
|
||||
|
|
|
@ -8,7 +8,6 @@ import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart';
|
|||
import '../../../models/isar/models/isar_models.dart';
|
||||
import '../../../models/signing_data.dart';
|
||||
import '../../../utilities/logger.dart';
|
||||
import '../../crypto_currency/crypto_currency.dart';
|
||||
import '../../crypto_currency/interfaces/electrumx_currency_interface.dart';
|
||||
import '../../models/tx_data.dart';
|
||||
import '../intermediate/bip39_hd_wallet.dart';
|
||||
|
@ -27,7 +26,7 @@ mixin BCashInterface<T extends ElectrumXCurrencyInterface>
|
|||
// TODO: use coinlib
|
||||
|
||||
final builder = bitbox.Bitbox.transactionBuilder(
|
||||
testnet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
testnet: cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
|
||||
builder.setVersion(cryptoCurrency.transactionVersion);
|
||||
|
@ -100,7 +99,7 @@ mixin BCashInterface<T extends ElectrumXCurrencyInterface>
|
|||
network: bitbox_utils.Network(
|
||||
cryptoCurrency.networkParams.privHDPrefix,
|
||||
cryptoCurrency.networkParams.pubHDPrefix,
|
||||
cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
cryptoCurrency.network.isTestNet,
|
||||
cryptoCurrency.networkParams.p2pkhPrefix,
|
||||
cryptoCurrency.networkParams.wifPrefix,
|
||||
cryptoCurrency.networkParams.p2pkhPrefix,
|
||||
|
|
|
@ -6,6 +6,8 @@ import 'package:bitcoindart/bitcoindart.dart' as bitcoindart;
|
|||
import 'package:decimal/decimal.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:lelantus/lelantus.dart' as lelantus;
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../../../models/balance.dart';
|
||||
import '../../../models/isar/models/isar_models.dart';
|
||||
import '../../../models/lelantus_fee_data.dart';
|
||||
|
@ -15,12 +17,10 @@ import '../../../utilities/extensions/impl/uint8_list.dart';
|
|||
import '../../../utilities/format.dart';
|
||||
import '../../../utilities/logger.dart';
|
||||
import '../../api/lelantus_ffi_wrapper.dart';
|
||||
import '../../crypto_currency/crypto_currency.dart';
|
||||
import '../../crypto_currency/interfaces/electrumx_currency_interface.dart';
|
||||
import '../../models/tx_data.dart';
|
||||
import '../intermediate/bip39_hd_wallet.dart';
|
||||
import 'electrumx_interface.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
mixin LelantusInterface<T extends ElectrumXCurrencyInterface>
|
||||
on Bip39HDWallet<T>, ElectrumXInterface<T> {
|
||||
|
@ -38,7 +38,7 @@ mixin LelantusInterface<T extends ElectrumXCurrencyInterface>
|
|||
spendAmount: amount,
|
||||
subtractFeeFromAmount: true,
|
||||
lelantusEntries: lelantusEntries,
|
||||
isTestNet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
|
||||
return Amount(
|
||||
|
@ -526,7 +526,7 @@ mixin LelantusInterface<T extends ElectrumXCurrencyInterface>
|
|||
int.parse(coin.value),
|
||||
mintKeyPair.privateKey.data.toHex,
|
||||
coin.mintIndex,
|
||||
isTestnet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestnet: cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
final bool isUsed = usedSerialNumbersSet.contains(serialNumber);
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ mixin LelantusInterface<T extends ElectrumXCurrencyInterface>
|
|||
await mainDB.getHighestUsedMintIndex(walletId: walletId);
|
||||
final nextFreeMintIndex = (lastUsedIndex ?? 0) + 1;
|
||||
|
||||
final isTestnet = cryptoCurrency.network == CryptoCurrencyNetwork.test;
|
||||
final isTestnet = cryptoCurrency.network.isTestNet;
|
||||
|
||||
final root = await getRootHDNode();
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
|
|||
final root = await _getRootNode();
|
||||
final node = root.derivePath(
|
||||
_basePaynymDerivePath(
|
||||
testnet: info.coin.network == CryptoCurrencyNetwork.test,
|
||||
testnet: info.coin.network.isTestNet,
|
||||
),
|
||||
);
|
||||
return node;
|
||||
|
@ -159,7 +159,7 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
|
|||
final root = await _getRootNode();
|
||||
final node = root.derivePath(
|
||||
_basePaynymDerivePath(
|
||||
testnet: info.coin.network == CryptoCurrencyNetwork.test,
|
||||
testnet: info.coin.network.isTestNet,
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -182,7 +182,7 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
|
|||
derivationPath: DerivationPath()
|
||||
..value = _receivingPaynymAddressDerivationPath(
|
||||
index,
|
||||
testnet: info.coin.network == CryptoCurrencyNetwork.test,
|
||||
testnet: info.coin.network.isTestNet,
|
||||
),
|
||||
type: generateSegwitAddress ? AddressType.p2wpkh : AddressType.p2pkh,
|
||||
subType: AddressSubType.paynymReceive,
|
||||
|
@ -219,7 +219,7 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
|
|||
derivationPath: DerivationPath()
|
||||
..value = _sendPaynymAddressDerivationPath(
|
||||
index,
|
||||
testnet: info.coin.network == CryptoCurrencyNetwork.test,
|
||||
testnet: info.coin.network.isTestNet,
|
||||
),
|
||||
type: AddressType.nonWallet,
|
||||
subType: AddressSubType.paynymSend,
|
||||
|
@ -314,7 +314,7 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
|
|||
final node = root
|
||||
.derivePath(
|
||||
_basePaynymDerivePath(
|
||||
testnet: info.coin.network == CryptoCurrencyNetwork.test,
|
||||
testnet: info.coin.network.isTestNet,
|
||||
),
|
||||
)
|
||||
.derive(0);
|
||||
|
@ -330,7 +330,7 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
|
|||
final paymentCode = PaymentCode.fromBip32Node(
|
||||
node.derivePath(
|
||||
_basePaynymDerivePath(
|
||||
testnet: info.coin.network == CryptoCurrencyNetwork.test,
|
||||
testnet: info.coin.network.isTestNet,
|
||||
),
|
||||
),
|
||||
networkType: networkType,
|
||||
|
@ -1469,7 +1469,7 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
|
|||
final root = await _getRootNode();
|
||||
final node = root.derivePath(
|
||||
_basePaynymDerivePath(
|
||||
testnet: info.coin.network == CryptoCurrencyNetwork.test,
|
||||
testnet: info.coin.network.isTestNet,
|
||||
),
|
||||
);
|
||||
final paymentCode = PaymentCode.fromBip32Node(
|
||||
|
@ -1497,7 +1497,7 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
|
|||
derivationIndex: 0,
|
||||
derivationPath: DerivationPath()
|
||||
..value = _notificationDerivationPath(
|
||||
testnet: info.coin.network == CryptoCurrencyNetwork.test,
|
||||
testnet: info.coin.network.isTestNet,
|
||||
),
|
||||
type: AddressType.p2pkh,
|
||||
subType: AddressSubType.paynymNotification,
|
||||
|
|
|
@ -18,7 +18,6 @@ import '../../../utilities/amount/amount.dart';
|
|||
import '../../../utilities/enums/derive_path_type_enum.dart';
|
||||
import '../../../utilities/extensions/extensions.dart';
|
||||
import '../../../utilities/logger.dart';
|
||||
import '../../crypto_currency/crypto_currency.dart';
|
||||
import '../../crypto_currency/interfaces/electrumx_currency_interface.dart';
|
||||
import '../../isar/models/spark_coin.dart';
|
||||
import '../../isar/models/wallet_info.dart';
|
||||
|
@ -86,7 +85,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
|
|||
if (_sparkChangeAddressCached == null) {
|
||||
final root = await getRootHDNode();
|
||||
final String derivationPath;
|
||||
if (cryptoCurrency.network == CryptoCurrencyNetwork.test) {
|
||||
if (cryptoCurrency.network.isTestNet) {
|
||||
derivationPath =
|
||||
"$kSparkBaseDerivationPathTestnet$kDefaultSparkIndex";
|
||||
} else {
|
||||
|
@ -98,7 +97,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
|
|||
privateKey: keys.privateKey.data,
|
||||
index: kDefaultSparkIndex,
|
||||
diversifier: kSparkChange,
|
||||
isTestNet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
}
|
||||
} catch (e, s) {
|
||||
|
@ -158,7 +157,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
|
|||
|
||||
final root = await getRootHDNode();
|
||||
final String derivationPath;
|
||||
if (cryptoCurrency.network == CryptoCurrencyNetwork.test) {
|
||||
if (cryptoCurrency.network.isTestNet) {
|
||||
derivationPath = "$kSparkBaseDerivationPathTestnet$kDefaultSparkIndex";
|
||||
} else {
|
||||
derivationPath = "$kSparkBaseDerivationPath$kDefaultSparkIndex";
|
||||
|
@ -169,7 +168,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
|
|||
privateKey: keys.privateKey.data,
|
||||
index: kDefaultSparkIndex,
|
||||
diversifier: diversifier,
|
||||
isTestNet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: cryptoCurrency.network.isTestNet,
|
||||
);
|
||||
|
||||
return Address(
|
||||
|
@ -335,7 +334,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
|
|||
|
||||
final root = await getRootHDNode();
|
||||
final String derivationPath;
|
||||
if (cryptoCurrency.network == CryptoCurrencyNetwork.test) {
|
||||
if (cryptoCurrency.network.isTestNet) {
|
||||
derivationPath = "$kSparkBaseDerivationPathTestnet$kDefaultSparkIndex";
|
||||
} else {
|
||||
derivationPath = "$kSparkBaseDerivationPath$kDefaultSparkIndex";
|
||||
|
@ -704,7 +703,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
|
|||
groupId: groupId,
|
||||
privateKeyHexSet: privateKeyHexSet,
|
||||
walletId: walletId,
|
||||
isTestNet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: cryptoCurrency.network.isTestNet,
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -836,7 +835,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
|
|||
groupId: groupId,
|
||||
privateKeyHexSet: privateKeyHexSet,
|
||||
walletId: walletId,
|
||||
isTestNet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
isTestNet: cryptoCurrency.network.isTestNet,
|
||||
),
|
||||
);
|
||||
newlyIdCoins.addAll(myCoins);
|
||||
|
|
|
@ -56,7 +56,9 @@ final List<CryptoCurrency> _supportedCoins = List.unmodifiable([
|
|||
Monero(CryptoCurrencyNetwork.main),
|
||||
BitcoinFrost(CryptoCurrencyNetwork.main),
|
||||
Bitcoin(CryptoCurrencyNetwork.test),
|
||||
Bitcoin(CryptoCurrencyNetwork.test4),
|
||||
BitcoinFrost(CryptoCurrencyNetwork.test),
|
||||
BitcoinFrost(CryptoCurrencyNetwork.test4),
|
||||
]);
|
||||
|
||||
EOF
|
|
@ -69,13 +69,15 @@ final List<CryptoCurrency> _supportedCoins = List.unmodifiable([
|
|||
Tezos(CryptoCurrencyNetwork.main),
|
||||
Wownero(CryptoCurrencyNetwork.main),
|
||||
Bitcoin(CryptoCurrencyNetwork.test),
|
||||
BitcoinFrost(CryptoCurrencyNetwork.test),
|
||||
Litecoin(CryptoCurrencyNetwork.test),
|
||||
Bitcoin(CryptoCurrencyNetwork.test4),
|
||||
Bitcoincash(CryptoCurrencyNetwork.test),
|
||||
Firo(CryptoCurrencyNetwork.test),
|
||||
BitcoinFrost(CryptoCurrencyNetwork.test),
|
||||
BitcoinFrost(CryptoCurrencyNetwork.test4),
|
||||
Dogecoin(CryptoCurrencyNetwork.test),
|
||||
Stellar(CryptoCurrencyNetwork.test),
|
||||
Firo(CryptoCurrencyNetwork.test),
|
||||
Litecoin(CryptoCurrencyNetwork.test),
|
||||
Peercoin(CryptoCurrencyNetwork.test),
|
||||
Stellar(CryptoCurrencyNetwork.test),
|
||||
]);
|
||||
|
||||
EOF
|
Loading…
Reference in a new issue