@@ -20,12 +20,7 @@ exports.oneOf =
2020 exports . isTaptree =
2121 exports . isTapleaf =
2222 exports . TAPLEAF_VERSION_MASK =
23- exports . Network =
24- exports . ECPoint =
2523 exports . Satoshi =
26- exports . Signer =
27- exports . BIP32Path =
28- exports . UInt31 =
2924 exports . isPoint =
3025 exports . stacksEqual =
3126 exports . typeforce =
@@ -72,49 +67,11 @@ function isPoint(p) {
7267 return false ;
7368}
7469exports . isPoint = isPoint ;
75- const UINT31_MAX = Math . pow ( 2 , 31 ) - 1 ;
76- function UInt31 ( value ) {
77- return exports . typeforce . UInt32 ( value ) && value <= UINT31_MAX ;
78- }
79- exports . UInt31 = UInt31 ;
80- function BIP32Path ( value ) {
81- return (
82- exports . typeforce . String ( value ) && ! ! value . match ( / ^ ( m \/ ) ? ( \d + ' ? \/ ) * \d + ' ? $ / )
83- ) ;
84- }
85- exports . BIP32Path = BIP32Path ;
86- BIP32Path . toJSON = ( ) => {
87- return 'BIP32 derivation path' ;
88- } ;
89- function Signer ( obj ) {
90- return (
91- ( exports . typeforce . Buffer ( obj . publicKey ) ||
92- typeof obj . getPublicKey === 'function' ) &&
93- typeof obj . sign === 'function'
94- ) ;
95- }
96- exports . Signer = Signer ;
9770const SATOSHI_MAX = 21 * 1e14 ;
9871function Satoshi ( value ) {
9972 return exports . typeforce . UInt53 ( value ) && value <= SATOSHI_MAX ;
10073}
10174exports . Satoshi = Satoshi ;
102- // external dependent types
103- exports . ECPoint = exports . typeforce . quacksLike ( 'Point' ) ;
104- // exposed, external API
105- exports . Network = exports . typeforce . compile ( {
106- messagePrefix : exports . typeforce . oneOf (
107- exports . typeforce . Buffer ,
108- exports . typeforce . String ,
109- ) ,
110- bip32 : {
111- public : exports . typeforce . UInt32 ,
112- private : exports . typeforce . UInt32 ,
113- } ,
114- pubKeyHash : exports . typeforce . UInt8 ,
115- scriptHash : exports . typeforce . UInt8 ,
116- wif : exports . typeforce . UInt8 ,
117- } ) ;
11875exports . TAPLEAF_VERSION_MASK = 0xfe ;
11976function isTapleaf ( o ) {
12077 if ( ! o || ! ( 'output' in o ) ) return false ;
0 commit comments