pond: Basic message display in Block window
This commit is contained in:
parent
7f156c745f
commit
e430f86b69
@ -212,6 +212,7 @@ func (h handlers) handle(ctx context.Context, req request, w func(func(io.Writer
|
||||
if handler.errOut != -1 {
|
||||
err := callResult[handler.errOut].Interface()
|
||||
if err != nil {
|
||||
log.Warnf("error in RPC call: %s", err)
|
||||
resp.Error = &respError{
|
||||
Code: 1,
|
||||
Message: err.(error).Error(),
|
||||
@ -232,7 +233,7 @@ func (h handlers) handle(ctx context.Context, req request, w func(func(io.Writer
|
||||
}
|
||||
|
||||
if err := json.NewEncoder(w).Encode(resp); err != nil {
|
||||
fmt.Println(err)
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
@ -73,6 +73,7 @@ func (s *RPCServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func rpcError(wf func(func(io.Writer)), req *request, code int, err error) {
|
||||
log.Errorf("RPC Error: %s", err)
|
||||
wf(func(w io.Writer) {
|
||||
if hw, ok := w.(http.ResponseWriter); ok {
|
||||
hw.WriteHeader(500)
|
||||
|
@ -28,6 +28,14 @@
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.Block {
|
||||
background: #f9be77;
|
||||
user-select: text;
|
||||
font-family: monospace;
|
||||
min-width: 40em;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.CristalScroll {
|
||||
display: flex;
|
||||
min-width: 100%;
|
||||
|
@ -13,7 +13,9 @@ class Block extends React.Component {
|
||||
|
||||
async loadHeader() {
|
||||
const header = await this.props.conn.call('Filecoin.ChainGetBlock', [this.props.cid])
|
||||
this.setState({header: header})
|
||||
const messages = await this.props.conn.call('Filecoin.ChainGetBlockMessages', [this.props.cid])
|
||||
console.log(messages)
|
||||
this.setState({header: header, messages: messages})
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -21,17 +23,28 @@ class Block extends React.Component {
|
||||
if (this.state.header) {
|
||||
let head = this.state.header
|
||||
|
||||
content = (
|
||||
|
||||
|
||||
let messages = [
|
||||
...(this.state.messages.BlsMessages.map(m => ({...m, type: 'BLS'}))),
|
||||
...(this.state.messages.SecpkMessages.map(m => ({...(m.Message), type: 'Secpk'})))
|
||||
].map(m => (
|
||||
<div>
|
||||
{m.From}<b> => </b>{m.To} {m.Value}FIL M{m.Method}
|
||||
</div>
|
||||
))
|
||||
|
||||
content = (
|
||||
<div className="Block">
|
||||
<div>Height: {head.Height}</div>
|
||||
<div>Parents: <BlockLinks cids={head.Parents} conn={this.props.conn} mountWindow={this.props.mountWindow}/></div>
|
||||
<div>Weight: {head.ParentWeight}</div>
|
||||
<div>Miner: {head.Miner}</div>
|
||||
<div>Messages: {head.Messages['/']} {/*TODO: link to message explorer */}</div>
|
||||
<div>Receipts: {head.MessageReceipts['/']}</div>
|
||||
<div>State Root: {head.StateRoot['/']}</div>
|
||||
|
||||
|
||||
<div>State Root: {head.StateRoot['/']}</div>
|
||||
<div>----</div>
|
||||
<div>{messages}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class FullNode extends React.Component {
|
||||
chainInfo = (
|
||||
<div>
|
||||
Head: {
|
||||
<BlockLinks cids={this.state.tipset.Cids} conn={this.state.client} mountWindow={this.props.mountWindow} />
|
||||
<BlockLinks cids={this.state.tipset.Cids} conn={this.props.client} mountWindow={this.props.mountWindow} />
|
||||
} H:{this.state.tipset.Height}
|
||||
</div>
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user