@@ -7,8 +7,10 @@ import Spark, { getRetrievalUrl } from './lib/spark.js'
7
7
import { getMinerPeerId as defaultGetMinerPeerId } from './lib/miner-info.js'
8
8
9
9
// The task to check, replace with your own values
10
- const cid = 'bafkreih25dih6ug3xtj73vswccw423b56ilrwmnos4cbwhrceudopdp5sq'
11
- const minerId = 'f0frisbii'
10
+ const task = {
11
+ cid : 'bafkreih25dih6ug3xtj73vswccw423b56ilrwmnos4cbwhrceudopdp5sq' ,
12
+ minerId : 'f0frisbii'
13
+ }
12
14
13
15
const getMinerPeerId = ( minerId ) =>
14
16
minerId === 'f0frisbii'
@@ -17,8 +19,8 @@ const getMinerPeerId = (minerId) =>
17
19
18
20
// Run the check
19
21
const spark = new Spark ( { getMinerPeerId } )
20
- const stats = { cid , minerId , indexerResult : null , statusCode : null , byteLength : 0 }
21
- await spark . executeRetrievalCheck ( { cid , minerId } , stats )
22
+ const stats = { ... task , indexerResult : null , statusCode : null , byteLength : 0 }
23
+ await spark . executeRetrievalCheck ( task , stats )
22
24
console . log ( 'Measurement: %o' , stats )
23
25
24
26
if ( stats . providerAddress && stats . statusCode !== 200 ) {
@@ -29,13 +31,13 @@ if (stats.providerAddress && stats.statusCode !== 200) {
29
31
console . log (
30
32
' lassie fetch -o /dev/null -vv --dag-scope block --protocols graphsync --providers %s %s' ,
31
33
JSON . stringify ( stats . providerAddress ) ,
32
- cid
34
+ task . cid
33
35
)
34
36
console . log ( '\nHow to install Lassie: https://github.com/filecoin-project/lassie?tab=readme-ov-file#installation' )
35
37
break
36
38
case 'http' :
37
39
try {
38
- const url = getRetrievalUrl ( stats . protocol , stats . providerAddress , cid )
40
+ const url = getRetrievalUrl ( stats . protocol , stats . providerAddress , task . cid )
39
41
console . log ( 'You can get more details by requesting the following URL yourself:\n' )
40
42
console . log ( ' %s' , url )
41
43
console . log ( '\nE.g. using `curl`:' )
@@ -44,7 +46,7 @@ if (stats.providerAddress && stats.statusCode !== 200) {
44
46
console . log (
45
47
' lassie fetch -o /dev/null -vv --dag-scope block --protocols http --providers %s %s' ,
46
48
JSON . stringify ( stats . providerAddress ) ,
47
- cid
49
+ task . cid
48
50
)
49
51
console . log ( '\nHow to install Lassie: https://github.com/filecoin-project/lassie?tab=readme-ov-file#installation' )
50
52
} catch ( err ) {
0 commit comments