@@ -6,16 +6,13 @@ const { withTimeoutOption } = require('../../utils')
6
6
7
7
/**
8
8
* @param {Object } config
9
- * @param {import('.. ').IPFSBitSwap } config.bitswap
9
+ * @param {import('.').NetworkService } config.network
10
10
*/
11
- module . exports = ( { bitswap } ) => {
11
+ module . exports = ( { network } ) => {
12
12
/**
13
13
* Show diagnostic information on the bitswap agent.
14
14
* Note: `bitswap.stat` and `stats.bitswap` can be used interchangeably.
15
15
*
16
- * @param {import('../../utils').AbortOptions } [_options]
17
- * @returns {Promise<BitswapStats> }
18
- *
19
16
* @example
20
17
* ```js
21
18
* const stats = await ipfs.bitswap.stat()
@@ -35,8 +32,11 @@ module.exports = ({ bitswap }) => {
35
32
* // dupDataReceived: 0
36
33
* // }
37
34
* ```
35
+ * @param {import('.').AbortOptions } [options]
36
+ * @returns {Promise<BitswapStats> }
38
37
*/
39
- async function stat ( _options ) { // eslint-disable-line require-await
38
+ async function stat ( options ) {
39
+ const { bitswap } = await network . use ( options )
40
40
const snapshot = bitswap . stat ( ) . snapshot
41
41
42
42
return {
@@ -59,13 +59,11 @@ module.exports = ({ bitswap }) => {
59
59
* @typedef {object } BitswapStats - An object that contains information about the bitswap agent
60
60
* @property {number } provideBufLen - an integer
61
61
* @property {CID[] } wantlist
62
- * @property {string [] } peers - array of peer IDs as Strings
62
+ * @property {CID [] } peers - array of peer IDs as Strings
63
63
* @property {Big } blocksReceived
64
64
* @property {Big } dataReceived
65
65
* @property {Big } blocksSent
66
66
* @property {Big } dataSent
67
67
* @property {Big } dupBlksReceived
68
68
* @property {Big } dupDataReceived
69
- *
70
- * @typedef {import('..').CID } CID
71
69
*/
0 commit comments