Skip to content

Commit

Permalink
Merge branch 'dev' into lacchain
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier506 committed May 3, 2021
2 parents 4295c15 + 7699dd3 commit 141182f
Show file tree
Hide file tree
Showing 26 changed files with 762 additions and 348 deletions.
1 change: 1 addition & 0 deletions .env.jungle
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ REACT_APP_EOS_USE_BP_JSON_ON_CHAIN=false
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT=producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE=producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE=producerjson
REACT_APP_TOKEN_SYMBOL=EOS
1 change: 1 addition & 0 deletions .env.lacchain
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ REACT_APP_EOS_USE_BP_JSON_ON_CHAIN=false
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT=producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE=producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE=producerjson
REACT_APP_TOKEN_SYMBOL=
1 change: 1 addition & 0 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ REACT_APP_EOS_USE_BP_JSON_ON_CHAIN=false
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT=producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE=producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE=producerjson
REACT_APP_TOKEN_SYMBOL=EOS
7 changes: 5 additions & 2 deletions .env.telostestnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ HASURA_GRAPHQL_ACTION_BASE_URL=http://hapi:9090

# hapi
HAPI_EOS_API_ENDPOINT=https://telos-testnet.eosio.cr
HAPI_EOS_API_CHAIN_ID=2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840
HAPI_EOS_API_CHAIN_ID=1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f
HAPI_EOS_BASE_ACCOUNT=eosmechatero
HAPI_EOS_BASE_ACCOUNT_PASSWORD=PW...
HAPI_EOS_MECHANICS_ACCOUNT=eosmechatero
# TODO: add value
HAPI_EOS_MECHANICS_PASSWORD=PW...
HAPI_EOS_WALLET_URL=http://localhost:9999
HAPI_EOS_EXCHANGE_RATE_API=https://api.coingecko.com/api/v3/simple/price?ids=telos&vs_currencies=usd
Expand All @@ -39,6 +40,7 @@ HAPI_SYNC_PRODUCERS_INTERVAL=86400
HAPI_SYNC_PRODUCER_INFO_INTERVAL=1
HAPI_SYNC_PRODUCER_CPU_INTERVAL=6
HAPI_SYNC_EXCHANGE_RATE=86400
HAPI_COINGECKO_API_TOKEN_ID=telos
HAPI_SYNC_STATS_INTERVAL=60

#webapp
Expand Down Expand Up @@ -66,4 +68,5 @@ REACT_APP_EOS_CHAIN_ID=1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f319
REACT_APP_EOS_USE_BP_JSON_ON_CHAIN=false
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT=producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE=producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE=producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE=producerjson
REACT_APP_TOKEN_SYMBOL=TLOS
14 changes: 8 additions & 6 deletions .github/workflows/push-dev-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
REACT_APP_NAME: $npm_package_name
REACT_APP_TITLE: EOS Jungle Testnet Network Dashboard
REACT_APP_DEFAULT_PRODUCER_LOGO: https://bloks.io/img/eosio.png
REACT_APP_FOOTER_LINKS: ""
REACT_APP_FOOTER_LINKS: ''
REACT_APP_EOS_RATE_LINK: https://jungle.eosrate.io:8080
REACT_APP_USE_REWARDS: true
REACT_APP_USE_VOTES: true
Expand All @@ -55,6 +55,7 @@ jobs:
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: producerjson
REACT_APP_TOKEN_SYMBOL: ${{ secrets.REACT_APP_TOKEN_SYMBOL }}

