Removed Circular Dependencies

This commit is contained in:
Nicolas Gotchac 2016-11-26 17:06:37 +01:00
parent 002c793f53
commit 353b6c06db
7 changed files with 26 additions and 18 deletions

View File

@ -17,7 +17,7 @@
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import { isArray, isHex, isInstanceOf, isString } from '../util/types'; import { isArray, isHex, isInstanceOf, isString } from '../util/types';
import { padLeft } from '../util/format'; import { padLeft, toHex } from '../util/format';
export function inAddress (address) { export function inAddress (address) {
// TODO: address validation if we have upper-lower addresses // TODO: address validation if we have upper-lower addresses
@ -100,15 +100,7 @@ export function inFilter (options) {
} }
export function inHex (str) { export function inHex (str) {
if (str && str.toString) { return toHex(str);
str = str.toString(16);
}
if (str && str.substr(0, 2) === '0x') {
return str.toLowerCase();
}
return `0x${(str || '').toLowerCase()}`;
} }
export function inNumber10 (number) { export function inNumber10 (number) {

View File

@ -15,7 +15,6 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { range } from 'lodash'; import { range } from 'lodash';
import { inHex } from '../format/input';
export function bytesToHex (bytes) { export function bytesToHex (bytes) {
return '0x' + bytes.map((b) => ('0' + b.toString(16)).slice(-2)).join(''); return '0x' + bytes.map((b) => ('0' + b.toString(16)).slice(-2)).join('');
@ -38,11 +37,23 @@ export function asciiToHex (string) {
} }
export function padRight (input, length) { export function padRight (input, length) {
const value = inHex(input).substr(2, length * 2); const value = toHex(input).substr(2, length * 2);
return '0x' + value + range(length * 2 - value.length).map(() => '0').join(''); return '0x' + value + range(length * 2 - value.length).map(() => '0').join('');
} }
export function padLeft (input, length) { export function padLeft (input, length) {
const value = inHex(input).substr(2, length * 2); const value = toHex(input).substr(2, length * 2);
return '0x' + range(length * 2 - value.length).map(() => '0').join('') + value; return '0x' + range(length * 2 - value.length).map(() => '0').join('') + value;
} }
export function toHex (str) {
if (str && str.toString) {
str = str.toString(16);
}
if (str && str.substr(0, 2) === '0x') {
return str.toLowerCase();
}
return `0x${(str || '').toLowerCase()}`;
}

View File

@ -19,7 +19,7 @@ import React, { Component, PropTypes } from 'react';
import FileSaver from 'file-saver'; import FileSaver from 'file-saver';
import FileDownloadIcon from 'material-ui/svg-icons/file/file-download'; import FileDownloadIcon from 'material-ui/svg-icons/file/file-download';
import { Button } from '../../'; import Button from '../../Button';
class ActionbarExport extends Component { class ActionbarExport extends Component {
static propTypes = { static propTypes = {

View File

@ -20,7 +20,8 @@ import FileUploadIcon from 'material-ui/svg-icons/file/file-upload';
import ContentClear from 'material-ui/svg-icons/content/clear'; import ContentClear from 'material-ui/svg-icons/content/clear';
import ActionDoneAll from 'material-ui/svg-icons/action/done-all'; import ActionDoneAll from 'material-ui/svg-icons/action/done-all';
import { Modal, Button } from '../../'; import Button from '../../Button';
import Modal from '../../Modal';
import styles from './import.css'; import styles from './import.css';

View File

@ -17,7 +17,8 @@
import React, { Component, PropTypes } from 'react'; import React, { Component, PropTypes } from 'react';
import ActionSearch from 'material-ui/svg-icons/action/search'; import ActionSearch from 'material-ui/svg-icons/action/search';
import { Button, InputChip } from '../../'; import Button from '../../Button';
import InputChip from '../../Form/InputChip';
import styles from './search.css'; import styles from './search.css';

View File

@ -22,7 +22,7 @@ import MenuItem from 'material-ui/MenuItem';
import SortIcon from 'material-ui/svg-icons/content/sort'; import SortIcon from 'material-ui/svg-icons/content/sort';
import { Button } from '../../'; import Button from '../../Button';
import SortStore from './sortStore'; import SortStore from './sortStore';
import styles from './sort.css'; import styles from './sort.css';

View File

@ -22,7 +22,10 @@ import IconButton from 'material-ui/IconButton';
import AddIcon from 'material-ui/svg-icons/content/add'; import AddIcon from 'material-ui/svg-icons/content/add';
import RemoveIcon from 'material-ui/svg-icons/content/remove'; import RemoveIcon from 'material-ui/svg-icons/content/remove';
import { Input, InputAddressSelect, Select } from '../../../ui'; import Input from '../../../ui/Form/Input';
import InputAddressSelect from '../../../ui/Form/InputAddressSelect';
import Select from '../../../ui/Form/Select';
import { ABI_TYPES } from '../../../util/abi'; import { ABI_TYPES } from '../../../util/abi';
import styles from './typedInput.css'; import styles from './typedInput.css';