import React, { Component } from 'react' import Tooltip from 'rc-tooltip' import 'rc-tooltip/assets/bootstrap.css' const encodeJson = json => { const encoded = window.encodeURIComponent(JSON.stringify(json)) return `data:application/json;charset=utf-8,${encoded}` } export default class Keys extends Component { constructor(props) { super(props) this.onVisibleChange = this.onVisibleChange.bind(this) this.onCopyBtnClick = this.onCopyBtnClick.bind(this) this.state = { copyBtns: { copyMiningPass: { visible: false, text: 'Copy' }, copyVotingPass: { visible: false, text: 'Copy' }, copyPayoutPass: { visible: false, text: 'Copy' }, copyMiningKey: { visible: false, text: 'Copy' }, copyVotingKey: { visible: false, text: 'Copy' }, copyPayoutKey: { visible: false, text: 'Copy' } } } } componentWillUpdate(nextProps, nextState) { if (this.refs.miningKeyAddress) { const Clipboard = require('clipboard') // this.clipboard = new Clipboard(this.refs.copyBtn); new Clipboard(this.refs.miningKeyAddress) new Clipboard(this.refs.miningKeyPass) new Clipboard(this.refs.payoutKeyAddress) new Clipboard(this.refs.payoutKeyPass) new Clipboard(this.refs.votingKeyAddress) new Clipboard(this.refs.votingKeyPass) } } onVisibleChange(id) { console.log(id) let copyBtns = this.state.copyBtns copyBtns[id].visible = !copyBtns[id].visible copyBtns[id].text = 'Copy' this.setState({ copyBtns }) // const id = e.target.id; } onCopyBtnClick(e) { const id = e.target.id let copyBtns = this.state.copyBtns copyBtns[id].text = 'Copied!' this.setState({ copyBtns }) } render() { return (

Mining key

0x {this.props.mining.jsonStore.address}

{ this.onVisibleChange('copyMiningKey') }} placement="right" overlay={this.state.copyBtns.copyMiningKey.text} >

{ this.onVisibleChange('copyMiningPass') }} placement="right" overlay={this.state.copyBtns.copyMiningPass.text} >

Download this key and use it in your mining node to validate blocks in the network. Mined coins will be deposited to your payout account.

Download Mining Key

Payout key

0x {this.props.payout.jsonStore.address}

{ this.onVisibleChange('copyPayoutKey') }} placement="right" overlay={this.state.copyBtns.copyPayoutKey.text} >

{ this.onVisibleChange('copyPayoutPass') }} placement="right" overlay={this.state.copyBtns.copyPayoutPass.text} >

Download this key and use it on your client node/wallet to spend earned coins.

Download Payout Key

Voting key

0x {this.props.voting.jsonStore.address}

{ this.onVisibleChange('copyVotingKey') }} placement="right" overlay={this.state.copyBtns.copyVotingKey.text} >

{ this.onVisibleChange('copyVotingPass') }} placement="right" overlay={this.state.copyBtns.copyVotingPass.text} >

Download this key and use it on your client node to vote for necessary ballots, such as adding or removing miners from the network.

Download Voting Key

Important

Do not close this tab until you download all keys and save passwords. Keep keys secure and protected. If you lose your keys, you will need to get a new initial key using Voting DAPP.

) } }