diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/bitcoinjs-3.3.2.js | 25 | ||||
-rw-r--r-- | src/js/bitcoinjs-extensions.js | 11 | ||||
-rw-r--r-- | src/js/index.js | 8 |
3 files changed, 37 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 | ||
diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js index b556f42..8c0f79e 100644 --- a/src/js/bitcoinjs-extensions.js +++ b/src/js/bitcoinjs-extensions.js | |||
@@ -1199,3 +1199,14 @@ bitcoinjs.bitcoin.networks.zcoin = { | |||
1199 | scriptHash: 0x07, | 1199 | scriptHash: 0x07, |
1200 | wif: 0xd2, | 1200 | wif: 0xd2, |
1201 | }; | 1201 | }; |
1202 | |||
1203 | bitcoinjs.bitcoin.networks.zcash = { | ||
1204 | messagePrefix: '\x18Zcash Signed Message:\n', | ||
1205 | bip32: { | ||
1206 | public: 0x0488B21E, | ||
1207 | private: 0x0488ADE4, | ||
1208 | }, | ||
1209 | pubKeyHash: 0x1CB8, | ||
1210 | scriptHash: 0x1CBD, | ||
1211 | wif: 0x80, | ||
1212 | }; | ||
diff --git a/src/js/index.js b/src/js/index.js index 758b840..fc7e13b 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -2428,6 +2428,14 @@ | |||
2428 | setHdCoin(136); | 2428 | setHdCoin(136); |
2429 | }, | 2429 | }, |
2430 | }, | 2430 | }, |
2431 | { | ||
2432 | name: "ZEC - Zcash", | ||
2433 | segwitAvailable: false, | ||
2434 | onSelect: function() { | ||
2435 | network = bitcoinjs.bitcoin.networks.zcash; | ||
2436 | setHdCoin(133); | ||
2437 | }, | ||
2438 | }, | ||
2431 | ] | 2439 | ] |
2432 | 2440 | ||
2433 | var clients = [ | 2441 | var clients = [ |