Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 6de6adf

Browse files
author
Alan Shaw
authored
refactor: switch to bignumber.js (#1803)
BREAKING CHANGE: All API methods that returned [`big.js`](https://github.com./MikeMcl/big.js/) instances now return [`bignumber.js`](https://github.com./MikeMcl/bignumber.js/) instances. License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 8ca6471 commit 6de6adf

File tree

4 files changed

+29
-21
lines changed

4 files changed

+29
-21
lines changed

package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
},
6363
"homepage": "https://github.com./ipfs/js-ipfs#readme",
6464
"devDependencies": {
65-
"aegir": "^17.0.1",
65+
"aegir": "^17.1.1",
6666
"chai": "^4.2.0",
6767
"delay": "^4.1.0",
6868
"detect-node": "^2.0.4",
@@ -71,7 +71,7 @@
7171
"execa": "^1.0.0",
7272
"form-data": "^2.3.3",
7373
"hat": "0.0.3",
74-
"interface-ipfs-core": "~0.92.0",
74+
"interface-ipfs-core": "~0.96.0",
7575
"ipfsd-ctl": "~0.40.1",
7676
"ncp": "^2.0.0",
7777
"qs": "^6.5.2",
@@ -82,7 +82,7 @@
8282
"dependencies": {
8383
"@nodeutils/defaults-deep": "^1.1.0",
8484
"async": "^2.6.1",
85-
"big.js": "^5.2.2",
85+
"bignumber.js": "^8.0.2",
8686
"binary-querystring": "~0.1.2",
8787
"bl": "^2.1.2",
8888
"boom": "^7.2.0",
@@ -105,14 +105,14 @@
105105
"hoek": "^6.1.2",
106106
"human-to-milliseconds": "^1.0.0",
107107
"interface-datastore": "~0.6.0",
108-
"ipfs-bitswap": "~0.21.0",
108+
"ipfs-bitswap": "~0.22.0",
109109
"ipfs-block": "~0.8.0",
110110
"ipfs-block-service": "~0.15.1",
111-
"ipfs-http-client": "^28.1.0",
111+
"ipfs-http-client": "^29.0.0",
112112
"ipfs-http-response": "~0.2.1",
113113
"ipfs-mfs": "~0.8.0",
114114
"ipfs-multipart": "~0.1.0",
115-
"ipfs-repo": "~0.26.0",
115+
"ipfs-repo": "~0.26.1",
116116
"ipfs-unixfs": "~0.1.16",
117117
"ipfs-unixfs-engine": "~0.35.3",
118118
"ipld": "~0.20.1",
@@ -121,22 +121,22 @@
121121
"ipld-ethereum": "^2.0.1",
122122
"ipld-git": "~0.2.2",
123123
"ipld-zcash": "~0.1.6",
124-
"ipns": "~0.4.3",
124+
"ipns": "~0.5.0",
125125
"is-ipfs": "~0.4.8",
126126
"is-pull-stream": "~0.0.0",
127127
"is-stream": "^1.1.0",
128128
"joi": "^14.3.0",
129129
"joi-browser": "^13.4.0",
130-
"joi-multiaddr": "^3.0.0",
130+
"joi-multiaddr": "^4.0.0",
131131
"libp2p": "~0.24.1",
132132
"libp2p-bootstrap": "~0.9.3",
133-
"libp2p-crypto": "~0.14.1",
134-
"libp2p-kad-dht": "~0.12.1",
133+
"libp2p-crypto": "~0.16.0",
134+
"libp2p-kad-dht": "~0.14.4",
135135
"libp2p-keychain": "~0.3.3",
136136
"libp2p-mdns": "~0.12.0",
137137
"libp2p-mplex": "~0.8.4",
138138
"libp2p-record": "~0.6.1",
139-
"libp2p-secio": "~0.10.1",
139+
"libp2p-secio": "~0.11.0",
140140
"libp2p-tcp": "~0.13.0",
141141
"libp2p-webrtc-star": "~0.15.5",
142142
"libp2p-websocket-star": "~0.10.0",
@@ -169,11 +169,11 @@
169169
"pull-stream-to-stream": "^1.3.4",
170170
"pump": "^3.0.0",
171171
"read-pkg-up": "^4.0.0",
172-
"readable-stream": "3.0.6",
172+
"readable-stream": "^3.1.1",
173173
"receptacle": "^1.3.2",
174174
"stream-to-pull-stream": "^1.7.2",
175175
"tar-stream": "^1.6.2",
176-
"temp": "~0.8.3",
176+
"temp": "~0.9.0",
177177
"update-notifier": "^2.5.0",
178178
"varint": "^5.0.0",
179179
"yargs": "^12.0.5",

src/core/components/bitswap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const OFFLINE_ERROR = require('../utils').OFFLINE_ERROR
44
const promisify = require('promisify-es6')
55
const setImmediate = require('async/setImmediate')
6-
const Big = require('big.js')
6+
const Big = require('bignumber.js')
77
const CID = require('cids')
88
const PeerId = require('peer-id')
99
const errCode = require('err-code')

src/core/components/libp2p.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,23 @@ module.exports = function libp2p (self) {
8787
peerBook: self._peerInfoBook
8888
})
8989

90+
let discoveredPeers = []
91+
92+
const putAndDial = peerInfo => {
93+
self._peerInfoBook.put(peerInfo)
94+
self._libp2pNode.dial(peerInfo, () => {})
95+
}
96+
97+
self._libp2pNode.on('start', () => {
98+
discoveredPeers.forEach(putAndDial)
99+
discoveredPeers = []
100+
})
101+
90102
self._libp2pNode.on('peer:discovery', (peerInfo) => {
91-
const dial = () => {
92-
self._peerInfoBook.put(peerInfo)
93-
self._libp2pNode.dial(peerInfo, () => {})
94-
}
95103
if (self.isOnline()) {
96-
dial()
104+
putAndDial(peerInfo)
97105
} else {
98-
self._libp2pNode.once('start', dial)
106+
discoveredPeers.push(peerInfo)
99107
}
100108
})
101109

src/core/components/stats.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
const promisify = require('promisify-es6')
4-
const Big = require('big.js')
4+
const Big = require('bignumber.js')
55
const Pushable = require('pull-pushable')
66
const human = require('human-to-milliseconds')
77
const toStream = require('pull-stream-to-stream')

0 commit comments

Comments
 (0)