Last active
August 30, 2017 19:59
-
-
Save andytudhope/e1601f6dbfb6d9d6f0791fc2c8f26004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {Bond} from 'oo7'; | |
import {Rspan} from 'oo7-react'; | |
import {InputBond, HashBond, BButton, TransactionProgressLabel, TransactButton} from 'parity-reactive-ui'; | |
import {bonds, formatBlockNumber, formatBalance, isNullData} from 'oo7-parity'; | |
export class App extends React.Component { | |
constructor() { | |
super(); | |
this.bond = new Bond(); | |
this.name = new Bond; | |
this.recipient = bonds.registry.lookupAddress(this.name, 'A'); | |
} | |
render() { | |
return (<div> | |
Default account: | |
<Rspan>{bonds.me}</Rspan> | |
<br/><br/> | |
My balance: <Rspan> | |
{bonds.balance(bonds.me).map(formatBalance)} | |
</Rspan> | |
<br/><br/> | |
Current block is: | |
<Rspan style={{fontWeight: 'bold'}}> | |
{bonds.height.map(formatBlockNumber)} | |
</Rspan> | |
<div> | |
Current block author's balance is: | |
<Rspan style={{fontWeight: 'bold'}}> | |
{bonds.balance(bonds.head.author).map(formatBalance)} | |
</Rspan> | |
</div> | |
Address of <InputBond bond={this.bond} placeholder='Lookup a name' /> is:<br/> | |
<Rspan>{bonds.registry.lookupAddress(this.bond, 'A')}</Rspan> | |
, it's balance is <Rspan> | |
{bonds.balance(bonds.registry.lookupAddress(this.bond, 'A')).map(formatBalance)} | |
</Rspan> | |
<br/><br/> | |
<div> | |
<InputBond bond={this.name} placeholder='Name of recipient' /> | |
{/*<TransactButton | |
content={this.name.map(n => `Give ${n} 1 Finney`)} | |
disabled={this.recipient.map(isNullData)} | |
tx={{ | |
to: this.recipient, | |
value: 1 * 1e15 | |
}} | |
/>*/} | |
</div> | |
</div>); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment