1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 20:39:08 +01:00
metamask-extension/ui/pages/confirm-deploy-contract/confirm-deploy-contract.component.js

90 lines
2.4 KiB
JavaScript
Raw Normal View History

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ConfirmTransactionBase from '../confirm-transaction-base';
2021-05-21 22:07:06 +02:00
import { toBuffer } from '../../../shared/modules/buffer-utils';
import Box from '../../components/ui/box';
import { Text } from '../../components/component-library';
import {
Color,
DISPLAY,
OVERFLOW_WRAP,
TextVariant,
TEXT_TRANSFORM,
} from '../../helpers/constants/design-system';
export default class ConfirmDeployContract extends Component {
static contextTypes = {
t: PropTypes.func,
};
static propTypes = {
txData: PropTypes.object,
};
2020-11-03 00:41:28 +01:00
renderData() {
const { t } = this.context;
const { txData: { origin, txParams: { data } = {} } = {} } = this.props;
return (
<Box color={Color.textAlternative} padding={4}>
<Box
backgroundColor={Color.backgroundAlternative}
padding={4}
variant={TextVariant.bodySm}
>
<Box display={DISPLAY.FLEX}>
<Text
backgroundColor={Color.backgroundAlternative}
marginBottom={1}
paddingRight={4}
variant={TextVariant.bodySmBold}
>
2020-11-03 00:41:28 +01:00
{`${t('origin')}:`}
</Text>
<Text
overflowWrap={OVERFLOW_WRAP.BREAK_WORD}
variant={TextVariant.bodySm}
>
{origin}
</Text>
</Box>
<Box display={DISPLAY.FLEX}>
<Text
backgroundColor={Color.backgroundAlternative}
paddingRight={4}
variant={TextVariant.bodySmBold}
>
2020-11-03 00:41:28 +01:00
{`${t('bytes')}:`}
</Text>
<Text variant={TextVariant.bodySm}>{toBuffer(data).length}</Text>
</Box>
</Box>
<Text
as="h3"
paddingBottom={3}
paddingTop={2}
textTransform={TEXT_TRANSFORM.UPPERCASE}
variant={TextVariant.bodySm}
>{`${t('hexData')}:`}</Text>
<Text
backgroundColor={Color.backgroundAlternative}
overflowWrap={OVERFLOW_WRAP.BREAK_WORD}
padding={4}
variant={TextVariant.bodySm}
>
{data}
</Text>
</Box>
);
}
2020-11-03 00:41:28 +01:00
render() {
return (
<ConfirmTransactionBase
actionKey="contractDeployment"
dataComponent={this.renderData()}
/>
);
}
}