From dcb411b4aa0d065beffde83b7222e024917ee2a9 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 4 Feb 2021 19:52:49 +0000 Subject: [PATCH] fix: ts types after multihashing-async release The new types in multihashing-async are unsurprisingly stricter than using no types at all. fixes #3527 --- packages/ipfs-core/src/components/block/put.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ipfs-core/src/components/block/put.js b/packages/ipfs-core/src/components/block/put.js index 9d3aab45c1..4c65a0da55 100644 --- a/packages/ipfs-core/src/components/block/put.js +++ b/packages/ipfs-core/src/components/block/put.js @@ -82,7 +82,7 @@ module.exports = ({ blockService, pin, gcLock, preload }) => { cidVersion = options.version } - const multihash = await multihashing(block, mhtype) + const multihash = await multihashing(bytes, mhtype) const cid = new CID(cidVersion, format, multihash) block = new Block(bytes, cid) @@ -120,7 +120,7 @@ module.exports = ({ blockService, pin, gcLock, preload }) => { * @typedef {Object} PutOptions * @property {CID} [cid] - A CID to store the block under (default: `undefined`) * @property {string} [format='dag-pb'] - The codec to use to create the CID (default: `'dag-pb'`) - * @property {string} [mhtype='sha2-256'] - The hashing algorithm to use to create the CID (default: `'sha2-256'`) + * @property {import('multihashes').HashName} [mhtype='sha2-256'] - The hashing algorithm to use to create the CID (default: `'sha2-256'`) * @property {number} [mhlen] * @property {CIDVersion} [version=0] - The version to use to create the CID (default: `0`) * @property {boolean} [pin=false] - If true, pin added blocks recursively (default: `false`)