diff --git a/package.json b/package.json index 52c7e8d..669233e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "bitcoinjs-lib", "version": "4.0.2", "description": "Client-side Bitcoin JavaScript library", - "main": "./src/index.js", + "main": "./dist/src/index.js", "engines": { "node": ">=8.0.0" }, @@ -17,17 +17,18 @@ "coverage-report": "nyc report --reporter=lcov", "coverage-html": "nyc report --reporter=html", "coverage": "nyc --check-coverage --branches 90 --functions 90 mocha", - "integration": "mocha --timeout 50000 test/integration/", + "integration": "npm run build && mocha --timeout 50000 test/integration/", "standard": "standard", - "test": "npm run standard && npm run coverage", - "unit": "mocha" + "test": "npm run build && npm run standard && npm run coverage", + "unit": "npm run build && mocha", + "build": "tsc -p tsconfig.json" }, "repository": { "type": "git", "url": "https://github.com/bitcoinjs/bitcoinjs-lib.git" }, "files": [ - "src" + "dist/src" ], "dependencies": { "bech32": "^1.1.2", diff --git a/src/address.ts b/src/address.ts index e71bd46..e6f60fc 100644 --- a/src/address.ts +++ b/src/address.ts @@ -95,3 +95,4 @@ module.exports = { toBech32: toBech32, toOutputScript: toOutputScript } +export {} diff --git a/src/block.ts b/src/block.ts index eb7f708..1d69d0b 100644 --- a/src/block.ts +++ b/src/block.ts @@ -175,3 +175,4 @@ Block.prototype.checkProofOfWork = function () { } module.exports = Block +export {} diff --git a/src/bufferutils.ts b/src/bufferutils.ts index 48647d6..a78b07b 100644 --- a/src/bufferutils.ts +++ b/src/bufferutils.ts @@ -27,3 +27,4 @@ module.exports = { readUInt64LE: readUInt64LE, writeUInt64LE: writeUInt64LE } +export {} diff --git a/src/classify.ts b/src/classify.ts index 8350e07..3f824c4 100644 --- a/src/classify.ts +++ b/src/classify.ts @@ -68,3 +68,4 @@ module.exports = { witness: classifyWitness, types: types } +export {} diff --git a/src/crypto.ts b/src/crypto.ts index a11d061..a04c67f 100644 --- a/src/crypto.ts +++ b/src/crypto.ts @@ -27,3 +27,4 @@ module.exports = { sha1: sha1, sha256: sha256 } +export {} diff --git a/src/ecpair.ts b/src/ecpair.ts index 0e2cf26..0c9fd83 100644 --- a/src/ecpair.ts +++ b/src/ecpair.ts @@ -104,3 +104,4 @@ module.exports = { fromPublicKey, fromWIF } +export {} diff --git a/src/index.ts b/src/index.ts index 213e98a..967fddc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,3 +14,4 @@ module.exports = { payments: require('./payments'), script: script } +export {} diff --git a/src/networks.ts b/src/networks.ts index fb3957c..0aac048 100644 --- a/src/networks.ts +++ b/src/networks.ts @@ -36,3 +36,4 @@ module.exports = { wif: 0xef } } +export {} diff --git a/src/payments/embed.ts b/src/payments/embed.ts index ea2c8e9..bfb70e5 100644 --- a/src/payments/embed.ts +++ b/src/payments/embed.ts @@ -28,7 +28,10 @@ function p2data (a, opts) { }, a) const network = a.network || BITCOIN_NETWORK - const o = { network } + const o = { + network, + data: undefined + } lazy.prop(o, 'output', function () { if (!a.data) return @@ -54,3 +57,4 @@ function p2data (a, opts) { } module.exports = p2data +export {} diff --git a/src/payments/index.ts b/src/payments/index.ts index d445466..bb4e0e6 100644 --- a/src/payments/index.ts +++ b/src/payments/index.ts @@ -10,3 +10,4 @@ module.exports = { embed, p2ms, p2pk, p2pkh, p2sh, p2wpkh, p2wsh } // TODO // witness commitment +export {} diff --git a/src/payments/lazy.ts b/src/payments/lazy.ts index 8538752..4a9611c 100644 --- a/src/payments/lazy.ts +++ b/src/payments/lazy.ts @@ -28,3 +28,4 @@ function value (f) { } module.exports = { prop, value } +export {} diff --git a/src/payments/p2ms.ts b/src/payments/p2ms.ts index 5c90a4d..39b38f1 100644 --- a/src/payments/p2ms.ts +++ b/src/payments/p2ms.ts @@ -42,7 +42,15 @@ function p2ms (a, opts) { }, a) const network = a.network || BITCOIN_NETWORK - const o = { network } + const o = { + network, + m: undefined, + n: undefined, + pubkeys: undefined, + output: undefined, + input: undefined, + signatures: undefined, + } let chunks let decoded = false @@ -129,7 +137,7 @@ function p2ms (a, opts) { if (a.input[0] !== OPS.OP_0) throw new TypeError('Input is invalid') if (o.signatures.length === 0 || !o.signatures.every(isAcceptableSignature)) throw new TypeError('Input has invalid signature(s)') - if (a.signatures && !stacksEqual(a.signatures.equals(o.signatures))) throw new TypeError('Signature mismatch') + if (a.signatures && !stacksEqual(a.signatures.equals(o.signatures), undefined)) throw new TypeError('Signature mismatch') if (a.m !== undefined && a.m !== a.signatures.length) throw new TypeError('Signature count mismatch') } } @@ -138,3 +146,4 @@ function p2ms (a, opts) { } module.exports = p2ms +export {} diff --git a/src/payments/p2pk.ts b/src/payments/p2pk.ts index b930612..b810d48 100644 --- a/src/payments/p2pk.ts +++ b/src/payments/p2pk.ts @@ -30,7 +30,12 @@ function p2pk (a, opts) { const _chunks = lazy.value(function () { return bscript.decompile(a.input) }) const network = a.network || BITCOIN_NETWORK - const o = { network } + const o = { + network, + input: undefined, + pubkey: undefined, + signature: undefined, + } lazy.prop(o, 'output', function () { if (!a.pubkey) return @@ -78,3 +83,4 @@ function p2pk (a, opts) { } module.exports = p2pk +export {} diff --git a/src/payments/p2pkh.ts b/src/payments/p2pkh.ts index e9248a2..c322fc7 100644 --- a/src/payments/p2pkh.ts +++ b/src/payments/p2pkh.ts @@ -40,7 +40,12 @@ function p2pkh (a, opts) { const _chunks = lazy.value(function () { return bscript.decompile(a.input) }) const network = a.network || BITCOIN_NETWORK - const o = { network } + const o = { + network, + hash: undefined, + pubkey: undefined, + input: undefined, + } lazy.prop(o, 'address', function () { if (!o.hash) return @@ -135,3 +140,4 @@ function p2pkh (a, opts) { } module.exports = p2pkh +export {} diff --git a/src/payments/p2sh.ts b/src/payments/p2sh.ts index 0729c8b..07bb32e 100644 --- a/src/payments/p2sh.ts +++ b/src/payments/p2sh.ts @@ -50,7 +50,12 @@ function p2sh (a, opts) { network = (a.redeem && a.redeem.network) || BITCOIN_NETWORK } - const o = { network } + const o = { + network, + hash: undefined, + redeem: undefined, + input: undefined, + } const _address = lazy.value(function () { const payload = bs58check.decode(a.address) @@ -191,3 +196,4 @@ function p2sh (a, opts) { } module.exports = p2sh +export {} diff --git a/src/payments/p2wpkh.ts b/src/payments/p2wpkh.ts index 1483bd8..1ab21b5 100644 --- a/src/payments/p2wpkh.ts +++ b/src/payments/p2wpkh.ts @@ -46,7 +46,12 @@ function p2wpkh (a, opts) { }) const network = a.network || BITCOIN_NETWORK - const o = { network } + const o = { + network, + hash: undefined, + pubkey: undefined, + witness: undefined, + } lazy.prop(o, 'address', function () { if (!o.hash) return @@ -133,3 +138,4 @@ function p2wpkh (a, opts) { } module.exports = p2wpkh +export {} diff --git a/src/payments/p2wsh.ts b/src/payments/p2wsh.ts index d8e6e8a..fe19314 100644 --- a/src/payments/p2wsh.ts +++ b/src/payments/p2wsh.ts @@ -64,7 +64,12 @@ function p2wsh (a, opts) { network = (a.redeem && a.redeem.network) || BITCOIN_NETWORK } - const o = { network } + const o = { + network, + hash: undefined, + redeem: undefined, + witness: undefined, + } lazy.prop(o, 'address', function () { if (!o.hash) return @@ -178,3 +183,4 @@ function p2wsh (a, opts) { } module.exports = p2wsh +export {} diff --git a/src/script.ts b/src/script.ts index ad7c4e4..514e992 100644 --- a/src/script.ts +++ b/src/script.ts @@ -203,3 +203,4 @@ module.exports = { isPushOnly: isPushOnly, isDefinedHashType: isDefinedHashType } +export {} diff --git a/src/script_number.ts b/src/script_number.ts index 3440797..4df4704 100644 --- a/src/script_number.ts +++ b/src/script_number.ts @@ -65,3 +65,4 @@ module.exports = { decode: decode, encode: encode } +export {} diff --git a/src/script_signature.ts b/src/script_signature.ts index bdb3ddb..b1f933a 100644 --- a/src/script_signature.ts +++ b/src/script_signature.ts @@ -62,3 +62,4 @@ module.exports = { decode: decode, encode: encode } +export {} diff --git a/src/templates/multisig/index.ts b/src/templates/multisig/index.ts index 46863d6..7192cfd 100644 --- a/src/templates/multisig/index.ts +++ b/src/templates/multisig/index.ts @@ -2,3 +2,4 @@ module.exports = { input: require('./input'), output: require('./output') } +export {} diff --git a/src/templates/multisig/input.ts b/src/templates/multisig/input.ts index a66f05f..d395108 100644 --- a/src/templates/multisig/input.ts +++ b/src/templates/multisig/input.ts @@ -21,3 +21,4 @@ function check (script, allowIncomplete) { check.toJSON = function () { return 'multisig input' } module.exports = { check } +export {} diff --git a/src/templates/multisig/output.ts b/src/templates/multisig/output.ts index 5c9d81f..5ff18f1 100644 --- a/src/templates/multisig/output.ts +++ b/src/templates/multisig/output.ts @@ -27,3 +27,4 @@ function check (script, allowIncomplete) { check.toJSON = function () { return 'multi-sig output' } module.exports = { check } +export {} diff --git a/src/templates/nulldata.ts b/src/templates/nulldata.ts index d42fd71..145b504 100644 --- a/src/templates/nulldata.ts +++ b/src/templates/nulldata.ts @@ -12,3 +12,4 @@ function check (script) { check.toJSON = function () { return 'null data output' } module.exports = { output: { check: check } } +export {} diff --git a/src/templates/pubkey/index.ts b/src/templates/pubkey/index.ts index 46863d6..7192cfd 100644 --- a/src/templates/pubkey/index.ts +++ b/src/templates/pubkey/index.ts @@ -2,3 +2,4 @@ module.exports = { input: require('./input'), output: require('./output') } +export {} diff --git a/src/templates/pubkey/input.ts b/src/templates/pubkey/input.ts index ec21155..b6963e7 100644 --- a/src/templates/pubkey/input.ts +++ b/src/templates/pubkey/input.ts @@ -13,3 +13,4 @@ check.toJSON = function () { return 'pubKey input' } module.exports = { check: check } +export {} diff --git a/src/templates/pubkey/output.ts b/src/templates/pubkey/output.ts index b25c8c1..b64c596 100644 --- a/src/templates/pubkey/output.ts +++ b/src/templates/pubkey/output.ts @@ -13,3 +13,4 @@ function check (script) { check.toJSON = function () { return 'pubKey output' } module.exports = { check } +export {} diff --git a/src/templates/pubkeyhash/index.ts b/src/templates/pubkeyhash/index.ts index 46863d6..7192cfd 100644 --- a/src/templates/pubkeyhash/index.ts +++ b/src/templates/pubkeyhash/index.ts @@ -2,3 +2,4 @@ module.exports = { input: require('./input'), output: require('./output') } +export {} diff --git a/src/templates/pubkeyhash/input.ts b/src/templates/pubkeyhash/input.ts index f5bc452..cab6f0a 100644 --- a/src/templates/pubkeyhash/input.ts +++ b/src/templates/pubkeyhash/input.ts @@ -12,3 +12,4 @@ function check (script) { check.toJSON = function () { return 'pubKeyHash input' } module.exports = { check } +export {} diff --git a/src/templates/pubkeyhash/output.ts b/src/templates/pubkeyhash/output.ts index fbb6ed1..bf34b83 100644 --- a/src/templates/pubkeyhash/output.ts +++ b/src/templates/pubkeyhash/output.ts @@ -16,3 +16,4 @@ function check (script) { check.toJSON = function () { return 'pubKeyHash output' } module.exports = { check } +export {} diff --git a/src/templates/scripthash/index.ts b/src/templates/scripthash/index.ts index 46863d6..7192cfd 100644 --- a/src/templates/scripthash/index.ts +++ b/src/templates/scripthash/index.ts @@ -2,3 +2,4 @@ module.exports = { input: require('./input'), output: require('./output') } +export {} diff --git a/src/templates/scripthash/input.ts b/src/templates/scripthash/input.ts index 5164370..ad53df9 100644 --- a/src/templates/scripthash/input.ts +++ b/src/templates/scripthash/input.ts @@ -46,3 +46,4 @@ function check (script, allowIncomplete) { check.toJSON = function () { return 'scriptHash input' } module.exports = { check } +export {} diff --git a/src/templates/scripthash/output.ts b/src/templates/scripthash/output.ts index b5b6e7a..9f91f17 100644 --- a/src/templates/scripthash/output.ts +++ b/src/templates/scripthash/output.ts @@ -14,3 +14,4 @@ function check (script) { check.toJSON = function () { return 'scriptHash output' } module.exports = { check } +export {} diff --git a/src/templates/witnesscommitment/index.ts b/src/templates/witnesscommitment/index.ts index d459038..d274d6b 100644 --- a/src/templates/witnesscommitment/index.ts +++ b/src/templates/witnesscommitment/index.ts @@ -1,3 +1,4 @@ module.exports = { output: require('./output') } +export {} diff --git a/src/templates/witnesscommitment/output.ts b/src/templates/witnesscommitment/output.ts index 8938f45..db92e54 100644 --- a/src/templates/witnesscommitment/output.ts +++ b/src/templates/witnesscommitment/output.ts @@ -40,3 +40,4 @@ module.exports = { decode: decode, encode: encode } +export {} diff --git a/src/templates/witnesspubkeyhash/index.ts b/src/templates/witnesspubkeyhash/index.ts index 46863d6..7192cfd 100644 --- a/src/templates/witnesspubkeyhash/index.ts +++ b/src/templates/witnesspubkeyhash/index.ts @@ -2,3 +2,4 @@ module.exports = { input: require('./input'), output: require('./output') } +export {} diff --git a/src/templates/witnesspubkeyhash/input.ts b/src/templates/witnesspubkeyhash/input.ts index 488e5e6..ec93c47 100644 --- a/src/templates/witnesspubkeyhash/input.ts +++ b/src/templates/witnesspubkeyhash/input.ts @@ -16,3 +16,4 @@ function check (script) { check.toJSON = function () { return 'witnessPubKeyHash input' } module.exports = { check } +export {} diff --git a/src/templates/witnesspubkeyhash/output.ts b/src/templates/witnesspubkeyhash/output.ts index 08af3bc..a289038 100644 --- a/src/templates/witnesspubkeyhash/output.ts +++ b/src/templates/witnesspubkeyhash/output.ts @@ -15,3 +15,4 @@ check.toJSON = function () { return 'Witness pubKeyHash output' } module.exports = { check } +export {} diff --git a/src/templates/witnessscripthash/index.ts b/src/templates/witnessscripthash/index.ts index 46863d6..7192cfd 100644 --- a/src/templates/witnessscripthash/index.ts +++ b/src/templates/witnessscripthash/index.ts @@ -2,3 +2,4 @@ module.exports = { input: require('./input'), output: require('./output') } +export {} diff --git a/src/templates/witnessscripthash/input.ts b/src/templates/witnessscripthash/input.ts index 072a289..c6d47e3 100644 --- a/src/templates/witnessscripthash/input.ts +++ b/src/templates/witnessscripthash/input.ts @@ -37,3 +37,4 @@ function check (chunks, allowIncomplete) { check.toJSON = function () { return 'witnessScriptHash input' } module.exports = { check } +export {} diff --git a/src/templates/witnessscripthash/output.ts b/src/templates/witnessscripthash/output.ts index c9fc21a..3bc327f 100644 --- a/src/templates/witnessscripthash/output.ts +++ b/src/templates/witnessscripthash/output.ts @@ -13,3 +13,4 @@ function check (script) { check.toJSON = function () { return 'Witness scriptHash output' } module.exports = { check } +export {} diff --git a/src/transaction.ts b/src/transaction.ts index 751446f..4ee08d3 100644 --- a/src/transaction.ts +++ b/src/transaction.ts @@ -138,7 +138,7 @@ Transaction.fromBuffer = function (buffer, __noStrict) { } Transaction.fromHex = function (hex) { - return Transaction.fromBuffer(Buffer.from(hex, 'hex')) + return Transaction.fromBuffer(Buffer.from(hex, 'hex'), undefined) } Transaction.isCoinbaseHash = function (buffer) { @@ -490,3 +490,4 @@ Transaction.prototype.setWitness = function (index, witness) { } module.exports = Transaction +export {} diff --git a/src/transaction_builder.ts b/src/transaction_builder.ts index bea1ded..56368bf 100644 --- a/src/transaction_builder.ts +++ b/src/transaction_builder.ts @@ -102,7 +102,7 @@ function expandInput (scriptSig, witnessStack, type, scriptPubKey) { const outputType = classify.output(redeem.output) let expanded if (outputType === SCRIPT_TYPES.P2WPKH) { - expanded = expandInput(redeem.input, redeem.witness, outputType) + expanded = expandInput(redeem.input, redeem.witness, outputType, undefined) } else { expanded = expandInput(bscript.compile(redeem.witness), [], outputType, redeem.output) } @@ -473,7 +473,7 @@ TransactionBuilder.prototype.setVersion = function (version) { } TransactionBuilder.fromTransaction = function (transaction, network) { - const txb = new TransactionBuilder(network) + const txb = new TransactionBuilder(network, undefined) // Copy transaction fields txb.setVersion(transaction.version) @@ -537,11 +537,17 @@ TransactionBuilder.prototype.__addInputUnsafe = function (txHash, vout, options) const prevTxOut = txHash.toString('hex') + ':' + vout if (this.__prevTxSet[prevTxOut] !== undefined) throw new Error('Duplicate TxOut: ' + prevTxOut) - let input = {} + let input = { + value: undefined, + prevOutScript: undefined, + pubkeys: undefined, + signatures: undefined, + prevOutType: undefined, + } // derive what we can from the scriptSig if (options.script !== undefined) { - input = expandInput(options.script, options.witness || []) + input = expandInput(options.script, options.witness || [], undefined, undefined) } // if an input value was given, retain it @@ -554,7 +560,7 @@ TransactionBuilder.prototype.__addInputUnsafe = function (txHash, vout, options) let prevOutType if (!input.pubkeys && !input.signatures) { - const expanded = expandOutput(options.prevOutScript) + const expanded = expandOutput(options.prevOutScript, undefined) if (expanded.pubkeys) { input.pubkeys = expanded.pubkeys input.signatures = expanded.signatures @@ -705,10 +711,10 @@ function signatureHashType (buffer) { } TransactionBuilder.prototype.__canModifyInputs = function () { - return this.__inputs.every(function (input) { + return (this.__inputs || []).every(function (input) { if (!input.signatures) return true - return input.signatures.every(function (signature) { + return (input.signatures || []).every(function (signature) { if (!signature) return true const hashType = signatureHashType(signature) @@ -775,3 +781,4 @@ TransactionBuilder.prototype.__overMaximumFees = function (bytes) { } module.exports = TransactionBuilder +export {} diff --git a/src/types.ts b/src/types.ts index 2d1ec6f..9fff4a6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -47,3 +47,4 @@ for (var typeName in typeforce) { } module.exports = types +export {} diff --git a/test/address.js b/test/address.js index a0f4df0..19093b6 100644 --- a/test/address.js +++ b/test/address.js @@ -1,7 +1,7 @@ const { describe, it } = require('mocha') const assert = require('assert') -const baddress = require('../src/address') -const bscript = require('../src/script') +const baddress = require('../dist/src/address') +const bscript = require('../dist/src/script') const fixtures = require('./fixtures/address.json') const NETWORKS = Object.assign({ litecoin: { @@ -14,7 +14,7 @@ const NETWORKS = Object.assign({ scriptHash: 0x32, wif: 0xb0 } -}, require('../src/networks')) +}, require('../dist/src/networks')) describe('address', function () { describe('fromBase58Check', function () { diff --git a/test/block.js b/test/block.js index d9ff405..eb52c0c 100644 --- a/test/block.js +++ b/test/block.js @@ -1,6 +1,6 @@ const { describe, it, beforeEach } = require('mocha') const assert = require('assert') -const Block = require('../src/block') +const Block = require('../dist/src/block') const fixtures = require('./fixtures/block') diff --git a/test/bufferutils.js b/test/bufferutils.js index 5f2c39e..ceb649a 100644 --- a/test/bufferutils.js +++ b/test/bufferutils.js @@ -1,6 +1,6 @@ const { describe, it } = require('mocha') const assert = require('assert') -const bufferutils = require('../src/bufferutils') +const bufferutils = require('../dist/src/bufferutils') const fixtures = require('./fixtures/bufferutils.json') diff --git a/test/classify.js b/test/classify.js index 3efcc74..33225b5 100644 --- a/test/classify.js +++ b/test/classify.js @@ -1,18 +1,18 @@ const { describe, it } = require('mocha') const assert = require('assert') -const bscript = require('../src/script') -const classify = require('../src/classify') +const bscript = require('../dist/src/script') +const classify = require('../dist/src/classify') const fixtures = require('./fixtures/templates.json') -const multisig = require('../src/templates/multisig') -const nullData = require('../src/templates/nulldata') -const pubKey = require('../src/templates/pubkey') -const pubKeyHash = require('../src/templates/pubkeyhash') -const scriptHash = require('../src/templates/scripthash') -const witnessPubKeyHash = require('../src/templates/witnesspubkeyhash') -const witnessScriptHash = require('../src/templates/witnessscripthash') -const witnessCommitment = require('../src/templates/witnesscommitment') +const multisig = require('../dist/src/templates/multisig') +const nullData = require('../dist/src/templates/nulldata') +const pubKey = require('../dist/src/templates/pubkey') +const pubKeyHash = require('../dist/src/templates/pubkeyhash') +const scriptHash = require('../dist/src/templates/scripthash') +const witnessPubKeyHash = require('../dist/src/templates/witnesspubkeyhash') +const witnessScriptHash = require('../dist/src/templates/witnessscripthash') +const witnessCommitment = require('../dist/src/templates/witnesscommitment') const tmap = { pubKey, diff --git a/test/crypto.js b/test/crypto.js index 3f7802a..0a01c98 100644 --- a/test/crypto.js +++ b/test/crypto.js @@ -1,6 +1,6 @@ const { describe, it } = require('mocha') const assert = require('assert') -const bcrypto = require('../src/crypto') +const bcrypto = require('../dist/src/crypto') const fixtures = require('./fixtures/crypto') diff --git a/test/ecpair.js b/test/ecpair.js index 45e646d..75a2e81 100644 --- a/test/ecpair.js +++ b/test/ecpair.js @@ -5,12 +5,12 @@ const assert = require('assert') const proxyquire = require('proxyquire') const hoodwink = require('hoodwink') -const ECPair = require('../src/ecpair') +const ECPair = require('../dist/src/ecpair') const tinysecp = require('tiny-secp256k1') const fixtures = require('./fixtures/ecpair.json') -const NETWORKS = require('../src/networks') +const NETWORKS = require('../dist/src/networks') const NETWORKS_LIST = [] // Object.values(NETWORKS) for (let networkName in NETWORKS) { NETWORKS_LIST.push(NETWORKS[networkName]) @@ -144,7 +144,7 @@ describe('ECPair', function () { describe('uses randombytes RNG', function () { it('generates a ECPair', function () { const stub = { randombytes: function () { return d } } - const ProxiedECPair = proxyquire('../src/ecpair', stub) + const ProxiedECPair = proxyquire('../dist/src/ecpair', stub) const keyPair = ProxiedECPair.makeRandom() assert.strictEqual(keyPair.toWIF(), exWIF) diff --git a/test/payments.js b/test/payments.js index 3c07bf3..53e3f16 100644 --- a/test/payments.js +++ b/test/payments.js @@ -4,7 +4,7 @@ const u = require('./payments.utils') ;['embed', 'p2ms', 'p2pk', 'p2pkh', 'p2sh', 'p2wpkh', 'p2wsh'].forEach(function (p) { describe(p, function () { - const fn = require('../src/payments/' + p) + const fn = require('../dist/src/payments/' + p) const fixtures = require('./fixtures/' + p) fixtures.valid.forEach(function (f, i) { diff --git a/test/payments.utils.js b/test/payments.utils.js index 485bf03..086561d 100644 --- a/test/payments.utils.js +++ b/test/payments.utils.js @@ -1,6 +1,6 @@ const t = require('assert') -const bscript = require('../src/script') -const BNETWORKS = require('../src/networks') +const bscript = require('../dist/src/script') +const BNETWORKS = require('../dist/src/networks') function tryHex (x) { if (Buffer.isBuffer(x)) return x.toString('hex') diff --git a/test/script.js b/test/script.js index c2a60ad..013d50a 100644 --- a/test/script.js +++ b/test/script.js @@ -1,6 +1,6 @@ const { describe, it } = require('mocha') const assert = require('assert') -const bscript = require('../src/script') +const bscript = require('../dist/src/script') const minimalData = require('minimaldata') const fixtures = require('./fixtures/script.json') diff --git a/test/script_number.js b/test/script_number.js index bc8f395..1d38e48 100644 --- a/test/script_number.js +++ b/test/script_number.js @@ -1,6 +1,6 @@ const { describe, it } = require('mocha') const assert = require('assert') -const scriptNumber = require('../src/script_number') +const scriptNumber = require('../dist/src/script_number') const fixtures = require('./fixtures/script_number.json') describe('script-number', function () { diff --git a/test/script_signature.js b/test/script_signature.js index cee69bd..e56ff68 100644 --- a/test/script_signature.js +++ b/test/script_signature.js @@ -1,6 +1,6 @@ const { describe, it } = require('mocha') const assert = require('assert') -const bscriptSig = require('../src/script').signature +const bscriptSig = require('../dist/src/script').signature const Buffer = require('safe-buffer').Buffer const fixtures = require('./fixtures/signature.json') diff --git a/test/transaction.js b/test/transaction.js index f8b7de9..f315a7d 100644 --- a/test/transaction.js +++ b/test/transaction.js @@ -1,8 +1,8 @@ const { describe, it, beforeEach } = require('mocha') const assert = require('assert') -const bscript = require('../src/script') +const bscript = require('../dist/src/script') const fixtures = require('./fixtures/transaction') -const Transaction = require('../src/transaction') +const Transaction = require('../dist/src/transaction') describe('Transaction', function () { function fromRaw (raw, noWitness) { diff --git a/test/transaction_builder.js b/test/transaction_builder.js index 85adcff..a4b309a 100644 --- a/test/transaction_builder.js +++ b/test/transaction_builder.js @@ -1,13 +1,13 @@ const { describe, it, beforeEach } = require('mocha') const assert = require('assert') -const baddress = require('../src/address') -const bscript = require('../src/script') -const payments = require('../src/payments') +const baddress = require('../dist/src/address') +const bscript = require('../dist/src/script') +const payments = require('../dist/src/payments') -const ECPair = require('../src/ecpair') -const Transaction = require('../src/transaction') -const TransactionBuilder = require('../src/transaction_builder') -const NETWORKS = require('../src/networks') +const ECPair = require('../dist/src/ecpair') +const Transaction = require('../dist/src/transaction') +const TransactionBuilder = require('../dist/src/transaction_builder') +const NETWORKS = require('../dist/src/networks') const fixtures = require('./fixtures/transaction_builder') diff --git a/test/types.js b/test/types.js index d245d53..831d415 100644 --- a/test/types.js +++ b/test/types.js @@ -1,6 +1,6 @@ const { describe, it } = require('mocha') const assert = require('assert') -const types = require('../src/types') +const types = require('../dist/src/types') const typeforce = require('typeforce') describe('types', function () { diff --git a/tsconfig.json b/tsconfig.json index 8e1edb4..f358d14 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,7 @@ "src/**/*" ], "exclude": [ - "**/*.spec.ts" + "**/*.spec.ts", + "node_modules/**/*" ] }