diff options
author | iancoleman <1281387+iancoleman@users.noreply.github.com> | 2018-05-08 09:06:07 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-08 09:06:07 +1000 |
commit | 65cef19412b1f6640f9ce6e13aabcc0eb359f67e (patch) | |
tree | 1cbff566d83bf0e504a624838a94e87e46e4bdc7 /src/js/bitcoinjs-3.3.2.js | |
parent | 584dbddd37c762244f17a423a31573436d6dde11 (diff) | |
parent | 0702ecd3520c44cb8016f80329dcb5a3c8df88fc (diff) | |
download | BIP39-65cef19412b1f6640f9ce6e13aabcc0eb359f67e.tar.gz BIP39-65cef19412b1f6640f9ce6e13aabcc0eb359f67e.tar.zst BIP39-65cef19412b1f6640f9ce6e13aabcc0eb359f67e.zip |
Merge pull request #212 from Coinomi/zcash
Add zcash support
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 | ||