Skip to content

Commit

Permalink
Merge pull request #12 from eco-stake/release-v0.2.12
Browse files Browse the repository at this point in the history
Release v0.2.12
  • Loading branch information
tombeynon authored Mar 4, 2022
2 parents 2a2a61a + fc91d0b commit a88f202
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 19 deletions.
28 changes: 18 additions & 10 deletions src/components/Delegations.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
class Delegations extends React.Component {
constructor(props) {
super(props);
this.state = {operatorGrants: {}, validatorLoading: {}}
this.state = {operatorGrants: {}, validatorLoading: {}, orderedOperators: [], orderedRegularDelegations: []}

this.setError = this.setError.bind(this)
this.setClaimLoading = this.setClaimLoading.bind(this)
Expand Down Expand Up @@ -53,6 +53,8 @@ class Delegations extends React.Component {
}

refresh(){
this.setState({orderedOperators: this.orderedOperators()})
this.setState({orderedRegularDelegations: this.orderedRegularDelegations()})
this.getRewards()
this.refreshInterval()
if(this.props.operators.length){
Expand Down Expand Up @@ -203,12 +205,18 @@ class Delegations extends React.Component {
return Object.values(this.props.operators).length < 1 && Object.values(this.props.delegations).length < 1
}

operatorDelegations(){
return _.pick(this.props.delegations, this.operatorAddresses());
orderedOperators(){
const random = _.shuffle(this.props.operators)
const ownerAddress = this.props.network && this.props.network.data.ownerAddress
if(ownerAddress){
return _.sortBy(random, ({address}) => address === ownerAddress ? 0 : 1)
}
return random
}

otherDelegations(){
return _.omit(this.props.delegations, this.operatorAddresses())
orderedRegularDelegations(){
const delegations = Object.values(_.omit(this.props.delegations, this.operatorAddresses()))
return _.shuffle(delegations)
}

totalRewards(validators){
Expand Down Expand Up @@ -441,15 +449,15 @@ class Delegations extends React.Component {
</tr>
</thead>
<tbody>
{this.props.operators.length > 0 && (
this.props.operators.map(operator => {
{this.state.orderedOperators.length > 0 && (
this.state.orderedOperators.map(operator => {
const delegation = this.props.delegations && this.props.delegations[operator.address]
return this.renderValidator(operator.address, delegation)
})
)}
{this.props.delegations && (
Object.entries(this.otherDelegations()).map(([validatorAddress, item], i) => {
return this.renderValidator(validatorAddress, item)
{this.state.orderedRegularDelegations.length > 0 && (
this.state.orderedRegularDelegations.map(delegation => {
return this.renderValidator(delegation.delegation.validator_address, delegation)
})
)}
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion src/components/NetworkFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function NetworkFinder() {
operators: state.network.getOperators(validators),
loading: false
})
}, error => setState({loading: false, error: error}))
}, error => setState({loading: false, error: 'Unable to connect right now, try again'}))
}
}, [state.network])

Expand Down
29 changes: 25 additions & 4 deletions src/components/Validators.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import _ from 'lodash'
import FuzzySearch from 'fuzzy-search'

Expand All @@ -17,12 +17,33 @@ import {

function Validators(props) {
const [filter, setFilter] = useState()
const [orderedOperatorValidators, setOrderedOperatorValidators] = useState([])
const [orderedRegularValidators, setOrderedRegularValidators] = useState([])

useEffect(() => {
const ownerAddress = props.network && props.network.data.ownerAddress
setOrderedOperatorValidators(orderValidators(operatorValidators(), ownerAddress))
setOrderedRegularValidators(orderValidators(regularValidators()))
}, [props.operators, props.validators])

function orderValidators(validators, ownerAddress){
const random = _.shuffle(validators)
if(ownerAddress){
return _.sortBy(random, ({operator_address}) => operator_address === ownerAddress ? 0 : 1)
}
return random
}

function orderedRegularDelegations(){
const delegations = Object.values(_.omit(this.props.delegations, this.operatorAddresses()))
return _.shuffle(delegations)
}

function operatorValidators(){
return _.pick(props.validators, props.operators.map(el => el.address))
}

function otherValidators(){
function regularValidators(){
return _.omit(props.validators, props.operators.map(el => el.address))
}

Expand Down Expand Up @@ -78,8 +99,8 @@ function Validators(props) {
)
}

const filteredOperators = Object.entries(filteredResults(operatorValidators()))
const filteredValidators = Object.entries(filteredResults(otherValidators()))
const filteredOperators = Object.entries(filteredResults(orderedOperatorValidators))
const filteredValidators = Object.entries(filteredResults(orderedRegularValidators))

return (
<>
Expand Down
130 changes: 126 additions & 4 deletions src/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@
"image": "https://raw.githubusercontent.com/osmosis-labs/assetlists/main/images/osmo.svg",
"gasPrice": "0uosmo",
"testAddress": "osmo1yxsmtnxdt6gxnaqrg0j0nudg7et2gqczed559y",
"ownerAddress": "osmovaloper1u5v0m74mql5nzfx2yh43s2tke4mvzghr6m2n5t",
"operators": [
{
"address": "osmovaloper1u5v0m74mql5nzfx2yh43s2tke4mvzghr6m2n5t",
"botAddress": "osmo1yxsmtnxdt6gxnaqrg0j0nudg7et2gqczed559y",
"runTime": "21:00",
"minimumReward": 1000
},
{
"address": "osmovaloper1vrw2c99yvu5t9gugzuj38w35vmhmazzgx7dckk",
"botAddress": "osmo1yl54sf2ekqsc7y7r33267vhc546trx3fwz6yld",
"runTime": "21:00",
"minimumReward": 1000
},
{
"address": "osmovaloper1md9f5524vtmrn64lyv2pdfn7cnkjkklf44vtjz",
"botAddress": "osmo1e44rluarkdw56dy2turnwjtvtg4wqvs06sx5ph",
Expand All @@ -46,6 +53,18 @@
"botAddress": "osmo195mm9y35sekrjk73anw2az9lv9xs5mztjduk29",
"runTime": "22:00",
"minimumReward": 10000
},
{
"address": "osmovaloper1u6jr0pztvsjpvx77rfzmtw49xwzu9kas05lk04",
"botAddress": "osmo1v9vae554q55xa4pcfdm0p3kv8nxn50jkjh5zmm",
"runTime": "23:00",
"minimumReward": 10000
},
{
"address": "osmovaloper1glmy88g0uf6vmw29pyxu3yq0pxpjqtzqr5e57n",
"botAddress": "osmo12xpq68caw2aqdu70jm4k792g0v9prhrpgc45k2",
"runTime": "22:00",
"minimumReward": 10000
}
],
"authzSupport": true
Expand Down Expand Up @@ -74,6 +93,12 @@
"runTime": "21:00",
"minimumReward": 10000
},
{
"address": "junovaloper10wxn2lv29yqnw2uf4jf439kwy5ef00qdelfp7r",
"botAddress": "juno1xs023g3yj2mavwn3cjclgsh8mlk0kgsjsvdd2e",
"runTime": "21:00",
"minimumReward": 1000
},
{
"address": "junovaloper193xl2tqh2tjkld2zv49ku5s44ee4qmgr65jcep",
"botAddress": "juno1e44rluarkdw56dy2turnwjtvtg4wqvs0yeklse",
Expand Down Expand Up @@ -103,6 +128,18 @@
"botAddress": "juno1l7je4yr3ffs6d8v6ck49fmueqqndvgpw79c8jp",
"runTime": "14:00",
"minimumReward": 10000
},
{
"address": "junovaloper1p0r4znp29547d8ra5k8t6ls0ztm3tj74ak38wz",
"botAddress": "juno1v9vae554q55xa4pcfdm0p3kv8nxn50jkv7yf24",
"runTime": "23:00",
"minimumReward": 10000
},
{
"address": "junovaloper1wd02ktcvpananlvd9u6jm3x3ap3vmw59jv9vez",
"botAddress": "juno12xpq68caw2aqdu70jm4k792g0v9prhrpk39l8y",
"runTime": "14:00",
"minimumReward": 10000
}
],
"authzSupport": true
Expand Down Expand Up @@ -131,6 +168,18 @@
"botAddress": "cosmos1eml7agwd5x084ennlg6apvskufzrlvnrks6h4e",
"runTime": "21:00",
"minimumReward": 10000
},
{
"address": "cosmosvaloper1fsg635n5vgc7jazz9sx5725wnc3xqgr7awxaag",
"botAddress": "cosmos1v9vae554q55xa4pcfdm0p3kv8nxn50jk6v8jdf",
"runTime": "23:00",
"minimumReward": 10000
},
{
"address": "cosmosvaloper140l6y2gp3gxvay6qtn70re7z2s0gn57zfd832j",
"botAddress": "cosmos12xpq68caw2aqdu70jm4k792g0v9prhrpqrxyqc",
"runTime": "21:00",
"minimumReward": 10000
}
],
"authzSupport": true
Expand Down Expand Up @@ -163,12 +212,31 @@
],
"image": "https://raw.githubusercontent.com/osmosis-labs/assetlists/main/images/akt.svg",
"testAddress": null,
"ownerAddress": "akashvaloper1xgnd8aach3vawsl38snpydkng2nv8a4kqgs8hf",
"operators": [
{
"address": "akashvaloper1xgnd8aach3vawsl38snpydkng2nv8a4kqgs8hf",
"botAddress": "akash1yxsmtnxdt6gxnaqrg0j0nudg7et2gqczud2r2v",
"runTime": "21:00",
"minimumReward": 10000
},
{
"address": "akashvaloper1qwpnhmdlfj6gfyh0e29fjudh0ytfe5l7tjttul",
"botAddress": "akash1yl54sf2ekqsc7y7r33267vhc546trx3ftzyns9",
"runTime": "21:00",
"minimumReward": 10000
},
{
"address": "akashvaloper1enhj36w6clcm5fjnp87jnffnkthfux2uj88l6h",
"botAddress": "akash1eml7agwd5x084ennlg6apvskufzrlvnrmthsvr",
"runTime": "21:00",
"minimumReward": 10000
},
{
"address": "akashvaloper140l6y2gp3gxvay6qtn70re7z2s0gn57ztqs903",
"botAddress": "akash12xpq68caw2aqdu70jm4k792g0v9prhrpdctrez",
"runTime": "21:00",
"minimumReward": 10000
}
],
"authzSupport": false
Expand All @@ -187,6 +255,7 @@
],
"image": "https://raw.githubusercontent.com/osmosis-labs/assetlists/main/images/huahua.png",
"gasPrice": "0.025uhuahua",
"ownerAddress": "chihuahuavaloper19vwcee000fhazmpt4ultvnnkhfh23ppwxll8zz",
"testAddress": "chihuahua1yxsmtnxdt6gxnaqrg0j0nudg7et2gqczjr22j5",
"operators": [
{
Expand All @@ -195,6 +264,12 @@
"runTime": "21:00",
"minimumReward": 1000
},
{
"address": "chihuahuavaloper10wxn2lv29yqnw2uf4jf439kwy5ef00qdqj3xsc",
"botAddress": "chihuahua1xs023g3yj2mavwn3cjclgsh8mlk0kgsj9trcv8",
"runTime": "21:00",
"minimumReward": 1000
},
{
"address": "chihuahuavaloper19vwcee000fhazmpt4ultvnnkhfh23ppwxll8zz",
"botAddress": "chihuahua1yxsmtnxdt6gxnaqrg0j0nudg7et2gqczjr22j5",
Expand All @@ -212,6 +287,18 @@
"botAddress": "chihuahua195mm9y35sekrjk73anw2az9lv9xs5mzterzga4",
"runTime": "22:00",
"minimumReward": 1000
},
{
"address": "chihuahuavaloper18jlk0pkpr8cnnpjtgu3dqxjvpvlnj6r4e2dtvf",
"botAddress": "chihuahua1v9vae554q55xa4pcfdm0p3kv8nxn50jkee2uvt",
"runTime": "23:00",
"minimumReward": 1000
},
{
"address": "chihuahuavaloper140l6y2gp3gxvay6qtn70re7z2s0gn57zum7h5l",
"botAddress": "chihuahua12xpq68caw2aqdu70jm4k792g0v9prhrprkt2p6",
"runTime": "22:00",
"minimumReward": 1000
}
],
"authzSupport": false
Expand All @@ -234,7 +321,20 @@
],
"image": "https://raw.githubusercontent.com/Gravity-Bridge/Gravity-Docs/main/assets/Graviton-Blue.svg",
"testAddress": "gravity1yxsmtnxdt6gxnaqrg0j0nudg7et2gqcz4x4uk7",
"operators": [],
"operators": [
{
"address": "gravityvaloper187reejg4et24jpggqt55vnc47l926w0p8w70mh",
"botAddress": "gravity1v9vae554q55xa4pcfdm0p3kv8nxn50jk7u42gp",
"runTime": "23:00",
"minimumReward": 1000
},
{
"address": "gravityvaloper140l6y2gp3gxvay6qtn70re7z2s0gn57zezczfa",
"botAddress": "gravity12xpq68caw2aqdu70jm4k792g0v9prhrpyn5u9s",
"runTime": "22:00",
"minimumReward": 1000
}
],
"authzSupport": true
},
{
Expand Down Expand Up @@ -347,7 +447,9 @@
"https://emoney.validator.network"
],
"image": "https://raw.githubusercontent.com/osmosis-labs/assetlists/main/images/ngm.svg",
"operators": [],
"operators": [

],
"authzSupport": false
},
{
Expand All @@ -363,7 +465,14 @@
"https://rpc.kava.io"
],
"image": "https://raw.githubusercontent.com/Kava-Labs/kava/master/kava-logo.svg",
"operators": [],
"operators": [
{
"address": "kavavaloper17jr6wyhm2twyph6d88l5ux945gwmf8vfkhckda",
"botAddress": "kava1avq4zm9cyrhc2cv9e4pn6p2l97y8aaucu0r733",
"runTime": "23:00",
"minimumReward": 1000
}
],
"authzSupport": false
},
{
Expand All @@ -386,6 +495,12 @@
"botAddress": "desmos1hcuv07593sxu4luumnh4dy2fujaxyh7xd9rya5",
"runTime": "22:00",
"minimumReward": 1000
},
{
"address": "desmosvaloper1r0emf6ap6y5advzgtsf4uz3g68p5t5484j4alp",
"botAddress": "desmos1nrt8va6he35w4vclr6sejkqpvsmr4vtas330me",
"runTime": "22:00",
"minimumReward": 1000
}
],
"authzSupport": true
Expand All @@ -405,7 +520,14 @@
"https://rpc-crypto-org.keplr.app"
],
"image": "https://raw.githubusercontent.com/osmosis-labs/assetlists/main/images/cro.png",
"operators": [],
"operators": [
{
"address": "crocncl15m2ae4c2ajpkz6hw0d4ucvwfyuwq8ns5z369u8",
"botAddress": "cro1lwh80rs0m3rz5qrar46jz72eg8ykakukz7tdmc",
"runTime": "23:00",
"minimumReward": 1000
}
],
"authzSupport": true
}
]

0 comments on commit a88f202

Please sign in to comment.