diff --git a/lib/wallets/crypto_currency/coins/bitcoin.dart b/lib/wallets/crypto_currency/coins/bitcoin.dart index 118d61f24..ffdd4c15d 100644 --- a/lib/wallets/crypto_currency/coins/bitcoin.dart +++ b/lib/wallets/crypto_currency/coins/bitcoin.dart @@ -1,4 +1,5 @@ import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/amount/amount.dart'; @@ -291,4 +292,7 @@ class Bitcoin extends Bip39HDCurrency ); } } + + @override + int get transactionVersion => 1; } diff --git a/lib/wallets/crypto_currency/coins/bitcoincash.dart b/lib/wallets/crypto_currency/coins/bitcoincash.dart index 25e18f6a3..fb2f66a92 100644 --- a/lib/wallets/crypto_currency/coins/bitcoincash.dart +++ b/lib/wallets/crypto_currency/coins/bitcoincash.dart @@ -364,4 +364,7 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface { ); } } + + @override + int get transactionVersion => 2; } diff --git a/lib/wallets/crypto_currency/coins/dogecoin.dart b/lib/wallets/crypto_currency/coins/dogecoin.dart index 3e1824e48..cbb9bea1e 100644 --- a/lib/wallets/crypto_currency/coins/dogecoin.dart +++ b/lib/wallets/crypto_currency/coins/dogecoin.dart @@ -1,4 +1,5 @@ import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/amount/amount.dart'; @@ -248,4 +249,7 @@ class Dogecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface { ); } } + + @override + int get transactionVersion => 1; } diff --git a/lib/wallets/crypto_currency/coins/ecash.dart b/lib/wallets/crypto_currency/coins/ecash.dart index 593bb34f5..2b05784dd 100644 --- a/lib/wallets/crypto_currency/coins/ecash.dart +++ b/lib/wallets/crypto_currency/coins/ecash.dart @@ -336,4 +336,7 @@ class Ecash extends Bip39HDCurrency with ElectrumXCurrencyInterface { ); } } + + @override + int get transactionVersion => 2; } diff --git a/lib/wallets/crypto_currency/coins/firo.dart b/lib/wallets/crypto_currency/coins/firo.dart index d9dbe3e65..6880190b6 100644 --- a/lib/wallets/crypto_currency/coins/firo.dart +++ b/lib/wallets/crypto_currency/coins/firo.dart @@ -1,13 +1,14 @@ import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/default_nodes.dart'; import '../../../utilities/enums/derive_path_type_enum.dart'; +import '../../wallet/wallet_mixin_interfaces/spark_interface.dart'; import '../crypto_currency.dart'; import '../interfaces/electrumx_currency_interface.dart'; import '../intermediate/bip39_hd_currency.dart'; -import '../../wallet/wallet_mixin_interfaces/spark_interface.dart'; class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface { Firo(super.network) { @@ -266,4 +267,7 @@ class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface { ); } } + + @override + int get transactionVersion => 1; } diff --git a/lib/wallets/crypto_currency/coins/litecoin.dart b/lib/wallets/crypto_currency/coins/litecoin.dart index 89346e509..880a3260e 100644 --- a/lib/wallets/crypto_currency/coins/litecoin.dart +++ b/lib/wallets/crypto_currency/coins/litecoin.dart @@ -1,4 +1,5 @@ import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/amount/amount.dart'; @@ -279,4 +280,7 @@ class Litecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface { ); } } + + @override + int get transactionVersion => 1; } diff --git a/lib/wallets/crypto_currency/coins/namecoin.dart b/lib/wallets/crypto_currency/coins/namecoin.dart index daca04916..371406ddf 100644 --- a/lib/wallets/crypto_currency/coins/namecoin.dart +++ b/lib/wallets/crypto_currency/coins/namecoin.dart @@ -252,4 +252,7 @@ class Namecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface { ); } } + + @override + int get transactionVersion => 1; } diff --git a/lib/wallets/crypto_currency/coins/particl.dart b/lib/wallets/crypto_currency/coins/particl.dart index 382602e7a..595f6fbf4 100644 --- a/lib/wallets/crypto_currency/coins/particl.dart +++ b/lib/wallets/crypto_currency/coins/particl.dart @@ -230,4 +230,7 @@ class Particl extends Bip39HDCurrency with ElectrumXCurrencyInterface { ); } } + + @override + int get transactionVersion => 1; } diff --git a/lib/wallets/crypto_currency/coins/peercoin.dart b/lib/wallets/crypto_currency/coins/peercoin.dart index 0edc1cbfa..dec4ab846 100644 --- a/lib/wallets/crypto_currency/coins/peercoin.dart +++ b/lib/wallets/crypto_currency/coins/peercoin.dart @@ -254,4 +254,7 @@ class Peercoin extends Bip39HDCurrency with ElectrumXCurrencyInterface { ); } } + + @override + int get transactionVersion => 3; } diff --git a/lib/wallets/crypto_currency/interfaces/electrumx_currency_interface.dart b/lib/wallets/crypto_currency/interfaces/electrumx_currency_interface.dart index 4dd224aed..30ddf7c70 100644 --- a/lib/wallets/crypto_currency/interfaces/electrumx_currency_interface.dart +++ b/lib/wallets/crypto_currency/interfaces/electrumx_currency_interface.dart @@ -1,5 +1,5 @@ import '../intermediate/bip39_hd_currency.dart'; mixin ElectrumXCurrencyInterface on Bip39HDCurrency { - // + int get transactionVersion; } diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart index 9559fa848..be0727bfc 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart @@ -30,6 +30,8 @@ mixin BCashInterface testnet: cryptoCurrency.network == CryptoCurrencyNetwork.test, ); + builder.setVersion(cryptoCurrency.transactionVersion); + // temp tx data to show in gui while waiting for real data from server final List tempInputs = []; final List tempOutputs = []; diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart index 03eb150ac..81af17ff6 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart @@ -623,7 +623,7 @@ mixin ElectrumXInterface final List prevOuts = []; coinlib.Transaction clTx = coinlib.Transaction( - version: 1, // TODO: check if we can use 3 (as is default in coinlib) + version: cryptoCurrency.transactionVersion, inputs: [], outputs: [], ); diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart index b9759d474..86cd8b66b 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart @@ -10,6 +10,8 @@ import 'package:bitcoindart/src/utils/script.dart' as bscript; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:isar/isar.dart'; import 'package:pointycastle/digests/sha256.dart'; +import 'package:tuple/tuple.dart'; + import '../../../exceptions/wallet/insufficient_balance_exception.dart'; import '../../../exceptions/wallet/paynym_send_exception.dart'; import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; @@ -29,7 +31,6 @@ import '../../crypto_currency/interfaces/paynym_currency_interface.dart'; import '../../models/tx_data.dart'; import '../intermediate/bip39_hd_wallet.dart'; import 'electrumx_interface.dart'; -import 'package:tuple/tuple.dart'; const String kPCodeKeyPrefix = "pCode_key_"; @@ -750,7 +751,7 @@ mixin PaynymInterface final List prevOuts = []; coinlib.Transaction clTx = coinlib.Transaction( - version: 1, + version: cryptoCurrency.transactionVersion, inputs: [], outputs: [], );