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/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) => { diff --git a/package.json b/package.json index c756f4196..eddab09e5 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", @@ -49,7 +48,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": "~0.13.1", "ipld-dag-pb": "~0.15.0", "is-ipfs": "~0.4.2", "is-plain-object": "^2.0.4",