aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components/asset_amount_input.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/instant/src/components/asset_amount_input.tsx')
-rw-r--r--packages/instant/src/components/asset_amount_input.tsx15
1 files changed, 8 insertions, 7 deletions
diff --git a/packages/instant/src/components/asset_amount_input.tsx b/packages/instant/src/components/asset_amount_input.tsx
index 730e6396f..c03ef1cf3 100644
--- a/packages/instant/src/components/asset_amount_input.tsx
+++ b/packages/instant/src/components/asset_amount_input.tsx
@@ -2,17 +2,18 @@ import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import * as React from 'react';
-import { assetDataUtil } from '../util/asset_data';
-
import { ColorOption } from '../style/theme';
+import { ERC20Asset } from '../types';
+import { assetUtils } from '../util/asset';
import { util } from '../util/util';
import { AmountInput, AmountInputProps } from './amount_input';
import { Container, Text } from './ui';
+// Asset amounts only apply to ERC20 assets
export interface AssetAmountInputProps extends AmountInputProps {
- assetData?: string;
- onChange: (value?: BigNumber, assetData?: string) => void;
+ asset?: ERC20Asset;
+ onChange: (value?: BigNumber, asset?: ERC20Asset) => void;
}
export class AssetAmountInput extends React.Component<AssetAmountInputProps> {
@@ -20,19 +21,19 @@ export class AssetAmountInput extends React.Component<AssetAmountInputProps> {
onChange: util.boundNoop,
};
public render(): React.ReactNode {
- const { assetData, onChange, ...rest } = this.props;
+ const { asset, onChange, ...rest } = this.props;
return (
<Container>
<AmountInput {...rest} onChange={this._handleChange} />
<Container display="inline-block" marginLeft="10px">
<Text fontSize={rest.fontSize} fontColor={ColorOption.white} textTransform="uppercase">
- {assetDataUtil.bestNameForAsset(this.props.assetData, '???')}
+ {assetUtils.bestNameForAsset(asset)}
</Text>
</Container>
</Container>
);
}
private readonly _handleChange = (value?: BigNumber): void => {
- this.props.onChange(value, this.props.assetData);
+ this.props.onChange(value, this.props.asset);
};
}