Merge pull request #882 from cypherstack/peercoin

Fix Peercoin txs: add transactionVersion property
This commit is contained in:
julian-CStack 2024-06-05 17:37:59 -06:00 committed by GitHub
commit e9aed5694b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 39 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/address.dart';
import '../../../models/node_model.dart'; import '../../../models/node_model.dart';
import '../../../utilities/amount/amount.dart'; import '../../../utilities/amount/amount.dart';
@ -291,4 +292,7 @@ class Bitcoin extends Bip39HDCurrency
); );
} }
} }
@override
int get transactionVersion => 1;
} }

View file

@ -364,4 +364,7 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
); );
} }
} }
@override
int get transactionVersion => 2;
} }

View file

@ -1,4 +1,5 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/address.dart';
import '../../../models/node_model.dart'; import '../../../models/node_model.dart';
import '../../../utilities/amount/amount.dart'; import '../../../utilities/amount/amount.dart';
@ -248,4 +249,7 @@ class Dogecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
); );
} }
} }
@override
int get transactionVersion => 1;
} }

View file

@ -336,4 +336,7 @@ class Ecash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
); );
} }
} }
@override
int get transactionVersion => 2;
} }

View file

@ -1,13 +1,14 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/address.dart';
import '../../../models/node_model.dart'; import '../../../models/node_model.dart';
import '../../../utilities/amount/amount.dart'; import '../../../utilities/amount/amount.dart';
import '../../../utilities/default_nodes.dart'; import '../../../utilities/default_nodes.dart';
import '../../../utilities/enums/derive_path_type_enum.dart'; import '../../../utilities/enums/derive_path_type_enum.dart';
import '../../wallet/wallet_mixin_interfaces/spark_interface.dart';
import '../crypto_currency.dart'; import '../crypto_currency.dart';
import '../interfaces/electrumx_currency_interface.dart'; import '../interfaces/electrumx_currency_interface.dart';
import '../intermediate/bip39_hd_currency.dart'; import '../intermediate/bip39_hd_currency.dart';
import '../../wallet/wallet_mixin_interfaces/spark_interface.dart';
class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface { class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface {
Firo(super.network) { Firo(super.network) {
@ -266,4 +267,7 @@ class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface {
); );
} }
} }
@override
int get transactionVersion => 1;
} }

View file

@ -1,4 +1,5 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/address.dart';
import '../../../models/node_model.dart'; import '../../../models/node_model.dart';
import '../../../utilities/amount/amount.dart'; import '../../../utilities/amount/amount.dart';
@ -279,4 +280,7 @@ class Litecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
); );
} }
} }
@override
int get transactionVersion => 1;
} }

View file

@ -252,4 +252,7 @@ class Namecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
); );
} }
} }
@override
int get transactionVersion => 1;
} }

View file

@ -230,4 +230,7 @@ class Particl extends Bip39HDCurrency with ElectrumXCurrencyInterface {
); );
} }
} }
@override
int get transactionVersion => 1;
} }

View file

@ -254,4 +254,7 @@ class Peercoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
); );
} }
} }
@override
int get transactionVersion => 3;
} }

View file

@ -1,5 +1,5 @@
import '../intermediate/bip39_hd_currency.dart'; import '../intermediate/bip39_hd_currency.dart';
mixin ElectrumXCurrencyInterface on Bip39HDCurrency { mixin ElectrumXCurrencyInterface on Bip39HDCurrency {
// int get transactionVersion;
} }

View file

@ -30,6 +30,8 @@ mixin BCashInterface<T extends ElectrumXCurrencyInterface>
testnet: cryptoCurrency.network == CryptoCurrencyNetwork.test, testnet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
); );
builder.setVersion(cryptoCurrency.transactionVersion);
// temp tx data to show in gui while waiting for real data from server // temp tx data to show in gui while waiting for real data from server
final List<InputV2> tempInputs = []; final List<InputV2> tempInputs = [];
final List<OutputV2> tempOutputs = []; final List<OutputV2> tempOutputs = [];

View file

@ -623,7 +623,7 @@ mixin ElectrumXInterface<T extends ElectrumXCurrencyInterface>
final List<coinlib.Output> prevOuts = []; final List<coinlib.Output> prevOuts = [];
coinlib.Transaction clTx = coinlib.Transaction( coinlib.Transaction clTx = coinlib.Transaction(
version: 1, // TODO: check if we can use 3 (as is default in coinlib) version: cryptoCurrency.transactionVersion,
inputs: [], inputs: [],
outputs: [], outputs: [],
); );

View file

@ -10,6 +10,8 @@ import 'package:bitcoindart/src/utils/script.dart' as bscript;
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:pointycastle/digests/sha256.dart'; import 'package:pointycastle/digests/sha256.dart';
import 'package:tuple/tuple.dart';
import '../../../exceptions/wallet/insufficient_balance_exception.dart'; import '../../../exceptions/wallet/insufficient_balance_exception.dart';
import '../../../exceptions/wallet/paynym_send_exception.dart'; import '../../../exceptions/wallet/paynym_send_exception.dart';
import '../../../models/isar/models/blockchain_data/v2/input_v2.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 '../../models/tx_data.dart';
import '../intermediate/bip39_hd_wallet.dart'; import '../intermediate/bip39_hd_wallet.dart';
import 'electrumx_interface.dart'; import 'electrumx_interface.dart';
import 'package:tuple/tuple.dart';
const String kPCodeKeyPrefix = "pCode_key_"; const String kPCodeKeyPrefix = "pCode_key_";
@ -750,7 +751,7 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
final List<coinlib.Output> prevOuts = []; final List<coinlib.Output> prevOuts = [];
coinlib.Transaction clTx = coinlib.Transaction( coinlib.Transaction clTx = coinlib.Transaction(
version: 1, version: cryptoCurrency.transactionVersion,
inputs: [], inputs: [],
outputs: [], outputs: [],
); );