This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 5 files changed +64
-74
lines changed
5 files changed +64
-74
lines changed Original file line number Diff line number Diff line change 79
79
"eslint-plugin-react" : " ^7.9.1" ,
80
80
"go-ipfs-dep" : " ~0.4.15" ,
81
81
"gulp" : " ^3.9.1" ,
82
- "interface-ipfs-core" : " ~0.67.0 " ,
82
+ "interface-ipfs-core" : " ~0.68.1 " ,
83
83
"ipfsd-ctl" : " ~0.37.3" ,
84
84
"pull-stream" : " ^3.6.8" ,
85
85
"socket.io" : " ^2.1.1" ,
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const promisify = require ( 'promisify-es6' )
4
+ const CID = require ( 'cids' )
4
5
5
6
module . exports = ( send ) => {
6
- return promisify ( ( args , opts , callback ) => {
7
+ return promisify ( ( cid , opts , callback ) => {
7
8
if ( typeof ( opts ) === 'function' ) {
8
9
callback = opts
9
10
opts = { }
10
11
}
12
+
13
+ try {
14
+ cid = new CID ( cid )
15
+ } catch ( err ) {
16
+ return callback ( err )
17
+ }
18
+
11
19
send ( {
12
20
path : 'bitswap/unwant' ,
13
- args : args ,
21
+ args : cid . toBaseEncodedString ( ) ,
14
22
qs : opts
15
23
} , callback )
16
24
} )
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const promisify = require ( 'promisify-es6' )
4
+ const CID = require ( 'cids' )
4
5
5
6
module . exports = ( send ) => {
6
- return promisify ( ( callback ) => {
7
+ return promisify ( ( peerId , opts , callback ) => {
8
+ if ( typeof ( peerId ) === 'function' ) {
9
+ callback = peerId
10
+ opts = { }
11
+ peerId = null
12
+ } else if ( typeof ( opts ) === 'function' ) {
13
+ callback = opts
14
+ opts = { }
15
+ }
16
+
17
+ if ( peerId ) {
18
+ try {
19
+ opts . peer = new CID ( peerId ) . toBaseEncodedString ( )
20
+ } catch ( err ) {
21
+ return callback ( err )
22
+ }
23
+ }
24
+
7
25
send ( {
8
- path : 'bitswap/wantlist'
26
+ path : 'bitswap/wantlist' ,
27
+ qs : opts
9
28
} , callback )
10
29
} )
11
30
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /* eslint-env mocha */
2
+
3
+ 'use strict'
4
+
5
+ const test = require ( 'interface-ipfs-core' )
6
+ const parallel = require ( 'async/parallel' )
7
+
8
+ const IPFSApi = require ( '../../src' )
9
+ const f = require ( '../utils/factory' )
10
+
11
+ const nodes = [ ]
12
+ const common = {
13
+ setup : function ( callback ) {
14
+ callback ( null , {
15
+ spawnNode : ( cb ) => {
16
+ f . spawn ( { initOptions : { bits : 1024 } } , ( err , _ipfsd ) => {
17
+ if ( err ) {
18
+ return cb ( err )
19
+ }
20
+
21
+ nodes . push ( _ipfsd )
22
+ cb ( null , IPFSApi ( _ipfsd . apiAddr ) )
23
+ } )
24
+ }
25
+ } )
26
+ } ,
27
+ teardown : function ( callback ) {
28
+ parallel ( nodes . map ( ( node ) => ( cb ) => node . stop ( cb ) ) , callback )
29
+ }
30
+ }
31
+
32
+ test . bitswap ( common )
You can’t perform that action at this time.
0 commit comments