Skip to content

Commit

Permalink
Merge pull request #26 from eco-stake/release-v0.2.13
Browse files Browse the repository at this point in the history
Release v0.2.13
  • Loading branch information
tombeynon committed Mar 4, 2022
2 parents a88f202 + 5fafc86 commit c0a2ab0
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'build'
name: 'publish'

on:
push:
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ cp .env.sample .env

**Populate your new .env file with your mnemonic.**

### Install Docker Compose

```
sudo apt install docker
```

### Running the script (to see if everything works correctly)

Running the autostake script manually is then simple:

```
Expand All @@ -54,6 +62,8 @@ docker-compose run app npm run autostake

Note you might need `sudo` depending on your docker install.

### Setting up Cron to make sure the script runs daily

You should setup your script to run at the same time each day using `crontab`

```
Expand All @@ -64,7 +74,9 @@ crontab -e

Use `git pull` to retrieve the latest version as required. The autostaking script can and will change in the near future.

### Setup and submit your REStake operator
## Submiting your operator

### Setup your REStake operator

You now need to update the [networks.json](./src/networks.json) file at `./src/networks.json` to add your operator to any networks you want to auto-compound for. Check the existing file for examples, but the operators array is simple:

Expand Down
9 changes: 8 additions & 1 deletion src/components/Coins.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ function Coins(props) {
}

function denom(coins){
return coins.denom.slice(1).toUpperCase()
if(!coins.denom) return

if(coins.denom.startsWith('base')){
return coins.denom.slice(4).toUpperCase()
}else if(['u', 'a'].includes(coins.denom[0])){
return coins.denom.slice(1).toUpperCase()
}
return coins.denom.toUpperCase()
}

if(!props.coins || !props.coins.denom){
Expand Down
11 changes: 8 additions & 3 deletions src/components/Delegations.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Delegations extends React.Component {
}

getRewards() {
this.props.restClient.getRewards(this.props.address)
this.props.restClient.getRewards(this.props.address, this.props.network.denom)
.then(
(rewards) => {
this.setState({ rewards: rewards });
Expand Down Expand Up @@ -119,7 +119,7 @@ class Delegations extends React.Component {
}

getTestGrant(){
this.props.restClient.getGrants(this.props.network.data.testaddress, this.props.address)
this.props.restClient.getGrants(this.props.network.data.testAddress, this.props.address)
.then(
(result) => { }, (error) => {
if (error.response && error.response.status === 501) {
Expand Down Expand Up @@ -236,10 +236,15 @@ class Delegations extends React.Component {
}
}

denomRewards(rewards){
return rewards.reward.find(reward => reward.denom === this.props.network.denom)
}

renderValidator(validatorAddress, delegation){
const validator = this.props.validators[validatorAddress]
if(validator){
const rewards = this.state.rewards && this.state.rewards[validatorAddress]
const denomRewards = rewards && this.denomRewards(rewards)
const operator = this.operatorForValidator(validatorAddress)
let rowVariant = operator ? 'table-warning' : undefined

Expand Down Expand Up @@ -292,7 +297,7 @@ class Delegations extends React.Component {
<Coins coins={delegationBalance} />
</td>
<td className="d-none d-sm-table-cell">
{rewards && rewards.reward.map(el => <Coins key={el.denom} coins={el} />)}
{denomRewards && <Coins key={denomRewards.denom} coins={denomRewards} />}
</td>
<td>
<div className="d-grid gap-2 d-md-flex justify-content-end">
Expand Down
Loading

0 comments on commit c0a2ab0

Please sign in to comment.