From d86f0bbffe518b68bb199687526c1b24758d3990 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Tue, 4 Aug 2020 16:22:11 +0100 Subject: [PATCH] fix: update to latest cids and uint8array compatible deps BREAKING CHANGES: - `util.cid` returns `CID`s with a breaking API change - see https://github.com/multiformats/js-cid/pull/117 for changes --- package.json | 13 +++++-------- src/util.js | 4 ++-- test/mod.spec.js | 5 +---- test/resolver.spec.js | 5 +---- test/util.spec.js | 7 +------ 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index fb96f2f..f8f5e1e 100644 --- a/package.json +++ b/package.json @@ -34,17 +34,14 @@ "homepage": "https://github.com/ipld/js-ipld-zcash#readme", "dependencies": { "buffer": "^5.6.0", - "cids": "^0.8.3", - "multicodec": "^1.0.0", - "multihashes": "^1.0.1", - "multihashing-async": "^1.0.0", + "cids": "^1.0.0", + "multicodec": "^2.0.0", + "multihashes": "^3.0.1", + "multihashing-async": "^2.0.0", "zcash-block": "^2.0.0" }, "devDependencies": { - "aegir": "^25.0.0", - "chai": "^4.2.0", - "chai-as-promised": "^7.1.1", - "dirty-chai": "^2.0.1" + "aegir": "^25.0.0" }, "contributors": [ "David Dias ", diff --git a/src/util.js b/src/util.js index b5450b9..6854422 100644 --- a/src/util.js +++ b/src/util.js @@ -23,7 +23,7 @@ const serialize = (dagNode) => { /** * Deserialize Zcash block into the internal representation. * - * @param {Buffer} binaryBlob - Binary representation of a Zcash block + * @param {Uint8Array} binaryBlob - Binary representation of a Zcash block * @returns {ZcashBlock} */ const deserialize = (binaryBlob) => { @@ -31,7 +31,7 @@ const deserialize = (binaryBlob) => { if (!Buffer.isBuffer(binaryBlob)) { // zcash only takes Buffers, not Uint8Arrays - binaryBlob = Buffer.from(binaryBlob) + binaryBlob = Buffer.from(binaryBlob, binaryBlob.byteOffset, binaryBlob.byteLength) } if (binaryBlob.length < ZCASH_BLOCK_HEADER_SIZE) { diff --git a/test/mod.spec.js b/test/mod.spec.js index 34c3790..a548715 100644 --- a/test/mod.spec.js +++ b/test/mod.spec.js @@ -1,10 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const multicodec = require('multicodec') const mod = require('../src') diff --git a/test/resolver.spec.js b/test/resolver.spec.js index acf1750..adddf11 100644 --- a/test/resolver.spec.js +++ b/test/resolver.spec.js @@ -1,10 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const CID = require('cids') const IpldZcash = require('../src/index') const helpers = require('./helpers') diff --git a/test/util.spec.js b/test/util.spec.js index 4d161a0..456ac25 100644 --- a/test/util.spec.js +++ b/test/util.spec.js @@ -1,12 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const chaiAsPromised = require('chai-as-promised') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(chaiAsPromised) -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const CID = require('cids') const multicodec = require('multicodec') const { Buffer } = require('buffer')