- name: Build kubernetes files
id: build_kubernetes_files
Expand All @@ -72,7 +73,7 @@ jobs:
REACT_APP_NAME: $npm_package_name
REACT_APP_TITLE: EOS Jungle Testnet Network Dashboard
REACT_APP_DEFAULT_PRODUCER_LOGO: https://bloks.io/img/eosio.png
REACT_APP_FOOTER_LINKS: ""
REACT_APP_FOOTER_LINKS: ''
REACT_APP_EOS_RATE_LINK: https://jungle.eosrate.io:8080
REACT_APP_USE_REWARDS: true
REACT_APP_USE_VOTES: true
Expand All @@ -90,6 +91,7 @@ jobs:
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: producerjson
REACT_APP_TOKEN_SYMBOL: ${{ secrets.REACT_APP_TOKEN_SYMBOL }}
# postgres
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
Expand All @@ -105,11 +107,11 @@ jobs:
HAPI_EOS_WALLET_URL: http://monitor-wallet:8888
HAPI_EOS_EXCHANGE_RATE_API: ${{ secrets.HAPI_EOS_EXCHANGE_RATE_API }}
HAPI_EOS_BP_JSON_ON_CHAIN: false
HAPI_EOS_BP_JSON_ON_CHAIN_CONTRACT: ""
HAPI_EOS_BP_JSON_ON_CHAIN_TABLE: ""
HAPI_EOS_BP_JSON_ON_CHAIN_SCOPE: ""
HAPI_EOS_BP_JSON_ON_CHAIN_CONTRACT: ''
HAPI_EOS_BP_JSON_ON_CHAIN_TABLE: ''
HAPI_EOS_BP_JSON_ON_CHAIN_SCOPE: ''
HAPI_HASURA_URL: http://monitor-hasura:8080/v1/graphql
HAPI_HASURA_ADMIN_SECRET: ${{ secrets.HAPI_HASURA_ADMIN_SECRET }}
HAPI_HASURA_ADMIN_SECRET: ${{ secrets.HAPI_HASURA_ADMIN_SECRET }}
HAPI_SERVER_PORT: 9090
HAPI_SERVER_ADDRESS: '0.0.0.0'
HAPI_SYNC_PRODUCERS_INTERVAL: 86400
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/push-lacchain-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: 'producerjson'
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: 'producerjson'
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: 'producerjson'
REACT_APP_TOKEN_SYMBOL: ${{ secrets.REACT_APP_TOKEN_SYMBOL }}

- name: Build and deploy kubernetes files
id: build_kubernetes_files
Expand Down Expand Up @@ -90,6 +91,7 @@ jobs:
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: 'producerjson'
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: 'producerjson'
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: 'producerjson'
REACT_APP_TOKEN_SYMBOL: ${{ secrets.REACT_APP_TOKEN_SYMBOL }}
# postgres
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
Expand Down
42 changes: 23 additions & 19 deletions .github/workflows/push-master-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
# Webapp

PORT: "80"
REACT_APP_TITLE: "EOS Mainnet Network Dashboard"
REACT_APP_DEFAULT_PRODUCER_LOGO: "https://bloks.io/img/eosio.png"
Expand All @@ -45,12 +46,13 @@ jobs:
REACT_APP_EOS_CHAIN_ID: "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
REACT_APP_EOS_DEFAULT_EXCHANGE_RATE: "2.50"
REACT_APP_EOS_DEFAULT_EXCHANGE_RATE_API: ${{ secrets.REACT_APP_EOS_DEFAULT_EXCHANGE_RATE_API }}
REACT_APP_EOS_USE_BP_JSON_ON_CHAIN: "false"
REACT_APP_EOS_USE_BP_JSON_ON_CHAIN: 'false'
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: ${{ secrets.REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT }}
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: ${{ secrets.REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE }}
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: ${{ secrets.REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE }}
REACT_APP_EOS_API_NETWORK_LABEL: "Mainnet"
REACT_APP_EOS_API_NETWORK_LOGO: "https://bloks.io/img/eosio.png"
REACT_APP_EOS_API_NETWORK_LABEL: 'Mainnet'
REACT_APP_EOS_API_NETWORK_LOGO: 'https://bloks.io/img/eosio.png'
REACT_APP_TOKEN_SYMBOL: ${{ secrets.REACT_APP_TOKEN_SYMBOL }}

