Skip to content

Commit

Permalink
Merge pull request #246 from eoscostarica/fix/hide-current-supply
Browse files Browse the repository at this point in the history
Current supply
  • Loading branch information
xavier506 authored Nov 3, 2020
2 parents 83a81a2 + 7251b35 commit 4268a81
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/routes/Evodex/BackLayer/Liquidity/LiquidityBackLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,11 @@ const LiquidityBackLayer = ({

const getCurrentSupply = useCallback(async () => {
const currentSupply = await evolutiondex.getCurrentSupply(
ual,
youGive.selectValue
)

setCurrentSupplyValue(currentSupply)
}, [ual, youGive.selectValue])
}, [youGive.selectValue])

useEffect(() => {
getCurrentSupply()
Expand Down
9 changes: 9 additions & 0 deletions src/utils/eosapi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import EosApi from 'eosjs-api'

const eosApi = EosApi({
httpEndpoint: `${process.env.REACT_APP_EOS_API_PROTOCOL}://${process.env.REACT_APP_EOS_API_HOST}:${process.env.REACT_APP_EOS_API_PORT}`,
verbose: false,
fetchConfiguration: {}
})

export default eosApi
12 changes: 5 additions & 7 deletions src/utils/evolutiondex.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as eosCommon from 'eos-common'
import { JsonRpc } from 'eosjs'

import { evodexConfig } from '../config'

import { getScatterError } from './getScatterError'
import axiosUtil from './axios.util'

import { JsonRpc } from 'eosjs'
import eosApi from './eosapi'

const { asset, number_to_asset: numberToAsset } = eosCommon
const defaultState = { pairs: [], tokens: [] }
Expand Down Expand Up @@ -620,14 +620,12 @@ const voteFee = async (amount, pair, ual) => {
}
}

const getCurrentSupply = async (ual, pool) => {
if (!ual.activeUser || !pool) {
const getCurrentSupply = async (pool) => {
if (!pool) {
return
}

const rpc = getRpc(ual)

const { rows } = await rpc.get_table_rows({
const { rows } = await eosApi.getTableRows({
json: true,
code: 'evolutiondex',
scope: pool,
Expand Down

0 comments on commit 4268a81

Please sign in to comment.