aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pages/confirm-deploy-contract/confirm-deploy-contract.component.js
blob: 9bc0daab9fc57c5364e40eded8301f3385df715b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import ethUtil from 'ethereumjs-util'
import ConfirmTransactionBase from '../confirm-transaction-base'

export default class ConfirmDeployContract extends Component {
  static contextTypes = {
    t: PropTypes.func,
  }

  static propTypes = {
    txData: PropTypes.object,
  }

  renderData () {
    const { t } = this.context
    const {
      txData: {
        origin,
        txParams: {
          data,
        } = {},
      } = {},
    } = this.props

    return (
      <div className="confirm-page-container-content__data">
        <div className="confirm-page-container-content__data-box">
          <div className="confirm-page-container-content__data-field">
            <div className="confirm-page-container-content__data-field-label">
              { `${t('origin')}:` }
            </div>
            <div>
              { origin }
            </div>
          </div>
          <div className="confirm-page-container-content__data-field">
            <div className="confirm-page-container-content__data-field-label">
              { `${t('bytes')}:` }
            </div>
            <div>
              { ethUtil.toBuffer(data).length }
            </div>
          </div>
        </div>
        <div className="confirm-page-container-content__data-box-label">
          { `${t('hexData')}:` }
        </div>
        <div className="confirm-page-container-content__data-box">
          { data }
        </div>
      </div>
    )
  }

  render () {
    return (
      <ConfirmTransactionBase
        action={this.context.t('contractDeployment')}
        dataComponent={this.renderData()}
      />
    )
  }
}