import React from 'react'; import {Cristal} from "react-cristal"; import {BlockLinks} from "./BlockLink"; import Address from "./Address"; class Block extends React.Component { constructor(props) { super(props) this.state = {} this.loadHeader() } async loadHeader() { const header = await this.props.conn.call('Filecoin.ChainGetBlock', [this.props.cid]) const messages = await this.props.conn.call('Filecoin.ChainGetBlockMessages', [this.props.cid]) console.log(messages) this.setState({header: header, messages: messages}) } render() { let content =
Loading Block Info
if (this.state.header) { let head = this.state.header let messages = [ ...(this.state.messages.BlsMessages.map(m => ({...m, type: 'BLS'}))), ...(this.state.messages.SecpkMessages.map(m => ({...(m.Message), type: 'Secpk'}))) ].map(m => (
 => 
)) content = (
Height: {head.Height}
Parents:
Weight: {head.ParentWeight}
Miner: {
}
Messages: {head.Messages['/']} {/*TODO: link to message explorer */}
Receipts: {head.MessageReceipts['/']}
State Root: {head.StateRoot['/']}
----
{messages}
) } return ( {content} ) } } export default Block