From f95ba4a3bd40e2c67a58be90a285b1dae190e733 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Sun, 11 Aug 2019 16:46:32 +1000 Subject: [PATCH 01/20] Use new fee calculation. --- index.js | 60 +++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/index.js b/index.js index 8e76ec5..506b120 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,6 @@ const bitcoin = require('bsv'); const explorer = require('bitcore-explorers'); const defaults = { rpc: "https://api.bitindex.network", - fee: 400, feeb: 1.4 } // The end goal of 'build' is to create a hex formated transaction object @@ -12,13 +11,13 @@ const defaults = { // and return a hex formatted string of either a tranaction or a script var build = function(options, callback) { let script = null; - let rpcaddr = (options.pay && options.pay.rpc) ? options.pay.rpc : defaults.rpc; + const rpcaddr = (options.pay && options.pay.rpc) ? options.pay.rpc : defaults.rpc; if (options.tx) { // if tx exists, check to see if it's already been signed. // if it's a signed transaction // and the request is trying to override using 'data' or 'pay', // we should throw an error - let tx = new bitcoin.Transaction(options.tx) + const tx = new bitcoin.Transaction(options.tx) // transaction is already signed if (tx.inputs.length > 0 && tx.inputs[0].script) { if (options.pay || options.data) { @@ -33,12 +32,29 @@ var build = function(options, callback) { script = _script(options) } } + + const tx = new bitcoin.Transaction(options.tx); + + if (script) { + tx.addOutput(new bitcoin.Transaction.Output({ script: script, satoshis: 0 })); + } + + const opt_pay = options.pay || {}; + if (opt_pay.fee) { + tx.fee(opt_pay.fee) + } else { + const feeb = opt_pay.feeb || defaults.feeb; + tx.feePerKb(feeb * 1000); + } + // Instantiate pay if (options.pay && options.pay.key) { // key exists => create a signed transaction - let key = options.pay.key; + const key = options.pay.key; const privateKey = new bitcoin.PrivateKey(key); const address = privateKey.toAddress(); + tx.change(address) + const insight = new explorer.Insight(rpcaddr) insight.getUnspentUtxos(address, function (err, res) { if (err) { @@ -47,45 +63,27 @@ var build = function(options, callback) { } if (options.pay.filter && options.pay.filter.q && options.pay.filter.q.find) { - let f = new mingo.Query(options.pay.filter.q.find) + const f = new mingo.Query(options.pay.filter.q.find) res = res.filter(function(item) { return f.test(item) }) } - let tx = new bitcoin.Transaction(options.tx).from(res); - if (script) { - tx.addOutput(new bitcoin.Transaction.Output({ script: script, satoshis: 0 })); - } + tx.from(res); + if (options.pay.to && Array.isArray(options.pay.to)) { options.pay.to.forEach(function(receiver) { - tx.to(receiver.address, receiver.value) + if (receiver.value >= 546) { + tx.to(receiver.address, receiver.value) + } }) } - tx.fee(defaults.fee).change(address); - let opt_pay = options.pay || {}; - let myfee = opt_pay.fee || Math.ceil(tx._estimateSize()* (opt_pay.feeb || defaults.feeb)); - tx.fee(myfee); - - //Check all the outputs for dust - for(var i=0;i0 && tx.outputs[i]._satoshis<546){ - tx.outputs.splice(i,1); - i--; - } - } - let transaction = tx.sign(privateKey); - callback(null, transaction); + tx.sign(privateKey); + callback(null, tx); }) } else { - // key doesn't exist => create an unsigned transaction - let fee = (options.pay && options.pay.fee) ? options.pay.fee : defaults.fee; - let tx = new bitcoin.Transaction(options.tx).fee(fee); - if (script) { - tx.addOutput(new bitcoin.Transaction.Output({ script: script, satoshis: 0 })); - } - callback(null, tx) + callback(null, tx); } } var send = function(options, callback) { From 8104e963a67d6e50ae0014cfb72a4780eea47938 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Sun, 11 Aug 2019 20:58:16 +1000 Subject: [PATCH 02/20] Heavy refactor, breaking changes. --- index.js | 220 ++++++++++++++++++++------------------------------- package.json | 5 +- 2 files changed, 87 insertions(+), 138 deletions(-) diff --git a/index.js b/index.js index 506b120..df7b521 100644 --- a/index.js +++ b/index.js @@ -1,152 +1,102 @@ -const mingo = require("mingo") -const _Buffer = require('buffer/') -const bitcoin = require('bsv'); -const explorer = require('bitcore-explorers'); +require("buffer"); +const bsv = require("bsv"); +const { Insight } = require("bitcore-explorers"); + const defaults = { rpc: "https://api.bitindex.network", - feeb: 1.4 -} -// The end goal of 'build' is to create a hex formated transaction object -// therefore this function must end with _tx() for all cases -// and return a hex formatted string of either a tranaction or a script -var build = function(options, callback) { - let script = null; - const rpcaddr = (options.pay && options.pay.rpc) ? options.pay.rpc : defaults.rpc; - if (options.tx) { - // if tx exists, check to see if it's already been signed. - // if it's a signed transaction - // and the request is trying to override using 'data' or 'pay', - // we should throw an error - const tx = new bitcoin.Transaction(options.tx) - // transaction is already signed - if (tx.inputs.length > 0 && tx.inputs[0].script) { - if (options.pay || options.data) { - callback(new Error("the transaction is already signed and cannot be modified")) - return; - } - } - } else { - // construct script only if transaction doesn't exist - // if a 'transaction' attribute exists, the 'data' should be ignored to avoid confusion - if (options.data) { - script = _script(options) - } - } + feeb: 1.0 +}; + +let insight; + +const connect = (endpoint, network = "livenet") => { + insight = new Insight(endpoint || defaults.rpc, network); +}; + +const getUTXOs = address => + new Promise((resolve, reject) => { + insight.getUnspentUtxos(address, (err, res) => { + if (err) reject(err); + else resolve(res); + }); + }); - const tx = new bitcoin.Transaction(options.tx); +const broadcast = rawtx => + new Promise((resolve, reject) => { + insight.broadcast(rawtx, (err, txid) => { + if (err) reject(err); + else resolve(txid); + }); + }); +const build = async ({ data, safe, pay }) => { + const tx = new bsv.Transaction(); + + const script = createDataScript(data, safe); if (script) { - tx.addOutput(new bitcoin.Transaction.Output({ script: script, satoshis: 0 })); + tx.addOutput(new bsv.Transaction.Output({ script, satoshis: 0 })); } - const opt_pay = options.pay || {}; - if (opt_pay.fee) { - tx.fee(opt_pay.fee) - } else { - const feeb = opt_pay.feeb || defaults.feeb; - tx.feePerKb(feeb * 1000); - } + const { fee, feeb, key, to = [], filter } = pay; + + if (fee) tx.fee(fee); + else tx.feePerKb((feeb || defaults.feeb) * 1000); - // Instantiate pay - if (options.pay && options.pay.key) { - // key exists => create a signed transaction - const key = options.pay.key; - const privateKey = new bitcoin.PrivateKey(key); + to.forEach(receiver => tx.to(receiver.address, receiver.value)); + + if (key) { + const privateKey = new bsv.PrivateKey(key); const address = privateKey.toAddress(); - tx.change(address) - - const insight = new explorer.Insight(rpcaddr) - insight.getUnspentUtxos(address, function (err, res) { - if (err) { - callback(err); - return; - } - - if (options.pay.filter && options.pay.filter.q && options.pay.filter.q.find) { - const f = new mingo.Query(options.pay.filter.q.find) - res = res.filter(function(item) { - return f.test(item) - }) - } - - tx.from(res); - - if (options.pay.to && Array.isArray(options.pay.to)) { - options.pay.to.forEach(function(receiver) { - if (receiver.value >= 546) { - tx.to(receiver.address, receiver.value) - } - }) - } - - tx.sign(privateKey); - callback(null, tx); - }) - } else { - callback(null, tx); - } -} -var send = function(options, callback) { - if (!callback) { - callback = function() {}; + tx.change(address); + + let utxos = await getUTXOs(address); + if (filter) utxos = utxos.filter(filter); + tx.from(utxos); + + tx.sign(privateKey); } - build(options, function(err, tx) { - if (err) { - callback(err); + return tx; +}; + +const send = async (options, tx) => { + if (options && !tx) tx = await build(options); + return await broadcast(tx.serialize()); +}; + +const createDataScript = (data, safe) => { + if (!data) return; + if (typeof data === "string") return bsv.Script.fromHex(data); + + const s = new bsv.Script(); + + // Add OP_RETURN + if (safe) s.add(bsv.Opcode.OP_FALSE); + s.add(bsv.Opcode.OP_RETURN); + + // Add data + data.forEach(item => { + if (typeof item === "object" && item.hasOwnProperty("op")) { + s.add({ opcodenum: item.op }); return; } - let rpcaddr = (options.pay && options.pay.rpc) ? options.pay.rpc : defaults.rpc; - const insight = new explorer.Insight(rpcaddr) - insight.broadcast(tx.toString(), callback) - }) -} -// compose script -var _script = function(options) { - var s = null; - if (options.data) { - if (Array.isArray(options.data)) { - s = new bitcoin.Script(); - if (options.safe) { - s.add(bitcoin.Opcode.OP_FALSE); - } - // Add op_return - s.add(bitcoin.Opcode.OP_RETURN); - options.data.forEach(function(item) { - // add push data - if (item.constructor.name === 'ArrayBuffer') { - let buffer = _Buffer.Buffer.from(item) - s.add(buffer) - } else if (item.constructor.name === 'Buffer') { - s.add(item) - } else if (typeof item === 'string') { - if (/^0x/i.test(item)) { - // ex: 0x6d02 - s.add(Buffer.from(item.slice(2), "hex")) - } else { - // ex: "hello" - s.add(Buffer.from(item)) - } - } else if (typeof item === 'object' && item.hasOwnProperty('op')) { - s.add({ opcodenum: item.op }) - } - }) - } else if (typeof options.data === 'string') { - // Exported transaction - s = bitcoin.Script.fromHex(options.data); + if (typeof item === "string" && /^0x/i.test(item)) { + // e.g. 0x6d02 + s.add(Buffer.from(item.slice(2), "hex")); + return; } - } + + s.add(Buffer.from(item)); + }); + return s; -} -var connect = function(endpoint) { - var rpc = endpoint ? endpoint : defaults.rpc; - return new explorer.Insight(rpc); -} -module.exports = { - build: build, - send: send, - bsv: bitcoin, - connect: connect, -} +}; + +insight = connect(); +module.exports = { + build, + send, + connect +}; diff --git a/package.json b/package.json index ba435c8..ea953b3 100644 --- a/package.json +++ b/package.json @@ -19,11 +19,10 @@ "unpkg": "dist/datapay.min.js", "dependencies": { "bitcore-explorers": "^1.0.1", - "buffer": "^5.2.1", - "mingo": "^2.2.4" + "buffer": "^5.2.1" }, "peerDependencies": { - "bsv": "0.27.1" + "bsv": "git://github.com/Breavyn/bsv.git#tx-size" }, "files": [ "dist" From c1dff93aea2283d9830a03a7c85da354b3df3322 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Mon, 12 Aug 2019 06:59:49 +1000 Subject: [PATCH 03/20] Remove dependency on bitcore-explorers. --- index.js | 37 +++++++++++++++++++++---------------- package.json | 6 +++--- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/index.js b/index.js index df7b521..fe5f61e 100644 --- a/index.js +++ b/index.js @@ -1,34 +1,39 @@ require("buffer"); +const fetch = require("node-fetch"); const bsv = require("bsv"); -const { Insight } = require("bitcore-explorers"); const defaults = { - rpc: "https://api.bitindex.network", feeb: 1.0 }; let insight; -const connect = (endpoint, network = "livenet") => { - insight = new Insight(endpoint || defaults.rpc, network); +const connect = (url = "https://api.bitindex.network/api/v3/main", headers) => { + insight = { url, headers }; }; -const getUTXOs = address => - new Promise((resolve, reject) => { - insight.getUnspentUtxos(address, (err, res) => { - if (err) reject(err); - else resolve(res); - }); +const getUTXOs = async address => { + const res = await fetch(`${insight.url}/addrs/utxo`, { + method: "POST", + body: JSON.stringify({ addrs: address.toString() }), + headers: { "Content-Type": "application/json", ...insight.headers } }); -const broadcast = rawtx => - new Promise((resolve, reject) => { - insight.broadcast(rawtx, (err, txid) => { - if (err) reject(err); - else resolve(txid); - }); + if (res.ok) return await res.json(); + throw `${res.status} ${res.statusText}`; +}; + +const broadcast = async rawtx => { + const res = await fetch(`${insight.url}/tx/send`, { + method: "POST", + body: JSON.stringify({ rawtx }), + headers: { "Content-Type": "application/json", ...insight.headers } }); + if (res.ok) return await res.json(); + throw `${res.status} ${res.statusText}`; +}; + const build = async ({ data, safe, pay }) => { const tx = new bsv.Transaction(); diff --git a/package.json b/package.json index ea953b3..7429326 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,11 @@ "license": "MIT", "unpkg": "dist/datapay.min.js", "dependencies": { - "bitcore-explorers": "^1.0.1", - "buffer": "^5.2.1" + "buffer": "^5.2.1", + "node-fetch": "^2.6.0" }, "peerDependencies": { - "bsv": "git://github.com/Breavyn/bsv.git#tx-size" + "bsv": "git+https://github.com/Breavyn/bsv.git#tx-size" }, "files": [ "dist" From c67268e6472d7523584e8ebb344d94fa17a63284 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Tue, 13 Aug 2019 06:53:58 +1000 Subject: [PATCH 04/20] Support promises and callbacks. --- index.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index fe5f61e..7d48bb5 100644 --- a/index.js +++ b/index.js @@ -64,8 +64,8 @@ const build = async ({ data, safe, pay }) => { return tx; }; -const send = async (options, tx) => { - if (options && !tx) tx = await build(options); +const send = async options => { + const tx = options.tx || (await build(options)); return await broadcast(tx.serialize()); }; @@ -98,10 +98,23 @@ const createDataScript = (data, safe) => { return s; }; -insight = connect(); +const callbackWrapper = func => { + return async (options, callback) => { + try { + result = await func(options); + if (callback) callback(null, result); + else return result; + } catch (err) { + if (callback) callback(err); + else throw err; + } + }; +}; + +connect(); module.exports = { - build, - send, + build: callbackWrapper(build), + send: callbackWrapper(send), connect }; From b6786aedf7d2736343acfdcf569b572caf955aac Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Thu, 15 Aug 2019 21:01:44 +1000 Subject: [PATCH 05/20] Check for data before trying to create script. --- index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 7d48bb5..8177712 100644 --- a/index.js +++ b/index.js @@ -37,8 +37,8 @@ const broadcast = async rawtx => { const build = async ({ data, safe, pay }) => { const tx = new bsv.Transaction(); - const script = createDataScript(data, safe); - if (script) { + if (data.length) { + const script = createDataScript(data, safe); tx.addOutput(new bsv.Transaction.Output({ script, satoshis: 0 })); } @@ -70,7 +70,6 @@ const send = async options => { }; const createDataScript = (data, safe) => { - if (!data) return; if (typeof data === "string") return bsv.Script.fromHex(data); const s = new bsv.Script(); From 3ab66e5eeff893ca5cc2b992a884d7fe862ad86e Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Wed, 4 Sep 2019 10:23:56 +1000 Subject: [PATCH 06/20] Switch node-fetch to axios for isomorphic requests. --- index.js | 34 ++- package-lock.json | 565 ++++++++++++++-------------------------------- package.json | 8 +- 3 files changed, 181 insertions(+), 426 deletions(-) diff --git a/index.js b/index.js index 8177712..9359a47 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,7 @@ -require("buffer"); -const fetch = require("node-fetch"); +const axios = require("axios"); const bsv = require("bsv"); -const defaults = { - feeb: 1.0 -}; - +const defaults = { feeb: 1.0 }; let insight; const connect = (url = "https://api.bitindex.network/api/v3/main", headers) => { @@ -13,25 +9,23 @@ const connect = (url = "https://api.bitindex.network/api/v3/main", headers) => { }; const getUTXOs = async address => { - const res = await fetch(`${insight.url}/addrs/utxo`, { - method: "POST", - body: JSON.stringify({ addrs: address.toString() }), - headers: { "Content-Type": "application/json", ...insight.headers } - }); + const res = await axios.post( + `${insight.url}/addrs/utxo`, + { addrs: address.toString() }, + { headers: { ...insight.headers } } + ); - if (res.ok) return await res.json(); - throw `${res.status} ${res.statusText}`; + return res.data; }; const broadcast = async rawtx => { - const res = await fetch(`${insight.url}/tx/send`, { - method: "POST", - body: JSON.stringify({ rawtx }), - headers: { "Content-Type": "application/json", ...insight.headers } - }); + const res = await axios.post( + `${insight.url}/tx/send`, + { rawtx }, + { headers: { ...insight.headers } } + ); - if (res.ok) return await res.json(); - throw `${res.status} ${res.statusText}`; + return res.data; }; const build = async ({ data, safe, pay }) => { diff --git a/package-lock.json b/package-lock.json index 095478e..4dd7478 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,142 +1,53 @@ { "name": "datapay", - "version": "0.0.15", + "version": "0.0.18", "lockfileVersion": 1, "requires": true, "dependencies": { - "ajv": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.2.tgz", - "integrity": "sha512-FBHEW6Jf5TB9MGBgUUA9XHkTbjXYfAUjY43ACMfmdMRHniyoMHjHjzD50OK8LGDWQwp4rWEsIq5kEqq7rvIM1g==", + "aes-js": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", + "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" + }, + "axios": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", + "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" + "follow-redirects": "1.5.10", + "is-buffer": "^2.0.2" + }, + "dependencies": { + "is-buffer": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", + "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + } } }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base-x": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.6.tgz", + "integrity": "sha512-4PaF8u2+AlViJxRVjurkLTxpp7CaFRD/jo5rPT9ONnKxyhQ8f59yzamEvq7EkriG56yn5On4ONyaG75HLqr46w==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "base64-js": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "bitcore-explorers": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bitcore-explorers/-/bitcore-explorers-1.0.1.tgz", - "integrity": "sha1-0Lw0u9cSlmSh+5uklwkRtdEOlNU=", - "requires": { - "bitcore-lib": "^0.13.7", - "browser-request": "^0.3.3", - "request": "^2.51.0" - } - }, - "bitcore-lib": { - "version": "0.13.19", - "resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-0.13.19.tgz", - "integrity": "sha1-SK8em9oQBnwasWJjRyta3SAA89w=", - "requires": { - "bn.js": "=2.0.4", - "bs58": "=2.0.0", - "buffer-compare": "=1.0.0", - "elliptic": "=3.0.3", - "inherits": "=2.0.1", - "lodash": "=3.10.1" - }, - "dependencies": { - "bn.js": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-2.0.4.tgz", - "integrity": "sha1-Igp81nf38b+pNif/QZN3b+eBlIA=" - }, - "bs58": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-2.0.0.tgz", - "integrity": "sha1-crcTvtIjoKxRi72g484/SBfznrU=" - }, - "buffer-compare": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.0.0.tgz", - "integrity": "sha1-rKp6lm6Y7un64Usxw5pfFY+zxKI=" - }, - "elliptic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz", - "integrity": "sha1-hlybQgv75VAGuflp+XoNLESWZZU=", - "requires": { - "bn.js": "^2.0.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "inherits": "^2.0.1" - }, - "dependencies": { - "brorand": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz", - "integrity": "sha1-B7VMowKGq9Fxig4qgwgD79yb+gQ=" - }, - "hash.js": { - "version": "1.0.3", - "resolved": "http://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz", - "integrity": "sha1-EzL/ABVsCg/92CNgE9B7d6BFFXM=", - "requires": { - "inherits": "^2.0.1" - } - } - } - }, - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" - }, - "lodash": { - "version": "3.10.1", - "resolved": "http://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=" - } - } + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, "brace-expansion": { "version": "1.1.11", @@ -148,10 +59,10 @@ "concat-map": "0.0.1" } }, - "browser-request": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/browser-request/-/browser-request-0.3.3.tgz", - "integrity": "sha1-ns5bWsqJopkyJC4Yv5M975h2zBc=" + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, "browser-stdout": { "version": "1.3.1", @@ -159,6 +70,37 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "requires": { + "base-x": "^3.0.2" + } + }, + "bsv": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/bsv/-/bsv-0.30.0.tgz", + "integrity": "sha512-8TiRw8RSTX+SZ+karPipBIn5TC2/mWPULBTapzuPu1+hHSRw/d6FzZTjlPyp/LPqytlCHqchWLRSSTUYl0Evbg==", + "requires": { + "aes-js": "^3.1.2", + "bn.js": "=4.11.8", + "bs58": "=4.0.1", + "buffer-compare": "=1.1.1", + "clone-deep": "^4.0.1", + "elliptic": "6.4.1", + "hash.js": "^1.1.7", + "inherits": "2.0.3", + "unorm": "1.4.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + } + } + }, "buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", @@ -168,17 +110,19 @@ "ieee754": "^1.1.4" } }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + "buffer-compare": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.1.1.tgz", + "integrity": "sha1-W+e+hTr4kZjR9N3AkNHWakiu9ZY=" }, - "combined-stream": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", - "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", "requires": { - "delayed-stream": "~1.0.0" + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" } }, "commander": { @@ -193,24 +137,6 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -223,13 +149,18 @@ "integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==", "dev": true }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" } }, "escape-string-regexp": { @@ -238,39 +169,22 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" + "debug": "=3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } } }, "fs.realpath": { @@ -279,14 +193,6 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -307,40 +213,42 @@ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", - "requires": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" - } - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + } + } + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" } }, "ieee754": { @@ -361,67 +269,35 @@ "inherits": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" + "isobject": "^3.0.1" } }, - "mime-db": { - "version": "1.37.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", - "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, - "mime-types": { - "version": "2.1.21", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", - "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", - "requires": { - "mime-db": "~1.37.0" - } + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" }, - "mingo": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/mingo/-/mingo-2.2.8.tgz", - "integrity": "sha512-61ET/PK45Jm1yWfoiYL/9KBs/+66s4ctLJeMCnKgYJlrD46oqbIVnfm5RbDyqo9Gl19mzUUi4DDvTlMzirzKVw==" + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "minimatch": { "version": "3.0.4", @@ -480,13 +356,7 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "once": { "version": "1.4.0", @@ -503,62 +373,18 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "psl": { - "version": "1.1.31", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", - "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==" - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "requires": { + "kind-of": "^6.0.2" + } }, "source-map": { "version": "0.6.1", @@ -566,22 +392,6 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, - "sshpk": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.0.tgz", - "integrity": "sha512-Zhev35/y7hRMcID/upReIvRse+I9SVhyVre/KTJSJQWMz3C3+G+HpO7m1wK/yckEtujKZ7dS4hkVxAnmHaIGVQ==", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -591,35 +401,6 @@ "has-flag": "^3.0.0" } }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - } - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, "uglify-es": { "version": "3.3.9", "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", @@ -638,28 +419,10 @@ } } }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "requires": { - "punycode": "^2.1.0" - } - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } + "unorm": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz", + "integrity": "sha1-NkIA1fE2RsqLzURJAnEzVhR5IwA=" }, "wrappy": { "version": "1.0.2", diff --git a/package.json b/package.json index 7429326..414af37 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,9 @@ "license": "MIT", "unpkg": "dist/datapay.min.js", "dependencies": { - "buffer": "^5.2.1", - "node-fetch": "^2.6.0" - }, - "peerDependencies": { - "bsv": "git+https://github.com/Breavyn/bsv.git#tx-size" + "axios": "^0.19.0", + "bsv": "^0.30.0", + "buffer": "^5.2.1" }, "files": [ "dist" From ced37d2fdb55834a40738d3a984b56bc475126ff Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Wed, 4 Sep 2019 11:37:08 +1000 Subject: [PATCH 07/20] Removed buffer dependency. Browserify takes care of this. --- package-lock.json | 19 ------------------- package.json | 3 +-- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4dd7478..572e195 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,11 +39,6 @@ "safe-buffer": "^5.0.1" } }, - "base64-js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", - "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" - }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", @@ -101,15 +96,6 @@ } } }, - "buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", - "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, "buffer-compare": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.1.1.tgz", @@ -251,11 +237,6 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "ieee754": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", - "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==" - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", diff --git a/package.json b/package.json index 414af37..8756e0c 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,7 @@ "unpkg": "dist/datapay.min.js", "dependencies": { "axios": "^0.19.0", - "bsv": "^0.30.0", - "buffer": "^5.2.1" + "bsv": "^0.30.0" }, "files": [ "dist" From 1760d90e2f66b333a4eddc898981f0af156bb425 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Wed, 11 Sep 2019 07:02:55 +1000 Subject: [PATCH 08/20] Simplified axios usage by creating an instance. Instance parameters can be passed in via the connect method. --- index.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/index.js b/index.js index 9359a47..2795073 100644 --- a/index.js +++ b/index.js @@ -4,34 +4,24 @@ const bsv = require("bsv"); const defaults = { feeb: 1.0 }; let insight; -const connect = (url = "https://api.bitindex.network/api/v3/main", headers) => { - insight = { url, headers }; +const connect = options => { + insight = axios.create(options); }; const getUTXOs = async address => { - const res = await axios.post( - `${insight.url}/addrs/utxo`, - { addrs: address.toString() }, - { headers: { ...insight.headers } } - ); - + const res = await insight.post("/addrs/utxo", { addrs: address.toString() }); return res.data; }; const broadcast = async rawtx => { - const res = await axios.post( - `${insight.url}/tx/send`, - { rawtx }, - { headers: { ...insight.headers } } - ); - + const res = await insight.post("/tx/send", { rawtx }); return res.data; }; const build = async ({ data, safe, pay }) => { const tx = new bsv.Transaction(); - if (data.length) { + if (data && data.length) { const script = createDataScript(data, safe); tx.addOutput(new bsv.Transaction.Output({ script, satoshis: 0 })); } @@ -104,7 +94,7 @@ const callbackWrapper = func => { }; }; -connect(); +connect({ baseURL: "https://api.bitindex.network/api/v3/main" }); module.exports = { build: callbackWrapper(build), From ad4d48058ce3b232604ea0d51199c82924ca27ec Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Wed, 11 Sep 2019 07:27:53 +1000 Subject: [PATCH 09/20] Added documentation about how to use this fork. --- README.md | 91 ++++++++++++++++++++++++++++++++++++++++++++----------- index.js | 2 +- 2 files changed, 75 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1d3a826..e937e19 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,70 @@ +# About This Fork + +This fork contains several changes from unwriter's original version. + +## 1. Axios insight implementation + +The `connect` method can now be used to create an axios instance which will be +used for retrieving utxo's and broadcasting raw transactions. + +This is an example of using BitIndex's testnet endpoint, with an api key. + +``` +datapay.connect({ + baseURL: "https://api.bitindex.network/api/v3/test", + headers: { api_key: "myapikey" } +}); +``` + +## 2. Promises + +Both build and send now return promises which can be used with async/await. + +``` +const tx = await datapay.build({ + data: ["using promises with datapay"], + safe: true, + pay: { + key: "" + } +}); + +const txid = await datapay.send({ tx }); +``` + +## 3. Fees + +This fork is using bsv 0.30.0 which has a fixed implementation of fee +estimation. The default fee is set to 1 sat/byte. This means the fee paid should +be exact, or only a sat or two over exact. + +## 4. Filtering + +The mingo filtering has been removed in favour of using a plain javascript +function. + +``` +const tx = await datapay.build({ + data: ["using promises with datapay"], + safe: true, + pay: { + key: "", + filter: utxos => utxos.filter(utxo => utxo.confirmations > 5) + } +}); +``` + +# Using This Fork + +The api here is still evolving so I recommend using the package-lock file or installing a specific commit. + +``` +npm install git+https://github.com/Breavyn/datapay.git# + +# e.g. +npm install git+https://github.com/Breavyn/datapay.git#8fa2715d28ddd16c8efa0c61ec99700fc7674408 +``` + # Datapay Datapay is the simplest library for building and broadcasting data transactions to the **Bitcoin SV blockchain**. @@ -8,7 +75,7 @@ Datapay is the simplest library for building and broadcasting data transactions # Preview -Post to the blockchain with just 4 lines of code. +Post to the blockchain with just 4 lines of code. ![code](code.png) @@ -32,7 +99,6 @@ Post to both Memo.cash and Blockpress with a single interface. --- - # Install ## 1. In node.js @@ -62,7 +128,6 @@ const datapay = require('datapay') Send `"Hello from datapay"` to [memo.cash](https://memo.cash) in 5 lines of code. - ``` const privateKey = [YOUR PRIVATE KEY HERE]; datapay.send({ @@ -163,21 +228,18 @@ The first argument--a declarative JSON object--can contain the following attribu - `pay`: For describing everything related to actually sending money - `tx`: For importing previously "built" transactions - ### A. data The `data` attribute is used to construct human readable/processable data to post to the blockchain. - #### 1. Buid from push data array - ``` const tx = { safe: true, data: ["0x6d02", "hello world"] } -datapay.build(tx, function(err, tx) { +datapay.build(tx, function(err, tx) { /** * res contains the generated transaction object, powered by bsv * You can check it out at https://github.com/moneybutton/bsv/blob/master/lib/transaction/transaction.js @@ -194,7 +256,7 @@ datapay.build(tx, function(err, tx) { 2. a hex string 3. Binary data ([Buffer](https://nodejs.org/api/buffer.html) in node.js, and [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) in browser) -**To use hex string, simply prefix the string with "0x"**. +**To use hex string, simply prefix the string with "0x"**. **To use Buffer types, just pass the Buffer (or ArrayBuffer) object as push data.** @@ -202,7 +264,6 @@ datapay.build(tx, function(err, tx) { In above example, we can see that the first item is `"0x6d02"`. Datapay will automatically recognize this as a hex string and interpret as a hex string (while discarding the 0x prefix before the interpretation) - #### 2. Build from Binary Data + String In Node.js (Buffer) @@ -212,7 +273,7 @@ const tx = { safe: true, data: ["0x6d02", Buffer.from("Abc"), "hello world"] } -datapay.build(tx, function(err, tx) { +datapay.build(tx, function(err, tx) { /** * res contains the generated transaction object, powered by bsv * You can check it out at https://github.com/moneybutton/bsv/blob/master/lib/transaction/transaction.js @@ -296,10 +357,9 @@ datapay.build(tx, function(err, tx) { }) ``` - #### 2. `rpc` -The `rpc` attribute is used to manually set the JSON-RPC endpoint you wish to broadcast through. +The `rpc` attribute is used to manually set the JSON-RPC endpoint you wish to broadcast through. - default: `https://api.bitindex.network` @@ -410,7 +470,6 @@ But sometimes you want more fine-grained control over which UTXOs to use for a t For this feature, datapay uses [Bitquery](https://docs.bitdb.network/docs/query_v3) as a filter to describe the UTXOs to filter out. - ``` const tx = { safe: true, @@ -470,7 +529,6 @@ datapay.build({ Notice how in addition to the `tx` attribute we've added the `pay.key` attribute. This will import the unsigned transaction and sign it. - #### 3. Importing and sending a signed transaction from exported hex string If you already have a signed transaction object, you can simply send it away without any additional steps. @@ -533,7 +591,6 @@ datapay.send({ This time since the exported transaction is already signed, no need for additional `pay.key` attriute when sending later - ``` // Build and export an unsigned transaction for later usage var exportedSignedTxHex = ""; @@ -598,7 +655,7 @@ datapay.connect().getUnspentUtxos("14xMz8rKm4L83RuZdmsHXD2jvENZbv72vR", function if (err) { console.log("Error: ", err) } else { - console.log(utxos) + console.log(utxos) } }) ``` @@ -610,7 +667,7 @@ datapay.connect('https://api.bitindex.network').getUnspentUtxos("14xMz8rKm4L83Ru if (err) { console.log("Error: ", err) } else { - console.log(utxos) + console.log(utxos) } }); ``` diff --git a/index.js b/index.js index 2795073..c961267 100644 --- a/index.js +++ b/index.js @@ -39,7 +39,7 @@ const build = async ({ data, safe, pay }) => { tx.change(address); let utxos = await getUTXOs(address); - if (filter) utxos = utxos.filter(filter); + if (filter) utxos = filter(utxos); tx.from(utxos); tx.sign(privateKey); From 5eb918bd948e40e5bd8fe112c60dd30acc7b00af Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Thu, 12 Sep 2019 18:07:50 +1000 Subject: [PATCH 10/20] Wrap insight errors with some meaning. --- index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index c961267..4ba126c 100644 --- a/index.js +++ b/index.js @@ -9,13 +9,23 @@ const connect = options => { }; const getUTXOs = async address => { - const res = await insight.post("/addrs/utxo", { addrs: address.toString() }); - return res.data; + try { + const res = await insight.post("/addrs/utxo", { + addrs: address.toString() + }); + return res.data; + } catch (err) { + throw new Error(`Failed to retrieve utxo's for ${address}: ${err.message}`); + } }; const broadcast = async rawtx => { - const res = await insight.post("/tx/send", { rawtx }); - return res.data; + try { + const res = await insight.post("/tx/send", { rawtx }); + return res.data; + } catch (err) { + throw new Error(`Failed to broadcast transaction: ${err.message}`); + } }; const build = async ({ data, safe, pay }) => { From 17ad2f30d5ee6c2a83de1395019fb26d8e986424 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Sat, 14 Sep 2019 22:44:25 +1000 Subject: [PATCH 11/20] Expose methods for retrieving utxo's and broadcasting transactions. --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index 4ba126c..98c57b3 100644 --- a/index.js +++ b/index.js @@ -107,6 +107,8 @@ const callbackWrapper = func => { connect({ baseURL: "https://api.bitindex.network/api/v3/main" }); module.exports = { + getUTXOs, + broadcast, build: callbackWrapper(build), send: callbackWrapper(send), connect From 6d1df7b879ffc9bd5ac563014f3b12c52cc074ad Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Mon, 16 Sep 2019 22:32:23 +1000 Subject: [PATCH 12/20] Make bsv a peer dependency again. --- package-lock.json | 205 ++++------------------------------------------ package.json | 4 +- 2 files changed, 21 insertions(+), 188 deletions(-) diff --git a/package-lock.json b/package-lock.json index 572e195..2bebaaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,11 +4,6 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "aes-js": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", - "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" - }, "axios": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", @@ -16,13 +11,6 @@ "requires": { "follow-redirects": "1.5.10", "is-buffer": "^2.0.2" - }, - "dependencies": { - "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" - } } }, "balanced-match": { @@ -31,19 +19,6 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "base-x": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.6.tgz", - "integrity": "sha512-4PaF8u2+AlViJxRVjurkLTxpp7CaFRD/jo5rPT9ONnKxyhQ8f59yzamEvq7EkriG56yn5On4ONyaG75HLqr46w==", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -54,63 +29,12 @@ "concat-map": "0.0.1" } }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", - "requires": { - "base-x": "^3.0.2" - } - }, - "bsv": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/bsv/-/bsv-0.30.0.tgz", - "integrity": "sha512-8TiRw8RSTX+SZ+karPipBIn5TC2/mWPULBTapzuPu1+hHSRw/d6FzZTjlPyp/LPqytlCHqchWLRSSTUYl0Evbg==", - "requires": { - "aes-js": "^3.1.2", - "bn.js": "=4.11.8", - "bs58": "=4.0.1", - "buffer-compare": "=1.1.1", - "clone-deep": "^4.0.1", - "elliptic": "6.4.1", - "hash.js": "^1.1.7", - "inherits": "2.0.3", - "unorm": "1.4.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - } - } - }, - "buffer-compare": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.1.1.tgz", - "integrity": "sha1-W+e+hTr4kZjR9N3AkNHWakiu9ZY=" - }, - "clone-deep": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", - "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", - "requires": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - } - }, "commander": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", @@ -123,6 +47,14 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -135,20 +67,6 @@ "integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==", "dev": true }, - "elliptic": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", - "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -161,16 +79,6 @@ "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", "requires": { "debug": "=3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - } } }, "fs.realpath": { @@ -205,38 +113,12 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - } - } - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -248,37 +130,15 @@ } }, "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" - }, - "is-plain-object": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "requires": { - "isobject": "^3.0.1" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + "is-buffer": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", + "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" }, "minimatch": { "version": "3.0.4", @@ -291,13 +151,13 @@ }, "minimist": { "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -321,17 +181,6 @@ "minimatch": "3.0.4", "mkdirp": "0.5.1", "supports-color": "5.4.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } } }, "ms": { @@ -350,23 +199,10 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" - }, - "shallow-clone": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", - "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", - "requires": { - "kind-of": "^6.0.2" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -400,11 +236,6 @@ } } }, - "unorm": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz", - "integrity": "sha1-NkIA1fE2RsqLzURJAnEzVhR5IwA=" - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index 8756e0c..631a801 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,9 @@ "license": "MIT", "unpkg": "dist/datapay.min.js", "dependencies": { - "axios": "^0.19.0", + "axios": "^0.19.0" + }, + "peerDependencies": { "bsv": "^0.30.0" }, "files": [ From bcfc6b9210a8e3f7ce554c7ab2a19092d8c86c79 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Tue, 17 Sep 2019 18:56:53 +1000 Subject: [PATCH 13/20] Return broadcasted txid directly. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 98c57b3..1e91020 100644 --- a/index.js +++ b/index.js @@ -22,7 +22,7 @@ const getUTXOs = async address => { const broadcast = async rawtx => { try { const res = await insight.post("/tx/send", { rawtx }); - return res.data; + return res.data ? res.data.txid : null; } catch (err) { throw new Error(`Failed to broadcast transaction: ${err.message}`); } From c21af7974d058824a101fe9665a7074944a3a3e0 Mon Sep 17 00:00:00 2001 From: Breavyn Date: Wed, 18 Sep 2019 16:06:39 +1000 Subject: [PATCH 14/20] Added unit test coverage (#1) --- index.js | 85 ++-- package-lock.json | 1141 ++++++++++++++++++++++++++++++++++++++++++++- package.json | 5 +- test/test.js | 915 +++++++++++++----------------------- 4 files changed, 1477 insertions(+), 669 deletions(-) diff --git a/index.js b/index.js index 1e91020..d86c737 100644 --- a/index.js +++ b/index.js @@ -1,14 +1,28 @@ const axios = require("axios"); const bsv = require("bsv"); -const defaults = { feeb: 1.0 }; +const callbackWrapper = func => { + return async (options, callback) => { + try { + result = await func(options); + if (callback) callback(null, result); + else return result; + } catch (err) { + if (callback) callback(err); + else throw err; + } + }; +}; + let insight; const connect = options => { insight = axios.create(options); }; -const getUTXOs = async address => { +connect({ baseURL: "https://api.bitindex.network/api/v3/main" }); + +module.exports.getUTXOs = async address => { try { const res = await insight.post("/addrs/utxo", { addrs: address.toString() @@ -19,7 +33,7 @@ const getUTXOs = async address => { } }; -const broadcast = async rawtx => { +module.exports.broadcast = async rawtx => { try { const res = await insight.post("/tx/send", { rawtx }); return res.data ? res.data.txid : null; @@ -28,42 +42,44 @@ const broadcast = async rawtx => { } }; -const build = async ({ data, safe, pay }) => { +module.exports.build = callbackWrapper(async ({ data, safe, pay }) => { const tx = new bsv.Transaction(); if (data && data.length) { - const script = createDataScript(data, safe); + const script = module.exports.createDataScript(data, safe); tx.addOutput(new bsv.Transaction.Output({ script, satoshis: 0 })); } - const { fee, feeb, key, to = [], filter } = pay; + if (pay) { + const { fee, feeb = 1.0, key, to = [], filter } = pay; - if (fee) tx.fee(fee); - else tx.feePerKb((feeb || defaults.feeb) * 1000); + if (fee) tx.fee(fee); + else tx.feePerKb(feeb * 1000); - to.forEach(receiver => tx.to(receiver.address, receiver.value)); + to.forEach(receiver => tx.to(receiver.address, receiver.value)); - if (key) { - const privateKey = new bsv.PrivateKey(key); - const address = privateKey.toAddress(); - tx.change(address); + if (key) { + const privateKey = new bsv.PrivateKey(key); + const address = privateKey.toAddress(); + tx.change(address); - let utxos = await getUTXOs(address); - if (filter) utxos = filter(utxos); - tx.from(utxos); + let utxos = await module.exports.getUTXOs(address); + if (filter) utxos = filter(utxos); + tx.from(utxos); - tx.sign(privateKey); + tx.sign(privateKey); + } } return tx; -}; +}); -const send = async options => { - const tx = options.tx || (await build(options)); - return await broadcast(tx.serialize()); -}; +module.exports.send = callbackWrapper(async options => { + const tx = options.tx || (await module.exports.build(options)); + return await module.exports.broadcast(tx.serialize()); +}); -const createDataScript = (data, safe) => { +module.exports.createDataScript = (data, safe) => { if (typeof data === "string") return bsv.Script.fromHex(data); const s = new bsv.Script(); @@ -90,26 +106,3 @@ const createDataScript = (data, safe) => { return s; }; - -const callbackWrapper = func => { - return async (options, callback) => { - try { - result = await func(options); - if (callback) callback(null, result); - else return result; - } catch (err) { - if (callback) callback(err); - else throw err; - } - }; -}; - -connect({ baseURL: "https://api.bitindex.network/api/v3/main" }); - -module.exports = { - getUTXOs, - broadcast, - build: callbackWrapper(build), - send: callbackWrapper(send), - connect -}; diff --git a/package-lock.json b/package-lock.json index 2bebaaf..e0eee7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,84 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@sinonjs/commons": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.6.0.tgz", + "integrity": "sha512-w4/WHG7C4WWFyE5geCieFJF6MZkbW4VAriol5KlmQXpAQdxvV0p26sqNZOW6Qyw6Y0l9K4g+cHvvczR2sEEpqg==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/formatio": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.1.tgz", + "integrity": "sha512-tsHvOB24rvyvV2+zKMmPkZ7dXX6LSLKZ7aOtXY6Edklp0uRcgGpOsQTTGTcWViFyx4uhWc6GV8QdnALbIbIdeQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1", + "@sinonjs/samsam": "^3.1.0" + } + }, + "@sinonjs/samsam": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz", + "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.3.0", + "array-from": "^2.1.1", + "lodash": "^4.17.15" + } + }, + "@sinonjs/text-encoding": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz", + "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", + "dev": true + }, + "aes-js": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", + "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==", + "dev": true + }, + "ansi-colors": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", + "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-from": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", + "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", + "dev": true + }, "axios": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", @@ -19,6 +97,21 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base-x": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.7.tgz", + "integrity": "sha512-zAKJGuQPihXW22fkrfOclUUZXM2g92z5GzlSMHxhO6r6Qj+Nm0ccaGNBzDZojzwOMkpjAv4J0fOv1U4go+a4iw==", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "dev": true + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -29,16 +122,127 @@ "concat-map": "0.0.1" } }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "dev": true, + "requires": { + "base-x": "^3.0.2" + } + }, + "bsv": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/bsv/-/bsv-0.30.0.tgz", + "integrity": "sha512-8TiRw8RSTX+SZ+karPipBIn5TC2/mWPULBTapzuPu1+hHSRw/d6FzZTjlPyp/LPqytlCHqchWLRSSTUYl0Evbg==", + "dev": true, + "requires": { + "aes-js": "^3.1.2", + "bn.js": "=4.11.8", + "bs58": "=4.0.1", + "buffer-compare": "=1.1.1", + "clone-deep": "^4.0.1", + "elliptic": "6.4.1", + "hash.js": "^1.1.7", + "inherits": "2.0.3", + "unorm": "1.4.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + } + } + }, + "buffer-compare": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.1.1.tgz", + "integrity": "sha1-W+e+hTr4kZjR9N3AkNHWakiu9ZY=", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, "concat-map": { @@ -47,6 +251,19 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -55,24 +272,131 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, - "dotenv": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz", - "integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==", + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "es-abstract": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.2.tgz", + "integrity": "sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.0", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.0", + "is-callable": "^1.1.4", + "is-regex": "^1.0.4", + "object-inspect": "^1.6.0", + "object-keys": "^1.1.1", + "string.prototype.trimleft": "^2.0.0", + "string.prototype.trimright": "^2.0.0" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "flat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", + "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "dev": true, + "requires": { + "is-buffer": "~2.0.3" + } + }, "follow-redirects": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", @@ -87,10 +411,31 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -107,18 +452,54 @@ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -135,11 +516,186 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true + }, "is-buffer": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "just-extend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz", + "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "dev": true, + "requires": { + "invert-kv": "^2.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, + "lolex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", + "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", + "dev": true + }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "requires": { + "p-defer": "^1.0.0" + } + }, + "mem": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "dev": true, + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -165,22 +721,51 @@ } }, "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.0.tgz", + "integrity": "sha512-qwfFgY+7EKAAUAdv7VYMZQknI7YJSGesxHyhn6qD52DV8UcSZs5XwCifcZGMVIE4a5fbmhvbotxC0DLQ0oKohQ==", "dev": true, "requires": { + "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", + "debug": "3.2.6", "diff": "3.5.0", "escape-string-regexp": "1.0.5", - "glob": "7.1.2", + "find-up": "3.0.0", + "glob": "7.1.3", "growl": "1.10.5", - "he": "1.1.1", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "2.2.0", "minimatch": "3.0.4", "mkdirp": "0.5.1", - "supports-color": "5.4.0" + "ms": "2.1.1", + "node-environment-flags": "1.0.5", + "object.assign": "4.1.0", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", + "wide-align": "1.1.3", + "yargs": "13.2.2", + "yargs-parser": "13.0.0", + "yargs-unparser": "1.5.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } } }, "ms": { @@ -188,6 +773,84 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "nise": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.2.tgz", + "integrity": "sha512-/6RhOUlicRCbE9s+94qCUsyE+pKlVJ5AhIv+jEE7ESKwnbXqulKZ1FYU+XAtHHWE9TinYvAxDUJAb912PwPoWA==", + "dev": true, + "requires": { + "@sinonjs/formatio": "^3.2.1", + "@sinonjs/text-encoding": "^0.7.1", + "just-extend": "^4.0.2", + "lolex": "^4.1.0", + "path-to-regexp": "^1.7.0" + } + }, + "node-environment-flags": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", + "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", + "dev": true, + "requires": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-inspect": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", + "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -197,27 +860,260 @@ "wrappy": "1" } }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "dev": true, + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", + "dev": true + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-to-regexp": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "dev": true, + "requires": { + "isarray": "0.0.1" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "sinon": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.4.2.tgz", + "integrity": "sha512-pY5RY99DKelU3pjNxcWo6XqeB1S118GBcVIIdDi6V+h6hevn1izcg2xv1hTHW/sViRXU7sUOxt4wTUJ3gsW2CQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.4.0", + "@sinonjs/formatio": "^3.2.1", + "@sinonjs/samsam": "^3.3.3", + "diff": "^3.5.0", + "lolex": "^4.2.0", + "nise": "^1.5.2", + "supports-color": "^5.5.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string.prototype.trimleft": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", + "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string.prototype.trimright": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", + "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", "dev": true, "requires": { "has-flag": "^3.0.0" } }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, "uglify-es": { "version": "3.3.9", "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", @@ -236,11 +1132,206 @@ } } }, + "unorm": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz", + "integrity": "sha1-NkIA1fE2RsqLzURJAnEzVhR5IwA=", + "dev": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yargs": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", + "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "os-locale": "^3.1.0", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", + "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yargs-unparser": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", + "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "dev": true, + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.11", + "yargs": "^12.0.5" + }, + "dependencies": { + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "yargs": { + "version": "12.0.5", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", + "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" + } + }, + "yargs-parser": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } } } } diff --git a/package.json b/package.json index 631a801..4dbc10e 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,9 @@ "dist" ], "devDependencies": { - "dotenv": "^6.2.0", - "mocha": "^5.1.1", + "bsv": "^0.30.0", + "mocha": "^6.2.0", + "sinon": "^7.4.2", "uglify-es": "^3.3.9" } } diff --git a/test/test.js b/test/test.js index f1f9460..cf680ad 100644 --- a/test/test.js +++ b/test/test.js @@ -1,607 +1,330 @@ -require('dotenv').config() -const assert = require('assert'); -const bitcoin = require('bsv') -const datapay = require('../index'); - -// Private Key for Demo Purpose Only -const privKey = process.env.privKey - -var utxoSize; -describe('datapay', function() { - beforeEach(function(done) { - const address = new bitcoin.PrivateKey(privKey).toAddress() - datapay.connect().getUnspentUtxos(address, function(err, utxos) { - if (err) { - console.log("Error: ", err) - } else { - utxoSize = utxos.length - done() - } - }) - }) - describe('build', function() { - describe('data only', function() { - it('opcode', function(done) { - const options = { - data: [{op: 78}, "hello world"] - } - datapay.build(options, function(err, tx) { - let generated = tx.toObject() - let s = new bitcoin.Script(generated.outputs[0].script).toString() - assert(s.startsWith("OP_RETURN OP_PUSHDATA4 1818585099")) - done() - }); - }) - it('opcode 2', function(done) { - const options = { - data: ["0x6d02", "hello world", {op: 78}, "blah blah blah * 10^100"] - } - datapay.build(options, function(err, tx) { - let generated = tx.toObject() - let s = new bitcoin.Script(generated.outputs[0].script).toString() - assert(s.startsWith("OP_RETURN 2 0x6d02 11 0x68656c6c6f20776f726c64 OP_PUSHDATA4 1634492951")) - done() - }); - }) - it('push data array', function(done) { - const options = { - data: ["0x6d02", "hello world"] - } - datapay.build(options, function(err, tx) { - let generated = tx.toObject(); - // no input (since no one has signed yet) - assert.equal(generated.inputs.length, 0) - // output has one item (only OP_RETURN) - assert.equal(generated.outputs.length, 1) - // the only existing output is a script - assert(generated.outputs[0].script); - // uses the default fee of 400 - assert(generated.fee <= 400) - - done() - }); - }) - it('hex string that represents script', function(done) { - const options = { - data: "6a04366430320b68656c6c6f20776f726c64" - } - datapay.build(options, function(err, tx) { - let generated = tx.toObject(); - // no input (since no one has signed yet) - assert.equal(generated.inputs.length, 0) - // output has one item (only OP_RETURN) - assert.equal(generated.outputs.length, 1) - // the only existing output is a script - assert(generated.outputs[0].script); - // uses the default fee of 400 - assert(generated.fee <= 400) - - done() - }); - }) - it('Buffer', function(done) { - const options = { - data: [Buffer.from("abc"), "hello world"] - } - datapay.build(options, function(err, tx) { - let generated = tx.toObject(); - // no input (since no one has signed yet) - assert.equal(generated.inputs.length, 0) - // output has one item (only OP_RETURN) - assert.equal(generated.outputs.length, 1) - // the only existing output is a script - assert(generated.outputs[0].script); - // uses the default fee of 400 - assert(generated.fee <= 400) - - done() - }); - }) - }) - describe('pay only', function() { - it('to', function(done) { - const address = new bitcoin.PrivateKey(privKey).toAddress() - const options = { - pay: { - key: privKey, - to: [{ address: address, value: 100 }] +const assert = require("assert"); +const sinon = require("sinon"); +const bsv = require("bsv"); +const datapay = require("../index"); + +const sandbox = sinon.createSandbox(); + +// fake input data +const toAddress1 = "1DnFt3kHih4jkAbGYsF8wPhoisuM3vkWLN"; +const toAddress2 = "1LTLNv4SCF9pjj73t5ZEt5fYrWWadwfMFB"; +const privateKey = "Ky1WGEzN2Jn6CezPWdYMqTJzcBTJuFaMhna6wBpycg1wzVBUXcHC"; +const privateKeyRedeem = "76a914ee305aa2a75dbeff6f8f960eb1b7b16eb1d3b2df88ac"; +const utxos = [ + { + txid: "8a06f5d5449c0f68291171ad1a7cc427db9bef5abb93998b40c999f5e933eb89", + vout: 2, + amount: 0.045, + script: privateKeyRedeem + }, + { + txid: "23cad3adb933c194b57b9d8db22a977b281f7279f040c319a9552c3378a70f5a", + vout: 4, + satoshis: 10000, + scriptPubKey: privateKeyRedeem + } +]; + +describe("datapay", function() { + afterEach(function() { + sandbox.restore(); + }); + + describe("#createDataScript()", function() { + describe("with a pushdata array", function() { + it("should add an opcode", function() { + const script = datapay.createDataScript([{ op: 78 }, "hello world"]); + assert.equal( + script.toASM(), + "OP_RETURN OP_PUSHDATA4 68656c6c6f20776f726c64" + ); + }); + + it("should add a buffer", function() { + const script = datapay.createDataScript([ + Buffer.from("abc"), + "hello world" + ]); + + assert.equal(script.toASM(), "OP_RETURN 616263 68656c6c6f20776f726c64"); + }); + + it("should add a utf-8 string", function() { + const script = datapay.createDataScript(["hello world"]); + assert.equal(script.toASM(), "OP_RETURN 68656c6c6f20776f726c64"); + }); + + it("should add a hex string", function() { + const script = datapay.createDataScript(["0x6d02", "hello world"]); + assert.equal(script.toASM(), "OP_RETURN 6d02 68656c6c6f20776f726c64"); + }); + + it("should add OP_0 with safe option", function() { + const script = datapay.createDataScript(["hello world"], true); + assert.equal(script.toASM(), "0 OP_RETURN 68656c6c6f20776f726c64"); + }); + }); + + it("should build from a hex string", function() { + const script = datapay.createDataScript( + "6a04366430320b68656c6c6f20776f726c64" + ); + + assert.equal(script.toASM(), "OP_RETURN 36643032 68656c6c6f20776f726c64"); + }); + }); + + describe("#build()", function() { + describe("with data", function() { + it("should add OP_0 with safe option", async function() { + const options = { data: ["hello world"], safe: true }; + const tx = await datapay.build(options); + assert.equal(tx.outputs.length, 1); + assert.equal( + tx.outputs[0].script.toASM(), + "0 OP_RETURN 68656c6c6f20776f726c64" + ); + }); + + it("should add a data output", async function() { + const options = { data: ["hello world"] }; + const tx = await datapay.build(options); + assert.equal(tx.outputs.length, 1); + assert.equal( + tx.outputs[0].script.toASM(), + "OP_RETURN 68656c6c6f20776f726c64" + ); + }); + }); + + describe("with callback", function() { + it("should build a transaction", function(done) { + sandbox.stub(datapay, "getUTXOs").resolves(utxos); + + const options = { pay: { key: privateKey } }; + datapay.build(options, (err, tx) => { + try { + assert(tx, "a transaction was not returned in the callback"); + done(); + } catch (err) { + done(err); } - } - datapay.build(options, function(err, tx) { - // If only 'key' is included, it will use the default values for - // rest of the pay attributes - // and make a transaction that sends money to oneself - // (since no receiver is specified) - let generated = tx.toObject(); - done() - }) - }) - it('pay.key only', function(done) { - const options = { - pay: { - key: privKey - } - } - datapay.build(options, function(err, tx) { - // If only 'key' is included, it will use the default values for - // rest of the pay attributes - // and make a transaction that sends money to oneself - // (since no receiver is specified) - let generated = tx.toObject(); - - // input length utxoSize => from the user specifiec by the private key - assert.equal(generated.inputs.length, utxoSize) - // contains a 'changeScript' - assert(generated.changeScript) - - // output length 1 => the output points to the sender by default - assert.equal(generated.outputs.length, 1) - // script is a pubkeyhashout - let s = new bitcoin.Script(generated.outputs[0].script) - assert(s.isPublicKeyHashOut()) - - // script sends the money to the same address as the sender - // specified by the private key - const address = new bitcoin.PrivateKey(privKey).toAddress() - assert.equal(address.toString(), s.toAddress().toString()) - - done() }); - }) - it('pay.fee only', function(done) { - const options = { - pay: { - fee: 100 + }); + + it("should handle getUTXOs error", function(done) { + sandbox.stub(datapay, "getUTXOs").rejects(); + + const options = { pay: { key: privateKey } }; + datapay.build(options, (err, tx) => { + try { + assert(err, "an error was not returned in the callback"); + done(); + } catch (err) { + done(err); } - } - datapay.build(options, function(err, tx) { - // if no key is included, - // empty input (since no sender) - // empty output (since nothing else is specified) - let generated = tx.toObject(); - assert.equal(generated.inputs.length, 0) - assert.equal(generated.outputs.length, 0) - assert.equal(generated.fee, 100) - done() - }) - }) - it('pay.key and pay.fee', function(done) { - const options = { - pay: { - key: privKey, - fee: 100 - } - } - datapay.build(options, function(err, tx) { - let generated = tx.toObject(); - assert.equal(generated.fee, 100) - done() - }) - }) - - /** - - pay.rpc TBD - - **/ - - }) - describe('data and pay', function() { - it('both data and pay', function(done) { - const options = { - data: ["0x6d02", "hello world"], - pay: { - key: privKey - } - } - datapay.build(options, function(err, tx) { - let generated = tx.toObject(); - - // input length 1 => from the user specifiec by the private key - assert.equal(generated.inputs.length, utxoSize) - // contains a 'changeScript' - assert(generated.changeScript) - - // must have two outputs - assert.equal(generated.outputs.length, 2) - - let s1 = new bitcoin.Script(generated.outputs[0].script) - - // the first output is OP_RETURN - assert(s1.chunks[0].opcodenum, bitcoin.Opcode.OP_RETURN) - - // the second script is a pubkeyhashout (change address) - let s2 = new bitcoin.Script(generated.outputs[1].script) - assert(s2.isPublicKeyHashOut()) - - // script sends the money to the same address as the sender - // specified by the private key - const address = new bitcoin.PrivateKey(privKey).toAddress() - assert.equal(address.toString(), s2.toAddress().toString()) - - done() - }) - }) - /* - it('pay.filter', function(done) { - const options = { - data: ["0x6d02", "hello world"], - pay: { - key: privKey, - filter: { - v: 3, - q: { - find: { - } - } - } - } - } - datapay.build(options, function(err, tx) { - let generated = tx.toObject(); - - // input length 1 => from the user specifiec by the private key - assert.equal(generated.inputs.length, 5) - // contains a 'changeScript' - assert(generated.changeScript) - - // must have two outputs - assert.equal(generated.outputs.length, 2) - - let s1 = new bitcoin.Script(generated.outputs[0].script) - - // the first output is OP_RETURN - assert(s1.chunks[0].opcodenum, bitcoin.Opcode.OP_RETURN) - - // the second script is a pubkeyhashout (change address) - let s2 = new bitcoin.Script(generated.outputs[1].script) - assert(s2.isPublicKeyHashOut()) - - // script sends the money to the same address as the sender - // specified by the private key - const address = new bitcoin.PrivateKey(privKey).toAddress() - assert.equal(address.toString(), s2.toAddress().toString()) - - done() - }) - - }) - */ - }) - describe('attach coins to data', function() { - it('paying tip to 1 user', function(done) { - // send to myself - const receiver = new bitcoin.PrivateKey(privKey).toAddress() + }); + }); + }); - const options = { - data: ["0x6d02", "hello world"], - pay: { - key: privKey, - to: [{ - address: receiver, - value: 1000 - }] - } - } - datapay.build(options, function(err, tx) { - // output has 3 items - assert.equal(tx.outputs.length, 3) - - // 1. OP_RETURN - let s1 = new bitcoin.Script(tx.outputs[0].script) - assert(s1.chunks[0].opcodenum, bitcoin.Opcode.OP_RETURN) - // 2. Manual transaction output - // the second script is a pubkeyhashout (change address) - let s2 = new bitcoin.Script(tx.outputs[1].script) - assert(s2.isPublicKeyHashOut()) - // the value sent is 1000 - assert.equal(tx.outputs[1].satoshis, 1000) - // the receiver address is the address specified in pay.to - assert.equal(s2.toAddress().toString(), bitcoin.Address(receiver).toString()) - - // 3. Change address transaction output - let s3 = new bitcoin.Script(tx.outputs[2].script) - assert(s3.isPublicKeyHashOut()) - done() - }) - }) - it('paying tip to 2 users', function(done) { - // send to myself - const receiver = new bitcoin.PrivateKey(privKey).toAddress() + describe("with async/await", function() { + it("should build a transaction", async function() { + sandbox.stub(datapay, "getUTXOs").resolves(utxos); const options = { - data: ["0x6d02", "hello world"], - pay: { - key: privKey, - to: [{ - address: receiver, - value: 1000 - }, { - address: receiver, - value: 2000 - }] - } + pay: { key: privateKey, to: [{ address: toAddress1, value: 5000 }] }, + data: ["async", "await"] + }; + const tx = await datapay.build(options); + assert(tx.inputs.length, 2); + assert(tx.outputs.length, 3); + assert(tx.isFullySigned()); + }); + + it("should handle getUTXOs error", async function() { + sandbox.stub(datapay, "getUTXOs").rejects(); + + const options = { pay: { key: privateKey } }; + await assert.rejects(async () => await datapay.build(options)); + }); + }); + + it("should send output to address", async function() { + const options = { pay: { to: [{ address: toAddress1, value: 100000 }] } }; + const tx = await datapay.build(options); + assert.equal(tx.outputs.length, 1); + assert.equal(tx.outputs[0].satoshis, 100000); + assert.equal( + tx.outputs[0].script.toHex(), + "76a9148c30a62437626c504205900ed6def906b0b0b3fd88ac" + ); + }); + + it("should add change output", async function() { + sandbox.stub(datapay, "getUTXOs").resolves(utxos); + + const options = { pay: { key: privateKey } }; + const tx = await datapay.build(options); + const changeOutput = tx.getChangeOutput(); + assert(changeOutput); + assert.equal(changeOutput.script.toHex(), privateKeyRedeem); + }); + + it("should apply fixed fee", async function() { + sandbox.stub(datapay, "getUTXOs").resolves(utxos); + + const options = { pay: { key: privateKey, fee: 500 } }; + const tx = await datapay.build(options); + assert.equal(tx.getFee(), 500); + }); + + it("should apply custom fee rate", async function() { + sandbox.stub(datapay, "getUTXOs").resolves(utxos); + + const options = { pay: { key: privateKey, feeb: 5.0 } }; + const tx = await datapay.build(options); + assert.equal(tx._feePerKb, 5000); + }); + + it("should filter utxo's", async function() { + sandbox.stub(datapay, "getUTXOs").resolves(utxos); + + const prevTxId = + "8a06f5d5449c0f68291171ad1a7cc427db9bef5abb93998b40c999f5e933eb89"; + const options = { + pay: { + key: privateKey, + filter: utxos => utxos.filter(utxo => utxo.txid === prevTxId) } - datapay.build(options, function(err, tx) { - // output has 4 items - assert.equal(tx.outputs.length, 4) - - // 1. OP_RETURN - let s1 = new bitcoin.Script(tx.outputs[0].script) - assert(s1.chunks[0].opcodenum, bitcoin.Opcode.OP_RETURN) - // 2. Manual transaction output - // the second script is a pubkeyhashout (change address) - let s2 = new bitcoin.Script(tx.outputs[1].script) - assert(s2.isPublicKeyHashOut()) - // the value sent is 1000 - assert.equal(tx.outputs[1].satoshis, 1000) - // the receiver address is the address specified in pay.to - assert.equal(s2.toAddress().toString(), bitcoin.Address(receiver).toString()) - - // 3. Manual transaction output - // the third script is a pubkeyhashout (change address) - let s3 = new bitcoin.Script(tx.outputs[2].script) - assert(s3.isPublicKeyHashOut()) - // the value sent is 1000 - assert.equal(tx.outputs[2].satoshis, 2000) - // the receiver address is the address specified in pay.to - assert.equal(s3.toAddress().toString(), bitcoin.Address(receiver).toString()) - - // 3. Change address transaction output - let s4 = new bitcoin.Script(tx.outputs[3].script) - assert(s4.isPublicKeyHashOut()) - done() - }) - }) - }) - describe('tx', function() { - describe('importing unsigned tx', function() { - it('tx only', function(done) { - // 1. build - const options = { - data: ["0x6d02", "hello world"] - } - datapay.build(options, function(err, original_tx) { - // 2. export - let exportedTx = original_tx.toString() - // exported transaction is string - assert.equal(typeof exportedTx, "string") - // 3. re-import - datapay.build({ - tx: exportedTx - }, function(err, imported_tx) { - // the imported transaction should equal the original transaction - assert.equal(imported_tx.toString(), original_tx.toString()) - done() - }) - }) - }) - it('tx + data', function(done) { - // if there's a 'tx' attribute, it should ignore 'data' to avoid confusion - const options1 = { - data: ["0x6d02", "hello world"] - } - // 1. build initial transaction - datapay.build(options1, function(err, tx1) { - let exported_tx1 = tx1.toString(); - // 2. build a new transaction using the exported transaction + new data - let options2 = { - tx: exported_tx1, - data: ["0x6d02", "bye world"] - } - datapay.build(options2, function(err, tx2) { - assert.equal(tx1.toString(), tx2.toString()) - done() - }) - }) - }) - it('tx + pay', function(done) { - // tx1 is an unsigned transaction - // and we create a signed version by adding the 'pay' attribute - const options1 = { - data: ["0x6d02", "hello world"] + }; + const tx = await datapay.build(options); + assert.equal(tx.inputs.length, 1); + assert.equal(tx.inputs[0].prevTxId.toString("hex"), prevTxId); + }); + }); + + describe("#send()", function() { + const tx = bsv + .Transaction() + .from(utxos) + .change(toAddress2) + .to(toAddress1, 5000) + .sign(privateKey); + + describe("with callback", function() { + it("should broadcast a transaction", function(done) { + const broadcastFake = sandbox.fake.resolves(tx.hash); + sandbox.replace(datapay, "broadcast", broadcastFake); + + datapay.send({ tx }, (err, txid) => { + try { + assert(broadcastFake.called, "transaction was not broadcast"); + assert.equal(txid, tx.hash); + done(); + } catch (err) { + done(err); } - // 1. build initial transaction - datapay.build(options1, function(err, tx1) { - let exported_tx1 = tx1.toString(); - // 2. build a new transaction using the exported transaction + new data - let options2 = { - tx: exported_tx1, - pay: { - key: privKey - } - } - datapay.build(options2, function(err, tx2) { - - // tx1's input should be empty - assert.equal(tx1.inputs.length, 0) - // tx2's input should now have as many as the utxoSize - assert.equal(tx2.inputs.length, utxoSize) - - // tx1's output should have one item - assert.equal(tx1.outputs.length, 1) - // and it should be an OP_RETURN - let script1 = new bitcoin.Script(tx1.outputs[0].script) - assert(script1.chunks[0].opcodenum, bitcoin.Opcode.OP_RETURN) - - // tx2's output should have two items - assert.equal(tx2.outputs.length, 2) - let script2 = [ - new bitcoin.Script(tx2.outputs[0].script), - new bitcoin.Script(tx2.outputs[1].script) - ] - // the first should be OP_RETURN - assert(script2[0].chunks[0].opcodenum, bitcoin.Opcode.OP_RETURN) - // the second script is a pubkeyhashout (change address) - assert(script2[1].isPublicKeyHashOut()) - done() - }) - }) - }) - it('tx + pay + data', function(done) { - // tx1 is an unsigned transaction - // and we create a signed version by adding the 'pay' attribute - // but this time we also try to sneak in 'data' - // the 'data' should be ignored - const options1 = { - data: ["0x6d02", "hello world"] - } - // 1. build initial transaction - datapay.build(options1, function(err, tx1) { - let exported_tx1 = tx1.toString(); - // 2. build a new transaction using the exported transaction + new data - let options2 = { - tx: exported_tx1, - data: ["0x6d02", "bye world"], // trying to sneak in 'data' - pay: { - key: privKey - } - } - datapay.build(options2, function(err, tx2) { - - // tx2's input should now have as many as the utxoSize - assert.equal(tx2.inputs.length, utxoSize) - - // tx2's output should have two items - assert.equal(tx2.outputs.length, 2) - let script2 = [ - new bitcoin.Script(tx2.outputs[0].script), - new bitcoin.Script(tx2.outputs[1].script) - ] - // the first should be OP_RETURN - assert(script2[0].chunks[0].opcodenum, bitcoin.Opcode.OP_RETURN) - // the second script is a pubkeyhashout (change address) - assert(script2[1].isPublicKeyHashOut()) - - // the script for the original OP_RETURN - // should match the new OP_RETURN script - // because the 'data' attribute was ignored - let script1 = new bitcoin.Script(tx1.outputs[0].script) - assert.equal(script1.toString(), script2[0].toString()) - done() - }) - }) - }) - }) - describe('importing signed tx', function() { - it('tx only', function(done) { - const options1 = { - data: ["0x6d02", "hello world"], - pay: { key: privKey } - } - // 1. build initial transaction - datapay.build(options1, function(err, tx1) { - let exported_tx1 = tx1.toString(); - // 2. import transaction - datapay.build({ tx: exported_tx1 }, function(err, tx2) { - // the imported transaction should have as many as the utxoSize - assert.equal(tx2.inputs.length, utxoSize) - // the input should have 'script' property - assert(tx2.inputs[0].script) - // the script should be public key hash in - let script = new bitcoin.Script(tx2.inputs[0].script) - assert(script.isPublicKeyHashIn()) - // the imported transaction's input script address should match - // the address corresponding to the originally imported private key - const address = new bitcoin.PrivateKey(privKey).toAddress() - assert.equal(address.toString(), script.toAddress().toString()) - done() - }) - }) - }) - it('tx + data', function(done) { - // the transaction has already been signed - // the data should be ignored - // Better yet, this shouldn't be used - const options1 = { - data: ["0x6d02", "hello world"], - pay: { key: privKey } + }); + }); + + it("should propagate a build error", function(done) { + sandbox.stub(datapay, "build").rejects(); + + const options = { pay: { key: privateKey } }; + datapay.send(options, (err, txid) => { + try { + assert(err, "an error was not returned in the callback"); + done(); + } catch (err) { + done(err); } - // 1. build initial transaction - datapay.build(options1, function(err, tx1) { - let exported_tx1 = tx1.toString(); - // 2. import transaction - datapay.build({ - tx: exported_tx1, - data: ["0x6d02", "bye world"] - }, function(err, tx2) { - assert(err.toString(), "the transaction is already signed and cannot be modified") - assert.equal(tx2, undefined) - done() - }) - }) - }) - it('tx+ pay', function(done) { - // the transaction has already been signed - // the pay attribute should be ignored - // and throw and error - const options1 = { - data: ["0x6d02", "hello world"], - pay: { key: privKey } + }); + }); + + it("should propagate a broadcast error", function(done) { + sandbox.stub(datapay, "getUTXOs").resolves(utxos); + sandbox.stub(datapay, "broadcast").rejects(); + + const options = { pay: { key: privateKey } }; + datapay.send(options, (err, txid) => { + try { + assert(err, "an error was not returned in the callback"); + done(); + } catch (err) { + done(err); } - // 1. build initial transaction - datapay.build(options1, function(err, tx1) { - let exported_tx1 = tx1.toString(); - // 2. import transaction - // But this time, we're updating the key attribute. - // This should re-sign the transaction - datapay.build({ - tx: exported_tx1, - pay: { - key: privKey - } - }, function(err, tx2) { - assert(err.toString(), "the transaction is already signed and cannot be modified") - assert.equal(tx2, undefined) - done() - }) - }) - }) - it('tx + pay + data', function(done) { - const options1 = { - data: ["0x6d02", "hello world"], - pay: { key: privKey } + }); + }); + + it("should propagate a serialization error", function(done) { + // sending an unsigned transaction + const tx = bsv + .Transaction() + .from(utxos) + .change(toAddress1); + + datapay.send({ tx }, (err, txid) => { + try { + assert(err, "an error was not returned in the callback"); + done(); + } catch (err) { + done(err); } - // 1. build initial transaction - datapay.build(options1, function(err, tx1) { - let exported_tx1 = tx1.toString(); - // 2. import transaction - // But this time, we're updating the key attribute. - // This should re-sign the transaction - datapay.build({ - tx: exported_tx1, - data: ["0x6d02", "bye world"], - pay: { - key: privKey - } - }, function(err, tx2) { - assert(err.toString(), "the transaction is already signed and cannot be modified") - assert.equal(tx2, undefined) - done() - }) - }) - }) - }) - }) - }) - describe('advanced', function() { - describe('bitcoin', function() { - it('exposes bitcoin', function() { - assert(datapay.bsv.Networks) - assert(datapay.bsv.Opcode) - }) - }) - describe('connect', function() { - it('default', function() { - var insight = datapay.connect(); - assert.equal(insight.constructor.name, "Insight") - assert.equal(insight.url, 'https://api.bitindex.network') - }) - it('connect with url', function() { - var insight = datapay.connect('https://api.bitindex.network'); - assert.equal(insight.constructor.name, "Insight") - assert.equal(insight.url, 'https://api.bitindex.network') - }) - }) - }) -}) + }); + }); + }); + + describe("with async/await", function() { + it("should broadcast a transaction", async function() { + const broadcastFake = sandbox.fake.resolves(tx.hash); + sandbox.replace(datapay, "broadcast", broadcastFake); + + const txid = await datapay.send({ tx }); + assert(broadcastFake.called, "transaction was not broadcast"); + assert.equal(txid, tx.hash); + }); + + it("should propagate a build error", async function() { + sandbox.stub(datapay, "build").rejects(); + + const options = { pay: { key: privateKey } }; + assert.rejects(datapay.send(options)); + }); + + it("should propagate a broadcast error", async function() { + sandbox.stub(datapay, "getUTXOs").resolves(utxos); + sandbox.stub(datapay, "broadcast").rejects(); + + const options = { pay: { key: privateKey } }; + assert.rejects(datapay.send(options)); + }); + + it("should propagate a serialization error", async function() { + // sending an unsigned transaction + const tx = bsv + .Transaction() + .from(utxos) + .change(toAddress1); + + assert.rejects(datapay.send({ tx })); + }); + }); + + it("should build a transaction if not supplied", async function() { + const broadcastFake = sandbox.fake.resolves("faketxid"); + const buildFake = sandbox.fake.resolves(tx); + sandbox.replace(datapay, "broadcast", broadcastFake); + sandbox.replace(datapay, "build", buildFake); + sandbox.stub(datapay, "getUTXOs").resolves(utxos); + + const options = { + pay: { key: privateKey, to: [{ address: toAddress1, value: 5000 }] } + }; + const txid = await datapay.send(options); + + assert.equal(txid, "faketxid", "transaction was not broadcast"); + assert(buildFake.calledWith(options)); + assert(broadcastFake.calledWith(tx.serialize())); + }); + }); +}); From 3d12b66fe325216c6cca99b864db1e8dc0c56564 Mon Sep 17 00:00:00 2001 From: Breavyn Date: Thu, 24 Oct 2019 10:27:13 +1000 Subject: [PATCH 15/20] Export connect function. --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index d86c737..7ec7568 100644 --- a/index.js +++ b/index.js @@ -16,11 +16,11 @@ const callbackWrapper = func => { let insight; -const connect = options => { +module.exports.connect = options => { insight = axios.create(options); }; -connect({ baseURL: "https://api.bitindex.network/api/v3/main" }); +module.exports.connect({ baseURL: "https://api.bitindex.network/api/v3/main" }); module.exports.getUTXOs = async address => { try { From 5b60e13c0b95dd46329fc29e00255c03ffa0cb7b Mon Sep 17 00:00:00 2001 From: Breavyn Date: Fri, 25 Oct 2019 15:53:03 +1000 Subject: [PATCH 16/20] Bump dependencies. --- package-lock.json | 403 ++++++++++------------------------------------ package.json | 8 +- 2 files changed, 93 insertions(+), 318 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0eee7c..d9aa623 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,9 @@ } }, "@sinonjs/formatio": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.1.tgz", - "integrity": "sha512-tsHvOB24rvyvV2+zKMmPkZ7dXX6LSLKZ7aOtXY6Edklp0uRcgGpOsQTTGTcWViFyx4uhWc6GV8QdnALbIbIdeQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz", + "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==", "dev": true, "requires": { "@sinonjs/commons": "^1", @@ -144,9 +144,9 @@ } }, "bsv": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/bsv/-/bsv-0.30.0.tgz", - "integrity": "sha512-8TiRw8RSTX+SZ+karPipBIn5TC2/mWPULBTapzuPu1+hHSRw/d6FzZTjlPyp/LPqytlCHqchWLRSSTUYl0Evbg==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/bsv/-/bsv-1.0.0.tgz", + "integrity": "sha512-K7IpV4G7BHBO5zK/rDslrEnl8qmgSx3iKgD5oZ78MOtX043IoqDyVQLa2/FvqczgbVXYAsPaYL8q3u5up8M7oA==", "dev": true, "requires": { "aes-js": "^3.1.2", @@ -158,14 +158,6 @@ "hash.js": "^1.1.7", "inherits": "2.0.3", "unorm": "1.4.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - } } }, "buffer-compare": { @@ -203,14 +195,42 @@ } }, "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } } }, "clone-deep": { @@ -224,12 +244,6 @@ "shallow-clone": "^3.0.0" } }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -251,19 +265,6 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -314,19 +315,10 @@ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, "es-abstract": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.2.tgz", - "integrity": "sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.0.tgz", + "integrity": "sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg==", "dev": true, "requires": { "es-to-primitive": "^1.2.0", @@ -337,8 +329,8 @@ "is-regex": "^1.0.4", "object-inspect": "^1.6.0", "object-keys": "^1.1.1", - "string.prototype.trimleft": "^2.0.0", - "string.prototype.trimright": "^2.0.0" + "string.prototype.trimleft": "^2.1.0", + "string.prototype.trimright": "^2.1.0" } }, "es-to-primitive": { @@ -364,21 +356,6 @@ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -423,15 +400,6 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", @@ -511,15 +479,9 @@ } }, "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "is-buffer": { @@ -563,12 +525,6 @@ "has": "^1.0.1" } }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, "is-symbol": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", @@ -618,15 +574,6 @@ "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, - "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", - "dev": true, - "requires": { - "invert-kv": "^2.0.0" - } - }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -658,32 +605,6 @@ "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", "dev": true }, - "map-age-cleaner": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", - "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", - "dev": true, - "requires": { - "p-defer": "^1.0.0" - } - }, - "mem": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", - "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", - "dev": true, - "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -721,9 +642,9 @@ } }, "mocha": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.0.tgz", - "integrity": "sha512-qwfFgY+7EKAAUAdv7VYMZQknI7YJSGesxHyhn6qD52DV8UcSZs5XwCifcZGMVIE4a5fbmhvbotxC0DLQ0oKohQ==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.2.tgz", + "integrity": "sha512-FgDS9Re79yU1xz5d+C4rv1G7QagNGHZ+iXF81hO8zY35YZZcLEsJVfFolfsqKFWunATEvNzMK0r/CwWd/szO9A==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -746,9 +667,9 @@ "supports-color": "6.0.0", "which": "1.3.1", "wide-align": "1.1.3", - "yargs": "13.2.2", - "yargs-parser": "13.0.0", - "yargs-unparser": "1.5.0" + "yargs": "13.3.0", + "yargs-parser": "13.1.1", + "yargs-unparser": "1.6.0" }, "dependencies": { "debug": { @@ -773,12 +694,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, "nise": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.2.tgz", @@ -802,21 +717,6 @@ "semver": "^5.7.0" } }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, "object-inspect": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", @@ -860,35 +760,6 @@ "wrappy": "1" } }, - "os-locale": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", - "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" - } - }, - "p-defer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", - "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", - "dev": true - }, "p-limit": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", @@ -925,12 +796,6 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, "path-to-regexp": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", @@ -940,16 +805,6 @@ "isarray": "0.0.1" } }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -989,31 +844,10 @@ "kind-of": "^6.0.2" } }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, "sinon": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.4.2.tgz", - "integrity": "sha512-pY5RY99DKelU3pjNxcWo6XqeB1S118GBcVIIdDi6V+h6hevn1izcg2xv1hTHW/sViRXU7sUOxt4wTUJ3gsW2CQ==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz", + "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==", "dev": true, "requires": { "@sinonjs/commons": "^1.4.0", @@ -1087,12 +921,6 @@ "ansi-regex": "^3.0.0" } }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -1163,48 +991,40 @@ } }, "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" }, "dependencies": { "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" } }, "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "^4.1.0" } } } @@ -1222,22 +1042,21 @@ "dev": true }, "yargs": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", - "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", "dev": true, "requires": { - "cliui": "^4.0.0", + "cliui": "^5.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", - "os-locale": "^3.1.0", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.0.0" + "yargs-parser": "^13.1.1" }, "dependencies": { "ansi-regex": { @@ -1269,9 +1088,9 @@ } }, "yargs-parser": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", - "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", "dev": true, "requires": { "camelcase": "^5.0.0", @@ -1279,58 +1098,14 @@ } }, "yargs-unparser": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", - "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", "dev": true, "requires": { "flat": "^4.1.0", - "lodash": "^4.17.11", - "yargs": "^12.0.5" - }, - "dependencies": { - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "yargs": { - "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", - "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^11.1.1" - } - }, - "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } + "lodash": "^4.17.15", + "yargs": "^13.3.0" } } } diff --git a/package.json b/package.json index 4dbc10e..1a22b49 100644 --- a/package.json +++ b/package.json @@ -21,15 +21,15 @@ "axios": "^0.19.0" }, "peerDependencies": { - "bsv": "^0.30.0" + "bsv": "^1.0.0" }, "files": [ "dist" ], "devDependencies": { - "bsv": "^0.30.0", - "mocha": "^6.2.0", - "sinon": "^7.4.2", + "bsv": "^1.0.0", + "mocha": "^6.2.2", + "sinon": "^7.5.0", "uglify-es": "^3.3.9" } } From 12962fddf8b748f2e3a1114e738e965f109c9a71 Mon Sep 17 00:00:00 2001 From: breavyn Date: Wed, 5 Feb 2020 09:44:05 +1000 Subject: [PATCH 17/20] Use safe data out as default, and remove the option to disable it. --- README.md | 6 ++++-- index.js | 8 ++++---- test/test.js | 28 ++++++++-------------------- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index e937e19..9fc954c 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ Both build and send now return promises which can be used with async/await. ``` const tx = await datapay.build({ data: ["using promises with datapay"], - safe: true, pay: { key: "" } @@ -46,7 +45,6 @@ function. ``` const tx = await datapay.build({ data: ["using promises with datapay"], - safe: true, pay: { key: "", filter: utxos => utxos.filter(utxo => utxo.confirmations > 5) @@ -54,6 +52,10 @@ const tx = await datapay.build({ }); ``` +## 5. Genesis defaults + +`OP_FALSE OP_RETURN` is now used by default and the `safe: true` option has been removed. + # Using This Fork The api here is still evolving so I recommend using the package-lock file or installing a specific commit. diff --git a/index.js b/index.js index 7ec7568..f360272 100644 --- a/index.js +++ b/index.js @@ -42,11 +42,11 @@ module.exports.broadcast = async rawtx => { } }; -module.exports.build = callbackWrapper(async ({ data, safe, pay }) => { +module.exports.build = callbackWrapper(async ({ data, pay }) => { const tx = new bsv.Transaction(); if (data && data.length) { - const script = module.exports.createDataScript(data, safe); + const script = module.exports.createDataScript(data); tx.addOutput(new bsv.Transaction.Output({ script, satoshis: 0 })); } @@ -79,13 +79,13 @@ module.exports.send = callbackWrapper(async options => { return await module.exports.broadcast(tx.serialize()); }); -module.exports.createDataScript = (data, safe) => { +module.exports.createDataScript = data => { if (typeof data === "string") return bsv.Script.fromHex(data); const s = new bsv.Script(); // Add OP_RETURN - if (safe) s.add(bsv.Opcode.OP_FALSE); + s.add(bsv.Opcode.OP_FALSE); s.add(bsv.Opcode.OP_RETURN); // Add data diff --git a/test/test.js b/test/test.js index cf680ad..d431776 100644 --- a/test/test.js +++ b/test/test.js @@ -36,7 +36,7 @@ describe("datapay", function() { const script = datapay.createDataScript([{ op: 78 }, "hello world"]); assert.equal( script.toASM(), - "OP_RETURN OP_PUSHDATA4 68656c6c6f20776f726c64" + "0 OP_RETURN OP_PUSHDATA4 68656c6c6f20776f726c64" ); }); @@ -46,22 +46,20 @@ describe("datapay", function() { "hello world" ]); - assert.equal(script.toASM(), "OP_RETURN 616263 68656c6c6f20776f726c64"); + assert.equal( + script.toASM(), + "0 OP_RETURN 616263 68656c6c6f20776f726c64" + ); }); it("should add a utf-8 string", function() { const script = datapay.createDataScript(["hello world"]); - assert.equal(script.toASM(), "OP_RETURN 68656c6c6f20776f726c64"); + assert.equal(script.toASM(), "0 OP_RETURN 68656c6c6f20776f726c64"); }); it("should add a hex string", function() { const script = datapay.createDataScript(["0x6d02", "hello world"]); - assert.equal(script.toASM(), "OP_RETURN 6d02 68656c6c6f20776f726c64"); - }); - - it("should add OP_0 with safe option", function() { - const script = datapay.createDataScript(["hello world"], true); - assert.equal(script.toASM(), "0 OP_RETURN 68656c6c6f20776f726c64"); + assert.equal(script.toASM(), "0 OP_RETURN 6d02 68656c6c6f20776f726c64"); }); }); @@ -76,23 +74,13 @@ describe("datapay", function() { describe("#build()", function() { describe("with data", function() { - it("should add OP_0 with safe option", async function() { - const options = { data: ["hello world"], safe: true }; - const tx = await datapay.build(options); - assert.equal(tx.outputs.length, 1); - assert.equal( - tx.outputs[0].script.toASM(), - "0 OP_RETURN 68656c6c6f20776f726c64" - ); - }); - it("should add a data output", async function() { const options = { data: ["hello world"] }; const tx = await datapay.build(options); assert.equal(tx.outputs.length, 1); assert.equal( tx.outputs[0].script.toASM(), - "OP_RETURN 68656c6c6f20776f726c64" + "0 OP_RETURN 68656c6c6f20776f726c64" ); }); }); From 3bc2f930990ee92faf839e8976384023c27492cf Mon Sep 17 00:00:00 2001 From: breavyn Date: Wed, 5 Feb 2020 09:45:20 +1000 Subject: [PATCH 18/20] Updated default insight api url. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index f360272..fd8c391 100644 --- a/index.js +++ b/index.js @@ -20,7 +20,7 @@ module.exports.connect = options => { insight = axios.create(options); }; -module.exports.connect({ baseURL: "https://api.bitindex.network/api/v3/main" }); +module.exports.connect({ baseURL: "https://api.mattercloud.network/api/v3/main" }); module.exports.getUTXOs = async address => { try { From 1c0a9267f4c78ded6c1e4f6b613226c1cba190ed Mon Sep 17 00:00:00 2001 From: breavyn Date: Fri, 28 Feb 2020 09:09:03 +1000 Subject: [PATCH 19/20] Updated default insight api url. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index fd8c391..073b9b4 100644 --- a/index.js +++ b/index.js @@ -20,7 +20,7 @@ module.exports.connect = options => { insight = axios.create(options); }; -module.exports.connect({ baseURL: "https://api.mattercloud.network/api/v3/main" }); +module.exports.connect({ baseURL: "https://api.mattercloud.net/api/v3/main" }); module.exports.getUTXOs = async address => { try { From 4a939f881491b032ebd432d3e9f84cee2f685313 Mon Sep 17 00:00:00 2001 From: breavyn Date: Fri, 28 Feb 2020 09:13:11 +1000 Subject: [PATCH 20/20] Bump dependencies. --- package-lock.json | 408 +++++++++++++++++++++++++++++++--------------- package.json | 10 +- 2 files changed, 278 insertions(+), 140 deletions(-) diff --git a/package-lock.json b/package-lock.json index d9aa623..b07f2d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,33 +5,43 @@ "requires": true, "dependencies": { "@sinonjs/commons": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.6.0.tgz", - "integrity": "sha512-w4/WHG7C4WWFyE5geCieFJF6MZkbW4VAriol5KlmQXpAQdxvV0p26sqNZOW6Qyw6Y0l9K4g+cHvvczR2sEEpqg==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz", + "integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==", "dev": true, "requires": { "type-detect": "4.0.8" } }, + "@sinonjs/fake-timers": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-6.0.0.tgz", + "integrity": "sha512-atR1J/jRXvQAb47gfzSK8zavXy7BcpnYq21ALon0U99etu99vsir0trzIO3wpeLtW+LLVY6X7EkfVTbjGSH8Ww==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } + }, "@sinonjs/formatio": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz", - "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-5.0.1.tgz", + "integrity": "sha512-KaiQ5pBf1MpS09MuA0kp6KBQt2JUOQycqVG1NZXvzeaXe5LGFqAKueIS0bw4w0P9r7KuBSVdUk5QjXsUdu2CxQ==", "dev": true, "requires": { "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" + "@sinonjs/samsam": "^5.0.2" } }, "@sinonjs/samsam": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz", - "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.0.2.tgz", + "integrity": "sha512-p3yrEVB5F/1wI+835n+X8llOGRgV8+jw5BHQ/cJoLBUXXZ5U8Tr5ApwPc4L4av/vjla48kVPoN0t6dykQm+Rvg==", "dev": true, "requires": { - "@sinonjs/commons": "^1.3.0", - "array-from": "^2.1.1", - "lodash": "^4.17.15" + "@sinonjs/commons": "^1.6.0", + "@sinonjs/formatio": "^5.0.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" } }, "@sinonjs/text-encoding": { @@ -67,6 +77,16 @@ "color-convert": "^1.9.0" } }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -76,19 +96,12 @@ "sprintf-js": "~1.0.2" } }, - "array-from": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", - "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", - "dev": true - }, "axios": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", - "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", "requires": { - "follow-redirects": "1.5.10", - "is-buffer": "^2.0.2" + "follow-redirects": "1.5.10" } }, "balanced-match": { @@ -98,14 +111,20 @@ "dev": true }, "base-x": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.7.tgz", - "integrity": "sha512-zAKJGuQPihXW22fkrfOclUUZXM2g92z5GzlSMHxhO6r6Qj+Nm0ccaGNBzDZojzwOMkpjAv4J0fOv1U4go+a4iw==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.8.tgz", + "integrity": "sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA==", "dev": true, "requires": { "safe-buffer": "^5.0.1" } }, + "binary-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", + "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "dev": true + }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", @@ -122,6 +141,15 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -144,15 +172,14 @@ } }, "bsv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/bsv/-/bsv-1.0.0.tgz", - "integrity": "sha512-K7IpV4G7BHBO5zK/rDslrEnl8qmgSx3iKgD5oZ78MOtX043IoqDyVQLa2/FvqczgbVXYAsPaYL8q3u5up8M7oA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/bsv/-/bsv-1.3.0.tgz", + "integrity": "sha512-/mguDGAgpvzF6mtBFN3kuAGmoCr3ciesJCWDqvcAflvtvGsJyR0lSR4xfage7QfHWrHn/Y4iyPCshbsH6gI0jQ==", "dev": true, "requires": { "aes-js": "^3.1.2", "bn.js": "=4.11.8", "bs58": "=4.0.1", - "buffer-compare": "=1.1.1", "clone-deep": "^4.0.1", "elliptic": "6.4.1", "hash.js": "^1.1.7", @@ -160,12 +187,6 @@ "unorm": "1.4.1" } }, - "buffer-compare": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.1.1.tgz", - "integrity": "sha1-W+e+hTr4kZjR9N3AkNHWakiu9ZY=", - "dev": true - }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -194,6 +215,22 @@ } } }, + "chokidar": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", + "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.2.0" + } + }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -316,27 +353,28 @@ "dev": true }, "es-abstract": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.0.tgz", - "integrity": "sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg==", + "version": "1.17.4", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz", + "integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==", "dev": true, "requires": { - "es-to-primitive": "^1.2.0", + "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.0", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", - "object-inspect": "^1.6.0", + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", "object-keys": "^1.1.1", - "string.prototype.trimleft": "^2.1.0", - "string.prototype.trimright": "^2.1.0" + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" } }, "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, "requires": { "is-callable": "^1.1.4", @@ -356,6 +394,15 @@ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -388,6 +435,13 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -414,6 +468,15 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -436,9 +499,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "dev": true }, "hash.js": { @@ -484,21 +547,37 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true }, "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", "dev": true }, "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, "is-fullwidth-code-point": { @@ -507,6 +586,21 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -517,21 +611,21 @@ } }, "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", "dev": true, "requires": { - "has": "^1.0.1" + "has": "^1.0.3" } }, "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", "dev": true, "requires": { - "has-symbols": "^1.0.0" + "has-symbols": "^1.0.1" } }, "isarray": { @@ -563,15 +657,15 @@ } }, "just-extend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz", - "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.0.tgz", + "integrity": "sha512-ApcjaOdVTJ7y4r08xI5wIqpvwS48Q0PBG4DJROcEkH1f8MdAiNFyFxz3xoL0LWAVwjrwPYZdVHHxhRHcx/uGLA==", "dev": true }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, "locate-path": { @@ -590,21 +684,21 @@ "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, "log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", "dev": true, "requires": { - "chalk": "^2.0.1" + "chalk": "^2.4.2" } }, - "lolex": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", - "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", - "dev": true - }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -642,13 +736,14 @@ } }, "mocha": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.2.tgz", - "integrity": "sha512-FgDS9Re79yU1xz5d+C4rv1G7QagNGHZ+iXF81hO8zY35YZZcLEsJVfFolfsqKFWunATEvNzMK0r/CwWd/szO9A==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.0.tgz", + "integrity": "sha512-MymHK8UkU0K15Q/zX7uflZgVoRWiTjy0fXE/QjKts6mowUvGxOdPhZ2qj3b0iZdUrNZlW9LAIMFHB4IW+2b3EQ==", "dev": true, "requires": { "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", + "chokidar": "3.3.0", "debug": "3.2.6", "diff": "3.5.0", "escape-string-regexp": "1.0.5", @@ -657,11 +752,11 @@ "growl": "1.10.5", "he": "1.2.0", "js-yaml": "3.13.1", - "log-symbols": "2.2.0", + "log-symbols": "3.0.0", "minimatch": "3.0.4", "mkdirp": "0.5.1", "ms": "2.1.1", - "node-environment-flags": "1.0.5", + "node-environment-flags": "1.0.6", "object.assign": "4.1.0", "strip-json-comments": "2.0.1", "supports-color": "6.0.0", @@ -695,32 +790,39 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "nise": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.2.tgz", - "integrity": "sha512-/6RhOUlicRCbE9s+94qCUsyE+pKlVJ5AhIv+jEE7ESKwnbXqulKZ1FYU+XAtHHWE9TinYvAxDUJAb912PwPoWA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/nise/-/nise-4.0.2.tgz", + "integrity": "sha512-ALDnm0pTTyeGdbg5FCpWGd58Nmp3qO8d8x+dU2Fw8lApeJTEBSjkBZZM4S8t6GpKh+czxkfM/TKxpRMroZzwOg==", "dev": true, "requires": { - "@sinonjs/formatio": "^3.2.1", + "@sinonjs/commons": "^1.7.0", + "@sinonjs/fake-timers": "^6.0.0", + "@sinonjs/formatio": "^5.0.1", "@sinonjs/text-encoding": "^0.7.1", "just-extend": "^4.0.2", - "lolex": "^4.1.0", "path-to-regexp": "^1.7.0" } }, "node-environment-flags": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", - "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", + "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", "dev": true, "requires": { "object.getownpropertydescriptors": "^2.0.3", "semver": "^5.7.0" } }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, "object-inspect": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", - "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", "dev": true }, "object-keys": { @@ -742,13 +844,13 @@ } }, "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" } }, "once": { @@ -761,9 +863,9 @@ } }, "p-limit": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", - "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", "dev": true, "requires": { "p-try": "^2.0.0" @@ -797,14 +899,29 @@ "dev": true }, "path-to-regexp": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", - "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", "dev": true, "requires": { "isarray": "0.0.1" } }, + "picomatch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz", + "integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==", + "dev": true + }, + "readdirp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", + "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", + "dev": true, + "requires": { + "picomatch": "^2.0.4" + } + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -845,27 +962,39 @@ } }, "sinon": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz", - "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.4.0", - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/samsam": "^3.3.3", - "diff": "^3.5.0", - "lolex": "^4.2.0", - "nise": "^1.5.2", - "supports-color": "^5.5.0" + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.0.tgz", + "integrity": "sha512-c4bREcvuK5VuEGyMW/Oim9I3Rq49Vzb0aMdxouFaA44QCFpilc5LJOugrX+mkrvikbqCimxuK+4cnHVNnLR41g==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0", + "@sinonjs/fake-timers": "^6.0.0", + "@sinonjs/formatio": "^5.0.0", + "@sinonjs/samsam": "^5.0.1", + "diff": "^4.0.2", + "nise": "^4.0.1", + "supports-color": "^7.1.0" }, "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" } } } @@ -893,9 +1022,9 @@ } }, "string.prototype.trimleft": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", - "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz", + "integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==", "dev": true, "requires": { "define-properties": "^1.1.3", @@ -903,9 +1032,9 @@ } }, "string.prototype.trimright": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", - "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz", + "integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==", "dev": true, "requires": { "define-properties": "^1.1.3", @@ -936,6 +1065,15 @@ "has-flag": "^3.0.0" } }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", diff --git a/package.json b/package.json index 1a22b49..22f959b 100644 --- a/package.json +++ b/package.json @@ -18,18 +18,18 @@ "license": "MIT", "unpkg": "dist/datapay.min.js", "dependencies": { - "axios": "^0.19.0" + "axios": "^0.19.2" }, "peerDependencies": { - "bsv": "^1.0.0" + "bsv": "^1.3.0" }, "files": [ "dist" ], "devDependencies": { - "bsv": "^1.0.0", - "mocha": "^6.2.2", - "sinon": "^7.5.0", + "bsv": "^1.3.0", + "mocha": "^7.1.0", + "sinon": "^9.0.0", "uglify-es": "^3.3.9" } }