From 682e024f2d6c9ef31fd46e15825d17300c4b919b Mon Sep 17 00:00:00 2001 From: Xavier Fernandez Date: Sun, 23 Jun 2024 17:21:24 -0600 Subject: [PATCH 1/2] ci(github): update ci/cd library versions --- hapi/src/services/fioProducers.js | 84 +++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 hapi/src/services/fioProducers.js diff --git a/hapi/src/services/fioProducers.js b/hapi/src/services/fioProducers.js new file mode 100644 index 00000000..00605fba --- /dev/null +++ b/hapi/src/services/fioProducers.js @@ -0,0 +1,84 @@ +const axios = require('axios'); + +// FIO API endpoint (replace with the correct endpoint if needed) +const FIO_API_URL = 'https://testnet.fioprotocol.io/v1/chain/get_table_rows'; + +const getProducers = async () => { + let producers = []; + let totalVoteWeight; + let hasMore = true; + let nextKey; + + try { + while (hasMore) { + const response = await axios.post(FIO_API_URL, { + code: 'fio.system', // Contract name + table: 'producers', // Table name + scope: 'fio', // Scope + limit: 100, + json: true, + lower_bound: nextKey + }); + + if (response.status !== 200) { + throw new Error(`Request failed with status code ${response.status}`); + } + + const { + rows, + more, + total_producer_vote_weight: _totalVoteWeight + } = response.data; + + if (!rows) { + throw new Error('Response data does not contain rows'); + } + + hasMore = !!more; + nextKey = more; + totalVoteWeight = parseFloat(_totalVoteWeight); + producers.push(...rows); + } + } catch (error) { + console.error('PRODUCER SYNC ERROR', error.message); + return; + } + + producers = producers + .filter(producer => !!producer.is_active) + .sort((a, b) => { + if (parseFloat(a.total_votes) > parseFloat(b.total_votes)) { + return -1; + } + + if (parseFloat(a.total_votes) < parseFloat(b.total_votes)) { + return 1; + } + + return 0; + }); + + producers = producers.map((producer, index) => { + return { + id: producer.id, + owner: producer.owner, + fio_address: producer.fio_address, + total_votes: producer.total_votes, + total_votes_percent: producer.total_votes / totalVoteWeight, + total_votes_eos: producer.total_votes, + rank: index + 1, + producer_public_key: producer.producer_public_key, + url: producer.url, + unpaid_blocks: producer.unpaid_blocks, + last_claim_time: producer.last_claim_time, + location: producer.location, + is_active: !!producer.is_active + }; + }); + + console.log(producers); + return producers; +} + +// Call the function to test it +getProducers(); From d5ebb24575e6b7d86fda20e47bc11431e5abf8f5 Mon Sep 17 00:00:00 2001 From: Xavier Fernandez Date: Sun, 23 Jun 2024 17:22:01 -0600 Subject: [PATCH 2/2] fix(fio-testnet): update config params --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/deploy-airwire-testnet.yaml | 8 ++++---- .github/workflows/deploy-airwire.yaml | 8 ++++---- .github/workflows/deploy-fio-testnet.yaml | 6 +++--- .github/workflows/deploy-jungle-testnet.yaml | 8 ++++---- .github/workflows/deploy-lacchain.yaml | 8 ++++---- .github/workflows/deploy-libre-testnet.yaml | 8 ++++---- .github/workflows/deploy-libre.yaml | 8 ++++---- .github/workflows/deploy-mainnet.yaml | 8 ++++---- .github/workflows/deploy-telos-testnet.yaml | 8 ++++---- .github/workflows/deploy-telos.yaml | 8 ++++---- .github/workflows/deploy-ultra-testnet.yaml | 8 ++++---- .github/workflows/deploy-wax-testnet.yaml | 8 ++++---- .github/workflows/deploy-wax.yaml | 8 ++++---- .github/workflows/deploy-xpr-testnet.yaml | 8 ++++---- .github/workflows/deploy-xpr.yaml | 8 ++++---- {webapp/public => docs}/images/fio.png | Bin webapp/src/language/en/en.fio-testnet.json | 0 webapp/src/language/en/en.fio.json | 0 19 files changed, 60 insertions(+), 60 deletions(-) rename {webapp/public => docs}/images/fio.png (100%) create mode 100644 webapp/src/language/en/en.fio-testnet.json create mode 100644 webapp/src/language/en/en.fio.json diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7df02399..ce2d2c70 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/deploy-airwire-testnet.yaml b/.github/workflows/deploy-airwire-testnet.yaml index f19d67d4..3dec4226 100644 --- a/.github/workflows/deploy-airwire-testnet.yaml +++ b/.github/workflows/deploy-airwire-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: airwire-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-airwire.yaml b/.github/workflows/deploy-airwire.yaml index 62783f33..edf0af00 100644 --- a/.github/workflows/deploy-airwire.yaml +++ b/.github/workflows/deploy-airwire.yaml @@ -11,13 +11,13 @@ jobs: environment: airwire steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-fio-testnet.yaml b/.github/workflows/deploy-fio-testnet.yaml index 1072323d..d5b95470 100644 --- a/.github/workflows/deploy-fio-testnet.yaml +++ b/.github/workflows/deploy-fio-testnet.yaml @@ -45,7 +45,7 @@ jobs: REACT_APP_EOS_API_NETWORK_NAME: 'fio-testnet' REACT_APP_EOS_API_NETWORK_LABEL: 'FIO Testnet' REACT_APP_EOS_API_NETWORK_LOGO: 'https://antelope.tools/images/fio.png' - REACT_APP_EOS_API_HOSTS: '[\"fio-testnet.eosphere.io\"]' + REACT_APP_EOS_API_HOSTS: '[\"testnet.fioprotocol.io\",\"fio-testnet.eosphere.io\"]' REACT_APP_EOS_API_PORT: '443' REACT_APP_EOS_API_PROTOCOL: 'https' REACT_APP_EOS_CHAIN_ID: 'b20901380af44ef59c5918439a1f9a41d83669020319a80574b804a5f95cbd7e' @@ -81,8 +81,8 @@ jobs: POSTGRES_DATA: ${{ secrets.POSTGRES_DATA }} # hapi HAPI_EOS_API_NETWORK_NAME: fio-testnet - HAPI_EOS_API_ENDPOINTS: '["https://fio-testnet.eosphere.io"]' - HAPI_EOS_STATE_HISTORY_PLUGIN_ENDPOINT: 'ws://' + HAPI_EOS_API_ENDPOINTS: '["https://testnet.fioprotocol.io","https://fio-testnet.eosphere.io"]' + HAPI_EOS_STATE_HISTORY_PLUGIN_ENDPOINT: '' HAPI_EOS_MISSED_BLOCKS_ENABLED: 'false' HAPI_EOS_BLOCK_HISTORY_DAYS: 90 HAPI_EOS_MAX_CPU_BLOCK: 250000 diff --git a/.github/workflows/deploy-jungle-testnet.yaml b/.github/workflows/deploy-jungle-testnet.yaml index a925584a..854d4293 100644 --- a/.github/workflows/deploy-jungle-testnet.yaml +++ b/.github/workflows/deploy-jungle-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: jungle-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build new images and push diff --git a/.github/workflows/deploy-lacchain.yaml b/.github/workflows/deploy-lacchain.yaml index b3a652b1..9aebf796 100644 --- a/.github/workflows/deploy-lacchain.yaml +++ b/.github/workflows/deploy-lacchain.yaml @@ -11,13 +11,13 @@ jobs: environment: lacchain steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build new images and push diff --git a/.github/workflows/deploy-libre-testnet.yaml b/.github/workflows/deploy-libre-testnet.yaml index f0e81034..eae1322e 100644 --- a/.github/workflows/deploy-libre-testnet.yaml +++ b/.github/workflows/deploy-libre-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: libre-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-libre.yaml b/.github/workflows/deploy-libre.yaml index 58958bed..6824df16 100644 --- a/.github/workflows/deploy-libre.yaml +++ b/.github/workflows/deploy-libre.yaml @@ -11,13 +11,13 @@ jobs: environment: libre steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-mainnet.yaml b/.github/workflows/deploy-mainnet.yaml index 9a4e16b9..21a965d7 100644 --- a/.github/workflows/deploy-mainnet.yaml +++ b/.github/workflows/deploy-mainnet.yaml @@ -11,13 +11,13 @@ jobs: environment: mainnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build new images and push diff --git a/.github/workflows/deploy-telos-testnet.yaml b/.github/workflows/deploy-telos-testnet.yaml index 07bab71a..d446f367 100644 --- a/.github/workflows/deploy-telos-testnet.yaml +++ b/.github/workflows/deploy-telos-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: telos-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-telos.yaml b/.github/workflows/deploy-telos.yaml index 3d8d027f..d307db6c 100644 --- a/.github/workflows/deploy-telos.yaml +++ b/.github/workflows/deploy-telos.yaml @@ -11,13 +11,13 @@ jobs: environment: telos steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-ultra-testnet.yaml b/.github/workflows/deploy-ultra-testnet.yaml index 4d7a40c0..b72994bd 100644 --- a/.github/workflows/deploy-ultra-testnet.yaml +++ b/.github/workflows/deploy-ultra-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: ultra-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-wax-testnet.yaml b/.github/workflows/deploy-wax-testnet.yaml index 1f3b1d37..edc86370 100644 --- a/.github/workflows/deploy-wax-testnet.yaml +++ b/.github/workflows/deploy-wax-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: wax-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-wax.yaml b/.github/workflows/deploy-wax.yaml index 8a32273a..837537a4 100644 --- a/.github/workflows/deploy-wax.yaml +++ b/.github/workflows/deploy-wax.yaml @@ -11,13 +11,13 @@ jobs: environment: wax steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-xpr-testnet.yaml b/.github/workflows/deploy-xpr-testnet.yaml index 3c6dfb10..ce71dd08 100644 --- a/.github/workflows/deploy-xpr-testnet.yaml +++ b/.github/workflows/deploy-xpr-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: proton-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-xpr.yaml b/.github/workflows/deploy-xpr.yaml index eabe354e..173d5156 100644 --- a/.github/workflows/deploy-xpr.yaml +++ b/.github/workflows/deploy-xpr.yaml @@ -11,13 +11,13 @@ jobs: environment: proton steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/webapp/public/images/fio.png b/docs/images/fio.png similarity index 100% rename from webapp/public/images/fio.png rename to docs/images/fio.png diff --git a/webapp/src/language/en/en.fio-testnet.json b/webapp/src/language/en/en.fio-testnet.json new file mode 100644 index 00000000..e69de29b diff --git a/webapp/src/language/en/en.fio.json b/webapp/src/language/en/en.fio.json new file mode 100644 index 00000000..e69de29b