mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-21 15:28:32 +00:00
* Add a little arrow icon. * Replaced toEther function with toUnit to reduce the number of conversion functions wed need. Add tests for conversion functions. * First pass at a styled confirm transaction modal. * More data about data * Hook up generated transaction with modal * Fix modal position * Add from address. Restyle a bit. * Only show textareas and button if transaction has been generated. * Remove need for param. * Copy. * Use non-relative path. * Initial crack at transaction token support. * Fix flow type * Unit tests for contracts and erc20 * Convert contract class to ethereumjs-abi, caught a bug * Add decodeArgs for contracts, decodeTransfer for erc20 * Show token value in modal * Show value from transaction data in confirmation. * Show address of receiver, not token contract * Flow type * Only accept bigs * Unlog * Use ethereumjs-abis method ID function * Get transaction stuff out of state. Leave todo notes. * Intuit token from transaction to address. * Move generate transaction out of node and into libs/transaction. * timeout -> interval * Promise.reject -> throw * Get default currency from network. * Add more unit tests for decoding. Adopt the $ prefix for decoding calls. * Use signed transaction in confirmation modal.
88 lines
1.7 KiB
JavaScript
88 lines
1.7 KiB
JavaScript
// @flow
|
|
import React from 'react';
|
|
|
|
class Option extends React.Component {
|
|
props: {
|
|
value: string,
|
|
active: boolean,
|
|
onChange: (value: string) => void
|
|
};
|
|
render() {
|
|
const { value, active } = this.props;
|
|
return (
|
|
<li>
|
|
<a className={active ? 'active' : ''} onClick={this.onChange}>
|
|
{value}
|
|
</a>
|
|
</li>
|
|
);
|
|
}
|
|
|
|
onChange = () => {
|
|
this.props.onChange(this.props.value);
|
|
};
|
|
}
|
|
|
|
export default class UnitDropdown extends React.Component {
|
|
props: {
|
|
value: string,
|
|
options: string[],
|
|
onChange?: (value: string) => void
|
|
};
|
|
state: {
|
|
expanded: boolean
|
|
} = {
|
|
expanded: false
|
|
};
|
|
|
|
render() {
|
|
const { value, options, onChange } = this.props;
|
|
const isReadonly = !onChange;
|
|
|
|
return (
|
|
<div className="input-group-btn">
|
|
<a
|
|
style={{ minWidth: 170 }}
|
|
className="btn btn-default dropdown-toggle"
|
|
onClick={this.onToggleExpand}
|
|
>
|
|
<strong>
|
|
{value}
|
|
<i className="caret" />
|
|
</strong>
|
|
</a>
|
|
{this.state.expanded &&
|
|
!isReadonly &&
|
|
<ul className="dropdown-menu dropdown-menu-right">
|
|
{options.map(o =>
|
|
<Option
|
|
key={o}
|
|
active={value === o}
|
|
value={o}
|
|
onChange={this.onChange}
|
|
/>
|
|
)}
|
|
</ul>}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
onToggleExpand = () => {
|
|
this.setState(state => {
|
|
return {
|
|
expanded: !state.expanded
|
|
};
|
|
});
|
|
};
|
|
|
|
onChange = (value: string) => {
|
|
this.setState({
|
|
expanded: false
|
|
});
|
|
|
|
if (this.props.onChange) {
|
|
this.props.onChange(value);
|
|
}
|
|
};
|
|
}
|