diff options
Diffstat (limited to 'src/js/bitcoinjs-3.3.2.js')
-rw-r--r-- | src/js/bitcoinjs-3.3.2.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/js/bitcoinjs-3.3.2.js b/src/js/bitcoinjs-3.3.2.js index de75eaf..2390168 100644 --- a/src/js/bitcoinjs-3.3.2.js +++ b/src/js/bitcoinjs-3.3.2.js | |||
@@ -8662,13 +8662,24 @@ function fromBech32 (address) { | |||
8662 | } | 8662 | } |
8663 | 8663 | ||
8664 | function toBase58Check (hash, version) { | 8664 | function toBase58Check (hash, version) { |
8665 | typeforce(types.tuple(types.Hash160bit, types.UInt8), arguments) | 8665 | if (version < 256){ |
8666 | typeforce(types.tuple(types.Hash160bit, types.UInt8), arguments) | ||
8666 | 8667 | ||
8667 | var payload = Buffer.allocUnsafe(21) | 8668 | var payload = Buffer.allocUnsafe(21) |
8668 | payload.writeUInt8(version, 0) | 8669 | payload.writeUInt8(version, 0) |
8669 | hash.copy(payload, 1) | 8670 | hash.copy(payload, 1) |
8670 | 8671 | ||
8671 | return bs58check.encode(payload) | 8672 | return bs58check.encode(payload) |
8673 | } | ||
8674 | else{ | ||
8675 | typeforce(types.tuple(types.Hash160bit, types.UInt16), arguments) | ||
8676 | |||
8677 | var payload = Buffer.allocUnsafe(22) | ||
8678 | payload.writeUInt16BE(version, 0) | ||
8679 | hash.copy(payload, 2) | ||
8680 | |||
8681 | return bs58check.encode(payload) | ||
8682 | } | ||
8672 | } | 8683 | } |
8673 | 8684 | ||
8674 | function toBech32 (data, version, prefix) { | 8685 | function toBech32 (data, version, prefix) { |
@@ -12162,8 +12173,8 @@ var Network = typeforce.compile({ | |||
12162 | public: typeforce.UInt32, | 12173 | public: typeforce.UInt32, |
12163 | private: typeforce.UInt32 | 12174 | private: typeforce.UInt32 |
12164 | }, | 12175 | }, |
12165 | pubKeyHash: typeforce.UInt8, | 12176 | pubKeyHash: typeforce.oneOf(typeforce.UInt8, typeforce.UInt16), |
12166 | scriptHash: typeforce.UInt8, | 12177 | scriptHash: typeforce.oneOf(typeforce.UInt8, typeforce.UInt16), |
12167 | wif: typeforce.UInt8 | 12178 | wif: typeforce.UInt8 |
12168 | }) | 12179 | }) |
12169 | 12180 | ||