- name: Build and deploy kubernetes files
id: build_kubernetes_files
Expand All @@ -63,6 +65,7 @@ jobs:
INGRESS_HOST: mainnet.eosio.cr
INGRESS_GRAPHQL_HOST: graphql-mainnet.eosio.cr
# Webapp

PORT: "80"
REACT_APP_TITLE: "EOS Mainnet Network Dashboard"
REACT_APP_DEFAULT_PRODUCER_LOGO: "https://bloks.io/img/eosio.png"
Expand All @@ -77,38 +80,39 @@ jobs:
REACT_APP_EOS_CHAIN_ID: "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
REACT_APP_EOS_DEFAULT_EXCHANGE_RATE: "2.50"
REACT_APP_EOS_DEFAULT_EXCHANGE_RATE_API: ${{ secrets.REACT_APP_EOS_DEFAULT_EXCHANGE_RATE_API }}
REACT_APP_EOS_USE_BP_JSON_ON_CHAIN: "false"
REACT_APP_EOS_USE_BP_JSON_ON_CHAIN: 'false'
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: ${{ secrets.REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT }}
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: ${{ secrets.REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE }}
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: ${{ secrets.REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE }}
REACT_APP_EOS_API_NETWORK_LABEL: "Mainnet"
REACT_APP_EOS_API_NETWORK_LOGO: "https://bloks.io/img/eosio.png"
REACT_APP_EOS_API_NETWORK_LABEL: 'Mainnet'
REACT_APP_EOS_API_NETWORK_LOGO: 'https://bloks.io/img/eosio.png'
REACT_APP_TOKEN_SYMBOL: ${{ secrets.REACT_APP_TOKEN_SYMBOL }}
# postgres
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
POSTGRES_DATA: ${{ secrets.POSTGRES_DATA }}
# hapi
HAPI_EOS_API_ENDPOINT: "https://api.eosio.cr"
HAPI_EOS_API_CHAIN_ID: "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473"
HAPI_EOS_API_ENDPOINT: 'https://api.eosio.cr'
HAPI_EOS_API_CHAIN_ID: 'e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473'
HAPI_EOS_BASE_ACCOUNT: ${{ secrets.HAPI_EOS_BASE_ACCOUNT }}
HAPI_EOS_BASE_ACCOUNT_PASSWORD: ${{ secrets.HAPI_EOS_BASE_ACCOUNT_PASSWORD }}
HAPI_EOS_MECHANICS_ACCOUNT: ${{ secrets.HAPI_EOS_MECHANICS_ACCOUNT }}
HAPI_EOS_MECHANICS_PASSWORD: ${{ secrets.HAPI_EOS_MECHANICS_PASSWORD }}
HAPI_EOS_WALLET_URL: http://monitor-wallet:8888
HAPI_EOS_BP_JSON_ON_CHAIN: "false"
HAPI_EOS_BP_JSON_ON_CHAIN_CONTRACT: ""
HAPI_EOS_BP_JSON_ON_CHAIN_TABLE: ""
HAPI_EOS_BP_JSON_ON_CHAIN_SCOPE: ""
HAPI_HASURA_URL: "http://monitor-hasura:8080/v1/graphql"
HAPI_EOS_BP_JSON_ON_CHAIN: 'false'
HAPI_EOS_BP_JSON_ON_CHAIN_CONTRACT: ''
HAPI_EOS_BP_JSON_ON_CHAIN_TABLE: ''
HAPI_EOS_BP_JSON_ON_CHAIN_SCOPE: ''
HAPI_HASURA_URL: 'http://monitor-hasura:8080/v1/graphql'
HAPI_HASURA_ADMIN_SECRET: ${{ secrets.HAPI_HASURA_ADMIN_SECRET }}
HAPI_SERVER_PORT: "9090"
HAPI_SERVER_ADDRESS: "0.0.0.0"
HAPI_SYNC_PRODUCERS_INTERVAL: "86400"
HAPI_SYNC_PRODUCER_INFO_INTERVAL: "1"
HAPI_SYNC_PRODUCER_CPU_INTERVAL: "6"
HAPI_SERVER_PORT: '9090'
HAPI_SERVER_ADDRESS: '0.0.0.0'
HAPI_SYNC_PRODUCERS_INTERVAL: '86400'
HAPI_SYNC_PRODUCER_INFO_INTERVAL: '1'
HAPI_SYNC_PRODUCER_CPU_INTERVAL: '6'
# hasura
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_ENABLE_CONSOLE: 'true'
HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }}
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: ${{ secrets.HASURA_GRAPHQL_UNAUTHORIZED_ROLE }}
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/push-telos-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,91 @@ jobs:
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: producerjson
REACT_APP_TOKEN_SYMBOL: ${{ secrets.REACT_APP_TOKEN_SYMBOL }}

