Skip to content

Commit

Permalink
Merge pull request #45 from cryptape/develop
Browse files Browse the repository at this point in the history
neuronWeb Ready for v0.1.0-pre-release
  • Loading branch information
GyonGyon authored Sep 27, 2018
2 parents 04209f0 + f09857e commit f6195af
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 26 deletions.
4 changes: 4 additions & 0 deletions packages/neuron-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Neuron Web is an extension of chrome similar to [MetaMask](https://metamask.io).

# Disclaimer

Neuron Web is just a debugger tool now, do not take it as an official wallet.

# Quick Start

## Enable nervos in dapp to interact with NeuronWeb
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-web/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"main.css": "static/css/main.87567d85.css",
"main.css.map": "static/css/main.87567d85.css.map",
"main.js": "static/js/main.3b7f5f86.js",
"main.js.map": "static/js/main.3b7f5f86.js.map"
"main.js": "static/js/main.c0847399.js",
"main.js.map": "static/js/main.c0847399.js.map"
}
2 changes: 1 addition & 1 deletion packages/neuron-web/build/service-worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/neuron-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neuron-web",
"version": "0.1.8",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^1.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const EncryptedMessage = ({
}) => (
<div>
<TextField
label={'Message To Sign'}
value={encryptedMessage}
placeholder="Encrypted Message"
fullWidth={true}
Expand Down
5 changes: 4 additions & 1 deletion packages/neuron-web/src/components/Transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Button, TextField } from '@material-ui/core'
import * as React from 'react'
import { TransactionAction } from '../../hoc/UniComp'

const fields = ['from', 'to', 'value', 'quota', 'nonce', 'validUntilBlock', 'version', 'chainId', 'data']

export const tx = {
chainId: '',
data: '',
Expand Down Expand Up @@ -30,7 +32,8 @@ const Transaction = ({
<div>
{status === TransactionAction.SENDING ? 'Sending' : ''}
<div>
{Object.keys(transaction).map((key: string) => {
{// Object.keys(transaction)
fields.map((key: string) => {
return (
<TextField fullWidth={true} onChange={handleTxEdit(key)} key={key} value={transaction[key]} label={key} />
)
Expand Down
4 changes: 3 additions & 1 deletion packages/neuron-web/src/containers/Accounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { INervosContext, withNervos } from '../../contexts/nervos'
import { handleInputOf } from '../../utils/compActions'
import './accounts.css'

const ErrorMessage = 'Private Key Error...'

enum EnterEventType {
privateKey = 'PRIVATE_KEY',
login = 'LOGIN',
Expand Down Expand Up @@ -89,7 +91,7 @@ class Accounts extends React.Component<INervosContext & any, IAccounts> {
<TextField
value={privateKey}
error={!!privateKeyError}
helperText={privateKeyError}
helperText={privateKeyError ? ErrorMessage : ''}
onChange={this.handleInput('privateKey')}
onKeyPress={this.handleKeyPress(EnterEventType.privateKey)}
fullWidth={true}
Expand Down
7 changes: 6 additions & 1 deletion packages/neuron-web/src/containers/Options/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ class Options extends React.Component<IUniComp & INervosContext, typeof initStat
this.setState({ saved: true })
return
}
public componentDidMount() {
this.setState({
chainIp: this.props.nervos.currentProvider ? this.props.nervos.currentProvider.host : '',
})
}
public render() {
const { chainIp, chainIpError, saved } = this.state
return (
<div className="options__container">
<TextField
label="chain"
label="Chain Address"
value={chainIp}
helperText={chainIpError}
error={!!chainIpError}
Expand Down
42 changes: 23 additions & 19 deletions packages/neuron-web/src/containers/Transactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import './transactions.css'

const rebirth = window.localStorage.getItem('rebirth') || 'https://microscope.cryptape.com:8888'

const SwitchWallet = () => (
const SwitchWallet = ({ address }: { address: string }) => (
<Link to="/accounts">
<Button classes={{ root: `button-1 primary transactions__list--button` }}>Switch Wallet</Button>
<Button classes={{ root: `button-1 primary transactions__list--button` }}>
{address ? `Switch Wallet` : `Import Wallet`}
</Button>
</Link>
)

Expand All @@ -37,7 +39,7 @@ class Transactions extends React.Component<INervosContext & IUniComp, ITransacti
this.setState({
address: wallet[0].address,
})
this.loadTxs()
// this.loadTxs()
}
}
public getSnapshotBeforeUpdate(prevProps: INervosContext) {
Expand Down Expand Up @@ -107,12 +109,12 @@ class Transactions extends React.Component<INervosContext & IUniComp, ITransacti
>
{copied ? 'Copied' : 'Copy Address'}
</Button>
<SwitchWallet />
<SwitchWallet address={address} />
</React.Fragment>
) : (
<React.Fragment>
<h1 className="title-1">No wallet yet, please import wallet first!</h1>
<SwitchWallet />
<SwitchWallet address={address} />
</React.Fragment>
)}
<div className="transactions__container--second">
Expand All @@ -131,20 +133,22 @@ class Transactions extends React.Component<INervosContext & IUniComp, ITransacti
<div className="transactions__list--hash">{this.props.currentTxHash}</div>
</div>
) : null}
{transactions.map(tx => (
<div className="transactions__list--item" key={tx.hash}>
<div className="transactions__list--time">{new Date(tx.timestamp).toLocaleString()}</div>
<div className="transactions__list--hash" title={tx.hash}>
<a
href={`${process.env.REACT_APP_MICROSCOPE}#/transaction/${tx.hash}`}
target="_blank"
rel="noreferrer noopener"
>
{tx.hash}
</a>
</div>
</div>
))}
{transactions.length
? transactions.map(tx => (
<div className="transactions__list--item" key={tx.hash}>
<div className="transactions__list--time">{new Date(tx.timestamp).toLocaleString()}</div>
<div className="transactions__list--hash" title={tx.hash}>
<a
href={`${process.env.REACT_APP_MICROSCOPE}#/transaction/${tx.hash}`}
target="_blank"
rel="noreferrer noopener"
>
{tx.hash}
</a>
</div>
</div>
))
: 'No Transactions'}
</div>
</div>
<div
Expand Down

0 comments on commit f6195af

Please sign in to comment.