From c969d2c909a7cbe4a2ff33e8e3332a30e3f416e6 Mon Sep 17 00:00:00 2001 From: Rahul Trivedi Date: Tue, 13 Sep 2022 12:39:42 +0530 Subject: [PATCH 1/2] fix: passed GetOptions to getJSONData --- src/ipfs.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ipfs.ts b/src/ipfs.ts index eded781..531bc39 100644 --- a/src/ipfs.ts +++ b/src/ipfs.ts @@ -15,6 +15,7 @@ * */ import type { Options, IPFS, CID } from 'ipfs-core'; +import { GetOptions } from 'ipfs-core-types/src/dag'; import { IPFSInterface } from './types'; const defaultIpfsConfig: Options = { @@ -130,11 +131,11 @@ function createIPFSInterface(bootstrapNodes: string[], ipfsConfig: Options = def return Buffer.concat(content).toString(); }; - const getJSONData = async (cid: string) => { + const getJSONData = async (cid: string, options?: GetOptions) => { if (!node || !CIDClass) { throw new Error(`Not initialised!`); } - const res = await node.dag.get(CIDClass.parse(cid)); + const res = await node.dag.get(CIDClass.parse(cid), options); if (!res.value) { throw new Error(`No data found!`); } From be9cbd6afedbe704aa5fc75f64d51736dfc7fd69 Mon Sep 17 00:00:00 2001 From: Christos Panagiotakopoulos Date: Tue, 20 Sep 2022 11:16:29 +0200 Subject: [PATCH 2/2] fix: correct import from types and added peer-dependency --- package.json | 3 +++ src/ipfs.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c0151d1..bb4271a 100644 --- a/package.json +++ b/package.json @@ -35,5 +35,8 @@ }, "dependencies": { "ipfs-core": "0.14.3" + }, + "peerDependencies": { + "ipfs-core-types": "^0.10.3" } } diff --git a/src/ipfs.ts b/src/ipfs.ts index 531bc39..1c15e86 100644 --- a/src/ipfs.ts +++ b/src/ipfs.ts @@ -15,7 +15,7 @@ * */ import type { Options, IPFS, CID } from 'ipfs-core'; -import { GetOptions } from 'ipfs-core-types/src/dag'; +import type { GetOptions } from 'ipfs-core-types/types/src/dag'; import { IPFSInterface } from './types'; const defaultIpfsConfig: Options = {