diff --git a/src/actions/accounts/index.js b/src/actions/accounts/index.js index 2cb8d56..9a38ece 100644 --- a/src/actions/accounts/index.js +++ b/src/actions/accounts/index.js @@ -65,7 +65,7 @@ export const getDelegations = (address) => (dispatch) => { }, }) .then((res) => { - dispatch(fetchDelegationsSuccess(res.data && res.data.result)); + dispatch(fetchDelegationsSuccess(res.data && res.data.delegation_responses)); }) .catch((error) => { dispatch(fetchDelegationsError( @@ -107,7 +107,7 @@ export const getBalance = (address) => (dispatch) => { }, }) .then((res) => { - dispatch(fetchBalanceSuccess(res.data && res.data.result)); + dispatch(fetchBalanceSuccess(res.data && res.data.balances)); }) .catch((error) => { dispatch(fetchBalanceError( @@ -203,7 +203,7 @@ export const getUnBondingDelegations = (address) => (dispatch) => { }, }) .then((res) => { - dispatch(fetchUnBondingDelegationsSuccess(res.data && res.data.result)); + dispatch(fetchUnBondingDelegationsSuccess(res.data && res.data.unbonding_responses)); }) .catch((error) => { dispatch(fetchUnBondingDelegationsError( @@ -252,7 +252,7 @@ export const fetchRewards = (address) => (dispatch) => { }, }) .then((res) => { - dispatch(fetchRewardsSuccess(res.data && res.data.result)); + dispatch(fetchRewardsSuccess(res.data)); }) .catch((error) => { dispatch(fetchRewardsError( diff --git a/src/actions/stake.js b/src/actions/stake.js index ea18c96..89c31af 100644 --- a/src/actions/stake.js +++ b/src/actions/stake.js @@ -59,7 +59,7 @@ export const getValidators = (cb) => (dispatch) => { }, }) .then((res) => { - dispatch(fetchValidatorsSuccess(res.data && res.data.result)); + dispatch(fetchValidatorsSuccess(res.data && res.data.validators)); cb(res.data && res.data.result); }) .catch((error) => { @@ -182,7 +182,7 @@ export const getValidatorDetails = (address, cb) => (dispatch) => { }, }) .then((res) => { - dispatch(fetchValidatorSuccess(res.data && res.data.result)); + dispatch(fetchValidatorSuccess(res.data && res.data.validators)); cb(res.data && res.data.result); }) .catch((error) => { @@ -226,7 +226,7 @@ export const getDelegatedValidatorsDetails = (address) => (dispatch) => { }, }) .then((res) => { - dispatch(fetchDelegatedValidatorsSuccess(res.data && res.data.result)); + dispatch(fetchDelegatedValidatorsSuccess(res.data && res.data.validators)); }) .catch((error) => { dispatch(fetchDelegatedValidatorsError( diff --git a/src/constants/url.js b/src/constants/url.js index 93e50d7..f7d2b56 100644 --- a/src/constants/url.js +++ b/src/constants/url.js @@ -3,20 +3,20 @@ import { config } from '../config'; export const REST_URL = config.REST_URL; export const RPC_URL = config.RPC_URL; -export const urlFetchDelegations = (address) => `${REST_URL}/staking/delegators/${address}/delegations`; -export const urlFetchBalance = (address) => `${REST_URL}/bank/balances/${address}`; -export const urlFetchVestingBalance = (address) => `${REST_URL}/auth/accounts/${address}`; -export const urlFetchUnBondingDelegations = (address) => `${REST_URL}/staking/delegators/${address}/unbonding_delegations`; +export const urlFetchDelegations = (address) => `${REST_URL}/cosmos/staking/v1beta1/delegations/${address}`; +export const urlFetchBalance = (address) => `${REST_URL}/cosmos/bank/v1beta1/balances/${address}`; +export const urlFetchVestingBalance = (address) => `${REST_URL}/cosmos/auth/v1beta1/accounts/${address}`; +export const urlFetchUnBondingDelegations = (address) => `${REST_URL}/cosmos/staking/v1beta1/delegators/${address}/unbonding_delegations`; -export const urlFetchRewards = (address) => `${REST_URL}/distribution/delegators/${address}/rewards`; -export const urlFetchVoteDetails = (proposalId, address) => `${REST_URL}/gov/proposals/${proposalId}/votes/${address}`; +export const urlFetchRewards = (address) => `${REST_URL}/cosmos/distribution/v1beta1/delegators/${address}/rewards`; +export const urlFetchVoteDetails = (proposalId, address) => `${REST_URL}/cosmos/gov/v1beta1/proposals/${proposalId}/votes/${address}`; -export const VALIDATORS_LIST_URL = `${REST_URL}/staking/validators`; -export const getValidatorURL = (address) => `${REST_URL}/staking/validators/${address}`; +export const VALIDATORS_LIST_URL = `${REST_URL}/cosmos/staking/v1beta1/validators?pagination.limit=1000`; +export const getValidatorURL = (address) => `${REST_URL}/cosmos/staking/v1beta1/validators/${address}`; export const PROPOSALS_LIST_URL = `${REST_URL}/cosmos/gov/v1beta1/proposals?pagination.limit=1000`; -export const getDelegatedValidatorsURL = (address) => `${REST_URL}/staking/delegators/${address}/validators`; -export const urlFetchProposalVotes = (id) => `${REST_URL}/gov/proposals/${id}/votes`; -export const urlFetchTallyDetails = (id) => `${REST_URL}/gov/proposals/${id}/tally`; -export const urlFetchProposalDetails = (id) => `${REST_URL}/txs?message.module=governance&submit_proposal.proposal_id=${id}`; +export const getDelegatedValidatorsURL = (address) => `${REST_URL}/cosmos/staking/v1beta1/delegators/${address}/validators`; +export const urlFetchProposalVotes = (id) => `${REST_URL}/cosmos/gov/v1beta1/proposals/${id}/votes`; +export const urlFetchTallyDetails = (id) => `${REST_URL}/cosmos/gov/v1beta1/proposals/${id}/tally`; +export const urlFetchProposalDetails = (id) => `${REST_URL}/cosmos/tx/v1beta1/txs?events=submit_proposal.proposal_id=${id}`; export const validatorImageURL = (id) => `https://keybase.io/_/api/1.0/user/lookup.json?fields=pictures&key_suffix=${id}`; diff --git a/src/containers/Proposals/Cards.js b/src/containers/Proposals/Cards.js index 2f40f34..8eea686 100644 --- a/src/containers/Proposals/Cards.js +++ b/src/containers/Proposals/Cards.js @@ -70,12 +70,11 @@ const Cards = (props) => { if (key === proposal.proposal_id) { if (props.proposalDetails[key] && props.proposalDetails[key][0] && - props.proposalDetails[key][0].tx && - props.proposalDetails[key][0].tx.value && - props.proposalDetails[key][0].tx.value.msg[0] && - props.proposalDetails[key][0].tx.value.msg[0].value && - props.proposalDetails[key][0].tx.value.msg[0].value.proposer) { - proposer = props.proposalDetails[key][0].tx.value.msg[0].value.proposer; + props.proposalDetails[key][0].body && + props.proposalDetails[key][0].body.messages && + props.proposalDetails[key][0].body.messages.length && + props.proposalDetails[key][0].body.messages[0].proposer) { + proposer = props.proposalDetails[key][0].body.messages[0].proposer; } } diff --git a/src/containers/Proposals/ProposalDialog/index.js b/src/containers/Proposals/ProposalDialog/index.js index aa458d6..7822eed 100644 --- a/src/containers/Proposals/ProposalDialog/index.js +++ b/src/containers/Proposals/ProposalDialog/index.js @@ -108,12 +108,12 @@ class ProposalDialog extends Component { if (this.props.proposal && key === this.props.proposal.proposal_id) { if (this.props.proposalDetails[key] && this.props.proposalDetails[key][0] && - this.props.proposalDetails[key][0].tx && - this.props.proposalDetails[key][0].tx.value && - this.props.proposalDetails[key][0].tx.value.msg[0] && - this.props.proposalDetails[key][0].tx.value.msg[0].value && - this.props.proposalDetails[key][0].tx.value.msg[0].value.proposer) { - proposer = this.props.proposalDetails[key][0].tx.value.msg[0].value.proposer; + this.props.proposalDetails[key][0].body && + this.props.proposalDetails[key][0].body.messages && + this.props.proposalDetails[key][0].body.messages.length && + this.props.proposalDetails[key][0].body.messages[0] && + this.props.proposalDetails[key][0].body.messages[0].proposer) { + proposer = this.props.proposalDetails[key][0].body.messages[0].proposer; } } @@ -205,7 +205,7 @@ class ProposalDialog extends Component {

Voting Status

+ this.props.proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD') ? 'vote_in_progress' : '')}>

YES ({this.VoteCalculation('yes')})

@@ -227,7 +227,10 @@ class ProposalDialog extends Component {

Type

{this.props.proposal && this.props.proposal.content && - this.props.proposal.content.type}

+ this.props.proposal.content.type + ? this.props.proposal.content.type + : this.props.proposal && this.props.proposal.content && this.props.proposal.content['@type'] + ? this.props.proposal.content['@type'] : null}

{this.props.proposal && (this.props.proposal.status === 2 || diff --git a/src/containers/Proposals/index.js b/src/containers/Proposals/index.js index e363acc..e353a31 100644 --- a/src/containers/Proposals/index.js +++ b/src/containers/Proposals/index.js @@ -22,9 +22,9 @@ const Proposals = (props) => { setActive(value); setFilter(value === null ? 2 - : value === 2 ? 3 - : value === 3 ? 2 - : value === 4 ? 4 : null); + : value === 2 ? 'PROPOSAL_STATUS_PASSED' + : value === 3 ? 'PROPOSAL_STATUS_VOTING_PERIOD' + : value === 4 ? 'PROPOSAL_STATUS_REJECTED' : null); }; const filteredProposals = filter ? props.proposals.filter((item) => item.status === filter) : props.proposals; diff --git a/src/containers/Stake/Table.js b/src/containers/Stake/Table.js index 9497d23..3769e11 100644 --- a/src/containers/Stake/Table.js +++ b/src/containers/Stake/Table.js @@ -66,12 +66,16 @@ class Table extends Component { customBodyRender: (value) => (
- {value.status === 1 ? 'unbonded' - : value.status === 2 ? 'unbonding' - : value.status === 3 ? 'active' : ''} + title={value.status === 'BOND_STATUS_UNBONDED' ? 'unbonded' + : value.status === 'BOND_STATUS_UNBONDING' ? 'unbonding' + : value.status === 'BOND_STATUS_BONDED' ? 'active' + : value.status === 'BOND_STATUS_UNSPECIFIED' ? 'invalid' + : ''}> + {value.status === 'BOND_STATUS_UNBONDED' ? 'unbonded' + : value.status === 'BOND_STATUS_UNBONDING' ? 'unbonding' + : value.status === 'BOND_STATUS_BONDED' ? 'active' + : value.status === 'BOND_STATUS_UNSPECIFIED' ? 'invalid' + : ''}
), }, diff --git a/src/defaultGasValues.js b/src/defaultGasValues.js index dfcea19..85b636f 100644 --- a/src/defaultGasValues.js +++ b/src/defaultGasValues.js @@ -1,7 +1,7 @@ export const gas = { send: 80000, vote: 80000, - delegate: 180000, + delegate: 200000, un_delegate: 200000, re_delegate: 300000, claim_reward: 140000,