import React from 'react'; import {BlockLinks} from "./BlockLink"; import Address from "./Address"; import Window from "./Window"; 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]) let messages = await this.props.conn.call('Filecoin.ChainGetParentMessages', [this.props.cid]) let receipts = await this.props.conn.call('Filecoin.ChainGetParentReceipts', [this.props.cid]) if (!messages) { messages = [] } messages = messages.map((msg, k) => ({...msg.Message, cid: msg.Cid, receipt: receipts[k]})) messages = await Promise.all(messages.map(async (msg, i) => { if (msg.receipt.ExitCode !== 0) { let reply = await this.props.conn.call('Filecoin.StateReplay', [{Cids: [this.props.cid], Blocks: [header], Height: header.Height}, msg.Cid]) if(!reply.Error) { reply.Error = "reply: no error" } msg.Error = reply.Error } return msg })) this.setState({header: header, messages: messages}) } render() { let content =