pond: translate method names
This commit is contained in:
parent
0ed51b3226
commit
fc6e0d1645
@ -2,6 +2,7 @@ import React from 'react'
|
|||||||
import CID from 'cids'
|
import CID from 'cids'
|
||||||
import * as multihash from "multihashes";
|
import * as multihash from "multihashes";
|
||||||
import State from "./State";
|
import State from "./State";
|
||||||
|
import methods from "./chain/methods";
|
||||||
|
|
||||||
function truncAddr(addr) {
|
function truncAddr(addr) {
|
||||||
if (addr.length > 21) {
|
if (addr.length > 21) {
|
||||||
@ -34,6 +35,7 @@ class Address extends React.Component {
|
|||||||
try {
|
try {
|
||||||
balance = await this.props.client.call('Filecoin.WalletBalance', [this.props.addr])
|
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])
|
actor = await this.props.client.call('Filecoin.ChainGetActor', [this.props.addr, this.props.ts || null])
|
||||||
|
|
||||||
actorInfo = await this.actorInfo(actor)
|
actorInfo = await this.actorInfo(actor)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
@ -50,11 +52,16 @@ class Address extends React.Component {
|
|||||||
const c = new CID(actor.Code['/'])
|
const c = new CID(actor.Code['/'])
|
||||||
const mh = multihash.decode(c.multihash) // TODO: check identity
|
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()) {
|
switch(mh.digest.toString()) {
|
||||||
case 'paych':
|
case 'paych':
|
||||||
const actstate = await this.props.client.call('Filecoin.ChainReadState', [actor, this.props.ts || null])
|
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
|
return info
|
||||||
@ -78,7 +85,12 @@ class Address extends React.Component {
|
|||||||
balance = <span></span>
|
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;
|
background: #f9be77;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
min-width: 40em;
|
min-width: 50em;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +31,8 @@ class Block extends React.Component {
|
|||||||
...(this.state.messages.SecpkMessages.map(m => ({...(m.Message), type: 'Secpk'})))
|
...(this.state.messages.SecpkMessages.map(m => ({...(m.Message), type: 'Secpk'})))
|
||||||
].map(m => (
|
].map(m => (
|
||||||
<div>
|
<div>
|
||||||
<Address client={this.props.conn} addr={m.From} mountWindow={this.props.mountWindow}/><b>=> </b>
|
<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}/>
|
<Address client={this.props.conn} addr={m.To} mountWindow={this.props.mountWindow} transfer={m.Value} method={m.Method}/>
|
||||||
{m.Value}FIL M{m.Method}
|
|
||||||
</div>
|
</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}
|
{content}
|
||||||
</Cristal>)
|
</Cristal>)
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ class FullNode extends React.Component {
|
|||||||
const vouchers = this.state.vouchers[ak].map(voucher => {
|
const vouchers = this.state.vouchers[ak].map(voucher => {
|
||||||
let extra = <span></span>
|
let extra = <span></span>
|
||||||
if(voucher.Extra) {
|
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">
|
return <div key={voucher.Nonce} className="FullNode-voucher">
|
||||||
@ -158,7 +158,8 @@ class FullNode extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Cristal
|
<Cristal
|
||||||
title={"Node " + this.props.node.ID}
|
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="CristalScroll">
|
||||||
<div className="FullNode">
|
<div className="FullNode">
|
||||||
{runtime}
|
{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