From d390ffc1766dc91c8de28f2cf254fa513212c5d9 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 14 Dec 2018 16:29:22 +0000 Subject: [PATCH 1/5] fix: change from big to bignumber --- js/src/stats/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/stats/utils.js b/js/src/stats/utils.js index 7d02ce0e5..fd7a1d62a 100644 --- a/js/src/stats/utils.js +++ b/js/src/stats/utils.js @@ -3,7 +3,7 @@ const { expect } = require('../utils/mocha') const isBigInt = (n) => { - return n.constructor.name === 'Big' + return n.constructor.name === 'BigNumber' } exports.expectIsBitswap = (err, stats) => { From efef92721927cf686db0d3850b7159696d17b5e2 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 20 Dec 2018 11:26:43 +0000 Subject: [PATCH 2/5] chore: fix deps --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c756f4196..34be7743d 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "into-stream": "^4.0.0", "ipfs-block": "~0.8.0", "ipfs-unixfs": "~0.1.16", - "ipld-dag-cbor": "~0.13.0", + "ipld-dag-cbor": "ipld/js-ipld-dag-cbor#feat/reduce-bundle-size", "ipld-dag-pb": "~0.15.0", "is-ipfs": "~0.4.2", "is-plain-object": "^2.0.4", From 116d94976cd54712c22d7c7063af9e85f048c491 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 20 Dec 2018 11:45:17 +0000 Subject: [PATCH 3/5] chore: fix deps --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 34be7743d..c78aa2543 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "into-stream": "^4.0.0", "ipfs-block": "~0.8.0", "ipfs-unixfs": "~0.1.16", - "ipld-dag-cbor": "ipld/js-ipld-dag-cbor#feat/reduce-bundle-size", + "ipld-dag-cbor": "hugomrdias/js-ipld-dag-cbor#feat/reduce-bundle-size", "ipld-dag-pb": "~0.15.0", "is-ipfs": "~0.4.2", "is-plain-object": "^2.0.4", From 9d4cb5fb1fbc60c3c0bfeea9cdcf907456a7ca37 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 20 Dec 2018 11:48:45 +0000 Subject: [PATCH 4/5] chore: swap big for bignumber --- SPEC/BITSWAP.md | 14 +++++++------- SPEC/REPO.md | 8 ++++---- SPEC/STATS.md | 34 +++++++++++++++++----------------- package.json | 1 - 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/SPEC/BITSWAP.md b/SPEC/BITSWAP.md index 5f42db305..e6d218ac7 100644 --- a/SPEC/BITSWAP.md +++ b/SPEC/BITSWAP.md @@ -45,12 +45,12 @@ Note: `bitswap.stat` and `stats.bitswap` can be used interchangeably. - `provideBufLen` is an integer. - `wantlist` (array of CIDs) - `peers` (array of peer IDs) -- `blocksReceived` is a [Big Int][1] -- `dataReceived` is a [Big Int][1] -- `blocksSent` is a [Big Int][1] -- `dataSent` is a [Big Int][1] -- `dupBlksReceived` is a [Big Int][1] -- `dupDataReceived` is a [Big Int][1] +- `blocksReceived` is a [BigNumber Int][1] +- `dataReceived` is a [BigNumber Int][1] +- `blocksSent` is a [BigNumber Int][1] +- `dataSent` is a [BigNumber Int][1] +- `dupBlksReceived` is a [BigNumber Int][1] +- `dupDataReceived` is a [BigNumber Int][1] If no `callback` is passed, a promise is returned. @@ -73,4 +73,4 @@ ipfs.bitswap.stat((err, stats) => console.log(stats)) // dupDataReceived: 0 } ``` -[1]: https://github.com/MikeMcl/big.js/ +[1]: https://github.com/MikeMcl/bignumber.js/ diff --git a/SPEC/REPO.md b/SPEC/REPO.md index 4ce638ba8..55374d3d0 100644 --- a/SPEC/REPO.md +++ b/SPEC/REPO.md @@ -45,11 +45,11 @@ Where: `callback` must follow `function (err, stats) {}` signature, where `err` is an Error if the operation was not successful and `stats` is an object containing the following keys: -- `numObjects` is a [Big Int][1]. -- `repoSize` is a [Big Int][1], in bytes. +- `numObjects` is a [BigNumber Int][1]. +- `repoSize` is a [BigNumber Int][1], in bytes. - `repoPath` is a string. - `version` is a string. -- `storageMax` is a [Big Int][1]. +- `storageMax` is a [BigNumber Int][1]. If no `callback` is passed, a promise is returned. @@ -85,4 +85,4 @@ ipfs.repo.version((err, version) => console.log(version)) // "6" ``` -[1]: https://github.com/MikeMcl/big.js/ +[1]: https://github.com/MikeMcl/bignumber.js/ diff --git a/SPEC/STATS.md b/SPEC/STATS.md index 295a4aa95..82198c657 100644 --- a/SPEC/STATS.md +++ b/SPEC/STATS.md @@ -38,10 +38,10 @@ Where: `stat` is, in both cases, an Object containing the following keys: -- `totalIn` - is a [Big Int][big], in bytes. -- `totalOut` - is a [Big Int][big], in bytes. -- `rateIn` - is a [Big Int][big], in bytes. -- `rateOut` - is a [Big Int][big], in bytes. +- `totalIn` - is a [BigNumber Int][bigNumber], in bytes. +- `totalOut` - is a [BigNumber Int][bigNumber], in bytes. +- `rateIn` - is a [BigNumber Int][bigNumber], in bytes. +- `rateOut` - is a [BigNumber Int][bigNumber], in bytes. If no `callback` is passed, a promise is returned. @@ -50,10 +50,10 @@ If no `callback` is passed, a promise is returned. ```JavaScript ipfs.stats.bw((err, stats) => console.log(stats)) -// { totalIn: Big {...}, -// totalOut: Big {...}, -// rateIn: Big {...}, -// rateOut: Big {...} } +// { totalIn: BigNumber {...}, +// totalOut: BigNumber {...}, +// rateIn: BigNumber {...}, +// rateOut: BigNumber {...} } ``` #### `stats.bwPullStream` @@ -79,10 +79,10 @@ pull( log() ) -// { totalIn: Big {...}, -// totalOut: Big {...}, -// rateIn: Big {...}, -// rateOut: Big {...} } +// { totalIn: BigNumber {...}, +// totalOut: BigNumber {...}, +// rateIn: BigNumber {...}, +// rateOut: BigNumber {...} } // ... // Ad infinitum ``` @@ -106,14 +106,14 @@ stream.on('data', (data) => { console.log(data) })) -// { totalIn: Big {...}, -// totalOut: Big {...}, -// rateIn: Big {...}, -// rateOut: Big {...} } +// { totalIn: BigNumber {...}, +// totalOut: BigNumber {...}, +// rateIn: BigNumber {...}, +// rateOut: BigNumber {...} } // ... // Ad infinitum ``` -[big]: https://github.com/MikeMcl/big.js/ +[bigNumber]: https://github.com/MikeMcl/bignumber.js/ [rs]: https://www.npmjs.com/package/readable-stream [ps]: https://www.npmjs.com/package/pull-stream diff --git a/package.json b/package.json index c78aa2543..92612a682 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "homepage": "https://github.com/ipfs/interface-ipfs-core#readme", "dependencies": { "async": "^2.6.1", - "big.js": "^5.2.2", "bl": "^2.1.2", "bs58": "^4.0.1", "chai": "^4.2.0", From 74d377ae52915aa4b62c5e013dc280c1dadeadaa Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Tue, 15 Jan 2019 08:57:15 +0000 Subject: [PATCH 5/5] chore: update ipld-dag-cbor dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 92612a682..eddab09e5 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "into-stream": "^4.0.0", "ipfs-block": "~0.8.0", "ipfs-unixfs": "~0.1.16", - "ipld-dag-cbor": "hugomrdias/js-ipld-dag-cbor#feat/reduce-bundle-size", + "ipld-dag-cbor": "~0.13.1", "ipld-dag-pb": "~0.15.0", "is-ipfs": "~0.4.2", "is-plain-object": "^2.0.4",