diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..5dcc031c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,42 @@ +name: deploy +on: + push: + branches: [ "chihuahua" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + DEPLOY_DIR: /var/www/insync-chihuahua + + + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build-and-deploy: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: login to remote instance and build app + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.INSYNC_DEV_SSH_SERVER }} + username: ${{ secrets.INSYNC_DEV_SSH_USER }} + key: ${{ secrets.INSYNC_DEV_SSH_KEY }} + port: ${{ secrets.PORT }} + envs: GITHUB_REPOSITORY,DEPLOY_DIR + script: | + [ -d "$HOME/$GITHUB_REPOSITORY" ] && rm -rf "$HOME/$GITHUB_REPOSITORY" + mkdir -p "$HOME/$GITHUB_REPOSITORY" + git clone https://github.com/$GITHUB_REPOSITORY "$HOME/$GITHUB_REPOSITORY" + cd "$HOME/$GITHUB_REPOSITORY" + git checkout chihuahua && + git pull origin chihuahua && + yarn && + yarn build && + sudo rm -rf "${DEPLOY_DIR}" && + sudo mkdir -p "${DEPLOY_DIR}" && + sudo mv ./build/ "${DEPLOY_DIR}" diff --git a/public/assets/logos/og_image.png b/public/assets/logos/og_image.png new file mode 100644 index 00000000..ea2a24c2 Binary files /dev/null and b/public/assets/logos/og_image.png differ diff --git a/public/index.html b/public/index.html index bd869ab4..4de443a1 100644 --- a/public/index.html +++ b/public/index.html @@ -1,26 +1,37 @@ - OmniFlix | OmniFlix inSync + Celestia | OmniFlix inSync - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/src/actions/accounts/index.js b/src/actions/accounts/index.js index 6fa10a3a..9a38eceb 100644 --- a/src/actions/accounts/index.js +++ b/src/actions/accounts/index.js @@ -62,11 +62,10 @@ export const getDelegations = (address) => (dispatch) => { Axios.get(url, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { - dispatch(fetchDelegationsSuccess(res.data && res.data.result)); + dispatch(fetchDelegationsSuccess(res.data && res.data.delegation_responses)); }) .catch((error) => { dispatch(fetchDelegationsError( @@ -105,11 +104,10 @@ export const getBalance = (address) => (dispatch) => { Axios.get(url, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { - dispatch(fetchBalanceSuccess(res.data && res.data.result)); + dispatch(fetchBalanceSuccess(res.data && res.data.balances)); }) .catch((error) => { dispatch(fetchBalanceError( @@ -148,7 +146,6 @@ export const fetchVestingBalance = (address) => (dispatch) => { Axios.get(url, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { @@ -203,11 +200,10 @@ export const getUnBondingDelegations = (address) => (dispatch) => { Axios.get(url, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { - dispatch(fetchUnBondingDelegationsSuccess(res.data && res.data.result)); + dispatch(fetchUnBondingDelegationsSuccess(res.data && res.data.unbonding_responses)); }) .catch((error) => { dispatch(fetchUnBondingDelegationsError( @@ -253,11 +249,10 @@ export const fetchRewards = (address) => (dispatch) => { Axios.get(url, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { - dispatch(fetchRewardsSuccess(res.data && res.data.result)); + dispatch(fetchRewardsSuccess(res.data)); }) .catch((error) => { dispatch(fetchRewardsError( diff --git a/src/actions/proposals.js b/src/actions/proposals.js index 91507773..04e698cc 100644 --- a/src/actions/proposals.js +++ b/src/actions/proposals.js @@ -52,12 +52,11 @@ export const getProposals = (cb) => (dispatch) => { Axios.get(PROPOSALS_LIST_URL, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { - dispatch(fetchProposalsSuccess(res.data && res.data.result)); - cb(res.data && res.data.result); + dispatch(fetchProposalsSuccess(res.data && res.data.proposals)); + cb(res.data && res.data.proposals); }) .catch((error) => { dispatch(fetchProposalsError( @@ -98,7 +97,6 @@ export const getProposalVotes = (id) => (dispatch) => { Axios.get(url, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { @@ -155,7 +153,6 @@ export const fetchVoteDetails = (id, address) => (dispatch) => { Axios.get(url, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { @@ -200,7 +197,6 @@ export const fetchProposalTally = (id) => (dispatch) => { Axios.get(url, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { @@ -245,11 +241,10 @@ export const fetchProposalDetails = (id, cb) => (dispatch) => { Axios.get(url, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { - dispatch(fetchProposalDetailsSuccess(res.data && res.data.txs, id)); + dispatch(fetchProposalDetailsSuccess(res.data && res.data.proposal, id)); if (cb) { cb(res); } diff --git a/src/actions/stake.js b/src/actions/stake.js index 54f8ba1d..8ca904ac 100644 --- a/src/actions/stake.js +++ b/src/actions/stake.js @@ -56,12 +56,11 @@ export const getValidators = (cb) => (dispatch) => { Axios.get(VALIDATORS_LIST_URL, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { - dispatch(fetchValidatorsSuccess(res.data && res.data.result)); - cb(res.data && res.data.result); + dispatch(fetchValidatorsSuccess(res.data && res.data.validators)); + cb(res.data && res.data.validators); }) .catch((error) => { dispatch(fetchValidatorsError( @@ -180,11 +179,10 @@ export const getValidatorDetails = (address, cb) => (dispatch) => { Axios.get(URL, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { - dispatch(fetchValidatorSuccess(res.data && res.data.result)); + dispatch(fetchValidatorSuccess(res.data && res.data.validators)); cb(res.data && res.data.result); }) .catch((error) => { @@ -225,11 +223,10 @@ export const getDelegatedValidatorsDetails = (address) => (dispatch) => { Axios.get(URL, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { - dispatch(fetchDelegatedValidatorsSuccess(res.data && res.data.result)); + dispatch(fetchDelegatedValidatorsSuccess(res.data && res.data.validators)); }) .catch((error) => { dispatch(fetchDelegatedValidatorsError( @@ -287,7 +284,6 @@ export const fetchValidatorImage = (id) => (dispatch) => { return Axios.get(URL, { headers: { Accept: 'application/json, text/plain, */*', - Connection: 'keep-alive', }, }) .then((res) => { diff --git a/src/config.js b/src/config.js index 951326f1..56b40533 100644 --- a/src/config.js +++ b/src/config.js @@ -1,21 +1,23 @@ export const config = { - RPC_URL: 'https://rpc.chihuahua.wtf', - REST_URL: 'https://api.chihuahua.wtf', - EXPLORER_URL: 'https://www.mintscan.io/chihuahua', - STAKING_URL: 'https://chihuahua.omniflix.co/stake', - NETWORK_NAME: 'Chihuahua', + RPC_URL: 'https://public-celestia-rpc.numia.xyz', + REST_URL: 'https://public-celestia-lcd.numia.xyz', + EXPLORER_URL: 'https://www.mintscan.io/celestia', + STAKING_URL: 'https://celestia.omniflix.co/stake', + WALLET_URL: 'https://celestia.omniflix.co', + COIN_IMAGE_URL: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/celestia/images/celestia.png', + NETWORK_NAME: 'Celestia', NETWORK_TYPE: 'mainnet', - CHAIN_ID: 'chihuahua-1', - CHAIN_NAME: 'Chihuahua', - COIN_DENOM: 'HUAHUA', - COIN_MINIMAL_DENOM: 'uhuahua', + CHAIN_ID: 'celestia', + CHAIN_NAME: 'celestia', + COIN_DENOM: 'TIA', + COIN_MINIMAL_DENOM: 'utia', COIN_DECIMALS: 6, - PREFIX: 'chihuahua', + PREFIX: 'celestia', COIN_TYPE: 118, - COSMOSTAION: 'chihuahua', - COINGECKO_ID: 'chihuahua-token', - GAS_PRICE_STEP_LOW: 0.025, - GAS_PRICE_STEP_AVERAGE: 0.03, - GAS_PRICE_STEP_HIGH: 0.04, - FEATURES: ['ibc-transfer', 'ibc-go'], + COSMOSTAION: 'celestia', + COINGECKO_ID: 'celestia', + GAS_PRICE_STEP_LOW: 0.01, + GAS_PRICE_STEP_AVERAGE: 0.02, + GAS_PRICE_STEP_HIGH: 0.1, + // FEATURES: ['cosmwasm', 'ibc-transfer', 'ibc-go'], }; diff --git a/src/constants/url.js b/src/constants/url.js index af3bf45a..8c0dc4f4 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 PROPOSALS_LIST_URL = `${REST_URL}/gov/proposals`; -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 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/v1/proposals?pagination.limit=1000`; +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/gov/v1/proposals/${id}`; export const validatorImageURL = (id) => `https://keybase.io/_/api/1.0/user/lookup.json?fields=pictures&key_suffix=${id}`; diff --git a/src/containers/Home/index.js b/src/containers/Home/index.js index e01325a5..0b0ed1f5 100644 --- a/src/containers/Home/index.js +++ b/src/containers/Home/index.js @@ -67,7 +67,8 @@ class Home extends Component { render () { const { active } = this.state; - const filteredProposals = this.props.proposals && this.props.proposals.filter((item) => item.status === 2); + const filteredProposals = this.props.proposals && this.props.proposals.filter((item) => item.status === 2 || + item.status === 'PROPOSAL_STATUS_VOTING_PERIOD'); return ( <> diff --git a/src/containers/NavBar/ConnectDialog/index.js b/src/containers/NavBar/ConnectDialog/index.js index cc0f2888..5c7f9453 100644 --- a/src/containers/NavBar/ConnectDialog/index.js +++ b/src/containers/NavBar/ConnectDialog/index.js @@ -9,8 +9,9 @@ import ConnectButton from './KeplrConnectButton'; import CosmostationConnectButton from './CosmostationConnectButton'; import GetAppRoundedIcon from '@material-ui/icons/GetAppRounded'; import insync from '../../../assets/insync.png'; -import poweredBy from '../../../assets/powered_by.jpeg'; +// import poweredBy from '../../../assets/powered_by.jpeg'; import './index.css'; +import { config } from '../../../config'; const LightTooltip = withStyles((theme) => ({ tooltip: { @@ -45,7 +46,7 @@ const ConnectDialog = (props) => { -
+ {config.COSMOSTAION &&
{ -
+
} - - API/RPC powered by - notional - Notional - + {/* */} + {/* API/RPC powered by */} + {/* notional */} + {/* Notional */} + {/* */} ); diff --git a/src/containers/NavBar/index.js b/src/containers/NavBar/index.js index eab8ac7a..e35391b4 100644 --- a/src/containers/NavBar/index.js +++ b/src/containers/NavBar/index.js @@ -70,16 +70,16 @@ class NavBar extends Component { const array = []; result.map((val) => { const filter = this.props.proposalDetails && Object.keys(this.props.proposalDetails).length && - Object.keys(this.props.proposalDetails).find((key) => key === val.id); + Object.keys(this.props.proposalDetails).find((key) => key === val.proposal_id); if (!filter) { - if (this.props.home && val.status !== 2) { + if (this.props.home && (val.status !== 'PROPOSAL_STATUS_VOTING_PERIOD')) { return null; } - array.push(val.id); + array.push(val.proposal_id); } - if (val.status === 2) { - this.props.fetchProposalTally(val.id); + if (val.status === 2 || val.status === 'PROPOSAL_STATUS_VOTING_PERIOD') { + this.props.fetchProposalTally(val.proposal_id); } return null; @@ -93,16 +93,16 @@ class NavBar extends Component { const array = []; this.props.proposals.map((val) => { const filter = this.props.proposalDetails && Object.keys(this.props.proposalDetails).length && - Object.keys(this.props.proposalDetails).find((key) => key === val.id); + Object.keys(this.props.proposalDetails).find((key) => key === val.proposal_id); if (!filter) { - if (this.props.home && val.status !== 2) { + if (this.props.home && (val.status !== 'PROPOSAL_STATUS_VOTING_PERIOD')) { return null; } - array.push(val.id); + array.push(val.proposal_id); } - if (val.status === 2) { - this.props.fetchProposalTally(val.id); + if (val.status === 2 || val.status === 'PROPOSAL_STATUS_VOTING_PERIOD') { + this.props.fetchProposalTally(val.proposal_id); } return null; @@ -149,11 +149,12 @@ class NavBar extends Component { this.props.proposals && this.props.proposals.length) || ((pp.address !== this.props.address) && (pp.address === '') && (this.props.address !== ''))) { this.props.proposals.map((val) => { - const votedOption = this.props.voteDetails && this.props.voteDetails.length && val && val.id && - this.props.voteDetails.filter((vote) => vote.proposal_id === val.id)[0]; + const votedOption = this.props.voteDetails && this.props.voteDetails.length && val && val.proposal_id && + this.props.voteDetails.filter((vote) => vote.proposal_id === val.proposal_id)[0]; - if (val.status === 2 && !votedOption && this.props.address) { - this.props.fetchVoteDetails(val.id, this.props.address); + if ((val.status === 2 || val.status === 'PROPOSAL_STATUS_VOTING_PERIOD') && + !votedOption && this.props.address) { + this.props.fetchVoteDetails(val.proposal_id, this.props.address); } return null; @@ -167,17 +168,17 @@ class NavBar extends Component { const array = []; result.map((val) => { const filter = this.props.proposalDetails && Object.keys(this.props.proposalDetails).length && - Object.keys(this.props.proposalDetails).find((key) => key === val.id); + Object.keys(this.props.proposalDetails).find((key) => key === val.proposal_id); if (!filter) { - if (this.props.home && val.status !== 2) { + if (this.props.home && (val.status !== 'PROPOSAL_STATUS_VOTING_PERIOD')) { return null; } - array.push(val.id); + array.push(val.proposal_id); } - if (val.status === 2) { - this.props.fetchProposalTally(val.id); - this.props.fetchVoteDetails(val.id, this.props.address); + if (val.status === 2 || val.status === 'PROPOSAL_STATUS_VOTING_PERIOD') { + this.props.fetchProposalTally(val.proposal_id); + this.props.fetchVoteDetails(val.proposal_id, this.props.address); } return null; diff --git a/src/containers/Proposals/Cards.js b/src/containers/Proposals/Cards.js index df459859..998e168e 100644 --- a/src/containers/Proposals/Cards.js +++ b/src/containers/Proposals/Cards.js @@ -30,19 +30,19 @@ const Cards = (props) => { }).reverse(); const VoteCalculation = (proposal, val) => { - if (proposal.status === 2) { + if (proposal.status === 2 || proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD') { const value = props.tallyDetails && props.tallyDetails[proposal.id]; - const sum = value && value.yes && value.no && value.no_with_veto && value.abstain && - (parseInt(value.yes) + parseInt(value.no) + parseInt(value.no_with_veto) + parseInt(value.abstain)); + const sum = value && value.yes_count && value.no_count && value.no_with_veto_count && value.abstain_count && + (parseInt(value.yes_count) + parseInt(value.no_count) + parseInt(value.no_with_veto_count) + parseInt(value.abstain_count)); return (props.tallyDetails && props.tallyDetails[proposal.id] && props.tallyDetails[proposal.id][val] ? tally(props.tallyDetails[proposal.id][val], sum) : '0%'); } else { - const sum = proposal.final_tally_result && proposal.final_tally_result.yes && - proposal.final_tally_result.no && proposal.final_tally_result.no_with_veto && - proposal.final_tally_result.abstain && - (parseInt(proposal.final_tally_result.yes) + parseInt(proposal.final_tally_result.no) + - parseInt(proposal.final_tally_result.no_with_veto) + parseInt(proposal.final_tally_result.abstain)); + const sum = proposal.final_tally_result && proposal.final_tally_result.yes_count && + proposal.final_tally_result.no_count && proposal.final_tally_result.no_with_veto_count && + proposal.final_tally_result.abstain_count && + (parseInt(proposal.final_tally_result.yes_count) + parseInt(proposal.final_tally_result.no_count) + + parseInt(proposal.final_tally_result.no_with_veto_count) + parseInt(proposal.final_tally_result.abstain_count)); return (proposal && proposal.final_tally_result && proposal.final_tally_result[val] @@ -63,19 +63,18 @@ const Cards = (props) => { if (index < (page * rowsPerPage) && index >= (page - 1) * rowsPerPage) { const votedOption = props.voteDetails && props.voteDetails.length && proposal && proposal.id && - props.voteDetails.filter((vote) => vote.proposal_id === proposal.id)[0]; + props.voteDetails.filter((vote) => vote.id === proposal.id)[0]; let proposer = proposal.proposer; props.proposalDetails && Object.keys(props.proposalDetails).length && Object.keys(props.proposalDetails).filter((key) => { if (key === 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; } } @@ -95,12 +94,12 @@ const Cards = (props) => {

props.handleShow(proposal)}> { - proposal.content && proposal.content.value && - proposal.content.value.title + proposal.title }

- {proposal.status === 3 + {proposal.status === 3 || proposal.status === 'PROPOSAL_STATUS_PASSED' ? - : proposal.status === 2 && votedOption + : (proposal.status === 2 || proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD') && + votedOption ?

your vote is taken: {votedOption && votedOption.option === 1 ? 'Yes' @@ -115,7 +114,7 @@ const Cards = (props) => { Details

- : proposal.status === 2 + : proposal.status === 2 || proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD' ? : null}
-

{proposal.content && proposal.content.value && - proposal.content.value.description}

+

{proposal.summary}

@@ -154,36 +152,44 @@ const Cards = (props) => {

-

Proposal Status: { - proposal.status === 0 ? 'Nil' - : proposal.status === 1 ? 'DepositPeriod' - : proposal.status === 2 ? 'VotingPeriod' - : proposal.status === 3 ? 'Passed' - : proposal.status === 4 ? 'Rejected' - : proposal.status === 5 ? 'Failed' : '' + proposal.status === 0 || + proposal.status === 'PROPOSAL_STATUS_UNSPECIFIED' ? 'Nil' + : proposal.status === 1 || + proposal.status === 'PROPOSAL_STATUS_DEPOSIT_PERIOD' ? 'DepositPeriod' + : proposal.status === 2 || + proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD' ? 'VotingPeriod' + : proposal.status === 3 || + proposal.status === 'PROPOSAL_STATUS_PASSED' ? 'Passed' + : proposal.status === 4 || + proposal.status === 'PROPOSAL_STATUS_REJECTED' ? 'Rejected' + : proposal.status === 5 || + proposal.status === 'PROPOSAL_STATUS_FAILED' ? 'Failed' : '' }

-

YES ({VoteCalculation(proposal, 'yes')})

+

YES ({VoteCalculation(proposal, 'yes_count')})

-

NO ({VoteCalculation(proposal, 'no')})

+

NO ({VoteCalculation(proposal, 'no_count')})

-

NoWithVeto ({VoteCalculation(proposal, 'no_with_veto')})

+

NoWithVeto ({VoteCalculation(proposal, 'no_with_veto_count')})

-

Abstain ({VoteCalculation(proposal, 'abstain')})

+

Abstain ({VoteCalculation(proposal, 'abstain_count')})

diff --git a/src/containers/Proposals/ProposalDialog/index.js b/src/containers/Proposals/ProposalDialog/index.js index 4e8997ed..095fbd4e 100644 --- a/src/containers/Proposals/ProposalDialog/index.js +++ b/src/containers/Proposals/ProposalDialog/index.js @@ -38,7 +38,7 @@ class ProposalDialog extends Component { componentDidMount () { const votedOption = this.props.voteDetails && this.props.voteDetails.length && this.props.proposal && this.props.proposal.id && - this.props.voteDetails.filter((vote) => vote.proposal_id === this.props.proposal.id)[0]; + this.props.voteDetails.filter((vote) => vote.id === this.props.proposal.id)[0]; if (!votedOption && this.props.proposal && this.props.proposal.id && this.props.address) { this.props.fetchVoteDetails(this.props.proposal.id, this.props.address); @@ -50,7 +50,7 @@ class ProposalDialog extends Component { if (result && result.length) { const proposal = result.find((val) => val.id === this.props.match.params.proposalID); this.props.showProposalDialog(proposal); - if (proposal && proposal.status === 2) { + if (proposal && (proposal.status === 2 || proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD')) { this.props.fetchProposalTally(proposal.id); } } @@ -72,19 +72,19 @@ class ProposalDialog extends Component { VoteCalculation (val) { const { proposal } = this.props; - if (proposal && proposal.status === 2) { + if (proposal && (proposal.status === 2 || proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD')) { const value = this.props.tallyDetails && this.props.tallyDetails[proposal.id]; - const sum = value && value.yes && value.no && value.no_with_veto && value.abstain && - (parseInt(value.yes) + parseInt(value.no) + parseInt(value.no_with_veto) + parseInt(value.abstain)); + const sum = value && value.yes_count && value.no_count && value.no_with_veto_count && value.abstain_count && + (parseInt(value.yes_count) + parseInt(value.no_count) + parseInt(value.no_with_veto_count) + parseInt(value.abstain_count)); return (this.props.tallyDetails && this.props.tallyDetails[proposal.id] && this.props.tallyDetails[proposal.id][val] ? tally(this.props.tallyDetails[proposal.id][val], sum) : '0%'); } else { - const sum = proposal && proposal.final_tally_result && proposal.final_tally_result.yes && - proposal.final_tally_result.no && proposal.final_tally_result.no_with_veto && - proposal.final_tally_result.abstain && - (parseInt(proposal.final_tally_result.yes) + parseInt(proposal.final_tally_result.no) + - parseInt(proposal.final_tally_result.no_with_veto) + parseInt(proposal.final_tally_result.abstain)); + const sum = proposal && proposal.final_tally_result && proposal.final_tally_result.yes_count && + proposal.final_tally_result.no_count && proposal.final_tally_result.no_with_veto_count && + proposal.final_tally_result.abstain_count && + (parseInt(proposal.final_tally_result.yes_count) + parseInt(proposal.final_tally_result.no_count) + + parseInt(proposal.final_tally_result.no_with_veto_count) + parseInt(proposal.final_tally_result.abstain_count)); return (proposal && proposal.final_tally_result && proposal.final_tally_result[val] @@ -100,7 +100,7 @@ class ProposalDialog extends Component { render () { let votedOption = this.props.voteDetails && this.props.voteDetails.length && this.props.proposal && this.props.proposal.id && - this.props.voteDetails.filter((vote) => vote.proposal_id === this.props.proposal.id)[0]; + this.props.voteDetails.filter((vote) => vote.id === this.props.proposal.id)[0]; let proposer = this.props.proposal && this.props.proposal.proposer; this.props.proposalDetails && Object.keys(this.props.proposalDetails).length && @@ -108,12 +108,12 @@ class ProposalDialog extends Component { if (this.props.proposal && key === this.props.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; } } @@ -124,6 +124,8 @@ class ProposalDialog extends Component { votedOption = votedOption.options[0]; } + const content = this.props.proposal && this.props.proposal.messages && this.props.proposal.messages[0] && this.props.proposal.messages[0].content; + return (
@@ -139,28 +141,34 @@ class ProposalDialog extends Component {
{this.props.proposal && this.props.proposal.content && - this.props.proposal.content.value && this.props.proposal.content.value.title}
+ className="proposal_dialog_section1_header">{this.props.proposal && this.props.proposal.title}
Proposal Status:  {this.props.proposal && this.props.proposal.status - ? this.props.proposal.status === 0 ? 'Nil' - : this.props.proposal.status === 1 ? 'DepositPeriod' - : this.props.proposal.status === 2 ? 'VotingPeriod' - : this.props.proposal.status === 3 ? 'Passed' - : this.props.proposal.status === 4 ? 'Rejected' - : this.props.proposal.status === 5 ? 'Failed' : '' + ? this.props.proposal.status === 0 || + this.props.proposal.status === 'PROPOSAL_STATUS_UNSPECIFIED' ? 'Nil' + : this.props.proposal.status === 1 || + this.props.proposal.status === 'PROPOSAL_STATUS_DEPOSIT_PERIOD' ? 'DepositPeriod' + : this.props.proposal.status === 2 || + this.props.proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD' ? 'VotingPeriod' + : this.props.proposal.status === 3 || + this.props.proposal.status === 'PROPOSAL_STATUS_PASSED' ? 'Passed' + : this.props.proposal.status === 4 || + this.props.proposal.status === 'PROPOSAL_STATUS_REJECTED' ? 'Rejected' + : this.props.proposal.status === 5 || + this.props.proposal.status === 'PROPOSAL_STATUS_FAILED' ? 'Failed' : '' : ''}
-                                        {this.props.proposal && this.props.proposal.content &&
-                                this.props.proposal.content.value && this.props.proposal.content.value.description}
+                                        {this.props.proposal && this.props.proposal.summary}
                                     

Voting Status

+ this.props.proposal && (this.props.proposal.status === 2 || + this.props.proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD') ? 'vote_in_progress' : '')}>
-

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

+

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

-

NO ({this.VoteCalculation('no')})

+

NO ({this.VoteCalculation('no_count')})

-

NoWithVeto ({this.VoteCalculation('no_with_veto')})

+

NoWithVeto ({this.VoteCalculation('no_with_veto_count')})

-

Abstain ({this.VoteCalculation('abstain')})

+

Abstain ({this.VoteCalculation('abstain_count')})

Type

-

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

+

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

- {this.props.proposal && this.props.proposal.status === 2 && !this.props.voteDetailsInProgress + {this.props.proposal && (this.props.proposal.status === 2 || + this.props.proposal.status === 'PROPOSAL_STATUS_VOTING_PERIOD') && !this.props.voteDetailsInProgress ? : null} @@ -281,7 +293,7 @@ ProposalDialog.propTypes = { proposalsInProgress: PropTypes.bool, votes: PropTypes.arrayOf( PropTypes.shape({ - proposal_id: PropTypes.string.isRequired, + id: PropTypes.string.isRequired, voter: PropTypes.string.isRequired, option: PropTypes.number, }), diff --git a/src/containers/Proposals/index.js b/src/containers/Proposals/index.js index e363accb..e353a31f 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/DelegateDialog/SuccessDialog.js b/src/containers/Stake/DelegateDialog/SuccessDialog.js index dfadbece..5dee6937 100644 --- a/src/containers/Stake/DelegateDialog/SuccessDialog.js +++ b/src/containers/Stake/DelegateDialog/SuccessDialog.js @@ -12,7 +12,7 @@ import { withRouter } from 'react-router-dom'; const SuccessDialog = (props) => { const handleRedirect = () => { if (config.EXPLORER_URL) { - const link = `${config.EXPLORER_URL}/transactions/${props.hash}`; + const link = `${config.EXPLORER_URL}/txs/${props.hash}`; window.open(link, '_blank'); } }; diff --git a/src/containers/Stake/Table.js b/src/containers/Stake/Table.js index 9497d23e..3769e116 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 786999d1..6f41e5c7 100644 --- a/src/defaultGasValues.js +++ b/src/defaultGasValues.js @@ -1,8 +1,8 @@ export const gas = { - send: 80000, - vote: 80000, - delegate: 160000, - un_delegate: 200000, - re_delegate: 300000, - claim_reward: 140000, + send: 150000, + vote: 150000, + delegate: 250000, + un_delegate: 300000, + re_delegate: 350000, + claim_reward: 250000, }; diff --git a/src/helper.js b/src/helper.js index c61c54a0..edae05dd 100644 --- a/src/helper.js +++ b/src/helper.js @@ -22,6 +22,7 @@ const chainConfig = { coinMinimalDenom, coinDecimals, coinGeckoId, + coinImageUrl: config.COIN_IMAGE_URL, }, bip44: { coinType: 118, @@ -40,6 +41,7 @@ const chainConfig = { coinMinimalDenom, coinDecimals, coinGeckoId, + coinImageUrl: config.COIN_IMAGE_URL, }, ], feeCurrencies: [ @@ -48,16 +50,22 @@ const chainConfig = { coinMinimalDenom, coinDecimals, coinGeckoId, + coinImageUrl: config.COIN_IMAGE_URL, + gasPriceStep: { + low: config.GAS_PRICE_STEP_LOW, + average: config.GAS_PRICE_STEP_AVERAGE, + high: config.GAS_PRICE_STEP_HIGH, + }, }, ], coinType: config.COIN_TYPE, - gasPriceStep: { - low: config.GAS_PRICE_STEP_LOW, - average: config.GAS_PRICE_STEP_AVERAGE, - high: config.GAS_PRICE_STEP_HIGH, - }, features: config.FEATURES, + walletUrl: config.WALLET_URL, walletUrlForStaking: config.STAKING_URL, + txExplorer: { + name: 'Mintscan', + txUrl: `${config.EXPLORER_URL}/txs/{txHash}`, + }, }; export const initializeChain = (cb) => { @@ -131,7 +139,12 @@ export const signTxAndBroadcast = (tx, address, cb) => { cb(null, result); } }).catch((error) => { - cb(error && error.message); + const message = 'success'; + if (error && error.message === 'Invalid string. Length must be a multiple of 4') { + cb(null, message); + } else { + cb(error && error.message); + } }); })(); }; @@ -156,7 +169,12 @@ export const cosmoStationSign = (tx, address, cb) => { cb(null, result); } }).catch((error) => { - cb(error && error.message); + const message = 'success'; + if (error && error.message === 'Invalid string. Length must be a multiple of 4') { + cb(null, message); + } else { + cb(error && error.message); + } }); })(); }; diff --git a/src/reducers/snackbar.js b/src/reducers/snackbar.js index 59756ff0..c8920181 100644 --- a/src/reducers/snackbar.js +++ b/src/reducers/snackbar.js @@ -2,7 +2,6 @@ import { MESSAGE_SHOW, SNACKBAR_HIDE } from '../constants/snackbar'; import { BALANCE_FETCH_ERROR, DELEGATIONS_FETCH_ERROR, - REWARDS_FETCH_ERROR, UN_BONDING_DELEGATIONS_FETCH_ERROR, } from '../constants/accounts'; @@ -15,7 +14,6 @@ const snackbar = (state = { case DELEGATIONS_FETCH_ERROR: case BALANCE_FETCH_ERROR: case UN_BONDING_DELEGATIONS_FETCH_ERROR: - case REWARDS_FETCH_ERROR: return { open: true, message: action.message,