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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more