mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 02:24:30 +00:00
bch tweaks
This commit is contained in:
parent
5b5908196d
commit
157c7874f5
2 changed files with 31 additions and 8 deletions
|
@ -28,6 +28,10 @@ class Bitcoincash extends Bip39HDCurrency {
|
|||
@override
|
||||
int get maxNumberOfIndexesToCheck => 10000000;
|
||||
|
||||
@override
|
||||
// change this to change the number of confirms a tx needs in order to show as confirmed
|
||||
int get minConfirms => 0; // bch zeroconf
|
||||
|
||||
@override
|
||||
List<DerivePathType> get supportedDerivationPathTypes => [
|
||||
DerivePathType.bip44,
|
||||
|
@ -80,6 +84,23 @@ class Bitcoincash extends Bip39HDCurrency {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String addressToScriptHash({required String address}) {
|
||||
try {
|
||||
if (bitbox.Address.detectFormat(address) ==
|
||||
bitbox.Address.formatCashAddr &&
|
||||
_validateCashAddr(address)) {
|
||||
address = bitbox.Address.toLegacyAddress(address);
|
||||
}
|
||||
|
||||
final addr = coinlib.Address.fromString(address, networkParams);
|
||||
return Bip39HDCurrency.convertBytesToScriptHash(
|
||||
addr.program.script.compiled);
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String constructDerivePath({
|
||||
required DerivePathType derivePathType,
|
||||
|
@ -143,10 +164,6 @@ class Bitcoincash extends Bip39HDCurrency {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
// change this to change the number of confirms a tx needs in order to show as confirmed
|
||||
int get minConfirms => 0; // bch zeroconf
|
||||
|
||||
// TODO: [prio=med] bch p2sh addresses (complaints regarding sending to)
|
||||
@override
|
||||
bool validateAddress(String address) {
|
||||
|
|
|
@ -28,9 +28,12 @@ class BitcoincashWallet extends Bip39HDWallet with ElectrumX {
|
|||
[
|
||||
...standardChangeAddressFilters,
|
||||
FilterGroup.not(
|
||||
const FilterCondition.startsWith(
|
||||
const ObjectFilter(
|
||||
property: "derivationPath",
|
||||
value: "m/44'/0'",
|
||||
filter: FilterCondition.startsWith(
|
||||
property: "value",
|
||||
value: "m/44'/0'",
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -41,9 +44,12 @@ class BitcoincashWallet extends Bip39HDWallet with ElectrumX {
|
|||
[
|
||||
...standardReceivingAddressFilters,
|
||||
FilterGroup.not(
|
||||
const FilterCondition.startsWith(
|
||||
const ObjectFilter(
|
||||
property: "derivationPath",
|
||||
value: "m/44'/0'",
|
||||
filter: FilterCondition.startsWith(
|
||||
property: "value",
|
||||
value: "m/44'/0'",
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue