Platform
Resources
Pricing
Sign in
Get started
Nicola
Working to decentralize the web
Workspace
Fork
Published
By
Nicola
Edited
Sep 4, 2020
1 fork
2 stars
Insert cell
Insert cell
require
(
'https://bundle.run/@keyko-io/filecoin-verifier-tools'
)
Insert cell
zz
=
require
(
'https://bundle.run/@keyko-io/filecoin-verifier-tools/filecoin/methods'
)
Insert cell
require
(
'@keyko-io/filecoin-verifier-tools/filecoin/methods'
)
Insert cell
(
await
import
(
'@keyko-io/filecoin-verifier-tools/filecoin/methods'
)
)
Insert cell
schema
Insert cell
l
=
(
await
import
(
'@keyko-io/filecoin-verifier-tools'
)
)
Insert cell
active
=
(
await
client
.
StateMinerActiveSectors
(
hash
,
head
.
Cids
)
)
Insert cell
recoveries
=
(
await
client
.
StateMinerRecoveries
(
hash
,
head
.
Cids
)
)
.
reduce
(
(
acc
,
curr
)
=>
{
acc
[
curr
]
=
true
return
acc
}
,
{
}
)
Insert cell
faults
=
(
await
client
.
StateMinerFaults
(
hash
,
head
.
Cids
)
)
.
reduce
(
(
acc
,
curr
)
=>
{
acc
[
curr
]
=
true
return
acc
}
,
{
}
)
Insert cell
sectors
.
reduce
(
(
acc
,
curr
)
=>
{
acc
[
curr
.
ID
]
=
{
...
curr
,
state
:
(
recoveries
[
curr
.
ID
]
&&
'recovering'
)
||
(
faults
[
curr
.
ID
]
&&
'faulted'
)
||
''
}
return
acc
}
,
{
}
)
Insert cell
sectors
=
await
client
.
StateMinerSectors
(
hash
,
null
,
null
,
head
.
Cids
)
Insert cell
hash
=
`t01475`
Insert cell
allocatedSectors
=
sectors
.
map
(
d
=>
d
.
ID
)
Insert cell
sectorsEnriched
=
allocatedSectors
.
reduce
(
(
acc
,
curr
)
=>
{
acc
[
curr
]
=
{
number
:
curr
,
state
:
'committed'
}
return
acc
}
,
{
}
)
Insert cell
md
`---`
Insert cell
LotusRPC
=
(
await
import
(
'@filecoin-shipyard/lotus-client-rpc'
)
)
.
LotusRPC
Insert cell
BrowserProvider
=
(
await
import
(
'@filecoin-shipyard/lotus-client-provider-browser'
)
)
.
BrowserProvider
Insert cell
schema
=
(
await
import
(
'@filecoin-shipyard/lotus-client-schema'
)
)
.
testnet
.
fullNode
Insert cell
endpointUrl
=
"wss://lotus.jimpick.com/spacerace_api/0/node/rpc/v0"
Insert cell
client
=
{
const
provider
=
new
BrowserProvider
(
endpointUrl
)
return
new
LotusRPC
(
provider
,
{
schema
}
)
}
Insert cell
head
=
await
client
.
chainHead
(
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
zz
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
l
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
active
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
recoveries
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
faults
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sectors
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
hash
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
allocatedSectors
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sectorsEnriched
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
LotusRPC
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
BrowserProvider
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
schema
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
endpointUrl
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
client
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
head
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML