@exodus/bitcoinjs-lib-forks 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [0.0.7](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoinjs-lib-forks@0.0.6...@exodus/bitcoinjs-lib-forks@0.0.7) (2026-11-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * clean up deps ([30d1c23](https://github.com/ExodusMovement/assets/commit/30d1c230e67653a7d0320cb84560d04befa503a1))
12
+ * declare bs58check as a runtime dependency ([5028356](https://github.com/ExodusMovement/assets/commit/50283562ca3ed194fa940802729fad68ffb618df))
13
+
14
+
15
+
16
+ # 0.0.3 / 2019-03-19
17
+
18
+ - Use `ripemd160` instead of `rmd160` for Electron v4
19
+
20
+ # 0.0.2 / 2018-12-12
21
+
22
+ - Remove unneeded BCH fork changes
23
+
24
+ # 0.0.1 / 2018-11-14
25
+
26
+ Initial release, with 2018-11-15 BCH (BitcoinABC) HF support.
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # BitcoinJS Forks (`@exodus/bitcoinjs-lib-forks`)
2
2
 
3
- [![Build Status](https://travis-ci.com/ExodusMovement/bitcoinjs-lib-forks.svg?token=QTcVjCYzbYmjmHfQpsUB&branch=bcash-bgold)](https://travis-ci.com/ExodusMovement/bitcoinjs-lib-forks)
4
-
5
3
  `bitcoinjs-lib` forked to support Bitcoin Cash & Bitcoin Gold. Based off of https://github.com/bitcoinjs/bitcoinjs-lib/pull/831. Original README below.
6
4
 
7
5
  # BitcoinJS (bitcoinjs-lib)
package/package.json CHANGED
@@ -1,11 +1,18 @@
1
1
  {
2
2
  "name": "@exodus/bitcoinjs-lib-forks",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Client-side Bitcoin Forks JavaScript library",
5
- "main": "./src/index.js",
6
- "engines": {
7
- "node": ">=8.0.0"
5
+ "author": "Exodus Movement, Inc.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ExodusMovement/assets.git"
9
+ },
10
+ "homepage": "https://github.com/ExodusMovement/assets/tree/master/bitcoin/bitcoinjs-lib-forks",
11
+ "license": "MIT",
12
+ "bugs": {
13
+ "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Abitcoinjs-lib-forks"
8
14
  },
15
+ "main": "./src/index.js",
9
16
  "keywords": [
10
17
  "bitcoinjs",
11
18
  "bitcoin",
@@ -16,48 +23,32 @@
16
23
  "cash",
17
24
  "gold"
18
25
  ],
26
+ "files": [
27
+ "src",
28
+ "CHANGELOG.md"
29
+ ],
19
30
  "scripts": {
20
- "coverage-report": "nyc report --reporter=lcov",
21
- "coverage-html": "nyc report --reporter=html",
22
- "coverage": "nyc --check-coverage --branches 90 --functions 90 mocha",
23
- "integration": "mocha test/integration/",
24
- "standard": "standard",
25
- "test": "npm run standard && npm run coverage",
26
31
  "unit": "mocha"
27
32
  },
28
- "repository": {
29
- "type": "git",
30
- "url": "https://github.com/bitcoinjs/bitcoinjs-lib.git"
31
- },
32
- "files": [
33
- "src"
34
- ],
35
33
  "dependencies": {
34
+ "@exodus/bytes": "^1.16.0",
36
35
  "@exodus/crypto": "^1.0.0-rc.27",
37
36
  "bech32": "0.0.3",
38
37
  "bip66": "^1.1.0",
39
38
  "bitcoin-ops": "^1.3.0",
40
39
  "pushdata-bitcoin": "^1.0.1",
41
- "safe-buffer": "^5.0.1",
42
40
  "typeforce": "^1.11.3",
43
41
  "varuint-bitcoin": "^1.0.4"
44
42
  },
45
43
  "devDependencies": {
46
- "async": "^2.0.1",
47
- "bip39": "^2.3.0",
48
44
  "bs58": "^4.0.0",
49
- "cb-http-client": "^0.2.0",
50
- "coinselect": "^3.1.1",
51
- "dhttp": "^2.3.5",
52
- "ecurve": "^1.0.0",
53
45
  "minimaldata": "^1.0.2",
54
46
  "mocha": "^3.1.0",
55
- "nyc": "^10.2.0",
56
- "proxyquire": "^1.4.0",
57
- "randombytes": "^2.0.1",
58
- "sinon": "^1.12.2",
59
- "standard": "^9.0.2",
60
47
  "wif": "^2.0.1"
61
48
  },
62
- "license": "MIT"
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "provenance": false
52
+ },
53
+ "gitHead": "96212d9be9fa026ff8b683785a01c9892b610dd8"
63
54
  }
package/src/address.js CHANGED
@@ -1,5 +1,5 @@
1
+ const { fromBase58checkSync, toBase58checkSync } = require('@exodus/bytes/base58check.js')
1
2
  var bech32 = require('bech32')
2
- var bs58check = require('bs58check')
3
3
  var bscript = require('./script')
4
4
  var btemplates = require('./templates')
5
5
  var networks = require('./networks')
@@ -7,7 +7,7 @@ var typeforce = require('typeforce')
7
7
  var types = require('./types')
8
8
 
9
9
  function fromBase58Check (address) {
10
- var payload = Buffer.from(bs58check.decode(address))
10
+ const payload = fromBase58checkSync(address, 'buffer')
11
11
 
12
12
  // TODO: 4.0.0, move to "toOutputScript"
13
13
  if (payload.length < 21) throw new TypeError(address + ' is too short')
@@ -33,11 +33,11 @@ function fromBech32 (address) {
33
33
  function toBase58Check (hash, version) {
34
34
  typeforce(types.tuple(types.Hash160bit, types.UInt8), arguments)
35
35
 
36
- var payload = Buffer.allocUnsafe(21)
36
+ var payload = Buffer.alloc(21)
37
37
  payload.writeUInt8(version, 0)
38
38
  hash.copy(payload, 1)
39
39
 
40
- return bs58check.encode(payload)
40
+ return toBase58checkSync(payload)
41
41
  }
42
42
 
43
43
  function toBech32 (data, version, prefix) {
package/src/script.js CHANGED
@@ -51,7 +51,7 @@ function compile (chunks) {
51
51
  return accum + 1
52
52
  }, 0.0)
53
53
 
54
- var buffer = Buffer.allocUnsafe(bufferSize)
54
+ var buffer = Buffer.alloc(bufferSize)
55
55
  var offset = 0
56
56
 
57
57
  chunks.forEach(function (chunk) {
@@ -162,7 +162,7 @@ function toStack (chunks) {
162
162
 
163
163
  return chunks.map(function (op) {
164
164
  if (Buffer.isBuffer(op)) return op
165
- if (op === OPS.OP_0) return Buffer.allocUnsafe(0)
165
+ if (op === OPS.OP_0) return Buffer.alloc(0)
166
166
 
167
167
  return scriptNumber.encode(op - OP_INT_BASE)
168
168
  })
@@ -22,7 +22,7 @@ function check (script, allowIncomplete) {
22
22
  }
23
23
  check.toJSON = function () { return 'multisig input' }
24
24
 
25
- var EMPTY_BUFFER = Buffer.allocUnsafe(0)
25
+ var EMPTY_BUFFER = Buffer.alloc(0)
26
26
 
27
27
  function encodeStack (signatures, scriptPubKey) {
28
28
  typeforce([partialSignature], signatures)
@@ -21,7 +21,7 @@ check.toJSON = function () { return 'Witness commitment output' }
21
21
  function encode (commitment) {
22
22
  typeforce(types.Hash256bit, commitment)
23
23
 
24
- var buffer = Buffer.allocUnsafe(36)
24
+ var buffer = Buffer.alloc(36)
25
25
  HEADER.copy(buffer, 0)
26
26
  commitment.copy(buffer, 4)
27
27
 
@@ -38,7 +38,7 @@ Transaction.ADVANCED_TRANSACTION_FLAG = 0x01
38
38
  Transaction.FORKID_BTG = 0x4F // 79
39
39
  Transaction.FORKID_BCH = 0x00
40
40
 
41
- var EMPTY_SCRIPT = Buffer.allocUnsafe(0)
41
+ var EMPTY_SCRIPT = Buffer.alloc(0)
42
42
  var EMPTY_WITNESS = []
43
43
  var ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
44
44
  var ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
@@ -311,7 +311,7 @@ Transaction.prototype.hashForSignature = function (inIndex, prevOutScript, hashT
311
311
  }
312
312
 
313
313
  // serialize and hash
314
- var buffer = Buffer.allocUnsafe(txTmp.__byteLength(false) + 4)
314
+ var buffer = Buffer.alloc(txTmp.__byteLength(false) + 4)
315
315
  buffer.writeInt32LE(hashType, buffer.length - 4)
316
316
  txTmp.__toBuffer(buffer, 0, false)
317
317
 
@@ -336,7 +336,7 @@ Transaction.prototype.hashForWitnessV0 = function (inIndex, prevOutScript, value
336
336
  var hashSequence = ZERO
337
337
 
338
338
  if (!(hashType & Transaction.SIGHASH_ANYONECANPAY)) {
339
- tbuffer = Buffer.allocUnsafe(36 * this.ins.length)
339
+ tbuffer = Buffer.alloc(36 * this.ins.length)
340
340
  toffset = 0
341
341
 
342
342
  this.ins.forEach(function (txIn) {
@@ -350,7 +350,7 @@ Transaction.prototype.hashForWitnessV0 = function (inIndex, prevOutScript, value
350
350
  if (!(hashType & Transaction.SIGHASH_ANYONECANPAY) &&
351
351
  (hashType & 0x1f) !== Transaction.SIGHASH_SINGLE &&
352
352
  (hashType & 0x1f) !== Transaction.SIGHASH_NONE) {
353
- tbuffer = Buffer.allocUnsafe(4 * this.ins.length)
353
+ tbuffer = Buffer.alloc(4 * this.ins.length)
354
354
  toffset = 0
355
355
 
356
356
  this.ins.forEach(function (txIn) {
@@ -366,7 +366,7 @@ Transaction.prototype.hashForWitnessV0 = function (inIndex, prevOutScript, value
366
366
  return sum + 8 + varSliceSize(output.script)
367
367
  }, 0)
368
368
 
369
- tbuffer = Buffer.allocUnsafe(txOutsSize)
369
+ tbuffer = Buffer.alloc(txOutsSize)
370
370
  toffset = 0
371
371
 
372
372
  this.outs.forEach(function (out) {
@@ -378,7 +378,7 @@ Transaction.prototype.hashForWitnessV0 = function (inIndex, prevOutScript, value
378
378
  } else if ((hashType & 0x1f) === Transaction.SIGHASH_SINGLE && inIndex < this.outs.length) {
379
379
  var output = this.outs[inIndex]
380
380
 
381
- tbuffer = Buffer.allocUnsafe(8 + varSliceSize(output.script))
381
+ tbuffer = Buffer.alloc(8 + varSliceSize(output.script))
382
382
  toffset = 0
383
383
  writeUInt64(output.value)
384
384
  writeVarSlice(output.script)
@@ -386,7 +386,7 @@ Transaction.prototype.hashForWitnessV0 = function (inIndex, prevOutScript, value
386
386
  hashOutputs = bcrypto.hash256(tbuffer)
387
387
  }
388
388
 
389
- tbuffer = Buffer.allocUnsafe(156 + varSliceSize(prevOutScript))
389
+ tbuffer = Buffer.alloc(156 + varSliceSize(prevOutScript))
390
390
  toffset = 0
391
391
 
392
392
  var input = this.ins[inIndex]
@@ -470,7 +470,7 @@ Transaction.prototype.toBuffer = function (buffer, initialOffset) {
470
470
  }
471
471
 
472
472
  Transaction.prototype.__toBuffer = function (buffer, initialOffset, __allowWitness) {
473
- if (!buffer) buffer = Buffer.allocUnsafe(this.__byteLength(__allowWitness))
473
+ if (!buffer) buffer = Buffer.alloc(this.__byteLength(__allowWitness))
474
474
 
475
475
  var offset = initialOffset || 0
476
476
  function writeSlice (slice) { offset += slice.copy(buffer, offset) }