This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +64
-74
lines changed Expand file tree Collapse file tree 5 files changed +64
-74
lines changed Original file line number Diff line number Diff line change 7979 "eslint-plugin-react" : " ^7.9.1" ,
8080 "go-ipfs-dep" : " ~0.4.15" ,
8181 "gulp" : " ^3.9.1" ,
82- "interface-ipfs-core" : " ~0.67.0 " ,
82+ "interface-ipfs-core" : " ~0.68.1 " ,
8383 "ipfsd-ctl" : " ~0.37.3" ,
8484 "pull-stream" : " ^3.6.8" ,
8585 "socket.io" : " ^2.1.1" ,
Original file line number Diff line number Diff line change 11'use strict'
22
33const promisify = require ( 'promisify-es6' )
4+ const CID = require ( 'cids' )
45
56module . exports = ( send ) => {
6- return promisify ( ( args , opts , callback ) => {
7+ return promisify ( ( cid , opts , callback ) => {
78 if ( typeof ( opts ) === 'function' ) {
89 callback = opts
910 opts = { }
1011 }
12+
13+ try {
14+ cid = new CID ( cid )
15+ } catch ( err ) {
16+ return callback ( err )
17+ }
18+
1119 send ( {
1220 path : 'bitswap/unwant' ,
13- args : args ,
21+ args : cid . toBaseEncodedString ( ) ,
1422 qs : opts
1523 } , callback )
1624 } )
Original file line number Diff line number Diff line change 11'use strict'
22
33const promisify = require ( 'promisify-es6' )
4+ const CID = require ( 'cids' )
45
56module . 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+
725 send ( {
8- path : 'bitswap/wantlist'
26+ path : 'bitswap/wantlist' ,
27+ qs : opts
928 } , callback )
1029 } )
1130}
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