Skip to content
Snippets Groups Projects
Commit ef975b3e authored by Dan Notestein's avatar Dan Notestein
Browse files

Merge branch '11-delegations' into 'develop'

Wallet delegations

Closes #11

See merge request !16
parents 9709e113 a0382d57
No related branches found
No related tags found
2 merge requests!16Wallet delegations,!14chore: update master with latests fixes and features from develop
......@@ -10,7 +10,7 @@ const ConfirmDelegationTransfer = ({ operation, amount }) => {
key={`transaction-label-${i}`}
className="input-group-label"
>
STEEM
HIVE
</span>
<input
className="input-group-field"
......
......@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
const ConfirmTransfer = ({ operation }) => {
const info = Object.keys(operation).map((k, i) => {
if (k === '')
if (k !== '')
return (
<div key={`transaction-group-${i}`} className="input-group">
<span
......
......@@ -75,10 +75,7 @@ class Delegations extends React.Component {
<tr
key={`${item.delegator}--${item.delegatee}--${item.min_delegation_time}`}
>
<td className="red">
{vestsAsSteem}
HP
</td>
<td className="red">{vestsAsSteem} HP</td>
<td>{item.delegatee}</td>
<td>
<TimeAgoWrapper date={item.min_delegation_time} />
......
......@@ -237,18 +237,24 @@ class TransferForm extends Component {
: null;
if (toDelegate) {
balanceValue = currentAccount.get('savings_balance');
const vestingShares = parseFloat(
currentAccount.get('vesting_shares')
);
const toWithdraw = parseFloat(currentAccount.get('to_withdraw'));
const withdrawn = parseFloat(currentAccount.get('withdrawn'));
const delegatedVestingShares = parseFloat(
currentAccount.get('delegated_vesting_shares')
);
// Available Vests Calculation.
const avail =
parseFloat(currentAccount.get('vesting_shares')) -
(parseFloat(currentAccount.get('to_withdraw')) -
parseFloat(currentAccount.get('withdrawn'))) /
1e6 -
parseFloat(currentAccount.get('delegated_vesting_shares'));
vestingShares -
(toWithdraw - withdrawn) / 1e6 -
delegatedVestingShares;
// Representation of available Vests as Hive.
const vestSteem = totalVestingFund * (avail / totalVestingShares);
balanceValue = vestSteem;
balanceValue = `${vestSteem.toFixed(3)} HIVE`;
}
return balanceValue;
}
......@@ -453,7 +459,7 @@ class TransferForm extends Component {
spellCheck="false"
disabled={loading}
/>
{asset.value !== 'VESTS' && (
{asset && asset.value !== 'VESTS' && (
<span
className="input-group-label"
style={{ paddingLeft: 0, paddingRight: 0 }}
......@@ -474,7 +480,7 @@ class TransferForm extends Component {
</select>
</span>
)}
{asset.value === 'VESTS' && (
{asset && asset.value === 'VESTS' && (
<span
className="input-group-label"
style={{ paddingLeft: 0, paddingRight: 0 }}
......@@ -603,14 +609,16 @@ class TransferForm extends Component {
}
}
const AssetBalance = ({ onClick, balanceValue }) => (
<a
onClick={onClick}
style={{ borderBottom: '#A09F9F 1px dotted', cursor: 'pointer' }}
>
{tt('g.balance', { balanceValue: balanceValue.toFixed(3) })}
</a>
);
const AssetBalance = ({ onClick, balanceValue }) => {
return (
<a
onClick={onClick}
style={{ borderBottom: '#A09F9F 1px dotted', cursor: 'pointer' }}
>
{tt('g.balance', { balanceValue })}
</a>
);
};
import { connect } from 'react-redux';
......
......@@ -32,10 +32,11 @@ export function serverApiRecordEvent(type, val, rate_limit_ms = 5000) {
if (last_call && new Date() - last_call < rate_limit_ms) return;
last_call = new Date();
const value = val && val.stack ? `${val.toString()} | ${val.stack}` : val;
return;
api.call(
'overseer.collect',
{ collection: 'event', metadata: { type, value } },
error => {
(error) => {
if (error) console.warn('overseer error', error, error.data);
}
);
......@@ -83,7 +84,7 @@ export function isTosAccepted() {
const request = Object.assign({}, request_base, {
body: JSON.stringify({ csrf: window.$STM_csrf }),
});
return fetch('/api/v1/isTosAccepted', request).then(res => res.json());
return fetch('/api/v1/isTosAccepted', request).then((res) => res.json());
}
export function acceptTos() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment