NetworkParams->Network

TODO update network params
This commit is contained in:
sneurlax 2024-03-22 16:19:48 -05:00 committed by julian
parent 2f8f4b0e7f
commit 5f6eabb1dc
9 changed files with 65 additions and 23 deletions

View file

@ -51,10 +51,10 @@ class Bitcoin extends Bip39HDCurrency with PaynymCurrencyInterface {
);
@override
coinlib.NetworkParams get networkParams {
coinlib.Network get networkParams {
switch (network) {
case CryptoCurrencyNetwork.main:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0x80,
p2pkhPrefix: 0x00,
p2shPrefix: 0x05,
@ -62,9 +62,12 @@ class Bitcoin extends Bip39HDCurrency with PaynymCurrencyInterface {
pubHDPrefix: 0x0488b21e,
bech32Hrp: "bc",
messagePrefix: '\x18Bitcoin Signed Message:\n',
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(546), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
case CryptoCurrencyNetwork.test:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0xef,
p2pkhPrefix: 0x6f,
p2shPrefix: 0xc4,
@ -72,6 +75,9 @@ class Bitcoin extends Bip39HDCurrency with PaynymCurrencyInterface {
pubHDPrefix: 0x043587cf,
bech32Hrp: "tb",
messagePrefix: "\x18Bitcoin Signed Message:\n",
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(546), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
default:
throw Exception("Unsupported network: $network");

View file

@ -59,10 +59,10 @@ class Bitcoincash extends Bip39HDCurrency {
);
@override
coinlib.NetworkParams get networkParams {
coinlib.Network get networkParams {
switch (network) {
case CryptoCurrencyNetwork.main:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0x80,
p2pkhPrefix: 0x00,
p2shPrefix: 0x05,
@ -70,9 +70,12 @@ class Bitcoincash extends Bip39HDCurrency {
pubHDPrefix: 0x0488b21e,
bech32Hrp: "bc",
messagePrefix: '\x18Bitcoin Signed Message:\n',
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(546), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
case CryptoCurrencyNetwork.test:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0xef,
p2pkhPrefix: 0x6f,
p2shPrefix: 0xc4,
@ -80,6 +83,9 @@ class Bitcoincash extends Bip39HDCurrency {
pubHDPrefix: 0x043587cf,
bech32Hrp: "tb",
messagePrefix: "\x18Bitcoin Signed Message:\n",
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(546), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
default:
throw Exception("Unsupported network: $network");

View file

@ -102,10 +102,10 @@ class Dogecoin extends Bip39HDCurrency {
int get minConfirms => 1;
@override
coinlib.NetworkParams get networkParams {
coinlib.Network get networkParams {
switch (network) {
case CryptoCurrencyNetwork.main:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0x9e,
p2pkhPrefix: 0x1e,
p2shPrefix: 0x16,
@ -113,9 +113,12 @@ class Dogecoin extends Bip39HDCurrency {
pubHDPrefix: 0x02facafd,
bech32Hrp: "doge",
messagePrefix: '\x18Dogecoin Signed Message:\n',
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
case CryptoCurrencyNetwork.test:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0xf1,
p2pkhPrefix: 0x71,
p2shPrefix: 0xc4,
@ -123,6 +126,9 @@ class Dogecoin extends Bip39HDCurrency {
pubHDPrefix: 0x043587cf,
bech32Hrp: "tdge",
messagePrefix: "\x18Dogecoin Signed Message:\n",
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
default:
throw Exception("Unsupported network: $network");

View file

@ -57,10 +57,10 @@ class Ecash extends Bip39HDCurrency {
);
@override
coinlib.NetworkParams get networkParams {
coinlib.Network get networkParams {
switch (network) {
case CryptoCurrencyNetwork.main:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0x80,
p2pkhPrefix: 0x00,
p2shPrefix: 0x05,
@ -68,9 +68,12 @@ class Ecash extends Bip39HDCurrency {
pubHDPrefix: 0x0488b21e,
bech32Hrp: "bc",
messagePrefix: '\x18Bitcoin Signed Message:\n',
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
case CryptoCurrencyNetwork.test:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0xef,
p2pkhPrefix: 0x6f,
p2shPrefix: 0xc4,
@ -78,6 +81,9 @@ class Ecash extends Bip39HDCurrency {
pubHDPrefix: 0x043587cf,
bech32Hrp: "tb",
messagePrefix: "\x18Bitcoin Signed Message:\n",
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
default:
throw Exception("Unsupported network: $network");

View file

@ -48,10 +48,10 @@ class Firo extends Bip39HDCurrency {
);
@override
coinlib.NetworkParams get networkParams {
coinlib.Network get networkParams {
switch (network) {
case CryptoCurrencyNetwork.main:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0xd2,
p2pkhPrefix: 0x52,
p2shPrefix: 0x07,
@ -59,9 +59,12 @@ class Firo extends Bip39HDCurrency {
pubHDPrefix: 0x0488b21e,
bech32Hrp: "bc",
messagePrefix: '\x18Zcoin Signed Message:\n',
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
case CryptoCurrencyNetwork.test:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0xb9,
p2pkhPrefix: 0x41,
p2shPrefix: 0xb2,
@ -69,6 +72,9 @@ class Firo extends Bip39HDCurrency {
pubHDPrefix: 0x043587cf,
bech32Hrp: "tb",
messagePrefix: "\x18Zcoin Signed Message:\n",
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
default:
throw Exception("Unsupported network: $network");

View file

@ -55,10 +55,10 @@ class Litecoin extends Bip39HDCurrency {
);
@override
coinlib.NetworkParams get networkParams {
coinlib.Network get networkParams {
switch (network) {
case CryptoCurrencyNetwork.main:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0xb0,
p2pkhPrefix: 0x30,
p2shPrefix: 0x32,
@ -66,9 +66,12 @@ class Litecoin extends Bip39HDCurrency {
pubHDPrefix: 0x0488b21e,
bech32Hrp: "ltc",
messagePrefix: '\x19Litecoin Signed Message:\n',
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
case CryptoCurrencyNetwork.test:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0xef,
p2pkhPrefix: 0x6f,
p2shPrefix: 0x3a,
@ -76,6 +79,9 @@ class Litecoin extends Bip39HDCurrency {
pubHDPrefix: 0x043587cf,
bech32Hrp: "tltc",
messagePrefix: "\x19Litecoin Signed Message:\n",
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
default:
throw Exception("Unsupported network: $network");

View file

@ -143,10 +143,10 @@ class Namecoin extends Bip39HDCurrency {
@override
// See https://github.com/cypherstack/stack_wallet/blob/621aff47969761014e0a6c4e699cb637d5687ab3/lib/services/coins/namecoin/namecoin_wallet.dart#L3474
coinlib.NetworkParams get networkParams {
coinlib.Network get networkParams {
switch (network) {
case CryptoCurrencyNetwork.main:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0xb4, // From 180.
p2pkhPrefix: 0x34, // From 52.
p2shPrefix: 0x0d, // From 13.
@ -154,6 +154,9 @@ class Namecoin extends Bip39HDCurrency {
pubHDPrefix: 0x0488b21e,
bech32Hrp: "nc",
messagePrefix: '\x18Namecoin Signed Message:\n',
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
// case CryptoCurrencyNetwork.test:
// TODO: [prio=low] Add testnet support.

View file

@ -125,10 +125,10 @@ class Particl extends Bip39HDCurrency {
@override
// See https://github.com/cypherstack/stack_wallet/blob/d08b5c9b22b58db800ad07b2ceeb44c6d05f9cf3/lib/services/coins/particl/particl_wallet.dart#L3532
coinlib.NetworkParams get networkParams {
coinlib.Network get networkParams {
switch (network) {
case CryptoCurrencyNetwork.main:
return const coinlib.NetworkParams(
return coinlib.Network(
wifPrefix: 0x6c,
p2pkhPrefix: 0x38,
p2shPrefix: 0x3c,
@ -136,6 +136,9 @@ class Particl extends Bip39HDCurrency {
pubHDPrefix: 0x696e82d1,
bech32Hrp: "pw",
messagePrefix: '\x18Bitcoin Signed Message:\n',
minFee: BigInt.from(1), // TODO [prio=high].
minOutput: BigInt.from(1), // TODO.
feePerKb: BigInt.from(1), // TODO.
);
// case CryptoCurrencyNetwork.test:
// TODO: [prio=low] Add testnet.

View file

@ -11,7 +11,7 @@ import 'package:stackwallet/wallets/crypto_currency/intermediate/bip39_currency.
abstract class Bip39HDCurrency extends Bip39Currency {
Bip39HDCurrency(super.network);
coinlib.NetworkParams get networkParams;
coinlib.Network get networkParams;
Amount get dustLimit;