Published
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
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.
Learn more