Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
Cherry pick v0.38 fixes (#386)
Browse files Browse the repository at this point in the history
* Kwun/add rewards amount (#325)

* fix unjail message

* update changelog

* show reward amount in the activities

* update delegation in 6 decimal places

* update changelog

* Monika/kava testnet redelegations fix (#373)

* Fixed Redelegation List showing on all account pages

* Updated CHANGELOG.md

* Updated ChainStates.jsx

Co-authored-by: Kwun Yeung <kwun@forbole.com>

Co-authored-by: Magic Cat <37407870+MonikaCat@users.noreply.github.com>
  • Loading branch information
kwunyeung and MonikaCat authored Sep 10, 2020
1 parent e1e6927 commit 2acbc14
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 7 deletions.
9 changes: 3 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
* [#297] Prettify unrecognized JSON messages
* [#294] Fixed cloneDeep typo in Account section for case-sensitve filesystems.
* [#284] Support Tendermint v0.33 block format
* [#346] Changed "Governanza" typo to "Gobernanza" in Spanish Translation
* [#375] Fixed the Commission Value Calculations that caused Account Page to break
* [#372] Fixed Redelegation List showing on all account pages

## v0.37.x-patch-11

* [#306] Display errors with SDK v0.38 format
* [#301] Using Jazzicon as avatar if no Keybase avatar exists
* [#297] Prettify unrecognized JSON messages
* [#294] Fixed cloneDeep typo in Account section for case-sensitve filesystems.
* [#284] Support Tendermint v0.33 block format
* [#303] Fixed wrong validator display in unjail message
* [#294] Fixed cloneDeep typo in Account section for case-sensitve filesystems.
* [#298] Fixed NaN values for Rewards and Commissions that were displayed after clicking Withdrawal Button
Expand All @@ -28,7 +26,6 @@
* [#327] Fixed error in Proposals section to accept String and Number as a value in Changes table
* Hide Italian it-IT Translation
* Fixed hash overflow on mobile in Transaction Section (Added scroller)
* [#346] Changed "Governanza" typo to "Gobernanza" in Spanish Translation

## v0.37.x-patch-10.1

Expand Down
16 changes: 15 additions & 1 deletion imports/api/accounts/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,20 @@ Meteor.methods({
return redelegations
}
},
'accounts.getRedelegations'(address) {


let url = LCD + '/staking/redelegations?delegator=' + address;

try {
let userRedelegations = HTTP.get(url);
if (userRedelegations.statusCode == 200) {
userRedelegations = JSON.parse(userRedelegations.content).result;

return userRedelegations;
};
} catch (e) {
console.log(url);
console.log(e.response.content);
}
},
})
55 changes: 55 additions & 0 deletions imports/ui/accounts/Redelegations.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React, { Component } from 'react';
import { Card, CardHeader, CardBody, Container, Row, Col, Spinner } from 'reactstrap';
import numbro from 'numbro';
import Account from '../components/Account.jsx';
import { Mongo } from 'meteor/mongo';
import moment from 'moment';
import i18n from 'meteor/universe:i18n';
import Coin from '/both/utils/coins.js';

const T = i18n.createComponent();

export default class AccountRedelegations extends Component{
constructor(props){
super(props);
}

render(){
let numRedelegations = this.props.redelegations.length;
return <div>

<h6>{(numRedelegations > 0 )? numRedelegations : <T>accounts.no</T>}<T>accounts.redelegations</T>{(numRedelegations>1)?<T>accounts.plural</T>:''}</h6>

{(numRedelegations > 0)?<div className="list overflow-auto">
<Container fluid>
<Row className="header text-nowrap d-none d-lg-flex">
<Col md={3}><i className="fas fa-at"></i> <span><T>accounts.redelegatedFrom</T></span></Col>
<Col md={3}><i className="fas fa-at"></i> <span><T>accounts.redelegatedTo</T></span></Col>
<Col md={6}>
<Row>
<Col md={6}><i className="fas fa-piggy-bank"></i> <span><T>accounts.shares</T></span></Col>
<Col md={6}><i className="fas fa-clock"></i> <span><T>accounts.mature</T></span></Col>
</Row>
</Col>
</Row>
{this.props.redelegations.map((r, i) =>
<Row key={i} className="delegation-info">
<Col md={3} className="text-nowrap overflow-auto"><Account address={r.validator_src_address} /></Col>
<Col md={3} className="text-nowrap overflow-auto"><Account address={r.validator_dst_address} /></Col>
<Col md={6}>{r.entries.map((entry,j) =>
<Row key={j}>
<Col md={6}>
{new Coin(entry.balance).toString(4)}
</Col>
<Col md={6}>
{moment.utc(entry.completion_time).fromNow()}
</Col>
</Row>
)}</Col>
</Row>
)}
</Container>
</div>:''}
</div>
}
}

0 comments on commit 2acbc14

Please sign in to comment.