- name: Build and deploy kubernetes files
id: build_kubernetes_files
run: |
make \
build-kubernetes
env:
# general
NAMESPACE: telos-dashboard
INGRESS_HOST: telos.testnet.dashboard.eosio.cr
INGRESS_GRAPHQL_HOST: graphql-telos.dashboard.eosio.cr
# webapp
PORT: 80
REACT_APP_VERSION: $npm_package_version
REACT_APP_NAME: $npm_package_name
REACT_APP_TITLE: Telos Testnet Network Dashboard
REACT_APP_DEFAULT_PRODUCER_LOGO: https://telos.bloks.io/img/chains/telos.png
REACT_APP_FOOTER_LINKS:
[
{ 'text': 'Website', 'src': '' },
{ 'text': 'Block Explorer', 'src': 'https://telos.bloks.io' },
{
'text': 'Developer Guidelines',
'src': 'https://guide.eoscostarica.io'
},
{
'text': 'GitHub',
'src': 'https://github.com/eoscostarica/eosio-dashboard'
}
]
REACT_APP_EOS_RATE_LINK: ''
REACT_APP_USE_REWARDS: true
REACT_APP_USE_VOTES: true
REACT_APP_USE_CPU_BENCHMARK: true
REACT_APP_USE_BLOCK_PRODUCER_AGREEMENT_CONTRACT: true
REACT_APP_HASURA_URL: https://graphql-testnet.eosio.cr/v1/graphql
REACT_APP_EOS_API_NETWORK_NAME: telos
REACT_APP_EOS_API_NETWORK_LABEL: Telos
REACT_APP_EOS_API_NETWORK_LOGO: https://telos.bloks.io/img/chains/telos.png
REACT_APP_EOS_API_HOST: telos-testnet.eosio.cr
REACT_APP_EOS_API_PORT: 443
REACT_APP_EOS_API_PROTOCOL: https
REACT_APP_EOS_CHAIN_ID: 1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f
REACT_APP_EOS_USE_BP_JSON_ON_CHAIN: false
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: producerjson
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: producerjson
REACT_APP_TOKEN_SYMBOL: ${{ secrets.REACT_APP_TOKEN_SYMBOL }}
# postgres
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
POSTGRES_DATA: ${{ secrets.POSTGRES_DATA }}
# hapi
HAPI_EOS_API_ENDPOINT: https://telos-testnet.eosio.cr
HAPI_EOS_API_CHAIN_ID: 1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f
HAPI_EOS_BASE_ACCOUNT: ${{ secrets.HAPI_EOS_BASE_ACCOUNT }}
HAPI_EOS_BASE_ACCOUNT_PASSWORD: ${{ secrets.HAPI_EOS_BASE_ACCOUNT_PASSWORD }}
HAPI_EOS_MECHANICS_ACCOUNT: ${{ secrets.HAPI_EOS_MECHANICS_ACCOUNT }}
HAPI_EOS_MECHANICS_PASSWORD: ${{ secrets.HAPI_EOS_MECHANICS_PASSWORD }}
HAPI_EOS_WALLET_URL: http://monitor-wallet:8888
HAPI_EOS_BP_JSON_ON_CHAIN: 'false'
HAPI_EOS_BP_JSON_ON_CHAIN_CONTRACT: producerjson
HAPI_EOS_BP_JSON_ON_CHAIN_TABLE: producerjson
HAPI_EOS_BP_JSON_ON_CHAIN_SCOPE: producerjson
HAPI_HASURA_URL: 'http://monitor-hasura:8080/v1/graphql'
HAPI_HASURA_ADMIN_SECRET: ${{ secrets.HAPI_HASURA_ADMIN_SECRET }}
HAPI_SERVER_PORT: '9090'
HAPI_SERVER_ADDRESS: '127.0.0.1'
HAPI_SYNC_PRODUCERS_INTERVAL: '86400'
HAPI_SYNC_PRODUCER_INFO_INTERVAL: '1'
HAPI_SYNC_PRODUCER_CPU_INTERVAL: '6'
# hasura
HASURA_GRAPHQL_ENABLE_CONSOLE: 'true'
HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }}
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: ${{ secrets.HASURA_GRAPHQL_UNAUTHORIZED_ROLE }}
HASURA_GRAPHQL_MIGRATIONS_DIR: /hasura-migrations

