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

Commit

Permalink
Merge pull request #199 from kwunyeung/fix-display-v0.37
Browse files Browse the repository at this point in the history
Fix display v0.37
  • Loading branch information
kwunyeung authored Sep 21, 2019
2 parents e1d279e + cbe4309 commit cfba923
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
21 changes: 9 additions & 12 deletions imports/api/transactions/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,28 @@ Meteor.methods({
else return false;
},
'Transactions.findDelegation': function(address, height){
// following cosmos-sdk/x/slashing/spec/06_events.md and cosmos-sdk/x/staking/spec/06_events.md
return Transactions.find({
$or: [{$and: [
{"events.attributes.key": "action"},
{"events.attributes.value": "delegate"},
{"events.attributes.key": "destination-validator"},
{"events.type": "delegate"},
{"events.attributes.key": "validator"},
{"events.attributes.value": address}
]}, {$and:[
{"events.attributes.key": "action"},
{"events.attributes.value": "unjail"},
{"events.attributes.key": "validator"},
{"events.attributes.value": address}
]}, {$and:[
{"events.attributes.key": "action"},
{"events.attributes.value": "create_validator"},
{"events.attributes.key": "destination-validator"},
{"events.type": "create_validator"},
{"events.attributes.key": "validator"},
{"events.attributes.value": address}
]}, {$and:[
{"events.attributes.key": "action"},
{"events.attributes.value": "begin_unbonding"},
{"events.attributes.key": "source-validator"},
{"events.type": "unbond"},
{"events.attributes.key": "validator"},
{"events.attributes.value": address}
]}, {$and:[
{"events.attributes.key": "action"},
{"events.attributes.value": "begin_redelegate"},
{"events.attributes.key": "destination-validator"},
{"events.type": "redelegate"},
{"events.attributes.key": "destination_validator"},
{"events.attributes.value": address}
]}],
"code": {$exists: false},
Expand Down
12 changes: 6 additions & 6 deletions imports/ui/accounts/Account.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,23 @@ export default class AccountDetails extends Component{
<Col md={6} lg={8}>
<Row>
<Col xs={4} className="label text-nowrap"><div className="available infinity" /><T>accounts.available</T></Col>
<Col xs={8} className="value text-right">{new Coin(this.state.available).toString("0,0.0000")}</Col>
<Col xs={8} className="value text-right">{new Coin(this.state.available).toString(4)}</Col>
</Row>
<Row>
<Col xs={4} className="label text-nowrap"><div className="delegated infinity" /><T>accounts.delegated</T></Col>
<Col xs={8} className="value text-right">{new Coin(this.state.delegated).toString("0,0.0000")}</Col>
<Col xs={8} className="value text-right">{new Coin(this.state.delegated).toString(4)}</Col>
</Row>
<Row>
<Col xs={4} className="label text-nowrap"><div className="unbonding infinity" /><T>accounts.unbonding</T></Col>
<Col xs={8} className="value text-right">{new Coin(this.state.unbonding).toString("0,0.0000")}</Col>
<Col xs={8} className="value text-right">{new Coin(this.state.unbonding).toString(4)}</Col>
</Row>
<Row>
<Col xs={4} className="label text-nowrap"><div className="rewards infinity" /><T>accounts.rewards</T></Col>
<Col xs={8} className="value text-right">{new Coin(this.state.rewards).toString("0,0.0000")}</Col>
<Col xs={8} className="value text-right">{new Coin(this.state.rewards).toString(4)}</Col>
</Row>
{this.state.commission?<Row>
<Col xs={4} className="label text-nowrap"><div className="commission infinity" /><T>validators.commission</T></Col>
<Col xs={8} className="value text-right">{new Coin(this.state.commission).toString("0,0.0000")}</Col>
<Col xs={8} className="value text-right">{new Coin(this.state.commission).toString(4)}</Col>
</Row>:null}
</Col>
<Col md={6} lg={4} className="total d-flex flex-column justify-content-end">
Expand All @@ -209,7 +209,7 @@ export default class AccountDetails extends Component{
</Row>:null}
<Row>
<Col xs={4} className="label d-flex align-self-end"><div className="infinity" /><T>accounts.total</T></Col>
<Col xs={8} className="value text-right">{new Coin(this.state.total).toString("0,0.0000a")}</Col>
<Col xs={8} className="value text-right">{new Coin(this.state.total).toString(4)}</Col>
<Col xs={12} className="dollar-value text-right text-secondary">~{numbro(this.state.total/Meteor.settings.public.stakingFraction*this.state.price).format("$0,0.0000a")} ({numbro(this.state.price).format("$0,0.00")}/{Meteor.settings.public.stakingDenom})</Col>
</Row>
</Col>
Expand Down
7 changes: 5 additions & 2 deletions imports/ui/ledger/LedgerActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const Types = {
DEPOSIT: 'deposit'
}

const DEFAULT_GAS_ADJUSTMENT = '1.4';

const durationToDay = 1/60/60/24/10e8;

const TypeMeta = {
Expand Down Expand Up @@ -73,7 +75,8 @@ const TypeMeta = {
button_other: 'send',
pathPreFix: 'bank/accounts',
pathSuffix: 'transfers',
warning: ''
warning: '',
gasAdjustment: '1.7'
},
[Types.SUBMITPROPOSAL]: {
button: 'new',
Expand Down Expand Up @@ -391,7 +394,7 @@ class LedgerButton extends Component {
}

runSimulatation = (txMsg, simulateBody) => {
let gasAdjustment = TypeMeta[this.state.actionType].gasAdjustment || '1.2';
let gasAdjustment = TypeMeta[this.state.actionType].gasAdjustment || DEFAULT_GAS_ADJUSTMENT;
Meteor.call('transaction.simulate', simulateBody, this.state.user, this.getPath(), gasAdjustment, (err, res) =>{
if (res){
Ledger.applyGas(txMsg, res, Meteor.settings.public.gasPrice, Coin.MintingDenom);
Expand Down
2 changes: 1 addition & 1 deletion imports/ui/transactions/Transaction.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class Transaction extends Component{
{tx.block() && `(${moment.utc(tx.block().time).format("D MMM YYYY, h:mm:ssa z")})`}
</Col>
<Col md={4} className="label"><T>transactions.fee</T></Col>
<Col md={8} className="value">{tx.tx.value.fee.amount?tx.tx.value.fee.amount.map((fee,i) => {
<Col md={8} className="value">{(tx.tx.value.fee.amount.length > 0)?tx.tx.value.fee.amount.map((fee,i) => {
return <span className="text-nowrap" key={i}>{new Coin(fee.amount).toString()}</span>
}):<span>No fee</span>}</Col>
<Col md={4} className="label"><T>transactions.gasUsedWanted</T></Col>
Expand Down
2 changes: 1 addition & 1 deletion imports/ui/transactions/TransactionRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const TransactionRow = (props) => {
{(!props.blockList)?<Col xs={6} md={9} lg={{size:2,order:"last"}} className="text-nowrap"><i className="material-icons">schedule</i> <span>{tx.block()?<TimeAgo time={tx.block().time} />:''}</span></Col>:''}
{(!props.blockList)?<Col xs={4} md={2} lg={1}><i className="fas fa-database d-lg-none"></i> <Link to={"/blocks/"+tx.height}>{numbro(tx.height).format("0,0")}</Link></Col>:''}
<Col xs={(!props.blockList)?2:4} md={1}>{(!tx.code)?<TxIcon valid />:<TxIcon />}</Col>
<Col xs={(!props.blockList)?6:8} md={(!props.blockList)?9:4} lg={2} className="fee"><i className="material-icons d-lg-none">monetization_on</i> {tx.tx.value.fee.amount?tx.tx.value.fee.amount.map((fee,i) => {
<Col xs={(!props.blockList)?6:8} md={(!props.blockList)?9:4} lg={2} className="fee"><i className="material-icons d-lg-none">monetization_on</i> {(tx.tx.value.fee.amount.length > 0)?tx.tx.value.fee.amount.map((fee,i) => {
return <span className="text-nowrap" key={i}>{new Coin(fee.amount).toString()}</span>
}):<span>No fee</span>}</Col>
{(tx.code)?<Col xs={{size:12, order:"last"}} className="error">
Expand Down
8 changes: 4 additions & 4 deletions imports/ui/validators/Validator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default class Validator extends Component{
componentDidUpdate(prevProps, prevState){
if (!this.isSameValidator(prevProps) || this.state.user !== prevState.user)
this.getUserDelegations();
if (!this.isSameValidator(prevProps)){
if (this.props.validator != prevProps.validator){
// if (this.props.validator.description.identity != prevProps.validator.description.identity){
if ((this.props.validator.description) && (this.props.validator.description != prevProps.validator.description)){
// console.log(prevProps.validator.description);
Expand Down Expand Up @@ -222,11 +222,11 @@ export default class Validator extends Component{
<Col sm={4} className="label"><T>validators.selfDelegationAddress</T></Col>
<Col sm={8} className="value address" data-delegator-address={this.props.validator.delegator_address}><Link to={"/account/"+this.props.validator.delegator_address}>{this.props.validator.delegator_address}</Link></Col>
<Col sm={4} className="label"><T>validators.commissionRate</T></Col>
<Col sm={8} className="value">{this.props.validator.commission&&this.props.validator.commission.commission_rates?numbro(this.props.validator.commission.commission_rates.rate).format('0.00')+"%":''} <small className="text-secondary">({this.state.updateTime})</small></Col>
<Col sm={8} className="value">{this.props.validator.commission&&this.props.validator.commission.commission_rates?numbro(this.props.validator.commission.commission_rates.rate*100).format('0.00')+"%":''} <small className="text-secondary">({this.state.updateTime})</small></Col>
<Col sm={4} className="label"><T>validators.maxRate</T></Col>
<Col sm={8} className="value">{this.props.validator.commission&&this.props.validator.commission.commission_rates?numbro(this.props.validator.commission.commission_rates.max_rate).format('0.00')+"%":''}</Col>
<Col sm={8} className="value">{this.props.validator.commission&&this.props.validator.commission.commission_rates?numbro(this.props.validator.commission.commission_rates.max_rate*100).format('0.00')+"%":''}</Col>
<Col sm={4} className="label"><T>validators.maxChangeRate</T></Col>
<Col sm={8} className="value">{this.props.validator.commission&&this.props.validator.commission.commission_rates?numbro(this.props.validator.commission.commission_rates.max_change_rate).format('0.00')+"%":''}</Col>
<Col sm={8} className="value">{this.props.validator.commission&&this.props.validator.commission.commission_rates?numbro(this.props.validator.commission.commission_rates.max_change_rate*100).format('0.00')+"%":''}</Col>
</Row>
</CardBody>
</Card>
Expand Down

0 comments on commit cfba923

Please sign in to comment.