diff --git a/src/address.js b/src/address.js index 221f85a..949e389 100644 --- a/src/address.js +++ b/src/address.js @@ -1,11 +1,11 @@ -var Buffer = require('safe-buffer').Buffer -var bech32 = require('bech32') -var bs58check = require('bs58check') -var bscript = require('./script') -var btemplates = require('./templates') -var networks = require('./networks') -var typeforce = require('typeforce') -var types = require('./types') +const Buffer = require('safe-buffer').Buffer +const bech32 = require('bech32') +const bs58check = require('bs58check') +const bscript = require('./script') +const btemplates = require('./templates') +const networks = require('./networks') +const typeforce = require('typeforce') +const types = require('./types') function fromBase58Check (address) { var payload = bs58check.decode(address) diff --git a/src/block.js b/src/block.js index c545996..0d4a585 100644 --- a/src/block.js +++ b/src/block.js @@ -1,11 +1,11 @@ -var Buffer = require('safe-buffer').Buffer -var bcrypto = require('./crypto') -var fastMerkleRoot = require('merkle-lib/fastRoot') -var typeforce = require('typeforce') -var types = require('./types') -var varuint = require('varuint-bitcoin') +const Buffer = require('safe-buffer').Buffer +const bcrypto = require('./crypto') +const fastMerkleRoot = require('merkle-lib/fastRoot') +const typeforce = require('typeforce') +const types = require('./types') +const varuint = require('varuint-bitcoin') -var Transaction = require('./transaction') +const Transaction = require('./transaction') function Block () { this.version = 1 diff --git a/src/crypto.js b/src/crypto.js index 1bb39f1..a11d061 100644 --- a/src/crypto.js +++ b/src/crypto.js @@ -1,4 +1,4 @@ -var createHash = require('create-hash') +const createHash = require('create-hash') function ripemd160 (buffer) { return createHash('rmd160').update(buffer).digest() diff --git a/src/script.js b/src/script.js index 612ce9d..63bf75d 100644 --- a/src/script.js +++ b/src/script.js @@ -1,14 +1,14 @@ -var Buffer = require('safe-buffer').Buffer -var bip66 = require('bip66') +const Buffer = require('safe-buffer').Buffer +const bip66 = require('bip66') const ecc = require('tiny-secp256k1') -var pushdata = require('pushdata-bitcoin') -var typeforce = require('typeforce') -var types = require('./types') -var scriptNumber = require('./script_number') +const pushdata = require('pushdata-bitcoin') +const typeforce = require('typeforce') +const types = require('./types') +const scriptNumber = require('./script_number') -var OPS = require('bitcoin-ops') -var REVERSE_OPS = require('bitcoin-ops/map') -var OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1 +const OPS = require('bitcoin-ops') +const REVERSE_OPS = require('bitcoin-ops/map') +const OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1 function isOPInt (value) { return types.Number(value) && diff --git a/src/script_number.js b/src/script_number.js index 3fd6326..6257690 100644 --- a/src/script_number.js +++ b/src/script_number.js @@ -1,4 +1,4 @@ -var Buffer = require('safe-buffer').Buffer +const Buffer = require('safe-buffer').Buffer function decode (buffer, maxLength, minimal) { maxLength = maxLength || 4 diff --git a/src/templates/index.js b/src/templates/index.js index af09112..4d7ce69 100644 --- a/src/templates/index.js +++ b/src/templates/index.js @@ -1,14 +1,14 @@ -var decompile = require('../script').decompile -var multisig = require('./multisig') -var nullData = require('./nulldata') -var pubKey = require('./pubkey') -var pubKeyHash = require('./pubkeyhash') -var scriptHash = require('./scripthash') -var witnessPubKeyHash = require('./witnesspubkeyhash') -var witnessScriptHash = require('./witnessscripthash') -var witnessCommitment = require('./witnesscommitment') +const decompile = require('../script').decompile +const multisig = require('./multisig') +const nullData = require('./nulldata') +const pubKey = require('./pubkey') +const pubKeyHash = require('./pubkeyhash') +const scriptHash = require('./scripthash') +const witnessPubKeyHash = require('./witnesspubkeyhash') +const witnessScriptHash = require('./witnessscripthash') +const witnessCommitment = require('./witnesscommitment') -var types = { +const types = { MULTISIG: 'multisig', NONSTANDARD: 'nonstandard', NULLDATA: 'nulldata', diff --git a/src/templates/multisig/input.js b/src/templates/multisig/input.js index 0ba0a06..54f2a9f 100644 --- a/src/templates/multisig/input.js +++ b/src/templates/multisig/input.js @@ -1,10 +1,10 @@ // OP_0 [signatures ...] -var Buffer = require('safe-buffer').Buffer -var bscript = require('../../script') -var p2mso = require('./output') -var typeforce = require('typeforce') -var OPS = require('bitcoin-ops') +const Buffer = require('safe-buffer').Buffer +const bscript = require('../../script') +const p2mso = require('./output') +const typeforce = require('typeforce') +const OPS = require('bitcoin-ops') function partialSignature (value) { return value === OPS.OP_0 || bscript.isCanonicalScriptSignature(value) @@ -23,7 +23,7 @@ function check (script, allowIncomplete) { } check.toJSON = function () { return 'multisig input' } -var EMPTY_BUFFER = Buffer.allocUnsafe(0) +const EMPTY_BUFFER = Buffer.allocUnsafe(0) function encodeStack (signatures, scriptPubKey) { typeforce([partialSignature], signatures) diff --git a/src/templates/multisig/output.js b/src/templates/multisig/output.js index 70e8488..baef7e7 100644 --- a/src/templates/multisig/output.js +++ b/src/templates/multisig/output.js @@ -1,10 +1,10 @@ // m [pubKeys ...] n OP_CHECKMULTISIG -var bscript = require('../../script') -var types = require('../../types') -var typeforce = require('typeforce') -var OPS = require('bitcoin-ops') -var OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1 +const bscript = require('../../script') +const types = require('../../types') +const typeforce = require('typeforce') +const OPS = require('bitcoin-ops') +const OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1 function check (script, allowIncomplete) { var chunks = bscript.decompile(script) diff --git a/src/templates/nulldata.js b/src/templates/nulldata.js index b7d53f8..1b9c404 100644 --- a/src/templates/nulldata.js +++ b/src/templates/nulldata.js @@ -1,9 +1,9 @@ // OP_RETURN {data} -var bscript = require('../script') -var types = require('../types') -var typeforce = require('typeforce') -var OPS = require('bitcoin-ops') +const bscript = require('../script') +const types = require('../types') +const typeforce = require('typeforce') +const OPS = require('bitcoin-ops') function check (script) { var buffer = bscript.compile(script) diff --git a/src/templates/pubkey/input.js b/src/templates/pubkey/input.js index 9149289..e4cb931 100644 --- a/src/templates/pubkey/input.js +++ b/src/templates/pubkey/input.js @@ -1,7 +1,7 @@ // {signature} -var bscript = require('../../script') -var typeforce = require('typeforce') +const bscript = require('../../script') +const typeforce = require('typeforce') function check (script) { var chunks = bscript.decompile(script) diff --git a/src/templates/pubkey/output.js b/src/templates/pubkey/output.js index 69a747f..f8bff2f 100644 --- a/src/templates/pubkey/output.js +++ b/src/templates/pubkey/output.js @@ -1,8 +1,8 @@ // {pubKey} OP_CHECKSIG -var bscript = require('../../script') -var typeforce = require('typeforce') -var OPS = require('bitcoin-ops') +const bscript = require('../../script') +const typeforce = require('typeforce') +const OPS = require('bitcoin-ops') function check (script) { var chunks = bscript.decompile(script) diff --git a/src/templates/pubkeyhash/input.js b/src/templates/pubkeyhash/input.js index 81e1f80..0d5497b 100644 --- a/src/templates/pubkeyhash/input.js +++ b/src/templates/pubkeyhash/input.js @@ -1,7 +1,7 @@ // {signature} {pubKey} -var bscript = require('../../script') -var typeforce = require('typeforce') +const bscript = require('../../script') +const typeforce = require('typeforce') function check (script) { var chunks = bscript.decompile(script) diff --git a/src/templates/pubkeyhash/output.js b/src/templates/pubkeyhash/output.js index 2a7c4ab..c89685b 100644 --- a/src/templates/pubkeyhash/output.js +++ b/src/templates/pubkeyhash/output.js @@ -1,9 +1,9 @@ // OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG -var bscript = require('../../script') -var types = require('../../types') -var typeforce = require('typeforce') -var OPS = require('bitcoin-ops') +const bscript = require('../../script') +const types = require('../../types') +const typeforce = require('typeforce') +const OPS = require('bitcoin-ops') function check (script) { var buffer = bscript.compile(script) diff --git a/src/templates/scripthash/input.js b/src/templates/scripthash/input.js index 2ce55e3..a2d0693 100644 --- a/src/templates/scripthash/input.js +++ b/src/templates/scripthash/input.js @@ -1,14 +1,14 @@ // {serialized scriptPubKey script} -var Buffer = require('safe-buffer').Buffer -var bscript = require('../../script') -var typeforce = require('typeforce') +const Buffer = require('safe-buffer').Buffer +const bscript = require('../../script') +const typeforce = require('typeforce') -var p2ms = require('../multisig/') -var p2pk = require('../pubkey/') -var p2pkh = require('../pubkeyhash/') -var p2wpkho = require('../witnesspubkeyhash/output') -var p2wsho = require('../witnessscripthash/output') +const p2ms = require('../multisig/') +const p2pk = require('../pubkey/') +const p2pkh = require('../pubkeyhash/') +const p2wpkho = require('../witnesspubkeyhash/output') +const p2wsho = require('../witnessscripthash/output') function check (script, allowIncomplete) { var chunks = bscript.decompile(script) diff --git a/src/templates/scripthash/output.js b/src/templates/scripthash/output.js index 83d2501..d9776da 100644 --- a/src/templates/scripthash/output.js +++ b/src/templates/scripthash/output.js @@ -1,9 +1,9 @@ // OP_HASH160 {scriptHash} OP_EQUAL -var bscript = require('../../script') -var types = require('../../types') -var typeforce = require('typeforce') -var OPS = require('bitcoin-ops') +const bscript = require('../../script') +const types = require('../../types') +const typeforce = require('typeforce') +const OPS = require('bitcoin-ops') function check (script) { var buffer = bscript.compile(script) diff --git a/src/templates/witnesscommitment/output.js b/src/templates/witnesscommitment/output.js index 3984ea5..5f97d69 100644 --- a/src/templates/witnesscommitment/output.js +++ b/src/templates/witnesscommitment/output.js @@ -1,12 +1,12 @@ // OP_RETURN {aa21a9ed} {commitment} -var Buffer = require('safe-buffer').Buffer -var bscript = require('../../script') -var types = require('../../types') -var typeforce = require('typeforce') -var OPS = require('bitcoin-ops') +const Buffer = require('safe-buffer').Buffer +const bscript = require('../../script') +const types = require('../../types') +const typeforce = require('typeforce') +const OPS = require('bitcoin-ops') -var HEADER = Buffer.from('aa21a9ed', 'hex') +const HEADER = Buffer.from('aa21a9ed', 'hex') function check (script) { var buffer = bscript.compile(script) diff --git a/src/templates/witnesspubkeyhash/input.js b/src/templates/witnesspubkeyhash/input.js index 089c8d8..a0549ff 100644 --- a/src/templates/witnesspubkeyhash/input.js +++ b/src/templates/witnesspubkeyhash/input.js @@ -1,7 +1,7 @@ // {signature} {pubKey} -var bscript = require('../../script') -var typeforce = require('typeforce') +const bscript = require('../../script') +const typeforce = require('typeforce') function isCompressedCanonicalPubKey (pubKey) { return bscript.isCanonicalPubKey(pubKey) && pubKey.length === 33 diff --git a/src/templates/witnesspubkeyhash/output.js b/src/templates/witnesspubkeyhash/output.js index ebcb185..d2b091b 100644 --- a/src/templates/witnesspubkeyhash/output.js +++ b/src/templates/witnesspubkeyhash/output.js @@ -1,9 +1,9 @@ // OP_0 {pubKeyHash} -var bscript = require('../../script') -var types = require('../../types') -var typeforce = require('typeforce') -var OPS = require('bitcoin-ops') +const bscript = require('../../script') +const types = require('../../types') +const typeforce = require('typeforce') +const OPS = require('bitcoin-ops') function check (script) { var buffer = bscript.compile(script) diff --git a/src/templates/witnessscripthash/input.js b/src/templates/witnessscripthash/input.js index d6e85f5..c21ee1e 100644 --- a/src/templates/witnessscripthash/input.js +++ b/src/templates/witnessscripthash/input.js @@ -1,12 +1,12 @@ // {serialized scriptPubKey script} -var bscript = require('../../script') -var types = require('../../types') -var typeforce = require('typeforce') +const bscript = require('../../script') +const types = require('../../types') +const typeforce = require('typeforce') -var p2ms = require('../multisig/') -var p2pk = require('../pubkey/') -var p2pkh = require('../pubkeyhash/') +const p2ms = require('../multisig/') +const p2pk = require('../pubkey/') +const p2pkh = require('../pubkeyhash/') function check (chunks, allowIncomplete) { typeforce(types.Array, chunks) diff --git a/src/templates/witnessscripthash/output.js b/src/templates/witnessscripthash/output.js index f1656b5..d800fda 100644 --- a/src/templates/witnessscripthash/output.js +++ b/src/templates/witnessscripthash/output.js @@ -1,9 +1,9 @@ // OP_0 {scriptHash} -var bscript = require('../../script') -var types = require('../../types') -var typeforce = require('typeforce') -var OPS = require('bitcoin-ops') +const bscript = require('../../script') +const types = require('../../types') +const typeforce = require('typeforce') +const OPS = require('bitcoin-ops') function check (script) { var buffer = bscript.compile(script) diff --git a/src/transaction.js b/src/transaction.js index 86cccea..8187c73 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -1,11 +1,11 @@ -var Buffer = require('safe-buffer').Buffer -var bcrypto = require('./crypto') -var bscript = require('./script') -var bufferutils = require('./bufferutils') -var opcodes = require('bitcoin-ops') -var typeforce = require('typeforce') -var types = require('./types') -var varuint = require('varuint-bitcoin') +const Buffer = require('safe-buffer').Buffer +const bcrypto = require('./crypto') +const bscript = require('./script') +const bufferutils = require('./bufferutils') +const opcodes = require('bitcoin-ops') +const typeforce = require('typeforce') +const types = require('./types') +const varuint = require('varuint-bitcoin') function varSliceSize (someScript) { var length = someScript.length @@ -36,12 +36,12 @@ Transaction.SIGHASH_ANYONECANPAY = 0x80 Transaction.ADVANCED_TRANSACTION_MARKER = 0x00 Transaction.ADVANCED_TRANSACTION_FLAG = 0x01 -var EMPTY_SCRIPT = Buffer.allocUnsafe(0) -var EMPTY_WITNESS = [] -var ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex') -var ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex') -var VALUE_UINT64_MAX = Buffer.from('ffffffffffffffff', 'hex') -var BLANK_OUTPUT = { +const EMPTY_SCRIPT = Buffer.allocUnsafe(0) +const EMPTY_WITNESS = [] +const ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex') +const ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex') +const VALUE_UINT64_MAX = Buffer.from('ffffffffffffffff', 'hex') +const BLANK_OUTPUT = { script: EMPTY_SCRIPT, valueBuffer: VALUE_UINT64_MAX } diff --git a/src/transaction_builder.js b/src/transaction_builder.js index 4f731dc..d5ad34c 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -1,18 +1,18 @@ -var Buffer = require('safe-buffer').Buffer -var baddress = require('./address') -var bcrypto = require('./crypto') -var bscript = require('./script') -var btemplates = require('./templates') -var networks = require('./networks') -var ops = require('bitcoin-ops') -var typeforce = require('typeforce') -var types = require('./types') -var scriptTypes = btemplates.types -var SIGNABLE = [btemplates.types.P2PKH, btemplates.types.P2PK, btemplates.types.MULTISIG] -var P2SH = SIGNABLE.concat([btemplates.types.P2WPKH, btemplates.types.P2WSH]) +const Buffer = require('safe-buffer').Buffer +const baddress = require('./address') +const bcrypto = require('./crypto') +const bscript = require('./script') +const btemplates = require('./templates') +const networks = require('./networks') +const ops = require('bitcoin-ops') +const typeforce = require('typeforce') +const types = require('./types') +const scriptTypes = btemplates.types +const SIGNABLE = [btemplates.types.P2PKH, btemplates.types.P2PK, btemplates.types.MULTISIG] +const P2SH = SIGNABLE.concat([btemplates.types.P2WPKH, btemplates.types.P2WSH]) -var ECPair = require('./ecpair') -var Transaction = require('./transaction') +const ECPair = require('./ecpair') +const Transaction = require('./transaction') function supportedType (type) { return SIGNABLE.indexOf(type) !== -1 diff --git a/src/types.js b/src/types.js index 302043f..2d1ec6f 100644 --- a/src/types.js +++ b/src/types.js @@ -1,6 +1,6 @@ -var typeforce = require('typeforce') +const typeforce = require('typeforce') -var UINT31_MAX = Math.pow(2, 31) - 1 +const UINT31_MAX = Math.pow(2, 31) - 1 function UInt31 (value) { return typeforce.UInt32(value) && value <= UINT31_MAX } @@ -10,16 +10,16 @@ function BIP32Path (value) { } BIP32Path.toJSON = function () { return 'BIP32 derivation path' } -var SATOSHI_MAX = 21 * 1e14 +const SATOSHI_MAX = 21 * 1e14 function Satoshi (value) { return typeforce.UInt53(value) && value <= SATOSHI_MAX } // external dependent types -var ECPoint = typeforce.quacksLike('Point') +const ECPoint = typeforce.quacksLike('Point') // exposed, external API -var Network = typeforce.compile({ +const Network = typeforce.compile({ messagePrefix: typeforce.oneOf(typeforce.Buffer, typeforce.String), bip32: { public: typeforce.UInt32, @@ -31,7 +31,7 @@ var Network = typeforce.compile({ }) // extend typeforce types with ours -var types = { +const types = { BIP32Path: BIP32Path, Buffer256bit: typeforce.BufferN(32), ECPoint: ECPoint, diff --git a/test/bitcoin.core.js b/test/bitcoin.core.js index 4d73c2a..bda6899 100644 --- a/test/bitcoin.core.js +++ b/test/bitcoin.core.js @@ -1,17 +1,17 @@ /* global describe, it */ -var assert = require('assert') -var base58 = require('bs58') -var bitcoin = require('../') +const assert = require('assert') +const base58 = require('bs58') +const bitcoin = require('../') -var base58EncodeDecode = require('./fixtures/core/base58_encode_decode.json') -var base58KeysInvalid = require('./fixtures/core/base58_keys_invalid.json') -var base58KeysValid = require('./fixtures/core/base58_keys_valid.json') -var blocksValid = require('./fixtures/core/blocks.json') -var sigCanonical = require('./fixtures/core/sig_canonical.json') -var sigHash = require('./fixtures/core/sighash.json') -var sigNoncanonical = require('./fixtures/core/sig_noncanonical.json') -var txValid = require('./fixtures/core/tx_valid.json') +const base58EncodeDecode = require('./fixtures/core/base58_encode_decode.json') +const base58KeysInvalid = require('./fixtures/core/base58_keys_invalid.json') +const base58KeysValid = require('./fixtures/core/base58_keys_valid.json') +const blocksValid = require('./fixtures/core/blocks.json') +const sigCanonical = require('./fixtures/core/sig_canonical.json') +const sigHash = require('./fixtures/core/sighash.json') +const sigNoncanonical = require('./fixtures/core/sig_noncanonical.json') +const txValid = require('./fixtures/core/tx_valid.json') describe('Bitcoin-core', function () { // base58EncodeDecode diff --git a/test/block.js b/test/block.js index 19866e5..5794d66 100644 --- a/test/block.js +++ b/test/block.js @@ -1,9 +1,9 @@ /* global describe, it, beforeEach */ -var assert = require('assert') -var Block = require('../src/block') +const assert = require('assert') +const Block = require('../src/block') -var fixtures = require('./fixtures/block') +const fixtures = require('./fixtures/block') describe('Block', function () { describe('version', function () { diff --git a/test/bufferutils.js b/test/bufferutils.js index e172ba1..da98828 100644 --- a/test/bufferutils.js +++ b/test/bufferutils.js @@ -1,9 +1,9 @@ /* global describe, it */ -var assert = require('assert') -var bufferutils = require('../src/bufferutils') +const assert = require('assert') +const bufferutils = require('../src/bufferutils') -var fixtures = require('./fixtures/bufferutils.json') +const fixtures = require('./fixtures/bufferutils.json') describe('bufferutils', function () { describe('readUInt64LE', function () { diff --git a/test/crypto.js b/test/crypto.js index 0fcc24b..91bc674 100644 --- a/test/crypto.js +++ b/test/crypto.js @@ -1,9 +1,9 @@ /* global describe, it */ -var assert = require('assert') -var bcrypto = require('../src/crypto') +const assert = require('assert') +const bcrypto = require('../src/crypto') -var fixtures = require('./fixtures/crypto') +const fixtures = require('./fixtures/crypto') describe('crypto', function () { ['hash160', 'hash256', 'ripemd160', 'sha1', 'sha256'].forEach(function (algorithm) { diff --git a/test/integration/_regtest.js b/test/integration/_regtest.js index 409f908..91b25d5 100644 --- a/test/integration/_regtest.js +++ b/test/integration/_regtest.js @@ -1,9 +1,9 @@ -var assert = require('assert') -var bitcoin = require('../../') -var dhttp = require('dhttp/200') +const assert = require('assert') +const bitcoin = require('../../') +const dhttp = require('dhttp/200') -var APIPASS = process.env.APIPASS || 'satoshi' -var APIURL = 'https://api.dcousens.cloud/1' +const APIPASS = process.env.APIPASS || 'satoshi' +const APIURL = 'https://api.dcousens.cloud/1' function broadcast (txHex, callback) { dhttp({ diff --git a/test/integration/blocks.js b/test/integration/blocks.js index 56eca68..d4a7ec4 100644 --- a/test/integration/blocks.js +++ b/test/integration/blocks.js @@ -1,8 +1,8 @@ /* global describe, it */ 'use strict' -var assert = require('assert') -var bitcoin = require('../../') +const assert = require('assert') +const bitcoin = require('../../') describe('bitcoinjs-lib (blocks)', function () { it('can extract a height from a CoinBase transaction', function () { diff --git a/test/integration/cltv.js b/test/integration/cltv.js index b7c6c2c..90e78a9 100644 --- a/test/integration/cltv.js +++ b/test/integration/cltv.js @@ -1,13 +1,13 @@ /* global describe, it, before */ -var assert = require('assert') -var bitcoin = require('../../') -var regtestUtils = require('./_regtest') -var regtest = regtestUtils.network -var bip65 = require('bip65') +const assert = require('assert') +const bitcoin = require('../../') +const regtestUtils = require('./_regtest') +const regtest = regtestUtils.network +const bip65 = require('bip65') -var alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest) -var bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest) +const alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest) +const bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest) describe('bitcoinjs-lib (transactions w/ CLTV)', function () { // force update MTP diff --git a/test/integration/crypto.js b/test/integration/crypto.js index 58ae431..deddf67 100644 --- a/test/integration/crypto.js +++ b/test/integration/crypto.js @@ -1,14 +1,14 @@ /* global describe, it */ -var assert = require('assert') -var bigi = require('bigi') -var bitcoin = require('../../') -var bip32 = require('bip32') -var crypto = require('crypto') -var tinysecp = require('tiny-secp256k1') +const assert = require('assert') +const bigi = require('bigi') +const bitcoin = require('../../') +const bip32 = require('bip32') +const crypto = require('crypto') +const tinysecp = require('tiny-secp256k1') -var ecurve = require('ecurve') -var secp256k1 = ecurve.getCurveByName('secp256k1') +const ecurve = require('ecurve') +const secp256k1 = ecurve.getCurveByName('secp256k1') describe('bitcoinjs-lib (crypto)', function () { it('can recover a private key from duplicate R values', function () { diff --git a/test/script.js b/test/script.js index 537e75a..71c9d72 100644 --- a/test/script.js +++ b/test/script.js @@ -1,11 +1,11 @@ /* global describe, it */ -var assert = require('assert') -var bscript = require('../src/script') -var minimalData = require('minimaldata') +const assert = require('assert') +const bscript = require('../src/script') +const minimalData = require('minimaldata') -var fixtures = require('./fixtures/script.json') -var fixtures2 = require('./fixtures/templates.json') +const fixtures = require('./fixtures/script.json') +const fixtures2 = require('./fixtures/templates.json') describe('script', function () { // TODO diff --git a/test/script_number.js b/test/script_number.js index 2aa33a7..9eb0820 100644 --- a/test/script_number.js +++ b/test/script_number.js @@ -1,8 +1,8 @@ /* global describe, it */ -var assert = require('assert') -var scriptNumber = require('../src/script_number') -var fixtures = require('./fixtures/script_number.json') +const assert = require('assert') +const scriptNumber = require('../src/script_number') +const fixtures = require('./fixtures/script_number.json') describe('script-number', function () { describe('decode', function () { diff --git a/test/script_signature.js b/test/script_signature.js index f53bc52..2c22540 100644 --- a/test/script_signature.js +++ b/test/script_signature.js @@ -1,9 +1,9 @@ /* global describe, it */ -var assert = require('assert') -var bscriptSig = require('../src/script').signature -var Buffer = require('safe-buffer').Buffer -var fixtures = require('./fixtures/signature.json') +const assert = require('assert') +const bscriptSig = require('../src/script').signature +const Buffer = require('safe-buffer').Buffer +const fixtures = require('./fixtures/signature.json') describe('Script Signatures', function () { function fromRaw (signature) { diff --git a/test/templates.js b/test/templates.js index c89bd52..a850564 100644 --- a/test/templates.js +++ b/test/templates.js @@ -1,12 +1,12 @@ /* global describe, it */ -var assert = require('assert') -var bcrypto = require('../src/crypto') -var bscript = require('../src/script') -var btemplates = require('../src/templates') -var ops = require('bitcoin-ops') +const assert = require('assert') +const bcrypto = require('../src/crypto') +const bscript = require('../src/script') +const btemplates = require('../src/templates') +const ops = require('bitcoin-ops') -var fixtures = require('./fixtures/templates.json') +const fixtures = require('./fixtures/templates.json') function fromHex (x) { return Buffer.from(x, 'hex') } function toHex (x) { return x.toString('hex') } diff --git a/test/transaction.js b/test/transaction.js index 62c24d0..fa69640 100644 --- a/test/transaction.js +++ b/test/transaction.js @@ -1,9 +1,9 @@ /* global describe, it, beforeEach */ -var assert = require('assert') -var bscript = require('../src/script') -var fixtures = require('./fixtures/transaction') -var Transaction = require('../src/transaction') +const assert = require('assert') +const bscript = require('../src/script') +const fixtures = require('./fixtures/transaction') +const Transaction = require('../src/transaction') describe('Transaction', function () { function fromRaw (raw, noWitness) { diff --git a/test/types.js b/test/types.js index 2dbc554..ab2110d 100644 --- a/test/types.js +++ b/test/types.js @@ -1,8 +1,8 @@ /* global describe, it */ -var assert = require('assert') -var types = require('../src/types') -var typeforce = require('typeforce') +const assert = require('assert') +const types = require('../src/types') +const typeforce = require('typeforce') describe('types', function () { describe('Buffer Hash160/Hash256', function () {