Skip to content

Commit f9b8f24

Browse files
committed
fix large script serialization
1 parent 01d915f commit f9b8f24

38 files changed

+225
-468
lines changed

analysis_options.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@
22
include: package:flutter_lints/flutter.yaml
33
# Additional information about this file can be found at
44
# https://dart.dev/guides/language/analysis-options
5+
# Uncomment the following section to specify additional rules.
6+
linter:
7+
rules:
8+
- unnecessary_const
9+
- prefer_const_declarations
10+
- prefer_final_locals # Warns when a local variable could be final
11+
- prefer_final_in_for_each # Warns when a forEach variable could be final

example/test/bch_test.dart

-1
This file was deleted.

example/test/btc2_test.dart

-1
This file was deleted.

example/test/btc_test.dart

-118
This file was deleted.

example/test/e_test.dart

-1
This file was deleted.

example/test/widget_test.dart

-97
This file was deleted.

lib/bitcoin_base.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// including spending transactions, Bitcoin address management,
55
/// Bitcoin Schnorr signatures, BIP-39 mnemonic phrase generation,
66
/// hierarchical deterministic (HD) wallet derivation, and Web3 Secret Storage Definition.
7-
library bitcoin_base;
7+
library;
88

99
export 'package:bitcoin_base/src/bitcoin/address/address.dart';
1010

lib/src/bitcoin/address/address.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// - Utility functions for address manipulation.
77
// - encode/decode Segregated Witness (SegWit) address implementation.
88
// - Enhanced functionality for improved handling of addresses across diverse networks.
9-
library bitcoin_base.address;
9+
library;
1010

1111
import 'package:bitcoin_base/bitcoin_base.dart';
1212
import 'package:bitcoin_base/src/exception/exception.dart';

lib/src/bitcoin/address/core.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ abstract class BitcoinBaseAddress {
5959
}
6060

6161
class PubKeyAddressType extends BitcoinAddressType {
62-
const PubKeyAddressType._(String value) : super._(value);
62+
const PubKeyAddressType._(super.value) : super._();
6363
static const PubKeyAddressType p2pk = PubKeyAddressType._("P2PK");
6464
@override
6565
bool get isP2sh => false;
@@ -75,7 +75,7 @@ class PubKeyAddressType extends BitcoinAddressType {
7575
}
7676

7777
class P2pkhAddressType extends BitcoinAddressType {
78-
const P2pkhAddressType._(String value) : super._(value);
78+
const P2pkhAddressType._(super.value) : super._();
7979
static const P2pkhAddressType p2pkh = P2pkhAddressType._("P2PKH");
8080
static const P2pkhAddressType p2pkhwt = P2pkhAddressType._("P2PKHWT");
8181

@@ -93,8 +93,8 @@ class P2pkhAddressType extends BitcoinAddressType {
9393
}
9494

9595
class P2shAddressType extends BitcoinAddressType {
96-
const P2shAddressType._(String value, this.hashLength, this.withToken)
97-
: super._(value);
96+
const P2shAddressType._(super.value, this.hashLength, this.withToken)
97+
: super._();
9898
static const P2shAddressType p2wshInP2sh = P2shAddressType._(
9999
"P2SH/P2WSH", _BitcoinAddressUtils.hash160DigestLength, false);
100100
static const P2shAddressType p2wpkhInP2sh = P2shAddressType._(
@@ -143,7 +143,7 @@ class P2shAddressType extends BitcoinAddressType {
143143
}
144144

145145
class SegwitAddresType extends BitcoinAddressType {
146-
const SegwitAddresType._(String value) : super._(value);
146+
const SegwitAddresType._(super.value) : super._();
147147
static const SegwitAddresType p2wpkh = SegwitAddresType._("P2WPKH");
148148
static const SegwitAddresType p2tr = SegwitAddresType._("P2TR");
149149
static const SegwitAddresType p2wsh = SegwitAddresType._("P2WSH");

lib/src/bitcoin/address/legacy_address.dart

+10-10
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ abstract class LegacyAddress implements BitcoinBaseAddress {
4545

4646
class P2shAddress extends LegacyAddress {
4747
P2shAddress.fromScript(
48-
{required Script script, this.type = P2shAddressType.p2pkInP2sh})
49-
: super.fromScript(script: script);
48+
{required super.script, this.type = P2shAddressType.p2pkInP2sh})
49+
: super.fromScript();
5050

5151
P2shAddress.fromAddress(
52-
{required String address,
53-
required BasedUtxoNetwork network,
52+
{required super.address,
53+
required super.network,
5454
this.type = P2shAddressType.p2pkInP2sh})
55-
: super.fromAddress(address: address, network: network);
55+
: super.fromAddress();
5656
P2shAddress.fromHash160(
5757
{required String addrHash, this.type = P2shAddressType.p2pkInP2sh})
5858
: super.fromHash160(addrHash, type);
@@ -81,13 +81,13 @@ class P2shAddress extends LegacyAddress {
8181

8282
class P2pkhAddress extends LegacyAddress {
8383
P2pkhAddress.fromScript(
84-
{required Script script, this.type = P2pkhAddressType.p2pkh})
85-
: super.fromScript(script: script);
84+
{required super.script, this.type = P2pkhAddressType.p2pkh})
85+
: super.fromScript();
8686
P2pkhAddress.fromAddress(
87-
{required String address,
88-
required BasedUtxoNetwork network,
87+
{required super.address,
88+
required super.network,
8989
this.type = P2pkhAddressType.p2pkh})
90-
: super.fromAddress(address: address, network: network);
90+
: super.fromAddress();
9191
P2pkhAddress.fromHash160(
9292
{required String addrHash, this.type = P2pkhAddressType.p2pkh})
9393
: super.fromHash160(addrHash, type);

0 commit comments

Comments
 (0)