// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see .
import React, { Component, PropTypes } from 'react';
import moment from 'moment';
import { Container, InputAddress } from '../../../ui';
import styles from '../wallet.css';
export default class WalletDetails extends Component {
static contextTypes = {
api: PropTypes.object.isRequired
};
static propTypes = {
owners: PropTypes.array,
require: PropTypes.object,
dailylimit: PropTypes.object
};
render () {
return (
{ this.renderOwners() }
{ this.renderDetails() }
);
}
renderOwners () {
const { owners } = this.props;
if (!owners) {
return null;
}
const ownersList = owners.map((address) => (
));
return (
{ ownersList }
);
}
renderDetails () {
const { require, dailylimit } = this.props;
const { api } = this.context;
if (!dailylimit || !dailylimit.limit) {
return null;
}
const limit = api.util.fromWei(dailylimit.limit).toFormat(3);
const spent = api.util.fromWei(dailylimit.spent).toFormat(3);
const date = moment(dailylimit.last.toNumber() * 24 * 3600 * 1000);
return (
This wallet requires at least
{ require.toFormat() } owners
to validate any action (transactions, modifications).
{ spent }
has been spent today, out of
{ limit }
set as the daily limit, which has been reset on
{ date.format('LL') }
);
}
}