Compare commits

..
Author SHA1 Message Date
Dariusz Majcherczyk 6334b689b9 test: move closeWelcomeDialog 2023-05-19 19:04:53 +02:00
Dariusz Majcherczyk 7b06d8a770 test: added clearAllLocalStorage 2023-05-19 19:02:53 +02:00
Dariusz Majcherczyk 4ae721ebae test: skip one test 2023-05-19 17:56:17 +02:00
Dariusz Majcherczyk 11f9fcb307 test: skip node tests 2023-05-19 17:21:16 +02:00
231 changed files with 151226 additions and 4874 deletions
+3 -2
View File
@@ -14,7 +14,8 @@ What we need to achieve and who for
## Tasks ## Tasks
- [ ] - [ ] What do we need to do first
- [ ] - [ ] and then what?
- [ ] Etc.
## Additional details / background info ## Additional details / background info
+4 -7
View File
@@ -22,14 +22,11 @@ So that
## Tasks ## Tasks
- [ ] UX (if needed) - [ ] Explore and sketch
- [ ] Design (if needed)
- [ ] Team and stakeholder review - [ ] Team and stakeholder review
- [ ] Specs reviewed and created or adjusted - [ ] Visual Design
- [ ] Implementation - [ ] Team review
- [ ] Testing (unit and/or e2e) - [ ] Etc.
- [ ] Code review
- [ ] QA review
## Sketch ## Sketch
@@ -48,8 +48,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
id: ${{ github.event.release.id }} id: ${{ github.event.release.id }}
body: | body: |
---
___
# Deployments # Deployments
* https://explorer.vega.xyz * https://explorer.vega.xyz
@@ -61,7 +60,7 @@ jobs:
CIDv0: ${{ env.IPFS_V0 }} CIDv0: ${{ env.IPFS_V0 }}
CIDv1: ${{ env.IPFS_V1 }} CIDv1: ${{ env.IPFS_V1 }}
You can always access the latest IPFS release by visiting [console.vega.xyz](https://console.vega.xyz). You can always access the latest IPFS release by visiting [vega.trading](https://vega.trading).
You can also access Trading directly from an IPFS gateway. You can also access Trading directly from an IPFS gateway.
BEWARE: The Trading interface uses [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) to remember your settings, such as which tokens you have imported. You should always use an IPFS gateway that enforces [origin separation](https://ipfs.github.io/public-gateway-checker/). BEWARE: The Trading interface uses [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) to remember your settings, such as which tokens you have imported. You should always use an IPFS gateway that enforces [origin separation](https://ipfs.github.io/public-gateway-checker/).
+23 -43
View File
@@ -5,7 +5,6 @@ on:
branches: branches:
- release/* - release/*
- develop - develop
- main
tags: tags:
- v* - v*
pull_request: pull_request:
@@ -99,37 +98,36 @@ jobs:
# See affected apps # See affected apps
- name: See affected apps - name: See affected apps
run: | run: |
affected="$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects)"
branch_slug="$(echo '${{ github.head_ref || github.ref_name }}' | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | cut -c 1-50 )"
echo ">>>> debug" echo ">>>> debug"
echo "NX_BASE: ${{ env.NX_BASE }}" echo "NX_BASE: ${{ env.NX_BASE }}"
echo "NX_HEAD: ${{ env.NX_HEAD }}" echo "NX_HEAD: ${{ env.NX_HEAD }}"
echo "Affected: ${affected}"
echo "Branch slug: ${branch_slug}"
echo ">>>> eof debug" echo ">>>> eof debug"
affected="$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects)"
branch_slug="$(echo '${{ github.head_ref || github.ref_name }}' | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | cut -c 1-50 )"
projects_e2e="" projects_e2e=""
preview_governance="not deployed" preview_governance="not deployed"
preview_trading="not deployed" preview_trading="not deployed"
preview_explorer="not deployed" preview_explorer="not deployed"
if [[ $affected == *"governance"* ]]; then
projects_e2e+='"governance-e2e" '
preview_governance=$(printf "https://%s.%s.vega.rocks" "governance" "$branch_slug")
fi
if [[ $affected == *"trading"* ]]; then
projects_e2e+='"trading-e2e" '
preview_trading=$(printf "https://%s.%s.vega.rocks" "trading" "$branch_slug")
fi
if [[ $affected == *"explorer"* ]]; then
projects_e2e+='"explorer-e2e" '
preview_explorer=$(printf "https://%s.%s.vega.rocks" "explorer" "$branch_slug")
fi
if [[ -z "$projects_e2e" ]]; then if [[ -z "$projects_e2e" ]]; then
projects_e2e+='"governance-e2e" "trading-e2e" "explorer-e2e" ' projects_e2e+='"governance-e2e" "trading-e2e" "explorer-e2e" '
preview_governance=$(printf "https://%s.%s.vega.rocks" "governance" "$branch_slug") preview_governance=$(printf "https://%s.%s.vega.rocks" "governance" "$branch_slug")
preview_trading=$(printf "https://%s.%s.vega.rocks" "trading" "$branch_slug") preview_trading=$(printf "https://%s.%s.vega.rocks" "trading" "$branch_slug")
preview_explorer=$(printf "https://%s.%s.vega.rocks" "explorer" "$branch_slug") preview_explorer=$(printf "https://%s.%s.vega.rocks" "explorer" "$branch_slug")
else
if [[ $affected == *"governance"* ]]; then
projects_e2e+='"governance-e2e" '
preview_governance=$(printf "https://%s.%s.vega.rocks" "governance" "$branch_slug")
fi
if [[ $affected == *"trading"* ]]; then
projects_e2e+='"trading-e2e" '
preview_trading=$(printf "https://%s.%s.vega.rocks" "trading" "$branch_slug")
fi
if [[ $affected == *"explorer"* ]]; then
projects_e2e+='"explorer-e2e" '
preview_explorer=$(printf "https://%s.%s.vega.rocks" "explorer" "$branch_slug")
fi
fi fi
projects_e2e=${projects_e2e%?} projects_e2e=${projects_e2e%?}
projects_e2e=[${projects_e2e// /,}] projects_e2e=[${projects_e2e// /,}]
@@ -171,7 +169,6 @@ jobs:
- publish-dist - publish-dist
- lint-test-build - lint-test-build
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 60
name: '(CD) comment preview links' name: '(CD) comment preview links'
steps: steps:
- name: Find Comment - name: Find Comment
@@ -181,29 +178,6 @@ jobs:
issue-number: ${{ github.event.pull_request.number }} issue-number: ${{ github.event.pull_request.number }}
body-includes: Previews body-includes: Previews
- name: Wait for deployments
run: |
# https://stackoverflow.com/questions/3183444/check-for-valid-link-url
regex='(https?|ftp|file)://[-[:alnum:]\+&@#/%?=~_|!:,.;]*[-[:alnum:]\+&@#/%=~_|]'
if [[ "${{ needs.lint-test-build.outputs.preview_governance }}" =~ $regex ]]; then
until curl -L --fail "${{ needs.lint-test-build.outputs.preview_governance }}"; do
echo "waiting for governance preview"
sleep 5
done
fi
if [[ "${{ needs.lint-test-build.outputs.preview_explorer }}" =~ $regex ]]; then
until curl -L --fail "${{ needs.lint-test-build.outputs.preview_explorer }}"; do
echo "waiting for explorer preview"
sleep 5
done
fi
if [[ "${{ needs.lint-test-build.outputs.preview_trading }}" =~ $regex ]]; then
until curl -L --fail "${{ needs.lint-test-build.outputs.preview_trading }}"; do
echo "waiting for trading preview"
sleep 5
done
fi
- name: Create comment - name: Create comment
uses: peter-evans/create-or-update-comment@v3 uses: peter-evans/create-or-update-comment@v3
if: ${{ steps.fc.outputs.comment-id == 0 }} if: ${{ steps.fc.outputs.comment-id == 0 }}
@@ -215,9 +189,15 @@ jobs:
* explorer: ${{ needs.lint-test-build.outputs.preview_explorer }} * explorer: ${{ needs.lint-test-build.outputs.preview_explorer }}
* trading: ${{ needs.lint-test-build.outputs.preview_trading }} * trading: ${{ needs.lint-test-build.outputs.preview_trading }}
# Report single result at the end, to avoid mess with required checks in PR
cypress-check: cypress-check:
name: '(CI) cypress - check' name: '(CI) cypress - check'
runs-on: ubuntu-latest
needs: cypress
steps:
- run: echo Done!
# Report single result at the end, to avoid mess with required checks in PR
cypress-result:
if: ${{ always() }} if: ${{ always() }}
needs: cypress needs: cypress
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
+32
View File
@@ -0,0 +1,32 @@
name: Generate tranches
on:
schedule:
- cron: '0 */6 * * *'
jobs:
master:
name: Generate Queries
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
fetch-depth: 0
- name: Use Node.js 16
id: Node
uses: actions/setup-node@v2
with:
node-version: 16.15.1
- name: Install root dependencies
run: yarn install
- name: Generate queries
run: node ./scripts/get-tranches.js
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore: update tranches'
commit_options: '--no-verify --signoff'
skip_fetch: true
skip_checkout: true
+38 -88
View File
@@ -59,39 +59,26 @@ jobs:
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }} key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
# https://docs.github.com/en/actions/learn-github-actions/contexts # https://docs.github.com/en/actions/learn-github-actions/contexts
- name: Define dist variables - name: Define variables
if: ${{ github.event_name == 'push' }}
run: | run: |
envName='' envName=''
domain="vega.rocks" domain="vega.rocks"
bucketName='' if [[ "${{ github.event_name }}" = "push" ]]; then
if [[ "${{ github.ref }}" =~ .*release/.* ]]; then
if [[ "${{ github.ref }}" =~ .*release/.* ]]; then envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)"
envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)" elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then
elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then envName="stagnet1"
envName="stagnet1" elif [[ "${{ matrix.app}}" = "trading" ]] && [[ ${{ startsWith(github.ref, 'refs/tags/v') && 'true' || 'false' }} = "true" ]]; then
elif [[ "${{ github.ref }}" =~ .*main$ ]]; then envName="mainnet"
envName="mainnet" elif [[ "${{ github.ref }}" =~ .*main$ ]]; then
elif [[ "${{ matrix.app}}" = "trading" ]] && [[ "${{ startsWith(github.ref, 'refs/tags/v') && 'true' || 'false' }}" = "true" ]]; then envName="mainnet"
envName="mainnet" fi
fi if [[ "${envName}" = "mainnet" ]]; then
domain="vega.xyz"
if [[ "${envName}" = "mainnet" ]]; then fi
domain="vega.xyz"
bucketName="${{ matrix.app }}.${domain}"
elif [[ "${envName}" = "testnet" ]]; then
domain="fairground.wtf"
bucketName="${{ matrix.app }}.${domain}"
fi
if [[ -z "${bucketName}" ]]; then
bucketName="${{ matrix.app }}.${envName}.${domain}" bucketName="${{ matrix.app }}.${envName}.${domain}"
echo BUCKET_NAME=${bucketName} >> $GITHUB_ENV
fi fi
echo "bucket name: ${bucketName}"
echo "env name: ${envName}"
echo BUCKET_NAME=${bucketName} >> $GITHUB_ENV
echo ENV_NAME=${envName} >> $GITHUB_ENV echo ENV_NAME=${envName} >> $GITHUB_ENV
- name: Build local dist - name: Build local dist
@@ -168,7 +155,7 @@ jobs:
# bucket creation in github.com/vegaprotocol/terraform//frontend # bucket creation in github.com/vegaprotocol/terraform//frontend
- name: Publish dist to s3 - name: Publish dist to s3
uses: jakejarvis/s3-sync-action@master uses: jakejarvis/s3-sync-action@master
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v') && ( matrix.app != 'trading' || (matrix.app == 'trading' && !endsWith(github.ref, 'main') ) ) }} if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v') }}
with: with:
args: --acl private --follow-symlinks --delete args: --acl private --follow-symlinks --delete
env: env:
@@ -200,19 +187,8 @@ jobs:
-d '{"query": "mutation{triggerDeploy(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id status}}"}' \ -d '{"query": "mutation{triggerDeploy(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id status}}"}' \
https://api.fleek.co/graphql https://api.fleek.co/graphql
- name: Check out ipfs-redirect - name: Update vega.trading DNS to redirect to the new console
if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
uses: actions/checkout@v3
with:
repository: 'vegaprotocol/ipfs-redirect'
path: 'ipfs-redirect'
fetch-depth: '0'
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
- name: Update console.vega.xyz DNS to redirect to the new console
if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
env:
GH_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
run: | run: |
curl -L https://dist.ipfs.tech/kubo/v0.20.0/kubo_v0.20.0_linux-amd64.tar.gz -o kubo.tgz curl -L https://dist.ipfs.tech/kubo/v0.20.0/kubo_v0.20.0_linux-amd64.tar.gz -o kubo.tgz
tar -xzf kubo.tgz tar -xzf kubo.tgz
@@ -221,52 +197,26 @@ jobs:
new_hash=$(cat ${{ matrix.app }}-ipfs-hash) new_hash=$(cat ${{ matrix.app }}-ipfs-hash)
new_cid=$(ipfs cid format -v 1 -b base32 $new_hash) new_cid=$(ipfs cid format -v 1 -b base32 $new_hash)
ls -al ipfs-redirect # Generate console URL
new_console_url_type=ipfs
# new_console_url_type=ipns
new_console_url_domain=cf-ipfs.com
# new_console_url_domain=dweb.link
new_console_url="https://${new_cid}.${new_console_url_type}.${new_console_url_domain}/"
echo "new_console_url=${new_console_url}"
echo $new_hash > ipfs-redirect/cidv0.txt # Update record in DNSimple
echo $new_cid > ipfs-redirect/cidv1.txt # docs: https://developer.dnsimple.com/v2/zones/records/#updateZoneRecord
dnsimple_account_id=84895
dnsimple_zone_name=vega.trading
dnsimple_record_id=44409591
# see: https://dnsimple.com/a/84895/domains/vega.trading/records/44409591/edit
( curl -H 'Authorization: Bearer ${{ secrets.DNSIMPLE_API_TOKEN }}' \
cd ipfs-redirect -H 'Accept: application/json' \
-H 'Content-Type: application/json' \
git status -X PATCH \
cat .git/config -d "{
git config --global user.email "vega-ci-bot@vega.xyz" \"content\": \"${new_console_url}\"
git config --global user.name "vega-ci-bot" }" \
https://api.dnsimple.com/v2/${dnsimple_account_id}/zones/${dnsimple_zone_name}/records/${dnsimple_record_id}
branch_name="update-hash-${{ github.ref }}"
git checkout -b "$branch_name"
commit_msg="Automated hash update from ${{ github.ref }}"
git add cidv0.txt cidv1.txt
git commit -m "$commit_msg"
git push -u origin "$branch_name"
pr_url="$(gh pr create --title "${commit_msg}" --body 'automated pull request to update CIDs')"
echo $pr_url
# once auto merge get's enabled on documentation repo let's do follow up
sleep 5
gh pr merge "${pr_url}" --delete-branch --squash --admin
)
# # Generate console URL
# new_console_url_type=ipfs
# # new_console_url_type=ipns
# new_console_url_domain=cf-ipfs.com
# # new_console_url_domain=dweb.link
# new_console_url="https://${new_cid}.${new_console_url_type}.${new_console_url_domain}/"
# echo "new_console_url=${new_console_url}"
# # Update record in DNSimple
# # docs: https://developer.dnsimple.com/v2/zones/records/#updateZoneRecord
# dnsimple_account_id=84895
# dnsimple_zone_name=console.vega.xyz
# dnsimple_record_id=44409591
# # see: https://dnsimple.com/a/84895/domains/console.vega.xyz/records/44409591/edit
# curl -H 'Authorization: Bearer ${{ secrets.DNSIMPLE_API_TOKEN }}' \
# -H 'Accept: application/json' \
# -H 'Content-Type: application/json' \
# -X PATCH \
# -d "{
# \"content\": \"${new_console_url}\"
# }" \
# https://api.dnsimple.com/v2/${dnsimple_account_id}/zones/${dnsimple_zone_name}/records/${dnsimple_record_id}
+23 -30
View File
@@ -43,17 +43,7 @@ jobs:
-d '{"query": "mutation{triggerDeploy(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id status}}"}' \ -d '{"query": "mutation{triggerDeploy(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id status}}"}' \
https://api.fleek.co/graphql https://api.fleek.co/graphql
- name: Check out ipfs-redirect - name: Update vega.trading DNS to redirect to the new console
uses: actions/checkout@v3
with:
repository: 'vegaprotocol/ipfs-redirect'
path: 'ipfs-redirect'
fetch-depth: '0'
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
- name: Update console.vega.xyz DNS to redirect to the new console
env:
GH_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
run: | run: |
curl -L https://dist.ipfs.tech/kubo/v0.20.0/kubo_v0.20.0_linux-amd64.tar.gz -o kubo.tgz curl -L https://dist.ipfs.tech/kubo/v0.20.0/kubo_v0.20.0_linux-amd64.tar.gz -o kubo.tgz
tar -xzf kubo.tgz tar -xzf kubo.tgz
@@ -61,24 +51,27 @@ jobs:
which ipfs which ipfs
new_hash=$(cat ipfs-hash) new_hash=$(cat ipfs-hash)
new_cid=$(ipfs cid format -v 1 -b base32 $new_hash) new_cid=$(ipfs cid format -v 1 -b base32 $new_hash)
git config --global user.email "vega-ci-bot@vega.xyz"
git config --global user.name "vega-ci-bot"
echo $new_hash > ipfs-redirect/cidv0.txt
echo $new_cid > ipfs-redirect/cidv1.txt
( # Generate console URL
cd ipfs-redirect new_console_url_type=ipfs
# new_console_url_type=ipns
new_console_url_domain=cf-ipfs.com
# new_console_url_domain=dweb.link
new_console_url="https://${new_cid}.${new_console_url_type}.${new_console_url_domain}/"
echo "new_console_url=${new_console_url}"
git status # Update record in DNSimple
branch_name="rollback-to-$new_hash" # docs: https://developer.dnsimple.com/v2/zones/records/#updateZoneRecord
git checkout -b "$branch_name" dnsimple_account_id=84895
commit_msg="hash rollback to $new_hash" dnsimple_zone_name=vega.trading
git add cidv0.txt cidv1.txt dnsimple_record_id=44409591
git commit -m "$commit_msg" # see: https://dnsimple.com/a/84895/domains/vega.trading/records/44409591/edit
git push -u origin "$branch_name" --force-with-lease
pr_url="$(gh pr create --title "${commit_msg}" --body 'automated pull request to update CIDs')" curl -H 'Authorization: Bearer ${{ secrets.DNSIMPLE_API_TOKEN }}' \
echo $pr_url -H 'Accept: application/json' \
# once auto merge get's enabled on documentation repo let's do follow up -H 'Content-Type: application/json' \
sleep 5 -X PATCH \
gh pr merge "${pr_url}" --delete-branch --squash --admin -d "{
) \"content\": \"${new_console_url}\"
}" \
https://api.dnsimple.com/v2/${dnsimple_account_id}/zones/${dnsimple_zone_name}/records/${dnsimple_record_id}
+3 -3
View File
@@ -3,15 +3,15 @@ NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
NX_VEGA_ENV=STAGNET1 NX_VEGA_ENV=STAGNET1
NX_VEGA_EXPLORER_URL=https://explorer.stagnet1.vega.rocks NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_TOKEN_URL=https://governance.stagnet1.vega.rocks NX_VEGA_TOKEN_URL=https://stagnet1.governance.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket
NX_BLOCK_EXPLORER=https://be.stagnet1.vega.xyz/rest NX_BLOCK_EXPLORER=https://be.stagnet1.vega.xyz/rest
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
NX_VEGA_GOVERNANCE_URL=https://governance.stagnet1.vega.rocks NX_VEGA_GOVERNANCE_URL=https://stagnet1.governance.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.jsoo NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.jsoo
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}' NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
-2
View File
@@ -1,7 +1,6 @@
# App configuration variables # App configuration variables
NX_TENDERMINT_URL=https://be.vega.community NX_TENDERMINT_URL=https://be.vega.community
NX_TENDERMINT_WEBSOCKET_URL=wss://be.vega.community/websocket NX_TENDERMINT_WEBSOCKET_URL=wss://be.vega.community/websocket
NX_SENTRY_DSN=https://b3a56b03eda842faad731f3ea9dfd1bc@o286262.ingest.sentry.io/6242427
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
NX_VEGA_URL=https://api.vega.community/graphql NX_VEGA_URL=https://api.vega.community/graphql
NX_VEGA_ENV=MAINNET NX_VEGA_ENV=MAINNET
@@ -10,4 +9,3 @@ NX_ETHERSCAN_URL=https://etherscan.io
NX_VEGA_GOVERNANCE_URL=https://governance.vega.xyz NX_VEGA_GOVERNANCE_URL=https://governance.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json
NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz/ NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz/
NX_VEGA_CONSOLE_URL=https://console.vega.xyz
-1
View File
@@ -10,4 +10,3 @@ NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_GOVERNANCE_URL=https://governance.fairground.wtf NX_VEGA_GOVERNANCE_URL=https://governance.fairground.wtf
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
NX_VEGA_CONSOLE_URL=https://console.fairground.wtf
@@ -7,9 +7,8 @@ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
NX_TENDERMINT_URL=https://tm.be.validators-testnet.vega.rocks NX_VEGA_GOVERNANCE_URL=https://validator-testnet.governance.vega.xyz
NX_TENDERMINT_URL=https://tm-be.validators-testnet.vega.rocks
NX_BLOCK_EXPLORER=https://be.validators-testnet.vega.rocks/rest NX_BLOCK_EXPLORER=https://be.validators-testnet.vega.rocks/rest
NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega.xyz/websocket NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega.xyz/websocket
NX_VEGA_GOVERNANCE_URL=https://governance.validators-testnet.vega.rocks NX_VEGA_EXPLORER_URL=https://validator-testnet.explorer.vega.xyz/
NX_VEGA_EXPLORER_URL=https://explorer.validators-testnet.vega.rocks/
NX_VEGA_CONSOLE_URL=https://trading.validators-testnet.vega.rocks/
+1 -4
View File
@@ -13,7 +13,6 @@ import { DEFAULT_CACHE_CONFIG } from '@vegaprotocol/apollo-client';
import { RouterProvider } from 'react-router-dom'; import { RouterProvider } from 'react-router-dom';
import { router } from './routes/router-config'; import { router } from './routes/router-config';
import { t } from '@vegaprotocol/i18n'; import { t } from '@vegaprotocol/i18n';
import { Suspense } from 'react';
const splashLoading = ( const splashLoading = (
<Splash> <Splash>
@@ -33,9 +32,7 @@ function App() {
skeleton={<div>{t('Loading')}</div>} skeleton={<div>{t('Loading')}</div>}
failure={<AppFailure title={t(`Node: ${VEGA_URL} is unsuitable`)} />} failure={<AppFailure title={t(`Node: ${VEGA_URL} is unsuitable`)} />}
> >
<Suspense fallback={splashLoading}> <RouterProvider router={router} fallbackElement={splashLoading} />
<RouterProvider router={router} fallbackElement={splashLoading} />
</Suspense>
</NodeGuard> </NodeGuard>
<NodeSwitcherDialog <NodeSwitcherDialog
open={nodeSwitcherOpen} open={nodeSwitcherOpen}
@@ -4,11 +4,9 @@ import {
} from '@vegaprotocol/environment'; } from '@vegaprotocol/environment';
import { t } from '@vegaprotocol/i18n'; import { t } from '@vegaprotocol/i18n';
import { useScreenDimensions } from '@vegaprotocol/react-helpers'; import { useScreenDimensions } from '@vegaprotocol/react-helpers';
import { Link, ExternalLink } from '@vegaprotocol/ui-toolkit'; import { ExternalLink, Link } from '@vegaprotocol/ui-toolkit';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { ENV } from '../../config/env'; import { ENV } from '../../config/env';
import { Routes } from '../../routes/route-names';
import { Link as RouteLink } from 'react-router-dom';
export const Footer = () => { export const Footer = () => {
const { VEGA_URL, GIT_COMMIT_HASH, GIT_ORIGIN_URL } = useEnvironment(); const { VEGA_URL, GIT_COMMIT_HASH, GIT_ORIGIN_URL } = useEnvironment();
@@ -23,7 +21,7 @@ export const Footer = () => {
); );
return ( return (
<footer className="grid grid-rows-2 lg:grid-cols-[1fr_auto] text-xs md:text-md lg:flex md:col-span-2 px-4 py-2 gap-4 border-t border-vega-light-200 dark:border-vega-dark-200"> <footer className="grid grid-rows-2 grid-cols-[1fr_auto] text-xs md:text-md md:flex md:col-span-2 px-4 py-2 gap-4 border-t border-vega-light-200 dark:border-vega-dark-200">
<div className="flex justify-between gap-2 align-middle"> <div className="flex justify-between gap-2 align-middle">
{GIT_COMMIT_HASH && ( {GIT_COMMIT_HASH && (
<div className="content-center flex border-r border-neutral-700 dark:border-neutral-300 pr-4"> <div className="content-center flex border-r border-neutral-700 dark:border-neutral-300 pr-4">
@@ -58,16 +56,11 @@ export const Footer = () => {
</div> </div>
) : null} ) : null}
</div> </div>
<div className="pl-2 align-center lg:align-right lg:flex lg:justify-end gap-2 align-middle lg:max-w-xs lg:ml-auto">
<RouteLink to={`/${Routes.DISCLAIMER}`} className="underline">
Disclaimer
</RouteLink>
</div>
</footer> </footer>
); );
}; };
export const NodeUrl = ({ url }: { url: string }) => { const NodeUrl = ({ url }: { url: string }) => {
// get base url from api url, api sub domain // get base url from api url, api sub domain
const urlObj = new URL(url); const urlObj = new URL(url);
const nodeUrl = urlObj.origin.replace(/^[^.]+\./g, ''); const nodeUrl = urlObj.origin.replace(/^[^.]+\./g, '');
@@ -84,17 +84,15 @@ export const MarketsTable = ({ data }: MarketsTableProps) => {
<AgGridColumn <AgGridColumn
colId="asset" colId="asset"
headerName={t('Settlement asset')} headerName={t('Settlement asset')}
field="tradableInstrument.instrument.product.settlementAsset.symbol" field="tradableInstrument.instrument.product.settlementAsset"
hide={window.innerWidth <= BREAKPOINT_MD} hide={window.innerWidth <= BREAKPOINT_MD}
cellRenderer={({ cellRenderer={({
data, value,
}: VegaICellRendererParams< }: VegaICellRendererParams<
MarketFieldsFragment, MarketFieldsFragment,
'tradableInstrument.instrument.product.settlementAsset.symbol' 'tradableInstrument.instrument.product.settlementAsset'
>) => { >) =>
const value = value ? (
data?.tradableInstrument.instrument.product.settlementAsset;
return value ? (
<ButtonLink <ButtonLink
onClick={(e) => { onClick={(e) => {
openAssetDetailsDialog(value.id, e.target as HTMLElement); openAssetDetailsDialog(value.id, e.target as HTMLElement);
@@ -104,8 +102,8 @@ export const MarketsTable = ({ data }: MarketsTableProps) => {
</ButtonLink> </ButtonLink>
) : ( ) : (
'' ''
); )
}} }
/> />
<AgGridColumn <AgGridColumn
flex={2} flex={2}
@@ -1,13 +1,12 @@
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import { OracleDetailsType, isInternalSourceType } from './oracle-details-type'; import { OracleDetailsType } from './oracle-details-type';
import type { SourceType } from './oracle'; import type { SourceTypeName } from './oracle-details-type';
import { PropertyKeyType } from '@vegaprotocol/types';
function renderComponent(type: SourceType) { function renderComponent(type: SourceTypeName) {
return <OracleDetailsType sourceType={type} />; return <OracleDetailsType type={type} />;
} }
function renderWrappedComponent(type: SourceType) { function renderWrappedComponent(type: SourceTypeName) {
return ( return (
<table> <table>
<tbody>{renderComponent(type)}</tbody> <tbody>{renderComponent(type)}</tbody>
@@ -15,53 +14,19 @@ function renderWrappedComponent(type: SourceType) {
); );
} }
function mock(name: string): SourceType {
return {
sourceType: {
filters: [
{
__typename: 'Filter',
key: {
name,
type: PropertyKeyType.TYPE_STRING,
},
},
],
},
};
}
describe('Oracle type view', () => { describe('Oracle type view', () => {
it('Renders nothing when type is null', () => { it('Renders nothing when type is null', () => {
const res = render(renderComponent(null as unknown as SourceType)); const res = render(renderComponent(null as unknown as SourceTypeName));
expect(res.container).toBeEmptyDOMElement(); expect(res.container).toBeEmptyDOMElement();
}); });
it('Renders Internal time for internal sources - timestamp', () => { it('Renders Internal time for internal sources', () => {
const s = mock('vegaprotocol.builtin.timestamp'); const res = render(renderWrappedComponent('DataSourceDefinitionInternal'));
expect(isInternalSourceType(s)).toEqual(true); expect(res.getByText('Internal time')).toBeInTheDocument();
const res = render(renderWrappedComponent(s));
expect(res.getByText('Internal data')).toBeInTheDocument();
});
it('Renders Internal time for internal sources - potential future types', () => {
const s = mock('vegaprotocol.builtin.boolean');
expect(isInternalSourceType(s)).toEqual(true);
const res = render(renderWrappedComponent(s));
expect(res.getByText('Internal data')).toBeInTheDocument();
});
it('Renders External data otherwise - prices.external.whatever', () => {
const s = mock('prices.external.whatever');
expect(isInternalSourceType(s)).toEqual(false);
const res = render(renderWrappedComponent(s));
expect(res.getByText('External data')).toBeInTheDocument();
}); });
it('Renders External data otherwise', () => { it('Renders External data otherwise', () => {
const s = mock('prices.external.vegaprotocol.builtin.'); const res = render(renderWrappedComponent('DataSourceDefinitionExternal'));
expect(isInternalSourceType(s)).toEqual(false);
const res = render(renderWrappedComponent(s));
expect(res.getByText('External data')).toBeInTheDocument(); expect(res.getByText('External data')).toBeInTheDocument();
}); });
}); });
@@ -1,51 +1,27 @@
import { TableRow, TableCell, TableHeader } from '../../../components/table'; import { TableRow, TableCell, TableHeader } from '../../../components/table';
import type { SourceType } from './oracle'; import type { SourceType } from './oracle';
/** export type SourceTypeName = SourceType['__typename'] | undefined;
* Basic function to determine if a source is internal or external.
*
* This should be distinguishable using __typename, but the type is incorrectly
* reported at the moment, so instead we check the filters.
*
* @param s SourceType
* @returns boolean True if the source is internal
*/
export function isInternalSourceType(s: SourceType) {
if ('filters' in s.sourceType) {
const filters = s.sourceType.filters;
if (filters) {
return (
filters?.filter((f) => {
return f.key.name?.indexOf('vegaprotocol.builtin.') === 0;
}).length > 0
);
}
}
return false;
}
interface OracleDetailsTypeProps { interface OracleDetailsTypeProps {
sourceType: SourceType; type: SourceTypeName;
} }
/** /**
* Renders a a single table row for the Oracle Details view that shows * Renders a a single table row for the Oracle Details view that shows
* if the oracle is using the internal time oracle or external data * if the oracle is using the internal time oracle or external data
*/ */
export function OracleDetailsType({ sourceType }: OracleDetailsTypeProps) { export function OracleDetailsType({ type }: OracleDetailsTypeProps) {
if (!sourceType) { if (!type) {
return null; return null;
} }
const isInternal = isInternalSourceType(sourceType);
return ( return (
<TableRow modifier="bordered"> <TableRow modifier="bordered">
<TableHeader scope="row">Type</TableHeader> <TableHeader scope="row">Type</TableHeader>
<TableCell modifier="bordered"> <TableCell modifier="bordered">
{isInternal ? 'Internal data' : 'External data'} {type === 'DataSourceDefinitionInternal'
? 'Internal time'
: 'External data'}
</TableCell> </TableCell>
</TableRow> </TableRow>
); );
@@ -53,7 +53,7 @@ export const OracleDetails = ({
<OracleLink id={id} /> <OracleLink id={id} />
</TableCell> </TableCell>
</TableRow> </TableRow>
<OracleDetailsType sourceType={sourceType} /> <OracleDetailsType type={sourceType.__typename} />
<OracleSigners sourceType={sourceType} /> <OracleSigners sourceType={sourceType} />
<OracleMarkets id={id} /> <OracleMarkets id={id} />
<TableRow modifier="bordered"> <TableRow modifier="bordered">
@@ -1,40 +0,0 @@
import { t } from '@vegaprotocol/i18n';
import { RouteTitle } from '../../components/route-title';
export const Disclaimer = () => {
return (
<section>
<div className="px-40 max-sm:px-0 max-md:px-10 mb-4 max-w-5xl">
<RouteTitle data-testid="disclaimer-header">
{t('Disclaimer')}
</RouteTitle>
<p className="mt-3">
The Vega Block Explorer is an application that allows users to, among
other things, browse through blocks, view wallet addresses, network
hashrate, transaction data and other key information on the Vega
blockchain. It is free, public and open source software. Software
upgrades may contain bugs or security vulnerabilities that might
result in loss of functionality.
</p>
<p className="mt-3">
The Vega Block Explorer uses data from nodes on the Vega Blockchain.
The developers of the Vega Block Explorer do not operate or run the
Vega Blockchain or any other blockchain.
</p>
<p className="mt-3 font-semibold">
The Vega Block Explorer is provided as is. The developers of the
Vega Block Explorer make no representations or warranties of any kind,
whether express or implied, statutory or otherwise regarding the Vega
Block Explorer. They disclaim all warranties of merchantability,
quality, fitness for purpose. They disclaim all warranties that the
Vega Block Explorer is free of harmful components or errors.
</p>
<p className="mt-3 font-bold">
No developer of the Vega Block Explorer accepts any responsibility
for, or liability to users in connection with their use of the Vega
Block Explorer.
</p>
</div>
</section>
);
};
@@ -10,5 +10,4 @@ export const Routes = {
MARKETS: 'markets', MARKETS: 'markets',
ORACLES: 'oracles', ORACLES: 'oracles',
NETWORK_PARAMETERS: 'network-parameters', NETWORK_PARAMETERS: 'network-parameters',
DISCLAIMER: 'disclaimer',
}; };
@@ -29,7 +29,6 @@ import { AssetLink, MarketLink } from '../components/links';
import { truncateMiddle } from '@vegaprotocol/ui-toolkit'; import { truncateMiddle } from '@vegaprotocol/ui-toolkit';
import { remove0x } from '@vegaprotocol/utils'; import { remove0x } from '@vegaprotocol/utils';
import { PartyAccountsByAsset } from './parties/id/accounts'; import { PartyAccountsByAsset } from './parties/id/accounts';
import { Disclaimer } from './pages/disclaimer';
export type Navigable = { export type Navigable = {
path: string; path: string;
@@ -336,17 +335,6 @@ export const routerConfig: Route[] = [
}, },
], ],
}, },
{
path: Routes.DISCLAIMER,
element: <Disclaimer />,
handle: {
name: t('Disclaimer'),
text: t('Disclaimer'),
breadcrumb: () => (
<Link to={Routes.DISCLAIMER}>{t('Disclaimer')}</Link>
),
},
},
...partiesRoutes, ...partiesRoutes,
...assetsRoutes, ...assetsRoutes,
...genesisRoutes, ...genesisRoutes,
@@ -33,9 +33,8 @@ const proposalDetailsTitle = '[data-testid="proposal-title"]';
const proposalDetailsDescription = '[data-testid="proposal-description"]'; const proposalDetailsDescription = '[data-testid="proposal-description"]';
const openProposals = '[data-testid="open-proposals"]'; const openProposals = '[data-testid="open-proposals"]';
const viewProposalButton = '[data-testid="view-proposal-btn"]'; const viewProposalButton = '[data-testid="view-proposal-btn"]';
const proposalDescriptionToggle = 'proposal-description-toggle';
const voteBreakdownToggle = 'vote-breakdown-toggle'; const voteBreakdownToggle = 'vote-breakdown-toggle';
const proposalTermsToggle = 'proposal-json-toggle'; const proposalTermsToggle = 'proposal-terms-toggle';
describe( describe(
'Governance flow for proposal details', 'Governance flow for proposal details',
@@ -74,8 +73,6 @@ describe(
'contain.text', 'contain.text',
rawProposal.rationale.title rawProposal.rationale.title
); );
cy.getByTestId(proposalDescriptionToggle).click();
cy.getByTestId('proposal-description-toggle');
cy.get(proposalDetailsDescription) cy.get(proposalDetailsDescription)
.find('p') .find('p')
.should('have.text', proposalDescription); .should('have.text', proposalDescription);
@@ -85,7 +82,7 @@ describe(
cy.get('code.language-json') cy.get('code.language-json')
.should('exist') .should('exist')
.within(() => { .within(() => {
cy.get('.hljs-attr').eq(0).should('have.text', '"id"'); cy.get('.hljs-string').eq(0).should('have.text', '"ProposalTerms"');
}); });
}); });
@@ -112,9 +109,16 @@ describe(
closingDate closingDate
); );
}); });
getProposalInformationFromTable('Proposed on') cy.wrap(
.invoke('text') formatDateWithLocalTimezone(
.should('not.be.empty'); new Date(createTenDigitUnixTimeStampForSpecifiedDays(0) * 1000)
)
).then((proposalDate) => {
getProposalInformationFromTable('Proposed on').should(
'have.text',
proposalDate
);
});
}); });
it('Newly created proposal details - shows default status set to fail', function () { it('Newly created proposal details - shows default status set to fail', function () {
@@ -7,6 +7,7 @@ import {
import { import {
clickOnValidatorFromList, clickOnValidatorFromList,
closeStakingDialog, closeStakingDialog,
stakingPageAssociateTokens,
stakingValidatorPageAddStake, stakingValidatorPageAddStake,
waitForBeginningOfEpoch, waitForBeginningOfEpoch,
} from '../../support/staking.functions'; } from '../../support/staking.functions';
@@ -30,17 +31,19 @@ context('rewards - flow', { tags: '@slow' }, function () {
cy.visit('/'); cy.visit('/');
waitForSpinner(); waitForSpinner();
depositAsset(vegaAssetAddress, '1000', 18); depositAsset(vegaAssetAddress, '1000', 18);
cy.validatorsSelfDelegate();
ethereumWalletConnect(); ethereumWalletConnect();
cy.connectVegaWallet(); cy.connectVegaWallet();
vegaWalletTeardown();
cy.associateTokensToVegaWallet('6000');
cy.VegaWalletTopUpRewardsPool(30, 200); cy.VegaWalletTopUpRewardsPool(30, 200);
navigateTo(navigation.validators); navigateTo(navigation.validators);
vegaWalletTeardown();
stakingPageAssociateTokens('6000');
cy.get(vegaWalletUnstakedBalance, txTimeout).should( cy.get(vegaWalletUnstakedBalance, txTimeout).should(
'contain', 'contain',
'6,000.0', '6,000.0',
txTimeout txTimeout
); );
cy.get('button').contains('Select a validator to nominate').click();
clickOnValidatorFromList(0); clickOnValidatorFromList(0);
stakingValidatorPageAddStake('3000'); stakingValidatorPageAddStake('3000');
closeStakingDialog(); closeStakingDialog();
@@ -24,7 +24,6 @@ const ethWalletContainer = '[data-testid="ethereum-wallet"]';
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]'; const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
const vegaWalletUnstakedBalance = const vegaWalletUnstakedBalance =
'[data-testid="vega-wallet-balance-unstaked"]'; '[data-testid="vega-wallet-balance-unstaked"]';
const currencyTitle = '[data-testid="currency-title"]:visible';
const txTimeout = Cypress.env('txTimeout'); const txTimeout = Cypress.env('txTimeout');
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort'); const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
const ethWalletAssociateButton = '[data-testid="associate-btn"]:visible'; const ethWalletAssociateButton = '[data-testid="associate-btn"]:visible';
@@ -80,11 +79,14 @@ context(
//0005-ETXN-005 //0005-ETXN-005
stakingPageAssociateTokens('2', { skipConfirmation: true }); stakingPageAssociateTokens('2', { skipConfirmation: true });
cy.get(currencyTitle, txTimeout).should('have.length.above', 4); cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
6
);
validateWalletCurrency('Associated', '0.00'); validateWalletCurrency('Associated', '0.00');
validateWalletCurrency('Pending association', '2.00'); validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '2.00'); validateWalletCurrency('Total associated after pending', '2.00');
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6); cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
// 0005-ETXN-002 // 0005-ETXN-002
verifyEthWalletAssociatedBalance('2.0'); verifyEthWalletAssociatedBalance('2.0');
@@ -115,11 +117,14 @@ context(
verifyEthWalletTotalAssociatedBalance('6,002.00'); verifyEthWalletTotalAssociatedBalance('6,002.00');
cy.get('button').contains('Select a validator to nominate').click(); cy.get('button').contains('Select a validator to nominate').click();
stakingPageDisassociateTokens('2'); stakingPageDisassociateTokens('2');
cy.get(currencyTitle, txTimeout).should('have.length.above', 4); cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
6
);
validateWalletCurrency('Associated', '2.00'); validateWalletCurrency('Associated', '2.00');
validateWalletCurrency('Pending association', '2.00'); validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '0.00'); validateWalletCurrency('Total associated after pending', '0.00');
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6); cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
cy.get( cy.get(
'[data-testid="eth-wallet-associated-balances"]:visible', '[data-testid="eth-wallet-associated-balances"]:visible',
txTimeout txTimeout
@@ -220,11 +225,14 @@ context(
skipConfirmation: true, skipConfirmation: true,
}); });
cy.get(currencyTitle, txTimeout).should('have.length.above', 4); cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
6
);
validateWalletCurrency('Associated', '0.00'); validateWalletCurrency('Associated', '0.00');
validateWalletCurrency('Pending association', '2.00'); validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '2.00'); validateWalletCurrency('Total associated after pending', '2.00');
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6); cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
verifyEthWalletAssociatedBalance('2.0'); verifyEthWalletAssociatedBalance('2.0');
verifyEthWalletTotalAssociatedBalance('2.0'); verifyEthWalletTotalAssociatedBalance('2.0');
cy.get(vegaWallet) cy.get(vegaWallet)
@@ -240,11 +248,14 @@ context(
type: 'contract', type: 'contract',
skipConfirmation: true, skipConfirmation: true,
}); });
cy.get(currencyTitle, txTimeout).should('have.length.above', 4); cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
6
);
validateWalletCurrency('Associated', '2.00'); validateWalletCurrency('Associated', '2.00');
validateWalletCurrency('Pending association', '1.00'); validateWalletCurrency('Pending association', '1.00');
validateWalletCurrency('Total associated after pending', '1.00'); validateWalletCurrency('Total associated after pending', '1.00');
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6); cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
verifyEthWalletAssociatedBalance('1.0'); verifyEthWalletAssociatedBalance('1.0');
verifyEthWalletTotalAssociatedBalance('1.0'); verifyEthWalletTotalAssociatedBalance('1.0');
}); });
@@ -328,11 +339,14 @@ context(
// 1004-ASSO-004 // 1004-ASSO-004
it('Pending association outside of app is shown', function () { it('Pending association outside of app is shown', function () {
vegaWalletAssociate('2'); vegaWalletAssociate('2');
cy.get(currencyTitle, txTimeout).should('have.length.above', 4); cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
6
);
validateWalletCurrency('Associated', '0.00'); validateWalletCurrency('Associated', '0.00');
validateWalletCurrency('Pending association', '2.00'); validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '2.00'); validateWalletCurrency('Total associated after pending', '2.00');
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6); cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
validateWalletCurrency('Associated', '2.00'); validateWalletCurrency('Associated', '2.00');
}); });
@@ -341,11 +355,14 @@ context(
cy.wrap(validateWalletCurrency('Associated', '2.00')).then(() => { cy.wrap(validateWalletCurrency('Associated', '2.00')).then(() => {
vegaWalletDisassociate('2'); vegaWalletDisassociate('2');
}); });
cy.get(currencyTitle, txTimeout).should('have.length.above', 4); cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
6
);
validateWalletCurrency('Associated', '2.00'); validateWalletCurrency('Associated', '2.00');
validateWalletCurrency('Pending association', '2.00'); validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '0.00'); validateWalletCurrency('Total associated after pending', '0.00');
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6); cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
validateWalletCurrency('Associated', '0.00'); validateWalletCurrency('Associated', '0.00');
}); });
@@ -15,7 +15,13 @@ const balanceAvailable = 'BALANCE_AVAILABLE_value';
const withdrawalThreshold = 'WITHDRAWAL_THRESHOLD_value'; const withdrawalThreshold = 'WITHDRAWAL_THRESHOLD_value';
const delayTime = 'DELAY_TIME_value'; const delayTime = 'DELAY_TIME_value';
const submitWithdrawalButton = 'submit-withdrawal'; const submitWithdrawalButton = 'submit-withdrawal';
const dialogTitle = 'dialog-title';
const dialogClose = 'dialog-close'; const dialogClose = 'dialog-close';
const txExplorerLink = 'tx-block-explorer';
const withdrawalAssetSymbol = 'withdrawal-asset-symbol';
const withdrawalAmount = 'withdrawal-amount';
const withdrawalRecipient = 'withdrawal-recipient';
const withdrawFundsButton = 'withdraw-funds';
const completeWithdrawalButton = 'complete-withdrawal'; const completeWithdrawalButton = 'complete-withdrawal';
const tableTxHash = '[col-id="txHash"]'; const tableTxHash = '[col-id="txHash"]';
const tableAssetSymbol = '[col-id="asset.symbol"]'; const tableAssetSymbol = '[col-id="asset.symbol"]';
@@ -24,16 +30,14 @@ const tableReceiverAddress = '[col-id="details.receiverAddress"]';
const tableWithdrawnTimeStamp = '[col-id="withdrawnTimestamp"]'; const tableWithdrawnTimeStamp = '[col-id="withdrawnTimestamp"]';
const tableWithdrawnStatus = '[col-id="status"]'; const tableWithdrawnStatus = '[col-id="status"]';
const tableCreatedTimeStamp = '[col-id="createdTimestamp"]'; const tableCreatedTimeStamp = '[col-id="createdTimestamp"]';
const toast = 'toast'; const toastContent = 'toast-content';
const toastPanel = 'toast-panel'; const toastPanel = 'toast-panel';
const toastClose = 'toast-close';
const withdrawalDialogContent = 'dialog-content';
const toastCompleteWithdrawal = 'toast-complete-withdrawal';
const usdtName = 'USDC (local)'; const usdtName = 'USDC (local)';
const usdcEthAddress = '0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0'; const usdcEthAddress = '0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0';
const usdcSymbol = 'tUSDC'; const usdcSymbol = 'tUSDC';
const usdtSelectValue = const usdtSelectValue =
'993ed98f4f770d91a796faab1738551193ba45c62341d20597df70fea6704ede'; '993ed98f4f770d91a796faab1738551193ba45c62341d20597df70fea6704ede';
const truncatedWithdrawalEthAddress = '0xEe7D…22d94F';
const formValidationError = 'input-error-text'; const formValidationError = 'input-error-text';
const txTimeout = Cypress.env('txTimeout'); const txTimeout = Cypress.env('txTimeout');
@@ -103,35 +107,29 @@ context(
cy.getByTestId(amountInput).click().type('120'); cy.getByTestId(amountInput).click().type('120');
cy.getByTestId(submitWithdrawalButton).click(); cy.getByTestId(submitWithdrawalButton).click();
}); });
cy.contains('Awaiting network confirmation').should('be.visible');
// assert withdrawal request // assert withdrawal request
cy.getByTestId(toast) cy.getByTestId(dialogTitle, txTimeout).should(
.first(txTimeout) 'have.text',
.should('contain.text', 'Funds unlocked') 'Transaction complete'
.within(() => { );
cy.getByTestId('external-link').should('exist'); cy.getByTestId(txExplorerLink)
cy.getByTestId(toastPanel).should( .should('have.attr', 'href')
'contain.text', .and('contain', '/txs/');
'Withdraw 120.00 tUSDC' cy.getByTestId(withdrawalAssetSymbol).should('have.text', usdcSymbol);
); cy.getByTestId(withdrawalAmount).should('have.text', '120.00');
cy.getByTestId(toastCompleteWithdrawal).click(); cy.getByTestId(withdrawalRecipient)
cy.getByTestId(toastClose).click(); .should('have.text', truncatedWithdrawalEthAddress)
}); .and('have.attr', 'href')
.and('contain', `/address/${Cypress.env('ethWalletPublicKey')}`);
cy.getByTestId(withdrawFundsButton).click();
// withdrawal complete // withdrawal complete
cy.getByTestId(toast) cy.getByTestId(dialogTitle, txTimeout).should(
.first(txTimeout) 'have.text',
.should('contain.text', 'The withdrawal has been approved.') 'Withdraw asset complete'
.within(() => { );
cy.getByTestId(toastPanel).should( cy.getByTestId(dialogClose).click();
'contain.text',
'Withdraw 120.00 tUSDC'
);
});
cy.getByTestId(toast)
.last(txTimeout)
.should('contain.text', 'Transaction confirmed')
.within(() => {
cy.getByTestId('external-link').should('exist');
});
// withdrawal history for complete withdrawal displayed // withdrawal history for complete withdrawal displayed
cy.get(tableWithdrawnStatus) cy.get(tableWithdrawnStatus)
.eq(1, txTimeout) .eq(1, txTimeout)
@@ -170,17 +168,13 @@ context(
cy.getByTestId(submitWithdrawalButton).click(); cy.getByTestId(submitWithdrawalButton).click();
}); });
cy.getByTestId(toast) cy.contains('Awaiting network confirmation').should('be.visible');
.first(txTimeout) // assert withdrawal request
.should('contain.text', 'Funds unlocked') cy.getByTestId(dialogTitle, txTimeout).should(
.within(() => { 'have.text',
cy.getByTestId('external-link').should('exist'); 'Transaction complete'
cy.getByTestId(toastPanel).should( );
'contain.text', cy.getByTestId(dialogClose).click();
'Withdraw 110.00 tUSDC'
);
cy.getByTestId(toastClose).click();
});
cy.get(tableTxHash) cy.get(tableTxHash)
.eq(1) .eq(1)
.should('have.text', 'Complete withdrawal') .should('have.text', 'Complete withdrawal')
@@ -195,75 +189,28 @@ context(
cy.get(tableCreatedTimeStamp).should('not.be.empty'); cy.get(tableCreatedTimeStamp).should('not.be.empty');
}); });
ethereumWalletConnect(); ethereumWalletConnect();
cy.getByTestId(completeWithdrawalButton).first().click(); cy.getByTestId(completeWithdrawalButton).click();
cy.getByTestId(toast) cy.getByTestId(toastContent)
.last(txTimeout) .last()
.should('contain.text', 'Awaiting confirmation') .should('contain.text', 'Awaiting confirmation')
.within(() => { .within(() => {
cy.getByTestId('external-link').should('exist'); cy.getByTestId('external-link').should('exist');
}); });
cy.getByTestId(toast) cy.getByTestId(toastContent)
.first(txTimeout) .first()
.should('contain.text', 'The withdrawal has been approved.') .should('contain.text', 'The withdrawal has been approved.')
.within(() => { .within(() => {
cy.getByTestId(toastPanel).should('contain.text', '110.00', 'tUSDC'); cy.getByTestId(toastPanel).should('contain.text', '110.00', 'tUSDC');
}); });
cy.getByTestId(toast) cy.getByTestId(toastContent)
.last(txTimeout) .last()
.should('contain.text', 'Transaction confirmed') .should('contain.text', 'Transaction confirmed')
.within(() => { .within(() => {
cy.getByTestId('external-link').should('exist'); cy.getByTestId('external-link').should('exist');
}); });
}); });
it('Should be able to see withdrawal details from toast', function () { it('Unable to withdraw asset on pub key view', function () {
cy.getByTestId(withdraw).click();
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
cy.get('select').select(usdtSelectValue, { force: true });
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
cy.getByTestId(withdrawalThreshold).should(
'have.text',
'100,000.00000T'
);
cy.getByTestId(amountInput).click().type('50');
cy.getByTestId(submitWithdrawalButton).click();
});
cy.getByTestId(toast)
.first(txTimeout)
.should('contain.text', 'Funds unlocked')
.within(() => {
cy.getByTestId('external-link').should('exist');
cy.getByTestId(toastPanel).should(
'contain.text',
'Withdraw 50.00 tUSDC'
);
cy.contains('save your withdrawal details').click();
});
cy.getByTestId(withdrawalDialogContent)
.last()
.within(() => {
cy.getByTestId('assetSource_value').should(
'have.text',
'0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0'
);
cy.getByTestId('amount_value').should('have.text', '5000000');
cy.getByTestId('nonce_value').invoke('text').should('not.be.empty');
cy.getByTestId('signatures_value')
.invoke('text')
.should('not.be.empty');
cy.getByTestId('targetAddress_value').should(
'have.text',
Cypress.env('ethWalletPublicKey')
);
cy.getByTestId('creation_value')
.invoke('text')
.should('not.be.empty');
});
cy.getByTestId(dialogClose).click();
});
// Skipping test due to bug #3882
it.skip('Unable to withdraw asset on pub key view', function () {
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey'); const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`; const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
@@ -277,11 +224,10 @@ context(
cy.get('select').select(usdtSelectValue, { force: true }); cy.get('select').select(usdtSelectValue, { force: true });
cy.getByTestId(balanceAvailable, txTimeout).should('exist'); cy.getByTestId(balanceAvailable, txTimeout).should('exist');
cy.getByTestId(amountInput).click().type('100'); cy.getByTestId(amountInput).click().type('100');
cy.pause();
cy.getByTestId(submitWithdrawalButton).click(); cy.getByTestId(submitWithdrawalButton).click();
}); });
cy.getByTestId(withdrawalDialogContent) cy.getByTestId('dialog-content')
.last() .last()
.within(() => { .within(() => {
cy.get('h1').should('have.text', 'Transaction failed'); cy.get('h1').should('have.text', 'Transaction failed');
@@ -128,7 +128,6 @@ context(
.first() .first()
.find('[data-testid="view-proposal-btn"]') .find('[data-testid="view-proposal-btn"]')
.click(); .click();
cy.url().should('contain', '/protocol-upgrades/v1');
cy.getByTestId('protocol-upgrade-proposal').within(() => { cy.getByTestId('protocol-upgrade-proposal').within(() => {
cy.get('h1').should('have.text', 'Vega Release v1'); cy.get('h1').should('have.text', 'Vega Release v1');
cy.getByTestId('protocol-upgrade-block-height').should( cy.getByTestId('protocol-upgrade-block-height').should(
@@ -221,7 +221,7 @@ export function ensureSpecifiedUnstakedTokensAreAssociated(
} }
export function closeStakingDialog() { export function closeStakingDialog() {
cy.getByTestId('dialog-title', txTimeout).should( cy.getByTestId('dialog-title').should(
'contain.text', 'contain.text',
'At the beginning of the next epoch' 'At the beginning of the next epoch'
); );
@@ -5,7 +5,7 @@ const capsuleWalletConnectButton = '[data-testid="web3-connector-Unknown"]';
export function ethereumWalletConnect() { export function ethereumWalletConnect() {
cy.highlight('Connecting Eth Wallet'); cy.highlight('Connecting Eth Wallet');
cy.get(connectToEthButton, { timeout: 60000 }).within(() => { cy.get(connectToEthButton).within(() => {
cy.contains('Connect Ethereum wallet to associate $VEGA') cy.contains('Connect Ethereum wallet to associate $VEGA')
.should('be.visible') .should('be.visible')
.click(); .click();
+2 -3
View File
@@ -5,11 +5,10 @@ NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_FAIRGROUND=false NX_FAIRGROUND=false
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","STAGNET1":"https://governance.stagnet1.vega.rocks","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}' NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","STAGNET1":"https://stagnet1.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_EXPLORER_URL=https://explorer.stagnet1.vega.rocks NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_DELEGATIONS_PAGINATION=50 NX_DELEGATIONS_PAGINATION=50
-1
View File
@@ -12,4 +12,3 @@ NX_DELEGATIONS_PAGINATION=50
NX_TRANCHES_SERVICE_URL=https://tranches-devnet1-k8s.ops.vega.xyz NX_TRANCHES_SERVICE_URL=https://tranches-devnet1-k8s.ops.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
NX_VEGA_REST_URL=https://api.n00.devnet1.vega.xyz/api/v2/ NX_VEGA_REST_URL=https://api.n00.devnet1.vega.xyz/api/v2/
NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40@o286262.ingest.sentry.io/5882996
+1 -2
View File
@@ -3,10 +3,9 @@ NX_VEGA_ENV=MAINNET
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
NX_VEGA_URL=https://api.vega.community/graphql NX_VEGA_URL=https://api.vega.community/graphql
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}' NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
NX_ETHEREUM_PROVIDER_URL=https://eth-mainnet.gateway.pokt.network/v1/lb/6684b914570bbfa533ba9324 NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://etherscan.io NX_ETHERSCAN_URL=https://etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40@o286262.ingest.sentry.io/5882996
NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz
NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet
NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40:87edc2605e544f888305d7fc4a9141bd@o286262.ingest.sentry.io/5882996 NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40:87edc2605e544f888305d7fc4a9141bd@o286262.ingest.sentry.io/5882996
+2 -2
View File
@@ -1,9 +1,9 @@
# App configuration variables # App configuration variables
NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql
NX_VEGA_ENV=STAGNET1 NX_VEGA_ENV=STAGNET1
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","STAGNET1":"https://governance.stagnet1.vega.rocks","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}' NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","STAGNET1":"https://stagnet1.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
NX_VEGA_EXPLORER_URL=https://explorer.stagnet1.vega.rocks NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_DELEGATIONS_PAGINATION=50 NX_DELEGATIONS_PAGINATION=50
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz
-1
View File
@@ -13,4 +13,3 @@ NX_DELEGATIONS_PAGINATION=50
NX_TRANCHES_SERVICE_URL=https://tranches-testnet-k8s.ops.vega.xyz NX_TRANCHES_SERVICE_URL=https://tranches-testnet-k8s.ops.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
NX_VEGA_REST_URL=https://api.n07.testnet.vega.xyz/api/v2/ NX_VEGA_REST_URL=https://api.n07.testnet.vega.xyz/api/v2/
NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40@o286262.ingest.sentry.io/5882996
@@ -10,4 +10,3 @@ NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
NX_VEGA_REST_URL=https://api-validators-testnet.vega.rocks/api/v2/ NX_VEGA_REST_URL=https://api-validators-testnet.vega.rocks/api/v2/
NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40@o286262.ingest.sentry.io/5882996
@@ -1,40 +0,0 @@
import { t } from '@vegaprotocol/i18n';
import {
ExternalLink,
VegaIcon,
VegaIconNames,
} from '@vegaprotocol/ui-toolkit';
import Routes from '../../routes/routes';
export const RiskMessage = () => {
return (
<>
<div className="bg-vega-light-100 dark:bg-vega-dark-100 p-6 mb-6">
<ul className="list-[square] ml-4">
<li>
{t(
'You may encounter bugs, loss of functionality or loss of assets using the App.'
)}
</li>
<li>
{t(
'No party accepts any liability for any losses whatsoever related to its use.'
)}
</li>
</ul>
</div>
<p className="mb-8">
{t(
'By using the Vega Governance App, you acknowledge that you have read and understood the'
)}{' '}
<ExternalLink href={Routes.DISCLAIMER} className="underline">
<span className="flex items-center gap-1">
<span>{t('Vega Governance Disclaimer')}</span>
<VegaIcon name={VegaIconNames.OPEN_EXTERNAL} />
</span>
</ExternalLink>
.
</p>
</>
);
};
@@ -4,11 +4,9 @@ import {
useAppState, useAppState,
} from '../../contexts/app-state/app-state-context'; } from '../../contexts/app-state/app-state-context';
import { Connectors } from '../../lib/vega-connectors'; import { Connectors } from '../../lib/vega-connectors';
import { RiskMessage } from './risk-message';
export const VegaWalletDialogs = () => { export const VegaWalletDialogs = () => {
const { appState, appDispatch } = useAppState(); const { appState, appDispatch } = useAppState();
return ( return (
<> <>
<VegaConnectDialog <VegaConnectDialog
@@ -19,7 +17,6 @@ export const VegaWalletDialogs = () => {
isOpen: open, isOpen: open,
}) })
} }
riskMessage={<RiskMessage />}
/> />
<VegaManageDialog <VegaManageDialog
@@ -815,11 +815,5 @@
"NoThanks": "No thanks", "NoThanks": "No thanks",
"ShareData": "Share data", "ShareData": "Share data",
"ContinueSharingData": "Continue sharing data", "ContinueSharingData": "Continue sharing data",
"NodeUnsuitable": "Node: {{url}} is unsuitable", "NodeUnsuitable": "Node: {{url}} is unsuitable"
"Disclaimer": "Disclaimer",
"disclaimer1": "The Vega Governance App allows the Vega network to arrive at on-chain decisions, where tokenholders can create proposals that other tokenholders can vote to approve or reject. Vega supports on-chain proposals for creating markets and assets, and changing network parameters, markets and assets. Vega also supports freeform proposals for community suggestions that will not be enacted on-chain.",
"disclaimer2": "The Vega Governance App is free, public and open source software. Software upgrades may contain bugs or security vulnerabilities that might result in loss of functionality.",
"disclaimer3": "The Vega Governance App uses data obtained from nodes on the Vega Blockchain. The developers of the Vega Governance App do not operate or run the Vega Blockchain or any other blockchain.",
"disclaimer4": "The Vega Governance App is provided “as is”. The developers of the Vega Governance App make no representations or warranties of any kind, whether express or implied, statutory or otherwise regarding the Vega Governance App. They disclaim all warranties of merchantability, quality, fitness for purpose. They disclaim all warranties that the Vega Governance App is free of harmful components or errors.",
"disclaimer5": "No developer of the Vega Governance App accepts any responsibility for, or liability to users in connection with their use of the Vega Governance App."
} }
@@ -1,21 +0,0 @@
import type { RouteChildProps } from '..';
import { useDocumentTitle } from '../../hooks/use-document-title';
import { Heading } from '../../components/heading';
import { useTranslation } from 'react-i18next';
const Disclaimer = ({ name }: RouteChildProps) => {
useDocumentTitle(name);
const { t } = useTranslation();
return (
<>
<Heading title={t('Disclaimer')} />
<p className="mb-6 mt-10">{t('disclaimer1')}</p>
<p className="mb-6">{t('disclaimer2')}</p>
<p className="mb-6">{t('disclaimer3')}</p>
<p className="mb-8">{t('disclaimer4')}</p>
<p className="mb-8">{t('disclaimer5')}</p>
</>
);
};
export default Disclaimer;
+1 -4
View File
@@ -209,10 +209,7 @@ const GovernanceHome = ({ name }: RouteChildProps) => {
[proposalsData] [proposalsData]
); );
const sortedProposals = useMemo( const sortedProposals = useMemo(() => orderByDate(proposals), [proposals]);
() => orderByDate(proposals).reverse(),
[proposals]
);
const protocolUpgradeProposals = useMemo( const protocolUpgradeProposals = useMemo(
() => () =>
@@ -124,7 +124,7 @@ describe('Proposal header', () => {
}) })
); );
expect(screen.getByTestId('proposal-title')).toHaveTextContent( expect(screen.getByTestId('proposal-title')).toHaveTextContent(
'New asset proposal' 'Unknown proposal'
); );
expect(screen.getByTestId('proposal-type')).toHaveTextContent('New asset'); expect(screen.getByTestId('proposal-type')).toHaveTextContent('New asset');
expect(screen.getByTestId('proposal-details')).toHaveTextContent( expect(screen.getByTestId('proposal-details')).toHaveTextContent(
@@ -21,7 +21,6 @@ export const ProposalHeader = ({
let details: ReactNode; let details: ReactNode;
let proposalType = ''; let proposalType = '';
let fallbackTitle = '';
const title = proposal?.rationale.title.trim(); const title = proposal?.rationale.title.trim();
@@ -30,7 +29,6 @@ export const ProposalHeader = ({
switch (change?.__typename) { switch (change?.__typename) {
case 'NewMarket': { case 'NewMarket': {
proposalType = 'NewMarket'; proposalType = 'NewMarket';
fallbackTitle = t('NewMarketProposal');
details = ( details = (
<> <>
<span> <span>
@@ -52,7 +50,6 @@ export const ProposalHeader = ({
} }
case 'UpdateMarket': { case 'UpdateMarket': {
proposalType = 'UpdateMarket'; proposalType = 'UpdateMarket';
fallbackTitle = t('UpdateMarketProposal');
details = ( details = (
<> <>
<span>{t('Market change')}:</span>{' '} <span>{t('Market change')}:</span>{' '}
@@ -63,7 +60,6 @@ export const ProposalHeader = ({
} }
case 'NewAsset': { case 'NewAsset': {
proposalType = 'NewAsset'; proposalType = 'NewAsset';
fallbackTitle = t('NewAssetProposal');
details = ( details = (
<> <>
<span>{t('Symbol')}:</span> <Lozenge>{change.symbol}.</Lozenge>{' '} <span>{t('Symbol')}:</span> <Lozenge>{change.symbol}.</Lozenge>{' '}
@@ -85,7 +81,6 @@ export const ProposalHeader = ({
} }
case 'UpdateNetworkParameter': { case 'UpdateNetworkParameter': {
proposalType = 'NetworkParameter'; proposalType = 'NetworkParameter';
fallbackTitle = t('NetworkParameterProposal');
details = ( details = (
<> <>
<span>{t('Change')}:</span>{' '} <span>{t('Change')}:</span>{' '}
@@ -100,13 +95,11 @@ export const ProposalHeader = ({
} }
case 'NewFreeform': { case 'NewFreeform': {
proposalType = 'Freeform'; proposalType = 'Freeform';
fallbackTitle = t('FreeformProposal');
details = <span />; details = <span />;
break; break;
} }
case 'UpdateAsset': { case 'UpdateAsset': {
proposalType = 'UpdateAsset'; proposalType = 'UpdateAsset';
fallbackTitle = t('UpdateAssetProposal');
details = ( details = (
<> <>
<span>{t('AssetID')}:</span>{' '} <span>{t('AssetID')}:</span>{' '}
@@ -122,14 +115,10 @@ export const ProposalHeader = ({
<div data-testid="proposal-title"> <div data-testid="proposal-title">
{isListItem ? ( {isListItem ? (
<header> <header>
<SubHeading <SubHeading title={titleContent || t('Unknown proposal')} />
title={titleContent || fallbackTitle || t('Unknown proposal')}
/>
</header> </header>
) : ( ) : (
<Heading <Heading title={titleContent || t('Unknown proposal')} />
title={titleContent || fallbackTitle || t('Unknown proposal')}
/>
)} )}
</div> </div>
@@ -115,6 +115,29 @@ describe('Proposals list', () => {
); );
}); });
it('Orders proposals correctly by closingDateTime', () => {
render(
renderComponent([
failedProposalClosedLastMonth,
openProposalClosesNextMonth,
openProposalClosesNextWeek,
enactedProposalClosedLastWeek,
])
);
const openProposals = within(screen.getByTestId('open-proposals'));
const closedProposals = within(screen.getByTestId('closed-proposals'));
const openProposalsItems = openProposals.getAllByTestId(
'proposals-list-item'
);
const closedProposalsItems = closedProposals.getAllByTestId(
'proposals-list-item'
);
expect(openProposalsItems[0]).toHaveAttribute('id', 'proposal2');
expect(openProposalsItems[1]).toHaveAttribute('id', 'proposal1');
expect(closedProposalsItems[0]).toHaveAttribute('id', 'proposal3');
expect(closedProposalsItems[1]).toHaveAttribute('id', 'proposal4');
});
it('Displays info on no proposals', () => { it('Displays info on no proposals', () => {
render(renderComponent([])); render(renderComponent([]));
expect(screen.queryByTestId('open-proposals')).not.toBeInTheDocument(); expect(screen.queryByTestId('open-proposals')).not.toBeInTheDocument();
@@ -35,11 +35,7 @@ export const orderByDate = (arr: ProposalFieldsFragment[]) =>
orderBy( orderBy(
arr, arr,
[ [
(p) => (p) => new Date(p?.terms?.closingDatetime).getTime(),
p?.terms?.enactmentDatetime
? new Date(p?.terms?.enactmentDatetime).getTime()
: // has to be defaulted to 0 because new Date(null).getTime() -> NaN which is first when ordered
new Date(p?.terms?.closingDatetime || 0).getTime(),
(p) => new Date(p?.datetime).getTime(), (p) => new Date(p?.datetime).getTime(),
], ],
['asc', 'asc'] ['asc', 'asc']
@@ -49,7 +49,6 @@ export const ProposeFreeform = () => {
formState: { errors }, formState: { errors },
setValue, setValue,
watch, watch,
trigger,
} = useForm<FreeformProposalFormFields>(); } = useForm<FreeformProposalFormFields>();
const { finalizedProposal, submit, Dialog } = useProposalSubmit(); const { finalizedProposal, submit, Dialog } = useProposalSubmit();
@@ -86,13 +85,7 @@ export const ProposeFreeform = () => {
await submit(assembleProposal(fields)); await submit(assembleProposal(fields));
}; };
const viewJson = async () => { const viewJson = () => {
const isValid = await trigger();
if (!isValid) {
return;
}
const formData = watch(); const formData = watch();
downloadJson( downloadJson(
JSON.stringify(assembleProposal(formData)), JSON.stringify(assembleProposal(formData)),
@@ -89,7 +89,6 @@ export const ProposeNetworkParameter = () => {
formState: { errors }, formState: { errors },
setValue, setValue,
watch, watch,
trigger,
} = useForm<NetworkParameterProposalFormFields>(); } = useForm<NetworkParameterProposalFormFields>();
const { finalizedProposal, submit, Dialog } = useProposalSubmit(); const { finalizedProposal, submit, Dialog } = useProposalSubmit();
@@ -149,13 +148,7 @@ export const ProposeNetworkParameter = () => {
await submit(assembleProposal(fields)); await submit(assembleProposal(fields));
}; };
const viewJson = async () => { const viewJson = () => {
const isValid = await trigger();
if (!isValid) {
return;
}
const formData = watch(); const formData = watch();
downloadJson( downloadJson(
JSON.stringify(assembleProposal(formData)), JSON.stringify(assembleProposal(formData)),
@@ -61,7 +61,6 @@ export const ProposeNewAsset = () => {
formState: { errors }, formState: { errors },
setValue, setValue,
watch, watch,
trigger,
} = useForm<NewAssetProposalFormFields>(); } = useForm<NewAssetProposalFormFields>();
const { finalizedProposal, submit, Dialog } = useProposalSubmit(); const { finalizedProposal, submit, Dialog } = useProposalSubmit();
@@ -118,13 +117,7 @@ export const ProposeNewAsset = () => {
await submit(assembleProposal(fields)); await submit(assembleProposal(fields));
}; };
const viewJson = async () => { const viewJson = () => {
const isValid = await trigger();
if (!isValid) {
return;
}
const formData = watch(); const formData = watch();
downloadJson( downloadJson(
JSON.stringify(assembleProposal(formData)), JSON.stringify(assembleProposal(formData)),
@@ -59,7 +59,6 @@ export const ProposeNewMarket = () => {
formState: { errors }, formState: { errors },
setValue, setValue,
watch, watch,
trigger,
} = useForm<NewMarketProposalFormFields>(); } = useForm<NewMarketProposalFormFields>();
const { finalizedProposal, submit, Dialog } = useProposalSubmit(); const { finalizedProposal, submit, Dialog } = useProposalSubmit();
@@ -108,13 +107,7 @@ export const ProposeNewMarket = () => {
await submit(assembleProposal(fields)); await submit(assembleProposal(fields));
}; };
const viewJson = async () => { const viewJson = () => {
const isValid = await trigger();
if (!isValid) {
return;
}
const formData = watch(); const formData = watch();
downloadJson( downloadJson(
JSON.stringify(assembleProposal(formData)), JSON.stringify(assembleProposal(formData)),
@@ -59,7 +59,6 @@ export const ProposeUpdateAsset = () => {
formState: { errors }, formState: { errors },
setValue, setValue,
watch, watch,
trigger,
} = useForm<UpdateAssetProposalFormFields>(); } = useForm<UpdateAssetProposalFormFields>();
const { finalizedProposal, submit, Dialog } = useProposalSubmit(); const { finalizedProposal, submit, Dialog } = useProposalSubmit();
@@ -108,13 +107,7 @@ export const ProposeUpdateAsset = () => {
await submit(assembleProposal(fields)); await submit(assembleProposal(fields));
}; };
const viewJson = async () => { const viewJson = () => {
const isValid = await trigger();
if (!isValid) {
return;
}
const formData = watch(); const formData = watch();
downloadJson( downloadJson(
JSON.stringify(assembleProposal(formData)), JSON.stringify(assembleProposal(formData)),
@@ -106,7 +106,6 @@ export const ProposeUpdateMarket = () => {
formState: { errors }, formState: { errors },
setValue, setValue,
watch, watch,
trigger,
} = useForm<UpdateMarketProposalFormFields>(); } = useForm<UpdateMarketProposalFormFields>();
const { finalizedProposal, submit, Dialog } = useProposalSubmit(); const { finalizedProposal, submit, Dialog } = useProposalSubmit();
@@ -158,13 +157,7 @@ export const ProposeUpdateMarket = () => {
await submit(assembleProposal(fields)); await submit(assembleProposal(fields));
}; };
const viewJson = async () => { const viewJson = () => {
const isValid = await trigger();
if (!isValid) {
return;
}
const formData = watch(); const formData = watch();
downloadJson( downloadJson(
JSON.stringify(assembleProposal(formData)), JSON.stringify(assembleProposal(formData)),
@@ -5,9 +5,6 @@ import { ProtocolUpgradeProposalDetailInfo } from '../components/protocol-upgrad
import { getNormalisedVotingPower } from '../../staking/shared'; import { getNormalisedVotingPower } from '../../staking/shared';
import type { NodesFragmentFragment } from '../../staking/home/__generated__/Nodes'; import type { NodesFragmentFragment } from '../../staking/home/__generated__/Nodes';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals'; import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import { useVegaRelease } from '@vegaprotocol/environment';
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
import { useTranslation } from 'react-i18next';
export interface ProtocolUpgradeProposalProps { export interface ProtocolUpgradeProposalProps {
proposal: ProtocolUpgradeProposalFieldsFragment; proposal: ProtocolUpgradeProposalFieldsFragment;
@@ -45,9 +42,6 @@ export const ProtocolUpgradeProposal = ({
lastBlockHeight, lastBlockHeight,
consensusValidators, consensusValidators,
}: ProtocolUpgradeProposalProps) => { }: ProtocolUpgradeProposalProps) => {
const { t } = useTranslation();
const releaseInfo = useVegaRelease(proposal.vegaReleaseTag);
const consensusApprovals = useMemo( const consensusApprovals = useMemo(
() => getConsensusApprovals(consensusValidators || [], proposal), () => getConsensusApprovals(consensusValidators || [], proposal),
[consensusValidators, proposal] [consensusValidators, proposal]
@@ -84,14 +78,6 @@ export const ProtocolUpgradeProposal = ({
totalConsensusValidators={consensusValidators.length} totalConsensusValidators={consensusValidators.length}
/> />
)} )}
{releaseInfo && releaseInfo.htmlUrl && (
<div className="mb-10">
<ExternalLink href={releaseInfo.htmlUrl}>
{t('Explore release on GitHub')}
</ExternalLink>
</div>
)}
</section> </section>
); );
}; };
@@ -8,7 +8,6 @@ const mockData = {
{ {
asset: 'tDAI', asset: 'tDAI',
totalAmount: '5', totalAmount: '5',
decimals: 6,
rewardTypes: { rewardTypes: {
ACCOUNT_TYPE_GLOBAL_REWARD: { ACCOUNT_TYPE_GLOBAL_REWARD: {
amount: '0', amount: '0',
@@ -1,5 +1,6 @@
import { formatNumber, toBigNum } from '@vegaprotocol/utils'; import { formatNumber, toBigNum } from '@vegaprotocol/utils';
import { Tooltip } from '@vegaprotocol/ui-toolkit'; import { Tooltip } from '@vegaprotocol/ui-toolkit';
import { useAppState } from '../../../contexts/app-state/app-state-context';
import { import {
rowGridItemStyles, rowGridItemStyles,
RewardsTable, RewardsTable,
@@ -12,8 +13,7 @@ interface EpochIndividualRewardsGridProps {
} }
interface RewardItemProps { interface RewardItemProps {
amount: string; value: string;
decimals: number;
percentageOfTotal?: string; percentageOfTotal?: string;
dataTestId: string; dataTestId: string;
last?: boolean; last?: boolean;
@@ -21,14 +21,15 @@ interface RewardItemProps {
const DisplayReward = ({ const DisplayReward = ({
reward, reward,
decimals,
percentageOfTotal, percentageOfTotal,
}: { }: {
reward: string; reward: string;
decimals: number;
percentageOfTotal?: string; percentageOfTotal?: string;
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const {
appState: { decimals },
} = useAppState();
if (Number(reward) === 0) { if (Number(reward) === 0) {
return <span className="text-vega-dark-300">-</span>; return <span className="text-vega-dark-300">-</span>;
@@ -63,8 +64,7 @@ const DisplayReward = ({
}; };
const RewardItem = ({ const RewardItem = ({
amount, value,
decimals,
percentageOfTotal, percentageOfTotal,
dataTestId, dataTestId,
last, last,
@@ -72,11 +72,7 @@ const RewardItem = ({
<div data-testid={dataTestId} className={rowGridItemStyles(last)}> <div data-testid={dataTestId} className={rowGridItemStyles(last)}>
<div className="h-full w-5 absolute right-0 top-0 bg-gradient-to-r from-transparent to-black pointer-events-none" /> <div className="h-full w-5 absolute right-0 top-0 bg-gradient-to-r from-transparent to-black pointer-events-none" />
<div className="overflow-auto p-5"> <div className="overflow-auto p-5">
<DisplayReward <DisplayReward reward={value} percentageOfTotal={percentageOfTotal} />
reward={amount}
decimals={decimals}
percentageOfTotal={percentageOfTotal}
/>
</div> </div>
<div className="h-full w-5 absolute left-0 top-0 bg-gradient-to-l from-transparent to-black pointer-events-none" /> <div className="h-full w-5 absolute left-0 top-0 bg-gradient-to-l from-transparent to-black pointer-events-none" />
</div> </div>
@@ -90,7 +86,7 @@ export const EpochIndividualRewardsTable = ({
dataTestId="epoch-individual-rewards-table" dataTestId="epoch-individual-rewards-table"
epoch={Number(data.epoch)} epoch={Number(data.epoch)}
> >
{data.rewards.map(({ asset, rewardTypes, totalAmount, decimals }, i) => ( {data.rewards.map(({ asset, rewardTypes, totalAmount }, i) => (
<div className="contents" key={i}> <div className="contents" key={i}>
<div <div
data-testid="individual-rewards-asset" data-testid="individual-rewards-asset"
@@ -102,19 +98,13 @@ export const EpochIndividualRewardsTable = ({
([key, { amount, percentageOfTotal }]) => ( ([key, { amount, percentageOfTotal }]) => (
<RewardItem <RewardItem
key={key} key={key}
amount={amount} value={amount}
decimals={decimals}
percentageOfTotal={percentageOfTotal} percentageOfTotal={percentageOfTotal}
dataTestId={key} dataTestId={key}
/> />
) )
)} )}
<RewardItem <RewardItem dataTestId="total" value={totalAmount} last={true} />
dataTestId="total"
amount={totalAmount}
decimals={decimals}
last={true}
/>
</div> </div>
))} ))}
</RewardsTable> </RewardsTable>
@@ -8,7 +8,7 @@ describe('generateEpochIndividualRewardsList', () => {
amount: '100', amount: '100',
percentageOfTotal: '0.1', percentageOfTotal: '0.1',
receivedAt: new Date(), receivedAt: new Date(),
asset: { id: 'usd', symbol: 'USD', name: 'USD', decimals: 6 }, asset: { id: 'usd', symbol: 'USD', name: 'USD' },
party: { id: 'blah' }, party: { id: 'blah' },
epoch: { id: '1' }, epoch: { id: '1' },
}; };
@@ -18,7 +18,7 @@ describe('generateEpochIndividualRewardsList', () => {
amount: '50', amount: '50',
percentageOfTotal: '0.05', percentageOfTotal: '0.05',
receivedAt: new Date(), receivedAt: new Date(),
asset: { id: 'eur', symbol: 'EUR', name: 'EUR', decimals: 5 }, asset: { id: 'eur', symbol: 'EUR', name: 'EUR' },
party: { id: 'blah' }, party: { id: 'blah' },
epoch: { id: '2' }, epoch: { id: '2' },
}; };
@@ -28,7 +28,7 @@ describe('generateEpochIndividualRewardsList', () => {
amount: '200', amount: '200',
percentageOfTotal: '0.2', percentageOfTotal: '0.2',
receivedAt: new Date(), receivedAt: new Date(),
asset: { id: 'gbp', symbol: 'GBP', name: 'GBP', decimals: 7 }, asset: { id: 'gbp', symbol: 'GBP', name: 'GBP' },
party: { id: 'blah' }, party: { id: 'blah' },
epoch: { id: '2' }, epoch: { id: '2' },
}; };
@@ -38,7 +38,7 @@ describe('generateEpochIndividualRewardsList', () => {
amount: '100', amount: '100',
percentageOfTotal: '0.1', percentageOfTotal: '0.1',
receivedAt: new Date(), receivedAt: new Date(),
asset: { id: 'usd', symbol: 'USD', name: 'USD', decimals: 6 }, asset: { id: 'usd', symbol: 'USD', name: 'USD' },
party: { id: 'blah' }, party: { id: 'blah' },
epoch: { id: '1' }, epoch: { id: '1' },
}; };
@@ -48,7 +48,7 @@ describe('generateEpochIndividualRewardsList', () => {
amount: '150', amount: '150',
percentageOfTotal: '0.15', percentageOfTotal: '0.15',
receivedAt: new Date(), receivedAt: new Date(),
asset: { id: 'usd', symbol: 'USD', name: 'USD', decimals: 6 }, asset: { id: 'usd', symbol: 'USD', name: 'USD' },
party: { id: 'blah' }, party: { id: 'blah' },
epoch: { id: '3' }, epoch: { id: '3' },
}; };
@@ -58,7 +58,7 @@ describe('generateEpochIndividualRewardsList', () => {
amount: '50', amount: '50',
percentageOfTotal: '0.05', percentageOfTotal: '0.05',
receivedAt: new Date(), receivedAt: new Date(),
asset: { id: 'eur', symbol: 'EUR', name: 'EUR', decimals: 5 }, asset: { id: 'eur', symbol: 'EUR', name: 'EUR' },
party: { id: 'blah' }, party: { id: 'blah' },
epoch: { id: '2' }, epoch: { id: '2' },
}; };
@@ -99,7 +99,6 @@ describe('generateEpochIndividualRewardsList', () => {
rewards: [ rewards: [
{ {
asset: 'USD', asset: 'USD',
decimals: 6,
totalAmount: '100', totalAmount: '100',
rewardTypes: { rewardTypes: {
[AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: { [AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: {
@@ -168,7 +167,6 @@ describe('generateEpochIndividualRewardsList', () => {
{ {
asset: 'GBP', asset: 'GBP',
totalAmount: '200', totalAmount: '200',
decimals: 7,
rewardTypes: { rewardTypes: {
[AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: { [AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: {
amount: '0', amount: '0',
@@ -199,7 +197,6 @@ describe('generateEpochIndividualRewardsList', () => {
{ {
asset: 'EUR', asset: 'EUR',
totalAmount: '50', totalAmount: '50',
decimals: 5,
rewardTypes: { rewardTypes: {
[AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: { [AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: {
amount: '0', amount: '0',
@@ -235,7 +232,6 @@ describe('generateEpochIndividualRewardsList', () => {
{ {
asset: 'USD', asset: 'USD',
totalAmount: '200', totalAmount: '200',
decimals: 6,
rewardTypes: { rewardTypes: {
[AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: { [AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: {
amount: '0', amount: '0',
@@ -283,7 +279,6 @@ describe('generateEpochIndividualRewardsList', () => {
rewards: [ rewards: [
{ {
asset: 'USD', asset: 'USD',
decimals: 6,
totalAmount: '150', totalAmount: '150',
rewardTypes: { rewardTypes: {
[AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: { [AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: {
@@ -320,7 +315,6 @@ describe('generateEpochIndividualRewardsList', () => {
{ {
asset: 'GBP', asset: 'GBP',
totalAmount: '200', totalAmount: '200',
decimals: 7,
rewardTypes: { rewardTypes: {
[AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: { [AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: {
amount: '0', amount: '0',
@@ -351,7 +345,6 @@ describe('generateEpochIndividualRewardsList', () => {
{ {
asset: 'EUR', asset: 'EUR',
totalAmount: '50', totalAmount: '50',
decimals: 5,
rewardTypes: { rewardTypes: {
[AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: { [AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: {
amount: '0', amount: '0',
@@ -397,7 +390,6 @@ describe('generateEpochIndividualRewardsList', () => {
{ {
asset: 'USD', asset: 'USD',
totalAmount: '200', totalAmount: '200',
decimals: 6,
rewardTypes: { rewardTypes: {
[AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: { [AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE]: {
amount: '0', amount: '0',
@@ -9,7 +9,6 @@ export interface EpochIndividualReward {
rewards: { rewards: {
asset: string; asset: string;
totalAmount: string; totalAmount: string;
decimals: number;
rewardTypes: { rewardTypes: {
[key in AccountType]?: { [key in AccountType]?: {
amount: string; amount: string;
@@ -54,7 +53,6 @@ export const generateEpochIndividualRewardsList = ({
const epochIndividualRewards = rewards.reduce((acc, reward) => { const epochIndividualRewards = rewards.reduce((acc, reward) => {
const epochId = reward.epoch.id; const epochId = reward.epoch.id;
const assetName = reward.asset.name; const assetName = reward.asset.name;
const assetDecimals = reward.asset.decimals;
const rewardType = reward.rewardType; const rewardType = reward.rewardType;
const amount = reward.amount; const amount = reward.amount;
const percentageOfTotal = reward.percentageOfTotal; const percentageOfTotal = reward.percentageOfTotal;
@@ -75,7 +73,6 @@ export const generateEpochIndividualRewardsList = ({
if (!asset) { if (!asset) {
asset = { asset = {
asset: assetName, asset: assetName,
decimals: assetDecimals,
totalAmount: '0', totalAmount: '0',
rewardTypes: Object.fromEntries(emptyRowAccountTypes), rewardTypes: Object.fromEntries(emptyRowAccountTypes),
}; };
@@ -52,7 +52,6 @@ const assetRewards: Map<
assetRewards.set(assetId, { assetRewards.set(assetId, {
assetId, assetId,
name: 'tDAI TEST', name: 'tDAI TEST',
decimals: 6,
rewards, rewards,
totalAmount: '295', totalAmount: '295',
}); });
@@ -1,5 +1,6 @@
import { formatNumber, toBigNum } from '@vegaprotocol/utils'; import { formatNumber, toBigNum } from '@vegaprotocol/utils';
import { Tooltip } from '@vegaprotocol/ui-toolkit'; import { Tooltip } from '@vegaprotocol/ui-toolkit';
import { useAppState } from '../../../contexts/app-state/app-state-context';
import { import {
rowGridItemStyles, rowGridItemStyles,
RewardsTable, RewardsTable,
@@ -11,19 +12,16 @@ interface EpochTotalRewardsGridProps {
} }
interface RewardItemProps { interface RewardItemProps {
amount: string; value: string;
decimals: number;
dataTestId: string; dataTestId: string;
last?: boolean; last?: boolean;
} }
const DisplayReward = ({ const DisplayReward = ({ reward }: { reward: string }) => {
reward, const {
decimals, appState: { decimals },
}: { } = useAppState();
reward: string;
decimals: number;
}) => {
if (Number(reward) === 0) { if (Number(reward) === 0) {
return <span className="text-vega-dark-300">-</span>; return <span className="text-vega-dark-300">-</span>;
} }
@@ -35,16 +33,11 @@ const DisplayReward = ({
); );
}; };
const RewardItem = ({ const RewardItem = ({ value, dataTestId, last }: RewardItemProps) => (
amount,
decimals,
dataTestId,
last,
}: RewardItemProps) => (
<div data-testid={dataTestId} className={rowGridItemStyles(last)}> <div data-testid={dataTestId} className={rowGridItemStyles(last)}>
<div className="h-full w-5 absolute right-0 top-0 bg-gradient-to-r from-transparent to-black pointer-events-none" /> <div className="h-full w-5 absolute right-0 top-0 bg-gradient-to-r from-transparent to-black pointer-events-none" />
<div className="overflow-auto p-5"> <div className="overflow-auto p-5">
<DisplayReward reward={amount} decimals={decimals} /> <DisplayReward reward={value} />
</div> </div>
<div className="h-full w-5 absolute left-0 top-0 bg-gradient-to-l from-transparent to-black pointer-events-none" /> <div className="h-full w-5 absolute left-0 top-0 bg-gradient-to-l from-transparent to-black pointer-events-none" />
</div> </div>
@@ -56,25 +49,15 @@ export const EpochTotalRewardsTable = ({
return ( return (
<RewardsTable dataTestId="epoch-total-rewards-table" epoch={data.epoch}> <RewardsTable dataTestId="epoch-total-rewards-table" epoch={data.epoch}>
{Array.from(data.assetRewards.values()).map( {Array.from(data.assetRewards.values()).map(
({ name, rewards, totalAmount, decimals }, i) => ( ({ name, rewards, totalAmount }, i) => (
<div className="contents" key={i}> <div className="contents" key={i}>
<div data-testid="asset" className={`${rowGridItemStyles()} p-5`}> <div data-testid="asset" className={`${rowGridItemStyles()} p-5`}>
{name} {name}
</div> </div>
{Array.from(rewards.values()).map(({ rewardType, amount }, i) => ( {Array.from(rewards.values()).map(({ rewardType, amount }, i) => (
<RewardItem <RewardItem key={i} dataTestId={rewardType} value={amount} />
key={i}
dataTestId={rewardType}
amount={amount}
decimals={decimals}
/>
))} ))}
<RewardItem <RewardItem dataTestId="total" value={totalAmount} last={true} />
dataTestId="total"
amount={totalAmount}
decimals={decimals}
last={true}
/>
</div> </div>
) )
)} )}
@@ -56,14 +56,12 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
id: '1', id: '1',
name: 'Asset 1', name: 'Asset 1',
decimals: 18,
}, },
}, },
{ {
node: { node: {
id: '2', id: '2',
name: 'Asset 2', name: 'Asset 2',
decimals: 6,
}, },
}, },
], ],
@@ -103,7 +101,6 @@ describe('generateEpochAssetRewardsList', () => {
{ {
node: { node: {
epoch: 1, epoch: 1,
decimals: 18,
assetId: '1', assetId: '1',
rewardType: AccountType.ACCOUNT_TYPE_GLOBAL_REWARD, rewardType: AccountType.ACCOUNT_TYPE_GLOBAL_REWARD,
amount: '123', amount: '123',
@@ -131,7 +128,6 @@ describe('generateEpochAssetRewardsList', () => {
'1', '1',
{ {
assetId: '1', assetId: '1',
decimals: 0,
name: '', name: '',
rewards: new Map([ rewards: new Map([
[ [
@@ -200,14 +196,12 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
id: '1', id: '1',
name: 'Asset 1', name: 'Asset 1',
decimals: 18,
}, },
}, },
{ {
node: { node: {
id: '2', id: '2',
name: 'Asset 2', name: 'Asset 2',
decimals: 6,
}, },
}, },
], ],
@@ -218,7 +212,6 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
epoch: 1, epoch: 1,
assetId: '1', assetId: '1',
decimals: 18,
rewardType: AccountType.ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES, rewardType: AccountType.ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES,
amount: '123', amount: '123',
}, },
@@ -227,7 +220,6 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
epoch: 1, epoch: 1,
assetId: '1', assetId: '1',
decimals: 18,
rewardType: AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE, rewardType: AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE,
amount: '100', amount: '100',
}, },
@@ -236,7 +228,6 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
epoch: 2, epoch: 2,
assetId: '1', assetId: '1',
decimals: 18,
rewardType: AccountType.ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES, rewardType: AccountType.ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
amount: '5', amount: '5',
}, },
@@ -263,7 +254,6 @@ describe('generateEpochAssetRewardsList', () => {
'1', '1',
{ {
assetId: '1', assetId: '1',
decimals: 18,
name: 'Asset 1', name: 'Asset 1',
rewards: new Map([ rewards: new Map([
[ [
@@ -329,7 +319,6 @@ describe('generateEpochAssetRewardsList', () => {
'1', '1',
{ {
assetId: '1', assetId: '1',
decimals: 18,
name: 'Asset 1', name: 'Asset 1',
rewards: new Map([ rewards: new Map([
[ [
@@ -398,14 +387,12 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
id: '1', id: '1',
name: 'Asset 1', name: 'Asset 1',
decimals: 18,
}, },
}, },
{ {
node: { node: {
id: '2', id: '2',
name: 'Asset 2', name: 'Asset 2',
decimals: 6,
}, },
}, },
], ],
@@ -416,7 +403,6 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
epoch: 1, epoch: 1,
assetId: '1', assetId: '1',
decimals: 18,
rewardType: AccountType.ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES, rewardType: AccountType.ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES,
amount: '123', amount: '123',
}, },
@@ -425,7 +411,6 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
epoch: 1, epoch: 1,
assetId: '1', assetId: '1',
decimals: 18,
rewardType: AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE, rewardType: AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE,
amount: '100', amount: '100',
}, },
@@ -434,7 +419,6 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
epoch: 2, epoch: 2,
assetId: '1', assetId: '1',
decimals: 18,
rewardType: AccountType.ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES, rewardType: AccountType.ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
amount: '6', amount: '6',
}, },
@@ -443,7 +427,6 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
epoch: 2, epoch: 2,
assetId: '1', assetId: '1',
decimals: 18,
rewardType: AccountType.ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES, rewardType: AccountType.ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
amount: '27', amount: '27',
}, },
@@ -452,7 +435,6 @@ describe('generateEpochAssetRewardsList', () => {
node: { node: {
epoch: 3, epoch: 3,
assetId: '1', assetId: '1',
decimals: 18,
rewardType: AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE, rewardType: AccountType.ACCOUNT_TYPE_FEES_INFRASTRUCTURE,
amount: '15', amount: '15',
}, },
@@ -485,7 +467,6 @@ describe('generateEpochAssetRewardsList', () => {
{ {
assetId: '1', assetId: '1',
name: 'Asset 1', name: 'Asset 1',
decimals: 18,
rewards: new Map([ rewards: new Map([
[ [
AccountType.ACCOUNT_TYPE_GLOBAL_REWARD, AccountType.ACCOUNT_TYPE_GLOBAL_REWARD,
@@ -550,7 +531,6 @@ describe('generateEpochAssetRewardsList', () => {
'1', '1',
{ {
assetId: '1', assetId: '1',
decimals: 18,
name: 'Asset 1', name: 'Asset 1',
rewards: new Map([ rewards: new Map([
[ [
@@ -628,7 +608,6 @@ describe('generateEpochAssetRewardsList', () => {
'1', '1',
{ {
assetId: '1', assetId: '1',
decimals: 18,
name: 'Asset 1', name: 'Asset 1',
rewards: new Map([ rewards: new Map([
[ [
@@ -22,7 +22,6 @@ export type AggregatedEpochRewardSummary = {
name: EpochSummaryWithNamedReward['name']; name: EpochSummaryWithNamedReward['name'];
rewards: Map<RewardType, RewardItem>; rewards: Map<RewardType, RewardItem>;
totalAmount: string; totalAmount: string;
decimals: number;
}; };
export type EpochTotalSummary = { export type EpochTotalSummary = {
@@ -92,7 +91,6 @@ export const generateEpochTotalRewardsList = ({
assetId: reward.assetId, assetId: reward.assetId,
name: matchingAsset?.name || '', name: matchingAsset?.name || '',
rewards: rewards || new Map(emptyRowAccountTypes), rewards: rewards || new Map(emptyRowAccountTypes),
decimals: matchingAsset?.decimals || 0,
totalAmount: ( totalAmount: (
Number(reward.amount) + Number(assetWithRewards?.totalAmount || 0) Number(reward.amount) + Number(assetWithRewards?.totalAmount || 0)
).toString(), ).toString(),
@@ -4,7 +4,6 @@ fragment RewardFields on Reward {
id id
symbol symbol
name name
decimals
} }
party { party {
id id
@@ -68,7 +67,6 @@ query EpochAssetsRewards(
node { node {
id id
name name
decimals
} }
} }
} }
@@ -3,7 +3,7 @@ import * as Types from '@vegaprotocol/types';
import { gql } from '@apollo/client'; import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client'; import * as Apollo from '@apollo/client';
const defaultOptions = {} as const; const defaultOptions = {} as const;
export type RewardFieldsFragment = { __typename?: 'Reward', rewardType: Types.AccountType, amount: string, percentageOfTotal: string, receivedAt: any, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, party: { __typename?: 'Party', id: string }, epoch: { __typename?: 'Epoch', id: string } }; export type RewardFieldsFragment = { __typename?: 'Reward', rewardType: Types.AccountType, amount: string, percentageOfTotal: string, receivedAt: any, asset: { __typename?: 'Asset', id: string, symbol: string, name: string }, party: { __typename?: 'Party', id: string }, epoch: { __typename?: 'Epoch', id: string } };
export type DelegationFieldsFragment = { __typename?: 'Delegation', amount: string, epoch: number }; export type DelegationFieldsFragment = { __typename?: 'Delegation', amount: string, epoch: number };
@@ -16,7 +16,7 @@ export type RewardsQueryVariables = Types.Exact<{
}>; }>;
export type RewardsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, rewardsConnection?: { __typename?: 'RewardsConnection', edges?: Array<{ __typename?: 'RewardEdge', node: { __typename?: 'Reward', rewardType: Types.AccountType, amount: string, percentageOfTotal: string, receivedAt: any, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, party: { __typename?: 'Party', id: string }, epoch: { __typename?: 'Epoch', id: string } } } | null> | null } | null, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number } } | null> | null } | null } | null }; export type RewardsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, rewardsConnection?: { __typename?: 'RewardsConnection', edges?: Array<{ __typename?: 'RewardEdge', node: { __typename?: 'Reward', rewardType: Types.AccountType, amount: string, percentageOfTotal: string, receivedAt: any, asset: { __typename?: 'Asset', id: string, symbol: string, name: string }, party: { __typename?: 'Party', id: string }, epoch: { __typename?: 'Epoch', id: string } } } | null> | null } | null, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number } } | null> | null } | null } | null };
export type EpochRewardSummaryFieldsFragment = { __typename?: 'EpochRewardSummary', epoch: number, assetId: string, amount: string, rewardType: Types.AccountType }; export type EpochRewardSummaryFieldsFragment = { __typename?: 'EpochRewardSummary', epoch: number, assetId: string, amount: string, rewardType: Types.AccountType };
@@ -26,7 +26,7 @@ export type EpochAssetsRewardsQueryVariables = Types.Exact<{
}>; }>;
export type EpochAssetsRewardsQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, decimals: number } } | null> | null } | null, epochRewardSummaries?: { __typename?: 'EpochRewardSummaryConnection', edges?: Array<{ __typename?: 'EpochRewardSummaryEdge', node: { __typename?: 'EpochRewardSummary', epoch: number, assetId: string, amount: string, rewardType: Types.AccountType } } | null> | null } | null }; export type EpochAssetsRewardsQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string } } | null> | null } | null, epochRewardSummaries?: { __typename?: 'EpochRewardSummaryConnection', edges?: Array<{ __typename?: 'EpochRewardSummaryEdge', node: { __typename?: 'EpochRewardSummary', epoch: number, assetId: string, amount: string, rewardType: Types.AccountType } } | null> | null } | null };
export type EpochFieldsFragment = { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: any | null, end?: any | null, expiry?: any | null } }; export type EpochFieldsFragment = { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: any | null, end?: any | null, expiry?: any | null } };
@@ -42,7 +42,6 @@ export const RewardFieldsFragmentDoc = gql`
id id
symbol symbol
name name
decimals
} }
party { party {
id id
@@ -144,7 +143,6 @@ export const EpochAssetsRewardsDocument = gql`
node { node {
id id
name name
decimals
} }
} }
} }
@@ -207,13 +207,6 @@ const LazyWithdrawals = React.lazy(
) )
); );
const LazyDisclaimer = React.lazy(
() =>
import(
/* webpackChunkName: "route-disclaimer", webpackPrefetch: true */ './disclaimer'
)
);
const redirects = [ const redirects = [
{ {
path: Routes.VALIDATORS, path: Routes.VALIDATORS,
@@ -356,10 +349,6 @@ const routerConfig = [
path: Routes.CONTRACTS, path: Routes.CONTRACTS,
element: <LazyContracts name="Contracts" />, element: <LazyContracts name="Contracts" />,
}, },
{
path: Routes.DISCLAIMER,
element: <LazyDisclaimer name="Disclaimer" />,
},
{ {
path: '*', path: '*',
// Not lazy as loaded when a user first hits the site // Not lazy as loaded when a user first hits the site
-1
View File
@@ -15,7 +15,6 @@ const Routes = {
SUPPLY: '/token/tranches', SUPPLY: '/token/tranches',
ASSOCIATE: '/token/associate', ASSOCIATE: '/token/associate',
DISASSOCIATE: '/token/disassociate', DISASSOCIATE: '/token/disassociate',
DISCLAIMER: '/disclaimer',
}; };
export default Routes; export default Routes;
@@ -5,22 +5,12 @@ query PreviousEpoch($epochId: ID) {
edges { edges {
node { node {
id id
stakedTotal
rewardScore { rewardScore {
rawValidatorScore rawValidatorScore
performanceScore performanceScore
multisigScore
validatorScore
normalisedScore
validatorStatus
} }
rankingScore { rankingScore {
status
previousStatus
rankingScore
stakeScore stakeScore
performanceScore
votingPower
} }
} }
} }
@@ -8,7 +8,7 @@ export type PreviousEpochQueryVariables = Types.Exact<{
}>; }>;
export type PreviousEpochQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string, validatorsConnection?: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', id: string, stakedTotal: string, rewardScore?: { __typename?: 'RewardScore', rawValidatorScore: string, performanceScore: string, multisigScore: string, validatorScore: string, normalisedScore: string, validatorStatus: Types.ValidatorStatus } | null, rankingScore: { __typename?: 'RankingScore', status: Types.ValidatorStatus, previousStatus: Types.ValidatorStatus, rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string } } } | null> | null } | null } }; export type PreviousEpochQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string, validatorsConnection?: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', id: string, rewardScore?: { __typename?: 'RewardScore', rawValidatorScore: string, performanceScore: string } | null, rankingScore: { __typename?: 'RankingScore', stakeScore: string } } } | null> | null } | null } };
export const PreviousEpochDocument = gql` export const PreviousEpochDocument = gql`
@@ -19,22 +19,12 @@ export const PreviousEpochDocument = gql`
edges { edges {
node { node {
id id
stakedTotal
rewardScore { rewardScore {
rawValidatorScore rawValidatorScore
performanceScore performanceScore
multisigScore
validatorScore
normalisedScore
validatorStatus
} }
rankingScore { rankingScore {
status
previousStatus
rankingScore
stakeScore stakeScore
performanceScore
votingPower
} }
} }
} }
@@ -79,72 +79,36 @@ const MOCK_PREVIOUS_EPOCH: PreviousEpochQuery = {
{ {
node: { node: {
id: 'ccc022b7e63a4d0a6d3a193c3940c88574060e58a184964c994998d86835a1b4', id: 'ccc022b7e63a4d0a6d3a193c3940c88574060e58a184964c994998d86835a1b4',
stakedTotal: '14182454495731682635157',
rewardScore: { rewardScore: {
rawValidatorScore: '0.25', rawValidatorScore: '0.25',
performanceScore: '0.9998677767864936', performanceScore: '0.9998677767864936',
multisigScore: '',
validatorScore: '',
normalisedScore: '',
validatorStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
}, },
rankingScore: { rankingScore: {
stakeScore: '0.2499583402766206', stakeScore: '0.2499583402766206',
performanceScore: '0.9998677767864936',
status: Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
previousStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
rankingScore: '',
votingPower: '',
}, },
}, },
}, },
{ {
node: { node: {
id: '966438c6bffac737cfb08173ffcb3f393c4692b099ad80cb45a82e2dc0a8cf99', id: '966438c6bffac737cfb08173ffcb3f393c4692b099ad80cb45a82e2dc0a8cf99',
stakedTotal: '9618711883996159534058',
rewardScore: { rewardScore: {
rawValidatorScore: '0.3', rawValidatorScore: '0.3',
performanceScore: '1', performanceScore: '1',
multisigScore: '',
validatorScore: '0.31067',
normalisedScore: '',
validatorStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
}, },
rankingScore: { rankingScore: {
stakeScore: '0.25', stakeScore: '0.25',
performanceScore: '0.9998677767864936',
status: Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
previousStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
rankingScore: '',
votingPower: '',
}, },
}, },
}, },
{ {
node: { node: {
id: '12c81b738e8051152e1afe44376ec37bca9216466e6d44cdd772194bad0ada81', id: '12c81b738e8051152e1afe44376ec37bca9216466e6d44cdd772194bad0ada81',
stakedTotal: '4041343338923442976709',
rewardScore: { rewardScore: {
rawValidatorScore: '0.35', rawValidatorScore: '0.35',
performanceScore: '0.999629748500531', performanceScore: '0.999629748500531',
multisigScore: '',
validatorScore: '',
normalisedScore: '',
validatorStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
}, },
rankingScore: { rankingScore: {
stakeScore: '0.2312', stakeScore: '0.2312',
performanceScore: '0.9998677767864936',
status: Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
previousStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
rankingScore: '',
votingPower: '',
}, },
}, },
}, },
@@ -7,12 +7,12 @@ import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid';
import { useAppState } from '../../../../contexts/app-state/app-state-context'; import { useAppState } from '../../../../contexts/app-state/app-state-context';
import { BigNumber } from '../../../../lib/bignumber'; import { BigNumber } from '../../../../lib/bignumber';
import { import {
calculateOverallPenalty,
calculateOverstakedPenalty,
calculatesPerformancePenalty,
getFormattedPerformanceScore, getFormattedPerformanceScore,
getLastEpochScoreAndPerformance, getLastEpochScoreAndPerformance,
getNormalisedVotingPower, getNormalisedVotingPower,
getOverstakingPenalty,
getPerformancePenalty,
getTotalPenalties,
getUnnormalisedVotingPower, getUnnormalisedVotingPower,
} from '../../shared'; } from '../../shared';
import { import {
@@ -32,7 +32,6 @@ import type { ValidatorsTableProps } from './shared';
import { import {
formatNumber, formatNumber,
formatNumberPercentage, formatNumberPercentage,
removePaginationWrapper,
toBigNum, toBigNum,
} from '@vegaprotocol/utils'; } from '@vegaprotocol/utils';
import { VALIDATOR_LOGO_MAP } from './logo-map'; import { VALIDATOR_LOGO_MAP } from './logo-map';
@@ -137,10 +136,6 @@ export const ConsensusValidatorsTable = ({
[totalStake] [totalStake]
); );
const allNodesInPreviousEpoch = removePaginationWrapper(
previousEpochData?.epoch.validatorsConnection?.edges
);
const nodes = useMemo(() => { const nodes = useMemo(() => {
if (!data) return []; if (!data) return [];
let canonisedNodes = data let canonisedNodes = data
@@ -165,7 +160,7 @@ export const ConsensusValidatorsTable = ({
stakedByDelegates, stakedByDelegates,
stakedByOperator, stakedByOperator,
stakedTotal, stakedTotal,
rankingScore: { stakeScore, votingPower, performanceScore }, rankingScore: { stakeScore, votingPower },
pendingStake, pendingStake,
stakedTotalRanking, stakedTotalRanking,
stakedByUser, stakedByUser,
@@ -177,8 +172,11 @@ export const ConsensusValidatorsTable = ({
: avatarUrl : avatarUrl
? avatarUrl ? avatarUrl
: null; : null;
const { rawValidatorScore: previousEpochValidatorScore } = const {
getLastEpochScoreAndPerformance(previousEpochData, id); rawValidatorScore: previousEpochValidatorScore,
performanceScore: previousEpochPerformanceScore,
stakeScore: previousEpochStakeScore,
} = getLastEpochScoreAndPerformance(previousEpochData, id);
return { return {
id, id,
@@ -201,19 +199,21 @@ export const ConsensusValidatorsTable = ({
toBigNum(stakedByOperator, decimals), toBigNum(stakedByOperator, decimals),
2 2
), ),
[ValidatorFields.PERFORMANCE_SCORE]: [ValidatorFields.PERFORMANCE_SCORE]: getFormattedPerformanceScore(
getFormattedPerformanceScore(performanceScore).toString(), previousEpochPerformanceScore
[ValidatorFields.PERFORMANCE_PENALTY]: formatNumberPercentage( ).toString(),
calculatesPerformancePenalty(performanceScore), [ValidatorFields.PERFORMANCE_PENALTY]: getPerformancePenalty(
2 previousEpochPerformanceScore
), ),
[ValidatorFields.OVERSTAKING_PENALTY]: formatNumberPercentage( [ValidatorFields.OVERSTAKING_PENALTY]: getOverstakingPenalty(
calculateOverstakedPenalty(id, allNodesInPreviousEpoch), previousEpochValidatorScore,
2 previousEpochStakeScore
), ),
[ValidatorFields.TOTAL_PENALTIES]: formatNumberPercentage( [ValidatorFields.TOTAL_PENALTIES]: getTotalPenalties(
calculateOverallPenalty(id, allNodesInPreviousEpoch), previousEpochValidatorScore,
2 previousEpochPerformanceScore,
stakedTotal,
totalStake
), ),
[ValidatorFields.PENDING_STAKE]: pendingStake, [ValidatorFields.PENDING_STAKE]: pendingStake,
[ValidatorFields.STAKED_BY_USER]: stakedByUser [ValidatorFields.STAKED_BY_USER]: stakedByUser
@@ -328,12 +328,12 @@ export const ConsensusValidatorsTable = ({
...remaining, ...remaining,
]; ];
}, [ }, [
allNodesInPreviousEpoch,
data, data,
decimals, decimals,
hideTopThird, hideTopThird,
previousEpochData, previousEpochData,
thirdOfTotalStake, thirdOfTotalStake,
totalStake,
validatorsView, validatorsView,
]); ]);
@@ -5,14 +5,15 @@ import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid';
import { useAppState } from '../../../../contexts/app-state/app-state-context'; import { useAppState } from '../../../../contexts/app-state/app-state-context';
import { BigNumber } from '../../../../lib/bignumber'; import { BigNumber } from '../../../../lib/bignumber';
import { import {
calculatesPerformancePenalty,
calculateOverallPenalty,
calculateOverstakedPenalty,
getFormattedPerformanceScore, getFormattedPerformanceScore,
getLastEpochScoreAndPerformance, getLastEpochScoreAndPerformance,
getOverstakingPenalty,
getPerformancePenalty,
getTotalPenalties,
} from '../../shared'; } from '../../shared';
import { import {
defaultColDef, defaultColDef,
StakeNeededForPromotionRenderer,
stakedTotalPercentage, stakedTotalPercentage,
ValidatorFields, ValidatorFields,
ValidatorRenderer, ValidatorRenderer,
@@ -27,7 +28,6 @@ import type { ValidatorsTableProps } from './shared';
import { import {
formatNumber, formatNumber,
formatNumberPercentage, formatNumberPercentage,
removePaginationWrapper,
toBigNum, toBigNum,
} from '@vegaprotocol/utils'; } from '@vegaprotocol/utils';
@@ -52,10 +52,6 @@ export const StandbyPendingValidatorsTable = ({
const gridRef = useRef<AgGridReact | null>(null); const gridRef = useRef<AgGridReact | null>(null);
const allNodesInPreviousEpoch = removePaginationWrapper(
previousEpochData?.epoch.validatorsConnection?.edges
);
let nodes = useMemo(() => { let nodes = useMemo(() => {
if (!data) return []; if (!data) return [];
@@ -81,15 +77,18 @@ export const StandbyPendingValidatorsTable = ({
stakedByDelegates, stakedByDelegates,
stakedByOperator, stakedByOperator,
stakedTotal, stakedTotal,
rankingScore: { stakeScore, performanceScore }, rankingScore: { stakeScore },
pendingStake, pendingStake,
stakedTotalRanking, stakedTotalRanking,
stakedByUser, stakedByUser,
pendingUserStake, pendingUserStake,
userStakeShare, userStakeShare,
}) => { }) => {
const { performanceScore: previousEpochPerformanceScore } = const {
getLastEpochScoreAndPerformance(previousEpochData, id); rawValidatorScore: previousEpochValidatorScore,
performanceScore: previousEpochPerformanceScore,
stakeScore: previousEpochStakeScore,
} = getLastEpochScoreAndPerformance(previousEpochData, id);
let individualStakeNeededForPromotion, let individualStakeNeededForPromotion,
individualStakeNeededForPromotionDescription; individualStakeNeededForPromotionDescription;
@@ -145,19 +144,21 @@ export const StandbyPendingValidatorsTable = ({
toBigNum(stakedByOperator, decimals), toBigNum(stakedByOperator, decimals),
2 2
), ),
[ValidatorFields.PERFORMANCE_SCORE]: [ValidatorFields.PERFORMANCE_SCORE]: getFormattedPerformanceScore(
getFormattedPerformanceScore(performanceScore).toString(), previousEpochPerformanceScore
[ValidatorFields.PERFORMANCE_PENALTY]: formatNumberPercentage( ).toString(),
calculatesPerformancePenalty(performanceScore), [ValidatorFields.PERFORMANCE_PENALTY]: getPerformancePenalty(
2 previousEpochPerformanceScore
), ),
[ValidatorFields.OVERSTAKING_PENALTY]: formatNumberPercentage( [ValidatorFields.OVERSTAKING_PENALTY]: getOverstakingPenalty(
calculateOverstakedPenalty(id, allNodesInPreviousEpoch), previousEpochValidatorScore,
2 previousEpochStakeScore
), ),
[ValidatorFields.TOTAL_PENALTIES]: formatNumberPercentage( [ValidatorFields.TOTAL_PENALTIES]: getTotalPenalties(
calculateOverallPenalty(id, allNodesInPreviousEpoch), previousEpochValidatorScore,
2 previousEpochPerformanceScore,
stakedTotal,
totalStake
), ),
[ValidatorFields.PENDING_STAKE]: pendingStake, [ValidatorFields.PENDING_STAKE]: pendingStake,
[ValidatorFields.STAKED_BY_USER]: stakedByUser [ValidatorFields.STAKED_BY_USER]: stakedByUser
@@ -171,13 +172,13 @@ export const StandbyPendingValidatorsTable = ({
} }
); );
}, [ }, [
allNodesInPreviousEpoch,
data, data,
decimals, decimals,
previousEpochData, previousEpochData,
stakeNeededForPromotion, stakeNeededForPromotion,
stakeNeededForPromotionDescription, stakeNeededForPromotionDescription,
t, t,
totalStake,
]); ]);
if (validatorsView === 'myStake') { if (validatorsView === 'myStake') {
@@ -225,21 +226,21 @@ export const StandbyPendingValidatorsTable = ({
cellRenderer: StakeShareRenderer, cellRenderer: StakeShareRenderer,
width: 100, width: 100,
}, },
// { {
// field: ValidatorFields.STAKE_NEEDED_FOR_PROMOTION, field: ValidatorFields.STAKE_NEEDED_FOR_PROMOTION,
// headerName: t(ValidatorFields.STAKE_NEEDED_FOR_PROMOTION).toString(), headerName: t(ValidatorFields.STAKE_NEEDED_FOR_PROMOTION).toString(),
// headerTooltip: t(stakeNeededForPromotionDescription, { headerTooltip: t(stakeNeededForPromotionDescription, {
// prefix: t('The'), prefix: t('The'),
// }), }),
// cellRenderer: StakeNeededForPromotionRenderer, cellRenderer: StakeNeededForPromotionRenderer,
// width: 210, width: 210,
// }, },
{ {
field: ValidatorFields.TOTAL_PENALTIES, field: ValidatorFields.TOTAL_PENALTIES,
headerName: t(ValidatorFields.TOTAL_PENALTIES).toString(), headerName: t(ValidatorFields.TOTAL_PENALTIES).toString(),
headerTooltip: t('TotalPenaltiesDescription').toString(), headerTooltip: t('TotalPenaltiesDescription').toString(),
cellRenderer: TotalPenaltiesRenderer, cellRenderer: TotalPenaltiesRenderer,
width: 120 + 210, width: 120,
}, },
], ],
[] []
@@ -1,15 +1,11 @@
import { useMemo } from 'react'; import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
useEnvironment, useEnvironment,
DocsLinks, DocsLinks,
ExternalLinks, ExternalLinks,
} from '@vegaprotocol/environment'; } from '@vegaprotocol/environment';
import { import { toBigNum } from '@vegaprotocol/utils';
formatNumberPercentage,
removePaginationWrapper,
toBigNum,
} from '@vegaprotocol/utils';
import * as Schema from '@vegaprotocol/types'; import * as Schema from '@vegaprotocol/types';
import { import {
Link as UTLink, Link as UTLink,
@@ -28,11 +24,11 @@ import { SubHeading } from '../../../components/heading';
import { import {
getLastEpochScoreAndPerformance, getLastEpochScoreAndPerformance,
getNormalisedVotingPower, getNormalisedVotingPower,
getOverstakingPenalty,
getPerformancePenalty,
getTotalPenalties,
getUnnormalisedVotingPower, getUnnormalisedVotingPower,
getStakePercentage, getStakePercentage,
calculatesPerformancePenalty,
calculateOverstakedPenalty,
calculateOverallPenalty,
} from '../shared'; } from '../shared';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import type { StakingNodeFieldsFragment } from '../__generated__/Staking'; import type { StakingNodeFieldsFragment } from '../__generated__/Staking';
@@ -82,27 +78,17 @@ export const ValidatorTable = ({
const stakedOnNode = toBigNum(node.stakedTotal, decimals); const stakedOnNode = toBigNum(node.stakedTotal, decimals);
const { rawValidatorScore } = getLastEpochScoreAndPerformance( const { rawValidatorScore, performanceScore, stakeScore } =
previousEpochData, getLastEpochScoreAndPerformance(previousEpochData, node.id);
node.id
);
const stakePercentage = getStakePercentage(total, stakedOnNode); const stakePercentage = getStakePercentage(total, stakedOnNode);
const penalties = useMemo(() => { const totalPenaltiesAmount = getTotalPenalties(
const allNodesInPreviousEpoch = removePaginationWrapper( rawValidatorScore,
previousEpochData?.epoch.validatorsConnection?.edges performanceScore,
); stakedOnNode.toString(),
return { total.toString()
// current epoch );
performance: calculatesPerformancePenalty(
node.rankingScore.performanceScore
),
// previous epoch
overstaked: calculateOverstakedPenalty(node.id, allNodesInPreviousEpoch),
overall: calculateOverallPenalty(node.id, allNodesInPreviousEpoch),
};
}, [node, previousEpochData?.epoch.validatorsConnection?.edges]);
return ( return (
<> <>
@@ -256,7 +242,7 @@ export const ValidatorTable = ({
<Tooltip description={t('OverstakedPenaltyDescription')}> <Tooltip description={t('OverstakedPenaltyDescription')}>
<span data-testid="overstaking-penalty"> <span data-testid="overstaking-penalty">
{formatNumberPercentage(penalties.overstaked, 2)} {getOverstakingPenalty(rawValidatorScore, stakeScore)}
</span> </span>
</Tooltip> </Tooltip>
</KeyValueTableRow> </KeyValueTableRow>
@@ -265,7 +251,7 @@ export const ValidatorTable = ({
<Tooltip description={t('PerformancePenaltyDescription')}> <Tooltip description={t('PerformancePenaltyDescription')}>
<span data-testid="performance-penalty"> <span data-testid="performance-penalty">
{formatNumberPercentage(penalties.performance, 2)} {getPerformancePenalty(performanceScore)}
</span> </span>
</Tooltip> </Tooltip>
</KeyValueTableRow> </KeyValueTableRow>
@@ -274,7 +260,7 @@ export const ValidatorTable = ({
<strong>{t('TOTAL PENALTIES')}</strong> <strong>{t('TOTAL PENALTIES')}</strong>
</span> </span>
<span data-testid="total-penalties"> <span data-testid="total-penalties">
<strong>{formatNumberPercentage(penalties.overall, 2)}</strong> <strong>{totalPenaltiesAmount}</strong>
</span> </span>
</KeyValueTableRow> </KeyValueTableRow>
</KeyValueTable> </KeyValueTable>
@@ -9,7 +9,6 @@ import {
getTotalPenalties, getTotalPenalties,
getStakePercentage, getStakePercentage,
} from './shared'; } from './shared';
import * as Schema from '@vegaprotocol/types';
describe('getLastEpochScoreAndPerformance', () => { describe('getLastEpochScoreAndPerformance', () => {
const mockPreviousEpochData = { const mockPreviousEpochData = {
@@ -20,48 +19,24 @@ describe('getLastEpochScoreAndPerformance', () => {
{ {
node: { node: {
id: '0x123', id: '0x123',
stakedTotal: '',
rewardScore: { rewardScore: {
rawValidatorScore: '0.25', rawValidatorScore: '0.25',
performanceScore: '0.75', performanceScore: '0.75',
multisigScore: '',
validatorScore: '',
normalisedScore: '',
validatorStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
}, },
rankingScore: { rankingScore: {
stakeScore: '0.25', stakeScore: '0.25',
performanceScore: '0.75',
status: Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
previousStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
rankingScore: '',
votingPower: '',
}, },
}, },
}, },
{ {
node: { node: {
id: '0x234', id: '0x234',
stakedTotal: '',
rewardScore: { rewardScore: {
rawValidatorScore: '0.35', rawValidatorScore: '0.35',
performanceScore: '0.85', performanceScore: '0.85',
multisigScore: '',
validatorScore: '',
normalisedScore: '',
validatorStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
}, },
rankingScore: { rankingScore: {
stakeScore: '0.25', stakeScore: '0.25',
performanceScore: '0.85',
status: Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
previousStatus:
Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
rankingScore: '',
votingPower: '',
}, },
}, },
}, },
+1 -81
View File
@@ -4,86 +4,6 @@ import {
} from '@vegaprotocol/utils'; } from '@vegaprotocol/utils';
import type { PreviousEpochQuery } from './__generated__/PreviousEpoch'; import type { PreviousEpochQuery } from './__generated__/PreviousEpoch';
import { BigNumber } from '../../lib/bignumber'; import { BigNumber } from '../../lib/bignumber';
import type { LastArrayElement } from 'type-fest';
type Node = NonNullable<
LastArrayElement<
NonNullable<
NonNullable<PreviousEpochQuery['epoch']['validatorsConnection']>['edges']
>
>
>['node'];
/**
* Calculates theoretical stake score for a given node
* @param nodeId Id of a node for which a score is calculated
* @param nodes A collection of all nodes
* @returns Theoretical stake score for given node based on the staked total
* of all node of the same type (status)
*/
const calculateTheoreticalStakeScore = (nodeId: string, nodes: Node[]) => {
const node = nodes.find((n) => n.id === nodeId);
if (!node) {
return new BigNumber(0);
}
const all = nodes
.filter((n) => n.rankingScore.status === node.rankingScore.status)
.map((n) => new BigNumber(n.stakedTotal));
const sumOfSameType = all.reduce((acc, a) => acc.plus(a), new BigNumber(0));
if (sumOfSameType.isZero()) {
return new BigNumber(0);
}
return new BigNumber(node.stakedTotal).dividedBy(sumOfSameType);
};
/**
* Calculates overall penalty for a given node
* @param nodeId Id of a node for which a penalty is calculated
* @param nodes A collection of all nodes - needed to calculate theoretical stake score
* @returns %
*/
export const calculateOverallPenalty = (nodeId: string, nodes: Node[]) => {
const node = nodes.find((n) => n.id === nodeId);
const tts = calculateTheoreticalStakeScore(nodeId, nodes);
if (!node || tts.isZero()) {
return new BigNumber(0);
}
const penalty = new BigNumber(1)
.minus(new BigNumber(node.rewardScore?.validatorScore || 0).dividedBy(tts))
.times(100);
return penalty.isLessThan(0) ? new BigNumber(0) : penalty;
};
/**
* Calculates over-staked penalty for a given node
* @param nodeId Id of a node for which a penalty is calculated
* @param nodes A collection of all nodes - needed to calculate theoretical stake score
* @returns %
*/
export const calculateOverstakedPenalty = (nodeId: string, nodes: Node[]) => {
const node = nodes.find((n) => n.id === nodeId);
const tts = calculateTheoreticalStakeScore(nodeId, nodes);
if (!node || tts.isZero()) {
return new BigNumber(0);
}
const penalty = new BigNumber(1)
.minus(
new BigNumber(node.rewardScore?.rawValidatorScore || 0).dividedBy(tts)
)
.times(100);
return penalty.isLessThan(0) ? new BigNumber(0) : penalty;
};
/**
* Calculates performance penalty based on the given performance score.
* @returns %
*/
export const calculatesPerformancePenalty = (performanceScore: string) => {
const penalty = new BigNumber(1)
.minus(new BigNumber(performanceScore))
.times(100);
return penalty.isLessThan(0) ? new BigNumber(0) : penalty;
};
export const getLastEpochScoreAndPerformance = ( export const getLastEpochScoreAndPerformance = (
previousEpochData: PreviousEpochQuery | undefined, previousEpochData: PreviousEpochQuery | undefined,
@@ -95,7 +15,7 @@ export const getLastEpochScoreAndPerformance = (
return { return {
rawValidatorScore: validator?.rewardScore?.rawValidatorScore, rawValidatorScore: validator?.rewardScore?.rawValidatorScore,
performanceScore: validator?.rankingScore?.performanceScore, performanceScore: validator?.rewardScore?.performanceScore,
stakeScore: validator?.rankingScore?.stakeScore, stakeScore: validator?.rankingScore?.stakeScore,
}; };
}; };
+1 -2
View File
@@ -23,6 +23,5 @@ NX_VEGA_URL="https://api.n07.testnet.vega.xyz/graphql"
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"} NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
NX_VEGA_CONSOLE_URL=https://console.fairground.wtf
@@ -2,7 +2,7 @@
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml
NX_VEGA_URL=https://api.n04.d.vega.xyz/graphql NX_VEGA_URL=https://api.n04.d.vega.xyz/graphql
NX_VEGA_ENV=DEVNET NX_VEGA_ENV=DEVNET
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"} NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz
@@ -2,8 +2,7 @@
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
NX_VEGA_URL=https://api.vega.community/graphql NX_VEGA_URL=https://api.vega.community/graphql
NX_VEGA_ENV=MAINNET NX_VEGA_ENV=MAINNET
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\"} NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"}
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://etherscan.io NX_ETHERSCAN_URL=https://etherscan.io
NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz
NX_VEGA_CONSOLE_URL=https://console.vega.xyz
@@ -4,6 +4,5 @@ NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql
NX_VEGA_ENV=STAGNET1 NX_VEGA_ENV=STAGNET1
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://explorer.stagnet1.vega.rocks NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"} NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
@@ -2,8 +2,7 @@
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml
NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
NX_VEGA_ENV=TESTNET NX_VEGA_ENV=TESTNET
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\"} NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"}
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
NX_VEGA_CONSOLE_URL=https://console.fairground.wtf
@@ -1,5 +1,5 @@
# App configuration variables # App configuration variables
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.tom NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.tom
NX_VEGA_URL=https://api-validators-testnet.vega.rocks/graphql NX_VEGA_URL=https://api-validators-testnet.vega.rocks/graphql
NX_VEGA_NETWORKS={'{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}' NX_VEGA_NETWORKS='{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}'
NX_VEGA_ENV=VALIDATOR_TESTNET NX_VEGA_ENV=VALIDATOR_TESTNET
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -6,8 +6,7 @@ NX_VEGA_CONFIG_URL=''
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_ENV=CUSTOM NX_VEGA_ENV=CUSTOM
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
NX_VEGA_CONSOLE_URL=https://console.fairground.wtf NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"}
NX_VEGA_TOKEN_URL=https://governance.fairground.wtf NX_VEGA_TOKEN_URL=https://governance.fairground.wtf
NX_VEGA_URL=http://localhost:3008/graphql NX_VEGA_URL=http://localhost:3008/graphql
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
@@ -20,7 +19,6 @@ CYPRESS_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit
CYPRESS_ETHEREUM_WALLET_ADDRESS=0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F CYPRESS_ETHEREUM_WALLET_ADDRESS=0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F
CYPRESS_ETHEREUM_PROVIDER_URL=http://localhost:8545 CYPRESS_ETHEREUM_PROVIDER_URL=http://localhost:8545
CYPRESS_EXPLORER_URL=https://explorer.fairground.wtf CYPRESS_EXPLORER_URL=https://explorer.fairground.wtf
CYPRESS_CONSOLE_URL=https://console.fairground.wtf
CYPRESS_FAUCET_URL=http://localhost:1790/api/v1/mint CYPRESS_FAUCET_URL=http://localhost:1790/api/v1/mint
CYPRESS_ORACLE_PUBKEY=6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61 CYPRESS_ORACLE_PUBKEY=6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY=02ecea…342f65 CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY=02ecea…342f65
+1 -3
View File
@@ -5,8 +5,7 @@ NX_VEGA_CONFIG_URL=''
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_ENV=CUSTOM NX_VEGA_ENV=CUSTOM
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
NX_VEGA_CONSOLE_URL=https://console.fairground.wtf NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"}
NX_VEGA_TOKEN_URL=https://governance.fairground.wtf NX_VEGA_TOKEN_URL=https://governance.fairground.wtf
NX_VEGA_URL=http://localhost:3008/graphql NX_VEGA_URL=http://localhost:3008/graphql
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
@@ -18,7 +17,6 @@ CYPRESS_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit
CYPRESS_ETHEREUM_WALLET_ADDRESS=0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F CYPRESS_ETHEREUM_WALLET_ADDRESS=0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F
CYPRESS_ETHEREUM_PROVIDER_URL=http://localhost:8545 CYPRESS_ETHEREUM_PROVIDER_URL=http://localhost:8545
CYPRESS_EXPLORER_URL=https://explorer.fairground.wtf CYPRESS_EXPLORER_URL=https://explorer.fairground.wtf
CYPRESS_CONSOLE_URL=https://console.fairground.wtf
CYPRESS_FAUCET_URL=http://localhost:1790/api/v1/mint CYPRESS_FAUCET_URL=http://localhost:1790/api/v1/mint
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY=02ecea…342f65 CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY=02ecea…342f65
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY2=7f9cf0…c25535 CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY2=7f9cf0…c25535
+1 -1
View File
@@ -24,7 +24,7 @@ module.exports = defineConfig({
viewportHeight: 900, viewportHeight: 900,
responseTimeout: 50000, responseTimeout: 50000,
requestTimeout: 20000, requestTimeout: 20000,
retries: 1, retries: 2,
testIsolation: false, testIsolation: false,
}, },
env: { env: {
+10 -10
View File
@@ -50,7 +50,10 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
cy.wrap(markets[0]).as('market'); cy.wrap(markets[0]).as('market');
}); });
cy.visit('/#/portfolio'); cy.visit('/#/portfolio');
cy.connectVegaWallet(); });
beforeEach(() => {
cy.setVegaWallet();
}); });
it('can deposit', function () { it('can deposit', function () {
@@ -169,6 +172,7 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
'contain.text', 'contain.text',
'Error occurredcannot estimate gas' 'Error occurredcannot estimate gas'
); );
cy.getByTestId(toastCloseBtn).click({ multiple: true });
cy.getByTestId(completeWithdrawalBtn).should( cy.getByTestId(completeWithdrawalBtn).should(
'contain.text', 'contain.text',
'Complete withdrawal' 'Complete withdrawal'
@@ -372,14 +376,10 @@ describe('capsule', { tags: '@slow', testIsolation: true }, () => {
'contain.text', 'contain.text',
'Transaction confirmed' 'Transaction confirmed'
); );
cy.getByTestId(toastContent, txTimeout) cy.getByTestId(toastContent, txTimeout).should(
.should('contain.text', 'Funds unlocked') 'contain.text',
.and('contain.text', 'Your funds have been unlocked for withdrawal.') 'Funds unlockedYour funds have been unlocked for withdrawalView in block explorerWithdraw 1.00 tBTCComplete withdrawal'
.and( );
'contain.text',
'View in block explorerYou can save your withdrawal details for extra security.'
)
.and('contain.text', 'Withdraw 1.00 tBTCComplete withdrawal');
cy.get('.ag-center-cols-container') cy.get('.ag-center-cols-container')
.find('[col-id="status"]') .find('[col-id="status"]')
@@ -407,7 +407,7 @@ describe('capsule', { tags: '@slow', testIsolation: true }, () => {
}); });
cy.getByTestId('withdraw-dialog-button').click({ force: true }); cy.getByTestId('withdraw-dialog-button').click({ force: true });
// cy.getByTestId('BALANCE_AVAILABLE_value').should('have.text', '6.999'); cy.getByTestId('BALANCE_AVAILABLE_value').should('have.text', '7.999');
}); });
it('approved amount is less than deposit', function () { it('approved amount is less than deposit', function () {
@@ -1,10 +1,5 @@
import { aliasGQLQuery } from '@vegaprotocol/cypress'; import { aliasGQLQuery } from '@vegaprotocol/cypress';
import type { DataSourceDefinition } from '@vegaprotocol/types'; import { MarketState, MarketStateMapping } from '@vegaprotocol/types';
import {
MarketState,
MarketStateMapping,
PropertyKeyType,
} from '@vegaprotocol/types';
import { addDays, subDays } from 'date-fns'; import { addDays, subDays } from 'date-fns';
import { import {
chainIdQuery, chainIdQuery,
@@ -25,25 +20,6 @@ import {
} from '@vegaprotocol/utils'; } from '@vegaprotocol/utils';
describe('Closed markets', { tags: '@smoke' }, () => { describe('Closed markets', { tags: '@smoke' }, () => {
const settlementDataProperty = 'settlement-data-property';
const settlementDataPropertyKey = {
__typename: 'PropertyKey' as const,
name: settlementDataProperty,
type: PropertyKeyType.TYPE_INTEGER,
numberDecimalPlaces: 2,
};
const settlementDataSourceData: DataSourceDefinition = {
sourceType: {
sourceType: {
filters: [
{
__typename: 'Filter',
key: settlementDataPropertyKey,
},
],
},
},
};
const rowSelector = const rowSelector =
'[data-testid="tab-closed-markets"] .ag-center-cols-container .ag-row'; '[data-testid="tab-closed-markets"] .ag-center-cols-container .ag-row';
@@ -61,15 +37,11 @@ describe('Closed markets', { tags: '@smoke' }, () => {
tradableInstrument: { tradableInstrument: {
instrument: { instrument: {
product: { product: {
dataSourceSpecBinding: {
settlementDataProperty,
},
dataSourceSpecForTradingTermination: { dataSourceSpecForTradingTermination: {
id: 'market-1-trading-termination-oracle-id', id: 'market-1-trading-termination-oracle-id',
}, },
dataSourceSpecForSettlementData: { dataSourceSpecForSettlementData: {
id: 'market-1-settlement-data-oracle-id', id: 'market-1-settlement-data-oracle-id',
data: settlementDataSourceData,
}, },
settlementAsset, settlementAsset,
}, },
@@ -91,15 +63,6 @@ describe('Closed markets', { tags: '@smoke' }, () => {
`settlement-expiry-date:${addDays(new Date(), 4).toISOString()}`, `settlement-expiry-date:${addDays(new Date(), 4).toISOString()}`,
], ],
}, },
product: {
dataSourceSpecBinding: {
settlementDataProperty,
},
dataSourceSpecForSettlementData: {
id: 'market-1-settlement-data-oracle-id',
data: settlementDataSourceData,
},
},
}, },
}, },
}); });
@@ -118,15 +81,6 @@ describe('Closed markets', { tags: '@smoke' }, () => {
`settlement-expiry-date:${subDays(new Date(), 2).toISOString()}`, `settlement-expiry-date:${subDays(new Date(), 2).toISOString()}`,
], ],
}, },
product: {
dataSourceSpecBinding: {
settlementDataProperty,
},
dataSourceSpecForSettlementData: {
id: 'market-1-settlement-data-oracle-id',
data: settlementDataSourceData,
},
},
}, },
}, },
}); });
@@ -347,7 +301,7 @@ describe('Closed markets', { tags: '@smoke' }, () => {
addDecimalsFormatNumber( addDecimalsFormatNumber(
// @ts-ignore cannot deep un-partial // @ts-ignore cannot deep un-partial
specDataConnection.externalData.data.data[0].value, specDataConnection.externalData.data.data[0].value,
settlementDataPropertyKey.numberDecimalPlaces settledMarket.decimalPlaces
) )
); );
@@ -1,16 +1,20 @@
import { closeWelcomeDialog } from '../support/helpers';
const dialogContent = 'dialog-content'; const dialogContent = 'dialog-content';
const nodeHealth = 'node-health'; const nodeHealth = 'node-health';
describe.skip('home', { tags: '@regression' }, () => { describe('home', { tags: '@regression' }, () => {
before(() => { before(() => {
cy.clearAllLocalStorage(); cy.clearAllLocalStorage();
cy.mockTradingPage(); cy.mockTradingPage();
cy.mockSubscription(); cy.mockSubscription();
cy.visit('/'); cy.visit('/');
closeWelcomeDialog();
}); });
describe('footer', () => { describe('footer', () => {
it('shows current block height', () => { it.skip('shows current block height', () => {
closeWelcomeDialog();
// 0006-NETW-004 // 0006-NETW-004
// 0006-NETW-005 // 0006-NETW-005
// 0006-NETW-008 // 0006-NETW-008
+97 -3
View File
@@ -1,7 +1,9 @@
import { aliasGQLQuery } from '@vegaprotocol/cypress'; import { aliasGQLQuery } from '@vegaprotocol/cypress';
import type { ProposalListFieldsFragment } from '@vegaprotocol/proposals'; import type { ProposalListFieldsFragment } from '@vegaprotocol/proposals';
import { marketsDataQuery } from '@vegaprotocol/mock';
import * as Schema from '@vegaprotocol/types'; import * as Schema from '@vegaprotocol/types';
const selectMarketOverlay = 'select-market-list';
const dialogContent = 'dialog-content'; const dialogContent = 'dialog-content';
const generateProposal = (code: string): ProposalListFieldsFragment => ({ const generateProposal = (code: string): ProposalListFieldsFragment => ({
@@ -108,12 +110,77 @@ describe('home', { tags: '@regression' }, () => {
cy.get('main[data-testid^="/markets/"]'); cy.get('main[data-testid^="/markets/"]');
// Overlay should be shown
cy.getByTestId(selectMarketOverlay).should('exist');
cy.contains('Select a market to get started').should('be.visible');
// I expect the market overlay table to contain at least 3 rows (one header row)
cy.getByTestId(selectMarketOverlay)
.get('table tr')
.then((row) => {
expect(row.length >= 3).to.be.true;
});
// each market shown in overlay table contains content under the last price and change fields
cy.getByTestId(selectMarketOverlay)
.get('table tr')
.each(($element, index) => {
if (index > 0) {
// skip header row
cy.root().within(() => {
cy.getByTestId('price').should('not.be.empty');
});
}
});
cy.getByTestId('welcome-notice-proposed-markets')
.children('div.pt-1.flex.justify-between')
.should('have.length', 3)
.each((item) => {
cy.wrap(item).getByTestId('external-link').should('exist');
});
cy.getByTestId('dialog-close').click();
cy.getByTestId(selectMarketOverlay).should('not.exist');
// the choose market overlay is no longer showing // the choose market overlay is no longer showing
cy.contains('Select a market to get started').should('not.exist');
cy.contains('Loading...').should('not.exist'); cy.contains('Loading...').should('not.exist');
cy.url().should('eq', Cypress.config().baseUrl + '/#/markets/market-0'); cy.url().should('eq', Cypress.config().baseUrl + '/#/markets/market-0');
}); });
}); });
describe('market table should be properly rendered', () => {
it('redirects to a default market with the landing dialog open', () => {
const override = {
marketsConnection: {
edges: [
{
node: {
data: {
markPrice: '46126900581221212121212121212121212121212121212',
},
},
},
],
},
};
// @ts-ignore partial deep check failing
const data = marketsDataQuery(override);
cy.mockGQL((req) => {
aliasGQLQuery(req, 'MarketsData', data);
});
cy.visit('/');
cy.wait('@Markets');
cy.getByTestId(selectMarketOverlay)
.get('table')
.invoke('outerWidth')
.then((value) => {
expect(value).to.be.closeTo(554, 10);
});
});
});
describe('no markets found', () => { describe('no markets found', () => {
beforeEach(() => { beforeEach(() => {
cy.mockGQL((req) => { cy.mockGQL((req) => {
@@ -139,13 +206,40 @@ describe('home', { tags: '@regression' }, () => {
cy.wait('@Markets'); cy.wait('@Markets');
cy.wait('@MarketsData'); cy.wait('@MarketsData');
}); });
it('redirects to a the empty market page and displays welcome notice', () => {
it('redirects to market/all and displays welcome notice', () => { cy.url().should('eq', Cypress.config().baseUrl + `/#/markets`);
cy.url().should('eq', Cypress.config().baseUrl + `/#/markets/all`);
cy.getByTestId('welcome-notice-title').should( cy.getByTestId('welcome-notice-title').should(
'contain.text', 'contain.text',
'Welcome to Console' 'Welcome to Console'
); );
cy.getByTestId('welcome-notice-proposed-markets').should(
'contain.text',
'AAAZZZ'
);
});
});
describe('no proposal found', () => {
it('there is a link to propose market', () => {
cy.mockGQL((req) => {
aliasGQLQuery(req, 'ProposalsList', {
proposalsConnection: {
__typename: 'ProposalsConnection',
edges: null,
},
});
});
cy.visit('/');
cy.wait('@Markets');
cy.wait('@MarketsData');
cy.getByTestId(selectMarketOverlay)
.get('table tr')
.then((row) => {
expect(row.length >= 3).to.be.true;
});
cy.getByTestId('external-link')
.contains('Propose a market')
.should('exist');
}); });
}); });
@@ -1,3 +1,4 @@
const selectMarketOverlay = 'select-market-list';
const marketInfoBtn = 'Info'; const marketInfoBtn = 'Info';
const marketInfoSubtitle = 'accordion-title'; const marketInfoSubtitle = 'accordion-title';
const marketSummaryBlock = 'header-summary'; const marketSummaryBlock = 'header-summary';
@@ -13,6 +14,45 @@ const itemHeader = 'item-header';
const itemValue = 'item-value'; const itemValue = 'item-value';
const marketListContent = 'popover-content'; const marketListContent = 'popover-content';
describe(
'Console - market list - live env',
{ tags: '@live', testIsolation: true },
() => {
beforeEach(() => {
cy.visit('/');
});
it('shows the market list page', () => {
cy.get('main', { timeout: 20000 });
// Overlay should be shown
cy.getByTestId(selectMarketOverlay).should('exist');
cy.contains('Select a market to get started').should('be.visible');
// I expect the market overlay table to contain at least one row
cy.getByTestId(selectMarketOverlay)
.get('table tr')
.should('have.length.greaterThan', 1);
// each market shown in overlay table contains content under the last price and change fields
cy.getByTestId(selectMarketOverlay)
.get('table tr')
.getByTestId('price')
.should('not.be.empty');
});
it('redirects to a default market', () => {
cy.getByTestId('dialog-close').click();
cy.getByTestId(selectMarketOverlay).should('not.exist');
// the choose market overlay is no longer showing
cy.contains('Select a market to get started').should('not.exist');
cy.contains('Loading...').should('not.exist');
cy.getByTestId('popover-trigger').should('not.be.empty');
});
}
);
describe( describe(
'Console - market info - live env', 'Console - market info - live env',
{ tags: '@live', testIsolation: true }, { tags: '@live', testIsolation: true },
@@ -55,10 +55,7 @@ describe('market info is displayed', { tags: '@smoke' }, () => {
validateMarketDataRow(3, 'Quote Unit', 'BTC'); validateMarketDataRow(3, 'Quote Unit', 'BTC');
}); });
// TODO: fix this test it('market volume displayed', () => {
// New volume check logic, added by https://github.com/vegaprotocol/frontend-monorepo/pull/3870 has caused the
// 24hr volume assertion to fail as it now reads 'Unknown'
it.skip('market volume displayed', () => {
cy.getByTestId(marketTitle).contains('Market volume').click(); cy.getByTestId(marketTitle).contains('Market volume').click();
validateMarketDataRow(0, '24 Hour Volume', '1'); validateMarketDataRow(0, '24 Hour Volume', '1');
validateMarketDataRow(1, 'Open Interest', '-'); validateMarketDataRow(1, 'Open Interest', '-');
@@ -38,28 +38,28 @@ describe('markets selector', { tags: '@smoke' }, () => {
// TODO: load data from mocks in. Using alias and wrap intermittently fails // TODO: load data from mocks in. Using alias and wrap intermittently fails
const data = [ const data = [
{ {
code: 'SOLUSD', code: 'AAPL.MF21',
markPrice: '84.41XYZalpha', name: 'Apple Monthly (30 Jun 2022)',
markPrice: '46,126.90058',
change: '+200.00%', change: '+200.00%',
vol: '324h vol',
},
{
code: 'ETHBTC.QM21',
markPrice: '46,126.90058tBTC',
change: '+200.00%',
vol: '324h vol',
}, },
{ {
code: 'BTCUSD.MF21', code: 'BTCUSD.MF21',
markPrice: '46,126.90058tDAI', name: 'ACTIVE MARKET',
markPrice: '46,126.90058',
change: '+200.00%', change: '+200.00%',
vol: '324h vol',
}, },
{ {
code: 'AAPL.MF21', code: 'ETHBTC.QM21',
markPrice: '46,126.90058tUSDC', name: 'ETHBTC Quarterly (30 Jun 2022)',
markPrice: '46,126.90058',
change: '+200.00%',
},
{
code: 'SOLUSD',
name: 'SUSPENDED MARKET',
markPrice: '84.41',
change: '+200.00%', change: '+200.00%',
vol: '324h vol',
}, },
]; ];
cy.getByTestId(list) cy.getByTestId(list)
@@ -68,13 +68,12 @@ describe('markets selector', { tags: '@smoke' }, () => {
const market = data[i]; const market = data[i];
// 6001-MARK-021 // 6001-MARK-021
expect(item.find('h3').text()).equals(market.code); expect(item.find('h3').text()).equals(market.code);
expect( // 6001-MARK-022
item.find('[data-testid="market-selector-data-row"]').eq(0).text() expect(item.find('h4').text()).equals(market.name);
).contains(market.vol);
// 6001-MARK-024 // 6001-MARK-024
expect( expect(item.find('[data-testid="market-item-price"]').text()).equals(
item.find('[data-testid="market-selector-data-row"]').eq(1).text() market.markPrice
).contains(market.markPrice); );
// 6001-MARK-023 // 6001-MARK-023
expect(item.find('[data-testid="market-item-change"]').text()).equals( expect(item.find('[data-testid="market-item-change"]').text()).equals(
market.change market.change
@@ -97,8 +96,8 @@ describe('markets selector', { tags: '@smoke' }, () => {
// 6001-MARK-29 // 6001-MARK-29
cy.getByTestId(searchInput).clear().type('btc'); cy.getByTestId(searchInput).clear().type('btc');
cy.getByTestId(list).find('a').should('have.length', 2); cy.getByTestId(list).find('a').should('have.length', 2);
cy.getByTestId(list).find('a').eq(1).contains('BTCUSD.MF21'); cy.getByTestId(list).find('a').eq(0).contains('BTCUSD.MF21');
cy.getByTestId(list).find('a').eq(0).contains('ETHBTC.QM21'); cy.getByTestId(list).find('a').eq(1).contains('ETHBTC.QM21');
cy.getByTestId(searchInput).clear(); cy.getByTestId(searchInput).clear();
cy.getByTestId(list).find('a').should('have.length', 4); cy.getByTestId(list).find('a').should('have.length', 4);
+17 -5
View File
@@ -3,6 +3,8 @@ import { aliasGQLQuery, checkSorting } from '@vegaprotocol/cypress';
import { marketsQuery } from '@vegaprotocol/mock'; import { marketsQuery } from '@vegaprotocol/mock';
import { getDateTimeFormat } from '@vegaprotocol/utils'; import { getDateTimeFormat } from '@vegaprotocol/utils';
const dialogCloseBtn = 'dialog-close';
describe('markets table', { tags: '@smoke' }, () => { describe('markets table', { tags: '@smoke' }, () => {
beforeEach(() => { beforeEach(() => {
cy.clearLocalStorage().then(() => { cy.clearLocalStorage().then(() => {
@@ -12,18 +14,20 @@ describe('markets table', { tags: '@smoke' }, () => {
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
); );
cy.mockSubscription(); cy.mockSubscription();
cy.visit('/#/markets/all'); cy.visit('/');
cy.wait('@Markets');
cy.wait('@MarketsData');
cy.wait('@MarketsCandles');
}); });
}); });
it('renders markets correctly', () => { it('renders markets correctly', () => {
cy.wait('@Markets');
cy.wait('@MarketsData');
cy.get('[data-testid^="market-link-"]').should('not.be.empty'); cy.get('[data-testid^="market-link-"]').should('not.be.empty');
cy.getByTestId('price').invoke('text').should('not.be.empty'); cy.getByTestId('price').invoke('text').should('not.be.empty');
cy.getByTestId('settlement-asset').should('not.be.empty'); cy.getByTestId('settlement-asset').should('not.be.empty');
cy.getByTestId('price-change-percentage').should('not.be.empty'); cy.getByTestId('price-change-percentage').should('not.be.empty');
cy.getByTestId('price-change').should('not.be.empty'); cy.getByTestId('price-change').should('not.be.empty');
cy.getByTestId('sparkline-svg').should('be.visible');
}); });
it('able to open and sort full market list - market page', () => { it('able to open and sort full market list - market page', () => {
@@ -33,6 +37,9 @@ describe('markets table', { tags: '@smoke' }, () => {
'ETHBTC.QM21', 'ETHBTC.QM21',
'SOLUSD', 'SOLUSD',
]; ];
cy.getByTestId('view-market-list-link')
.should('have.attr', 'href', '#/markets/all')
.click();
cy.url().should('eq', Cypress.config('baseUrl') + '/#/markets/all'); cy.url().should('eq', Cypress.config('baseUrl') + '/#/markets/all');
cy.contains('AAPL.MF21').should('be.visible'); cy.contains('AAPL.MF21').should('be.visible');
cy.get('.ag-header-cell-label').contains('Market').click(); // sort by market name cy.get('.ag-header-cell-label').contains('Market').click(); // sort by market name
@@ -44,6 +51,10 @@ describe('markets table', { tags: '@smoke' }, () => {
}); });
it('proposed markets tab should be rendered properly', () => { it('proposed markets tab should be rendered properly', () => {
cy.getByTestId('view-market-list-link')
.should('have.attr', 'href', '#/markets/all')
.click();
cy.get('[data-testid="All markets"]').should( cy.get('[data-testid="All markets"]').should(
'have.attr', 'have.attr',
'data-state', 'data-state',
@@ -76,8 +87,8 @@ describe('markets table', { tags: '@smoke' }, () => {
`${Cypress.env('VEGA_TOKEN_URL')}/proposals/propose/new-market` `${Cypress.env('VEGA_TOKEN_URL')}/proposals/propose/new-market`
); );
}); });
it('proposed markets tab should be sorted properly', () => { it('proposed markets tab should be sorted properly', () => {
cy.getByTestId('view-market-list-link').click();
cy.get('[data-testid="Proposed markets"]').click(); cy.get('[data-testid="Proposed markets"]').click();
const marketColDefault = [ const marketColDefault = [
'ETHUSD', 'ETHUSD',
@@ -156,7 +167,7 @@ describe('markets table', { tags: '@smoke' }, () => {
checkSorting('state', stateColDefault, stateColAsc, stateColDesc); checkSorting('state', stateColDefault, stateColAsc, stateColDesc);
}); });
it.skip('opening auction subsets should be properly displayed', () => { it('opening auction subsets should be properly displayed', () => {
cy.mockTradingPage( cy.mockTradingPage(
Schema.MarketState.STATE_ACTIVE, Schema.MarketState.STATE_ACTIVE,
Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION
@@ -189,6 +200,7 @@ describe('markets table', { tags: '@smoke' }, () => {
}); });
cy.visit('#/markets/market-0'); cy.visit('#/markets/market-0');
cy.url().should('contain', 'market-0'); cy.url().should('contain', 'market-0');
cy.getByTestId(dialogCloseBtn).click();
cy.getByTestId('item-value').contains('Opening auction').realHover(); cy.getByTestId('item-value').contains('Opening auction').realHover();
cy.getByTestId('opening-auction-sub-status').should( cy.getByTestId('opening-auction-sub-status').should(
'contain.text', 'contain.text',
+4 -13
View File
@@ -1,13 +1,16 @@
import { mockConnectWallet } from '@vegaprotocol/cypress'; import { mockConnectWallet } from '@vegaprotocol/cypress';
describe('Navbar', { tags: '@smoke' }, () => { describe('Navbar', { tags: '@smoke' }, () => {
beforeEach(() => { before(() => {
cy.clearAllLocalStorage(); cy.clearAllLocalStorage();
cy.mockTradingPage(); cy.mockTradingPage();
cy.mockSubscription(); cy.mockSubscription();
cy.visit('/'); cy.visit('/');
cy.wait('@Markets'); cy.wait('@Markets');
cy.wait('@MarketsData'); cy.wait('@MarketsData');
cy.wait('@MarketsCandles');
// close welcome dialog
cy.getByTestId('dialog-close').click();
}); });
const pages = [ const pages = [
@@ -44,18 +47,6 @@ describe('Navbar', { tags: '@smoke' }, () => {
}); });
}); });
}); });
it('Disclaimer should be presented after choosing from menu', () => {
cy.get('nav')
.find('ul li:contains(Resources)')
.contains('Resources')
.click();
cy.getByTestId('Disclaimer').eq(0).click();
cy.location('hash').should('equal', '#/disclaimer');
cy.get('p').contains(
'Vega is a decentralised peer-to-peer protocol that can be used to trade derivatives with cryptoassets.'
);
});
}); });
describe('mobile view', () => { describe('mobile view', () => {
@@ -1,9 +1,12 @@
import { closeWelcomeDialog } from '../support/helpers';
describe('Settings page', { tags: '@smoke' }, () => { describe('Settings page', { tags: '@smoke' }, () => {
beforeEach(() => { beforeEach(() => {
cy.clearLocalStorage().then(() => { cy.clearLocalStorage().then(() => {
cy.mockTradingPage(); cy.mockTradingPage();
cy.mockSubscription(); cy.mockSubscription();
cy.visit('/'); cy.visit('/');
closeWelcomeDialog();
cy.get('[aria-label="cog icon"]').click(); cy.get('[aria-label="cog icon"]').click();
}); });
}); });
@@ -1,7 +1,6 @@
import { checkSorting } from '@vegaprotocol/cypress'; import { checkSorting } from '@vegaprotocol/cypress';
import { aliasGQLQuery } from '@vegaprotocol/cypress'; import { aliasGQLQuery } from '@vegaprotocol/cypress';
import { marketsDataQuery } from '@vegaprotocol/mock'; import { marketsDataQuery } from '@vegaprotocol/mock';
import { positionsQuery } from '@vegaprotocol/mock';
beforeEach(() => { beforeEach(() => {
cy.mockTradingPage(); cy.mockTradingPage();
@@ -17,27 +16,9 @@ describe('positions', { tags: '@smoke', testIsolation: true }, () => {
}); });
it('renders positions on portfolio page', () => { it('renders positions on portfolio page', () => {
cy.mockGQL((req) => {
const positions = positionsQuery();
if (positions.positions?.edges) {
positions.positions.edges.push(
...positions.positions.edges.map((edge) => ({
...edge,
node: {
...edge.node,
party: {
...edge.node.party,
id: 'vega-1',
},
},
}))
);
}
aliasGQLQuery(req, 'Positions', positions);
});
cy.visit('/#/portfolio'); cy.visit('/#/portfolio');
cy.getByTestId('Positions').click(); cy.getByTestId('Positions').click();
validatePositionsDisplayed(true); validatePositionsDisplayed();
}); });
describe('renders position among some graphql errors', () => { describe('renders position among some graphql errors', () => {
it('rows should be displayed despite errors', () => { it('rows should be displayed despite errors', () => {
@@ -75,9 +56,7 @@ describe('positions', { tags: '@smoke', testIsolation: true }, () => {
cy.getByTestId('tab-positions') cy.getByTestId('tab-positions')
.first() .first()
.within(() => { .within(() => {
cy.get( cy.get('[row-id="market-2"]')
'[row-id="02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65-market-2"]'
)
.eq(1) .eq(1)
.within(() => { .within(() => {
emptyCells.forEach((cell) => { emptyCells.forEach((cell) => {
@@ -124,11 +103,9 @@ describe('positions', { tags: '@smoke', testIsolation: true }, () => {
const marketsSortedDefault = [ const marketsSortedDefault = [
'ACTIVE MARKET', 'ACTIVE MARKET',
'Apple Monthly (30 Jun 2022)', 'Apple Monthly (30 Jun 2022)',
'SUSPENDED MARKET',
]; ];
const marketsSortedAsc = ['ACTIVE MARKET', 'Apple Monthly (30 Jun 2022)']; const marketsSortedAsc = ['ACTIVE MARKET', 'Apple Monthly (30 Jun 2022)'];
const marketsSortedDesc = [ const marketsSortedDesc = [
'SUSPENDED MARKET',
'Apple Monthly (30 Jun 2022)', 'Apple Monthly (30 Jun 2022)',
'ACTIVE MARKET', 'ACTIVE MARKET',
]; ];
@@ -142,13 +119,9 @@ describe('positions', { tags: '@smoke', testIsolation: true }, () => {
}); });
it('sorting by notional', () => { it('sorting by notional', () => {
cy.visit('/#/markets/market-0'); cy.visit('/#/markets/market-0');
const marketsSortedDefault = [ const marketsSortedDefault = ['276,761.40348', '46,126.90058'];
'276,761.40348', const marketsSortedAsc = ['46,126.90058', '276,761.40348'];
'46,126.90058', const marketsSortedDesc = ['276,761.40348', '46,126.90058'];
'1,688.20',
];
const marketsSortedAsc = ['1,688.20', '46,126.90058', '276,761.40348'];
const marketsSortedDesc = ['276,761.40348', '46,126.90058', '1,688.20'];
cy.getByTestId('Positions').click(); cy.getByTestId('Positions').click();
checkSorting( checkSorting(
'notional', 'notional',
@@ -159,9 +132,9 @@ describe('positions', { tags: '@smoke', testIsolation: true }, () => {
}); });
it('sorting by unrealisedPNL', () => { it('sorting by unrealisedPNL', () => {
cy.visit('/#/markets/market-0'); cy.visit('/#/markets/market-0');
const marketsSortedDefault = ['8.95', '-0.22519', '8.95']; const marketsSortedDefault = ['8.95', '-0.22519'];
const marketsSortedAsc = ['-0.22519', '8.95', '8.95']; const marketsSortedAsc = ['-0.22519', '8.95'];
const marketsSortedDesc = ['8.95', '8.95', '-0.22519']; const marketsSortedDesc = ['8.95', '-0.22519'];
cy.getByTestId('Positions').click(); cy.getByTestId('Positions').click();
checkSorting( checkSorting(
'unrealisedPNL', 'unrealisedPNL',
@@ -172,7 +145,7 @@ describe('positions', { tags: '@smoke', testIsolation: true }, () => {
}); });
}); });
function validatePositionsDisplayed(multiKey = false) { function validatePositionsDisplayed() {
cy.getByTestId('tab-positions').should('be.visible'); cy.getByTestId('tab-positions').should('be.visible');
cy.getByTestId('tab-positions').within(() => { cy.getByTestId('tab-positions').within(() => {
cy.get('[col-id="marketName"]') cy.get('[col-id="marketName"]')
@@ -192,11 +165,10 @@ describe('positions', { tags: '@smoke', testIsolation: true }, () => {
cy.wrap($prices).invoke('text').should('not.be.empty'); cy.wrap($prices).invoke('text').should('not.be.empty');
}); });
if (!multiKey) { cy.get('[col-id="currentLeverage"]').should('contain.text', '2.846.1');
cy.get('[col-id="currentLeverage"]').should('contain.text', '2.846.1');
cy.get('[col-id="marginAccountBalance"]') // margin allocated cy.get('[col-id="marginAccountBalance"]') // margin allocated
.should('contain.text', '0.01'); .should('contain.text', '0.01');
}
cy.get('[col-id="unrealisedPNL"]').each(($unrealisedPnl) => { cy.get('[col-id="unrealisedPNL"]').each(($unrealisedPnl) => {
cy.wrap($unrealisedPnl).invoke('text').should('not.be.empty'); cy.wrap($unrealisedPnl).invoke('text').should('not.be.empty');
@@ -212,6 +184,6 @@ describe('positions', { tags: '@smoke', testIsolation: true }, () => {
cy.get('.ag-popup').should('contain.text', 'Mark price x open volume'); cy.get('.ag-popup').should('contain.text', 'Mark price x open volume');
}); });
cy.getByTestId('close-position').should('be.visible').and('have.length', 3); cy.getByTestId('close-position').should('be.visible').and('have.length', 2);
} }
}); });
+5
View File
@@ -9,3 +9,8 @@ export const selectAsset = (assetIndex: number) => {
// eslint-disable-next-line // eslint-disable-next-line
cy.wait(100); cy.wait(100);
}; };
export const closeWelcomeDialog = () => {
cy.getByTestId('select-market-list').should('exist');
cy.getByTestId('dialog-close').click();
};
+1 -1
View File
@@ -85,7 +85,7 @@ const mockTradingPage = (
trigger?: Schema.AuctionTrigger trigger?: Schema.AuctionTrigger
) => { ) => {
aliasGQLQuery(req, 'ChainId', chainIdQuery()); aliasGQLQuery(req, 'ChainId', chainIdQuery());
aliasGQLQuery(req, 'NodeCheck', statisticsQuery()); aliasGQLQuery(req, 'Statistics', statisticsQuery());
aliasGQLQuery(req, 'NodeGuard', nodeGuardQuery()); aliasGQLQuery(req, 'NodeGuard', nodeGuardQuery());
aliasGQLQuery( aliasGQLQuery(
req, req,
+2 -2
View File
@@ -5,8 +5,8 @@ NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
NX_VEGA_ENV=STAGNET1 NX_VEGA_ENV=STAGNET1
NX_VEGA_EXPLORER_URL=https://explorer.stagnet1.vega.rocks NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_NETWORKS={\"MAINNET\":\"https://console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"} NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://governance.fairground.wtf NX_VEGA_TOKEN_URL=https://governance.fairground.wtf
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
+2 -2
View File
@@ -4,8 +4,8 @@ NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_CONFIG_URL='' NX_VEGA_CONFIG_URL=''
NX_VEGA_ENV=CUSTOM NX_VEGA_ENV=CUSTOM
NX_VEGA_EXPLORER_URL=https://explorer.stagnet1.vega.rocks NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_NETWORKS={\"MAINNET\":\"https://console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"} NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://governance.fairground.wtf NX_VEGA_TOKEN_URL=https://governance.fairground.wtf
NX_VEGA_URL=http://localhost:3008/graphql NX_VEGA_URL=http://localhost:3008/graphql
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
+1 -2
View File
@@ -2,11 +2,10 @@ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_TRADING_SENTRY_DSN=https://2ffce43721964aafa78277c50654ece4@o286262.ingest.sentry.io/6300613
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml
NX_VEGA_ENV=DEVNET NX_VEGA_ENV=DEVNET
NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz
NX_VEGA_NETWORKS={\"MAINNET\":\"https://console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"} NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://governance.fairground.wtf NX_VEGA_TOKEN_URL=https://governance.fairground.wtf
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
+2 -6
View File
@@ -1,17 +1,13 @@
NX_ETHEREUM_PROVIDER_URL=https://eth-mainnet.gateway.pokt.network/v1/lb/af6a2d529a11f8158bc8ca2a NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://etherscan.io NX_ETHERSCAN_URL=https://etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_TRADING_SENTRY_DSN=https://2ffce43721964aafa78277c50654ece4@o286262.ingest.sentry.io/6300613
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
NX_VEGA_ENV=MAINNET NX_VEGA_ENV=MAINNET
NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz
NX_VEGA_NETWORKS={\"MAINNET\":\"https://console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"} NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://governance.vega.xyz NX_VEGA_TOKEN_URL=https://governance.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
NX_VEGA_CONSOLE_URL=https://console.vega.xyz
# TAG name of the current app version - TODO: bump to the latest upon release
NX_APP_VERSION=v0.20.14-core-0.71.4
+3 -4
View File
@@ -2,12 +2,11 @@ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_TRADING_SENTRY_DSN=https://2ffce43721964aafa78277c50654ece4@o286262.ingest.sentry.io/6300613
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
NX_VEGA_ENV=STAGNET1 NX_VEGA_ENV=STAGNET1
NX_VEGA_EXPLORER_URL=https://explorer.stagnet1.vega.rocks NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_NETWORKS={\"MAINNET\":\"https://console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"} NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://governance.stagnet1.vega.rocks NX_VEGA_TOKEN_URL=https://stagnet1.governance.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
+1 -3
View File
@@ -2,15 +2,13 @@ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_TRADING_SENTRY_DSN=https://2ffce43721964aafa78277c50654ece4@o286262.ingest.sentry.io/6300613
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml
NX_VEGA_ENV=TESTNET NX_VEGA_ENV=TESTNET
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
NX_VEGA_NETWORKS={\"MAINNET\":\"https://console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"} NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://governance.fairground.wtf NX_VEGA_TOKEN_URL=https://governance.fairground.wtf
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
NX_VEGA_CONSOLE_URL=https://console.fairground.wtf
@@ -2,15 +2,13 @@ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9
NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_TRADING_SENTRY_DSN=https://2ffce43721964aafa78277c50654ece4@o286262.ingest.sentry.io/6300613
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.toml NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.toml
NX_VEGA_ENV=VALIDATOR_TESTNET NX_VEGA_ENV=VALIDATOR_TESTNET
NX_VEGA_EXPLORER_URL=https://explorer.validators-testnet.vega.rocks NX_VEGA_EXPLORER_URL=https://validator-testnet.explorer.vega.xyz
NX_VEGA_NETWORKS={\"MAINNET\":\"https://console.vega.xyz\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\",\"TESTNET\":\"https://console.fairground.wtf\"} NX_VEGA_NETWORKS={\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"}
NX_VEGA_TOKEN_URL=https://governance.validators-testnet.vega.rocks NX_VEGA_TOKEN_URL=https://validator-testnet.governance.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
NX_VEGA_CONSOLE_URL=https://trading.validators-testnet.vega.rocks
@@ -1,48 +0,0 @@
import { t } from '@vegaprotocol/i18n';
export const Disclaimer = () => {
return (
<div className="py-16 px-8 flex w-full justify-center">
<div className="lg:min-w-[700px] min-w-[300px] max-w-[700px]">
<h1 className="text-4xl xl:text-5xl uppercase font-alpha calt">
{t('Disclaimer')}
</h1>
<p className="mb-6 mt-10">
{t(
'Vega is a decentralised peer-to-peer protocol that can be used to trade derivatives with cryptoassets. The Vega Protocol is an implementation layer (layer one) protocol made of free, public, open-source or source-available software. Use of the Vega Protocol involves various risks, including but not limited to, losses while digital assets are supplied to the Vega Protocol and losses due to the fluctuation of prices of assets.'
)}
</p>
<p className="mb-6">
{t(
'Before using the Vega Protocol, review the relevant documentation at docs.vega.xyz to make sure that you understand how it works. Conduct your own due diligence and consult your financial advisor before making any investment decisions.'
)}
</p>
<p className="mb-6">
{t(
'As described in the Vega Protocol core license, the Vega Protocol is provided “as is”, at your own risk, and without warranties of any kind. Although Gobalsky Labs Limited developed much of the initial code for the Vega Protocol, it does not provide or control the Vega Protocol, which is run by third parties deploying it on a bespoke blockchain. Upgrades and modifications to the Vega Protocol are managed in a community-driven way by holders of the VEGA governance token.'
)}
</p>
<p className="mb-8">
{t(
'No developer or entity involved in creating the Vega Protocol will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the Vega Protocol, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or legal costs, or loss of profits, cryptoassets, tokens or anything else of value.'
)}
</p>
<p className="mb-8">
{t(
'This website is hosted on a decentralised network, the Interplanetary File System (“IPFS”). The IPFS decentralised web is made up of all the computers (nodes) connected to it. Data is therefore stored on many different computers.'
)}
</p>
<p className="mb-8">
{t(
"The information provided on this website does not constitute investment advice, financial advice, trading advice, or any other sort of advice and you should not treat any of the website's content as such. No party recommends that any cryptoasset should be bought, sold, or held by you via this website. No party ensures the accuracy of information listed on this website or holds any responsibility for any missing or wrong information. You understand that you are using any and all information available here at your own risk."
)}
</p>
<p className="mb-8">
{t(
'Additionally, just as you can access email protocols such as SMTP through multiple email clients, you can potentially access the Vega Protocol through many web or mobile interfaces. You are responsible for doing your own diligence on those interfaces to understand the associated risks and any fees.'
)}
</p>
</div>
</div>
);
};

Some files were not shown because too many files have changed in this diff Show More