Merge pull request #144 from filecoin-project/feat/pond-methods
pond: Translate method names
This commit is contained in:
commit
639f07df92
@ -2,6 +2,7 @@ import React from 'react'
|
||||
import CID from 'cids'
|
||||
import * as multihash from "multihashes";
|
||||
import State from "./State";
|
||||
import methods from "./chain/methods";
|
||||
|
||||
function truncAddr(addr) {
|
||||
if (addr.length > 21) {
|
||||
@ -34,6 +35,7 @@ class Address extends React.Component {
|
||||
try {
|
||||
balance = await this.props.client.call('Filecoin.WalletBalance', [this.props.addr])
|
||||
actor = await this.props.client.call('Filecoin.ChainGetActor', [this.props.addr, this.props.ts || null])
|
||||
|
||||
actorInfo = await this.actorInfo(actor)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@ -50,11 +52,16 @@ class Address extends React.Component {
|
||||
const c = new CID(actor.Code['/'])
|
||||
const mh = multihash.decode(c.multihash) // TODO: check identity
|
||||
|
||||
let info = <span>({mh.digest.toString()})</span>
|
||||
let method = <span></span>
|
||||
if(this.props.method !== undefined && mh.digest.toString()) {
|
||||
method = <span>.{methods[mh.digest.toString()][this.props.method]}</span>
|
||||
}
|
||||
|
||||
let info = <span>({mh.digest.toString()}{method})</span>
|
||||
switch(mh.digest.toString()) {
|
||||
case 'paych':
|
||||
const actstate = await this.props.client.call('Filecoin.ChainReadState', [actor, this.props.ts || null])
|
||||
info = <span>({mh.digest.toString()} to <Address nobalance={true} client={this.props.client} addr={actstate.State.To} mountWindow={this.props.mountWindow}/>)</span>
|
||||
info = <span>({mh.digest.toString()}{method} to <Address nobalance={true} client={this.props.client} addr={actstate.State.To} mountWindow={this.props.mountWindow}/>)</span>
|
||||
}
|
||||
|
||||
return info
|
||||
@ -78,7 +85,12 @@ class Address extends React.Component {
|
||||
balance = <span></span>
|
||||
}
|
||||
|
||||
return <span>{addr}{balance} {actInfo}{add1k}</span>
|
||||
let transfer = <span></span>
|
||||
if(this.props.transfer) {
|
||||
transfer = <span> {this.props.transfer}FIL</span>
|
||||
}
|
||||
|
||||
return <span>{addr}{balance} {actInfo}{add1k}{transfer}</span>
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
background: #f9be77;
|
||||
user-select: text;
|
||||
font-family: monospace;
|
||||
min-width: 40em;
|
||||
min-width: 50em;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,8 @@ class Block extends React.Component {
|
||||
...(this.state.messages.SecpkMessages.map(m => ({...(m.Message), type: 'Secpk'})))
|
||||
].map(m => (
|
||||
<div>
|
||||
<Address client={this.props.conn} addr={m.From} mountWindow={this.props.mountWindow}/><b>=> </b>
|
||||
<Address client={this.props.conn} addr={m.To} mountWindow={this.props.mountWindow}/>
|
||||
{m.Value}FIL M{m.Method}
|
||||
<Address client={this.props.conn} addr={m.From} mountWindow={this.props.mountWindow}/><b> => </b>
|
||||
<Address client={this.props.conn} addr={m.To} mountWindow={this.props.mountWindow} transfer={m.Value} method={m.Method}/>
|
||||
</div>
|
||||
))
|
||||
|
||||
@ -52,7 +51,7 @@ class Block extends React.Component {
|
||||
)
|
||||
}
|
||||
|
||||
return (<Cristal onClose={this.props.onClose} title={`Block ${this.props.cid['/']}`}>
|
||||
return (<Cristal initialSize={{width: 700, height: 200}} onClose={this.props.onClose} title={`Block ${this.props.cid['/']}`}>
|
||||
{content}
|
||||
</Cristal>)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class Consensus extends React.Component {
|
||||
|
||||
async updateNodes() {
|
||||
const nodes = this.props.nodes
|
||||
let keys = Object.keys(nodes)
|
||||
let keys = Object.keys(nodes).filter(k => !nodes[k].Storage)
|
||||
|
||||
const tipsets = await keys.map(async k => {
|
||||
const tipset = await nodes[k].conn.call("Filecoin.ChainHead", [])
|
||||
|
@ -124,7 +124,7 @@ class FullNode extends React.Component {
|
||||
const vouchers = this.state.vouchers[ak].map(voucher => {
|
||||
let extra = <span></span>
|
||||
if(voucher.Extra) {
|
||||
extra = <span>Verif: <<b><Address nobalance={true} client={this.props.client} addr={voucher.Extra.Actor} mountWindow={this.props.mountWindow}/> M{voucher.Extra.Method}</b>></span>
|
||||
extra = <span>Verif: <<b><Address nobalance={true} client={this.props.client} addr={voucher.Extra.Actor} method={voucher.Extra.Method} mountWindow={this.props.mountWindow}/></b>></span>
|
||||
}
|
||||
|
||||
return <div key={voucher.Nonce} className="FullNode-voucher">
|
||||
@ -158,7 +158,8 @@ class FullNode extends React.Component {
|
||||
return (
|
||||
<Cristal
|
||||
title={"Node " + this.props.node.ID}
|
||||
initialPosition={{x: this.props.node.ID*30, y: this.props.node.ID * 30}} >
|
||||
initialPosition={{x: this.props.node.ID*30, y: this.props.node.ID * 30}}
|
||||
initialSize={{width: 690, height: 300}} >
|
||||
<div className="CristalScroll">
|
||||
<div className="FullNode">
|
||||
{runtime}
|
||||
|
64
lotuspond/front/src/chain/methods.js
Normal file
64
lotuspond/front/src/chain/methods.js
Normal file
@ -0,0 +1,64 @@
|
||||
export default {
|
||||
"account": [
|
||||
"Send",
|
||||
"Constructor",
|
||||
"GetAddress",
|
||||
],
|
||||
"smarket": [
|
||||
"Send",
|
||||
"Constructor",
|
||||
"CreateStorageMiner",
|
||||
"SlashConsensusFault",
|
||||
"UpdateStorage",
|
||||
"GetTotalStorage",
|
||||
"PowerLookup",
|
||||
"IsMiner",
|
||||
"StorageCollateralForSize"
|
||||
],
|
||||
"sminer": [
|
||||
"Send",
|
||||
"Constructor",
|
||||
"CommitSector",
|
||||
"SubmitPost",
|
||||
"SlashStorageFault",
|
||||
"GetCurrentProvingSet",
|
||||
"ArbitrateDeal",
|
||||
"DePledge",
|
||||
"GetOwner",
|
||||
"GetWorkerAddr",
|
||||
"GetPower",
|
||||
"GetPeerID",
|
||||
"GetSectorSize",
|
||||
"UpdatePeerID",
|
||||
"ChangeWorker",
|
||||
"IsSlashed",
|
||||
"IsLate",
|
||||
"PaymentVerifyInclusion",
|
||||
"PaymentVerifySector",
|
||||
],
|
||||
"multisig": [
|
||||
"Send",
|
||||
"Constructor",
|
||||
"Propose",
|
||||
"Approve",
|
||||
"Cancel",
|
||||
"ClearCompleted",
|
||||
"AddSigner",
|
||||
"RemoveSigner",
|
||||
"SwapSigner",
|
||||
"ChangeRequirement",
|
||||
],
|
||||
"init": [
|
||||
"Send",
|
||||
"Constructor",
|
||||
"Exec",
|
||||
"GetIdForAddress"
|
||||
],
|
||||
"paych": [
|
||||
"Send",
|
||||
"Constructor",
|
||||
"UpdateChannelState",
|
||||
"Close",
|
||||
"Collect",
|
||||
],
|
||||
}
|
Loading…
Reference in New Issue
Block a user