mirror of https://github.com/embarklabs/embark.git
enable searching contracts
This commit is contained in:
parent
aa742e4a6e
commit
47beac499f
|
@ -13,7 +13,7 @@ const Account = ({account}) => (
|
|||
<CardTitleIdenticon id={account.address}>Account {account.address}</CardTitleIdenticon>
|
||||
</CardHeader>
|
||||
<CardBody>
|
||||
<dl class="row">
|
||||
<dl className="row">
|
||||
<Description label="Balance" value={account.balance} />
|
||||
<Description label="Transaction count" value={account.transactionCount} />
|
||||
</dl>
|
||||
|
|
|
@ -10,7 +10,7 @@ const Blocks = ({blocks}) => (
|
|||
<Col>
|
||||
<h1>Blocks</h1>
|
||||
{blocks.map(block => (
|
||||
<Card>
|
||||
<Card key={block.number}>
|
||||
<CardHeader>
|
||||
<Link to={`/embark/explorer/blocks/${block.number}`}> <CardTitleIdenticon id={block.hash}>Block {block.number}</CardTitleIdenticon></Link>
|
||||
</CardHeader>
|
||||
|
|
|
@ -10,7 +10,6 @@ import {LIGHT_THEME, DARK_THEME} from '../constants';
|
|||
import FontAwesome from 'react-fontawesome';
|
||||
|
||||
import {
|
||||
AppAside,
|
||||
AppFooter,
|
||||
AppHeader,
|
||||
AppSidebar,
|
||||
|
@ -79,6 +78,10 @@ class Layout extends React.Component {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (nextProps.searchResult.className) {
|
||||
this.props.history.push(`/embark/contracts/${nextProps.searchResult.className}/overview`);
|
||||
return false;
|
||||
}
|
||||
if (nextProps.searchResult.address) {
|
||||
this.props.history.push(`/embark/explorer/accounts/${nextProps.searchResult.address}`);
|
||||
return false;
|
||||
|
|
|
@ -14,7 +14,7 @@ const Transaction = ({transaction}) => (
|
|||
<CardTitleIdenticon id={transaction.hash}>Transaction {transaction.hash}</CardTitleIdenticon>
|
||||
</CardHeader>
|
||||
<CardBody>
|
||||
<dl class="row">
|
||||
<dl className="row">
|
||||
<Description label="Block" value={<Link to={`/embark/explorer/blocks/${transaction.blockNumber}`}>{transaction.blockNumber}</Link>} />
|
||||
<Description label="From" value={transaction.from} />
|
||||
<Description label="To" value={transaction.to} />
|
||||
|
|
|
@ -10,7 +10,7 @@ const Transactions = ({transactions}) => (
|
|||
<Col>
|
||||
<h1>Transactions</h1>
|
||||
{transactions.map(transaction => (
|
||||
<Card>
|
||||
<Card key={transaction.hash}>
|
||||
<CardHeader>
|
||||
<Link to={`/embark/explorer/transactions/${transaction.hash}`}>
|
||||
<CardTitleIdenticon id={transaction.hash}>Transaction {transaction.hash}</CardTitleIdenticon>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
border-bottom-right-radius: 0;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
width: 330px;
|
||||
width: 245px;
|
||||
border: 1px solid #c8ced3;
|
||||
border-right: 0;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class GasStationContainer extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
return <DataWrapper shouldRender={this.props.gasOracleStats && Object.keys(this.props.gasOracleStats).length && this.props.lastBlock}
|
||||
return <DataWrapper shouldRender={Boolean(this.props.gasOracleStats && Object.keys(this.props.gasOracleStats).length && this.props.lastBlock)}
|
||||
{...this.props} render={({lastBlock, gasOracleStats}) => (
|
||||
<GasStation gasOracleStats={gasOracleStats} lastBlock={lastBlock}/>
|
||||
)}/>;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {put, select} from "redux-saga/effects";
|
||||
import {getAccounts, getBlocks, getTransactions} from "../reducers/selectors";
|
||||
import {fetchAccounts, fetchBlocks, fetchTransactions} from "./index";
|
||||
import {getAccounts, getBlocks, getTransactions, getContracts} from "../reducers/selectors";
|
||||
import {fetchAccounts, fetchBlocks, fetchTransactions, fetchContracts} from "./index";
|
||||
|
||||
export function *searchExplorer(entity, payload) {
|
||||
let result;
|
||||
|
@ -17,6 +17,17 @@ export function *searchExplorer(entity, payload) {
|
|||
return yield put(entity.success(result));
|
||||
}
|
||||
|
||||
// Contracts
|
||||
yield fetchContracts({});
|
||||
const contracts = yield select(getContracts);
|
||||
result = contracts.find(contract => {
|
||||
return contract.address === payload.searchValue;
|
||||
});
|
||||
|
||||
if (result) {
|
||||
return yield put(entity.success(result));
|
||||
}
|
||||
|
||||
// Blocks
|
||||
yield fetchBlocks({limit: SEARCH_LIMIT});
|
||||
const blocks = yield select(getBlocks);
|
||||
|
|
Loading…
Reference in New Issue