- name: Setup and deploy kubernetes environment
uses: steebchen/kubectl@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
NAMESPACE: jungle-dashboard
K8S_BUILD_DIR: build_k8s
with:
args: version && make deploy-kubernetes
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ services:
HAPI_SYNC_PRODUCERS_INTERVAL: '${HAPI_SYNC_PRODUCERS_INTERVAL}'
HAPI_SYNC_PRODUCER_INFO_INTERVAL: '${HAPI_SYNC_PRODUCER_INFO_INTERVAL}'
HAPI_SYNC_PRODUCER_CPU_INTERVAL: '${HAPI_SYNC_PRODUCER_CPU_INTERVAL}'
HAPI_COINGECKO_API_TOKEN_ID: '${HAPI_COINGECKO_API_TOKEN_ID}'
HAPI_SYNC_STATS_INTERVAL: '${HAPI_SYNC_STATS_INTERVAL}'
hasura:
container_name: '${STAGE}-${APP_NAME}-hasura'
Expand Down Expand Up @@ -102,3 +103,4 @@ services:
REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: '${REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT}'
REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: '${REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE}'
REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: '${REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE}'
REACT_APP_TOKEN_SYMBOL: '${REACT_APP_TOKEN_SYMBOL}'
1 change: 1 addition & 0 deletions hapi/src/config/eos.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
},
walletUrl: process.env.HAPI_EOS_WALLET_URL,
exchangeRateApi: process.env.HAPI_EOS_EXCHANGE_RATE_API,
coingeckoApiTokenId: process.env.HAPI_COINGECKO_API_TOKEN_ID,
bpJsonOnChain: process.env.HAPI_EOS_BP_JSON_ON_CHAIN === 'true',
bpJsonOnChainContract: process.env.HAPI_EOS_BP_JSON_ON_CHAIN_CONTRACT,
bpJsonOnChainTable: process.env.HAPI_EOS_BP_JSON_ON_CHAIN_TABLE,
Expand Down
6 changes: 3 additions & 3 deletions hapi/src/services/setting.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { hasuraUtil, axiosUtil } = require('../utils')

const UPSERT = `
mutation ($setting: setting_insert_input!) {
insert_setting(objects: [$setting], on_conflict: {constraint: setting_pkey, update_columns: [eos_price]}) {
insert_setting(objects: [$setting], on_conflict: {constraint: setting_pkey, update_columns: [token_price]}) {
affected_rows
}
}
Expand All @@ -18,12 +18,12 @@ const syncEOSPrice = async () => {

const { data } = await axiosUtil.instance.get(eosConfig.exchangeRateApi)

if (!data || !data.success) {
if (!data) {
return
}

await hasuraUtil.request(UPSERT, {
setting: { id: 1, eos_price: data.rates.EOS }
setting: { id: 1, token_price: data[eosConfig.coingeckoApiTokenId].usd }
})
} catch (error) {
console.error(error)
Expand Down
Loading

0 comments on commit 141182f

Please sign in to comment.