Compare commits

..
Author SHA1 Message Date
Bartłomiej Głownia 902fcb03a8 feat: fix positions table bottom placeholder 2023-05-04 11:37:49 +02:00
Bartłomiej Głownia 3abe8187db feat: fix orders e2e tests, improve use bottom placeholder 2023-05-04 10:30:13 +02:00
Bartłomiej Głownia 4c20bb1e9f chore: remove initializer from orders filter enum 2023-05-03 20:36:21 +02:00
Bartłomiej Głownia c6bd44ec67 Merge remote-tracking branch 'origin/develop' into feat/3452-divide-order-tab 2023-05-03 20:27:04 +02:00
Bartłomiej Głownia bfd6ca50bf Merge remote-tracking branch 'origin/develop' into feat/3452-divide-order-tab 2023-04-27 18:13:39 +02:00
Bartłomiej Głownia 584e23e5dc feat(trading): store current tab selection 2023-04-27 17:49:52 +02:00
Bartłomiej Głownia 7fcd9e9bf3 feat: remove reset button on disabled set filter 2023-04-27 08:36:14 +02:00
Bartłomiej Głownia 7797079889 Merge branch 'develop' into feat/3452-divide-order-tab 2023-04-26 17:54:50 +02:00
Bartłomiej Głownia a9da3c25ef feat(trading): fix market split bottom panels 2023-04-26 14:41:34 +02:00
Bartłomiej Głownia d60ebdc7c5 feat(trading): fix orders e2e tests 2023-04-26 13:46:46 +02:00
Bartłomiej Głownia 43e57cf5fc feat(trading): fix useBottomPlaceholder 2023-04-26 12:43:24 +02:00
Bartłomiej Głownia accdc17c97 feat(trading): remove market-oracles.cy.ts 2023-04-26 09:52:33 +02:00
Bartłomiej Głownia c6cd40af52 feat(trading): update OrderFilter type docs 2023-04-26 09:51:07 +02:00
Bartłomiej Głownia 835752a2e7 feat(trading): split orders into tabs, type fixes 2023-04-26 09:51:07 +02:00
Bartłomiej Głownia 8f5b6a9085 feat(trading): split orders into tabs, handle no orders properly 2023-04-26 09:51:07 +02:00
Bartłomiej Głownia b4c6ad5166 feat(trading): fix useBottomPlaceholder 2023-04-26 09:51:07 +02:00
Bartłomiej Głownia 924e10d903 feat(trading): fix useBottomPlaceholder 2023-04-26 09:51:07 +02:00
Bartłomiej Głownia 6eaba4c0be feat(trading): split orders into tabs, disable status filter when preselected 2023-04-26 09:51:07 +02:00
Bartłomiej Głownia 23264fb460 feat(trading): split orders into tabs 2023-04-26 09:51:07 +02:00
Bartłomiej Głownia 422fdf2b17 feat(trading): split orders into tabs 2023-04-26 09:51:07 +02:00
Bartłomiej Głownia 44f17fd028 feat(trading): split orders into tabs 2023-04-26 09:51:07 +02:00
93 changed files with 351 additions and 988 deletions
-16
View File
@@ -1,16 +0,0 @@
name: 'Check if branch is shorter than 52 chars'
on: pull_request
jobs:
branch-naming-rules:
runs-on: ubuntu-latest
steps:
# echo "branches that are longer than 51 chars can't be parsed by kubernetes to create previews. Each app has prefix of it's name like: 'governance-' (12 chars), what leaves 51 max branch length"
# current parsable length: $( git rev-parse --abbrev-ref HEAD | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | wc -c)
- uses: deepakputhraya/action-branch-name@master
with:
# regex: '([a-z])+\/([a-z])+' # Regex the branch should match. This example enforces grouping
# allowed_prefixes: 'feature,stable,fix' # All branches should start with the given prefix
# ignore: master,develop # Ignore exactly matching branch names from convention
min_length: 1 # Min length of the branch name
max_length: 51 # Max length of the branch name
+1 -1
View File
@@ -105,7 +105,7 @@ jobs:
affected="$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects)"
echo -n "Affected projects: $affected"
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 )"
branch_slug="$(echo ${{ github.head_ref || github.ref_name }} | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g )"
projects_e2e=""
preview_governance="not deployed"
preview_trading="not deployed"
+1 -1
View File
@@ -66,7 +66,7 @@ jobs:
fi
fi
elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then
envName="stagnet1"
envName="stagnet3"
fi
bucketName="${{ matrix.app }}.${envName}.${domain}"
echo BUCKET_NAME=${bucketName} >> $GITHUB_ENV
+1
View File
@@ -7,4 +7,5 @@ __generated___
apps/static/src/assets/devnet-tranches.json
apps/static/src/assets/mainnet-tranches.json
apps/static/src/assets/stagnet3-tranches.json
apps/static/src/assets/testnet-tranches.json
+18
View File
@@ -0,0 +1,18 @@
# App configuration variables
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n00.stagnet3.vega.xyz/websocket
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
NX_VEGA_ENV=STAGNET3
NX_BLOCK_EXPLORER=https://be.stagnet3.vega.xyz/rest
# App flags
NX_EXPLORER_ASSETS=1
NX_EXPLORER_GENESIS=1
NX_EXPLORER_GOVERNANCE=1
NX_EXPLORER_MARKETS=1
NX_EXPLORER_ORACLES=1
NX_EXPLORER_TXS_LIST=0
NX_EXPLORER_NETWORK_PARAMETERS=1
NX_EXPLORER_PARTIES=1
NX_EXPLORER_VALIDATORS=1
+8 -12
View File
@@ -1,17 +1,13 @@
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n00.stagnet3.vega.xyz/websocket
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_NETWORKS='{"STAGNET1":"https://stagnet1.token.vega.xyz", "STAGNET3":"https://stagnet3.explorer.vega.xyz","VALIDATOR_TESTNET":"https://validator-testnet.fairground.wtf","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_ENV=STAGNET3
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
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_ENV=STAGNET1
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket
NX_BLOCK_EXPLORER=https://be.stagnet1.vega.xyz/rest
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_GOVERNANCE_URL=https://stagnet1.token.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.jsoo
NX_BLOCK_EXPLORER=https://be.stagnet3.vega.xyz/rest
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
# App flags
NX_EXPLORER_ASSETS=1
+8
View File
@@ -6,4 +6,12 @@ NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/test/announcements.json
# App flags
NX_EXPLORER_ASSETS=1
NX_EXPLORER_GENESIS=1
NX_EXPLORER_GOVERNANCE=1
NX_EXPLORER_MARKETS=1
NX_EXPLORER_ORACLES=1
NX_EXPLORER_TXS_LIST=0
NX_EXPLORER_NETWORK_PARAMETERS=1
NX_EXPLORER_PARTIES=1
NX_EXPLORER_VALIDATORS=1
+14 -1
View File
@@ -1 +1,14 @@
# .env is stagnet1, so there are no overrides required
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
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_ENV=STAGNET1
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket
NX_BLOCK_EXPLORER=https://be.stagnet1.vega.xyz/rest
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_GOVERNANCE_URL=https://stagnet1.token.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
+8
View File
@@ -0,0 +1,8 @@
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://be.stagnet3.vega.xyz/websocket
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_ENV=STAGNET3
NX_BLOCK_EXPLORER=https://be.stagnet3.vega.xyz/rest
NX_VEGA_GOVERNANCE_URL=https://stagnet3.token.vega.xyz
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega-dev-releases/releases/
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
+2 -1
View File
@@ -35,11 +35,12 @@ Example configurations are provided here:
- [Devnet](./.env.devnet)
- [Capsule](./.env.capsule)
- [Testnet](./.env.testnet)
- [Stagnet3](./.env.stagnet3)
For convenience, you can boot the app injecting one of the configurations above by running:
```bash
yarn nx run explorer:serve --env={env} # e.g. stagnet1
yarn nx run explorer:serve --env={env} # e.g. stagnet3
```
There are a few different configuration options offered for this app:
+1 -1
View File
@@ -13,7 +13,7 @@ NX_LOCAL_PROVIDER_URL=http://localhost:8545/
NX_ETH_LOCAL_PROVIDER_URL=http://localhost:8545/
NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet3-k8s.ops.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/test/announcements.json
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
+5
View File
@@ -0,0 +1,5 @@
# App configuration variables
NX_VEGA_ENV=STAGNET3
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
@@ -89,6 +89,6 @@ export function mockNetworkUpgradeProposal() {
cy.mockGQL((req) => {
aliasGQLQuery(req, 'Nodes', nodeData);
aliasGQLQuery(req, 'Proposals', proposalsData);
aliasGQLQuery(req, 'ProtocolUpgradeProposals', upgradeProposalsData);
aliasGQLQuery(req, 'ProtocolUpgrades', upgradeProposalsData);
});
}
+6 -6
View File
@@ -1,18 +1,18 @@
# App configuration variables
NX_VEGA_ENV=STAGNET1
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql
NX_VEGA_ENV=STAGNET3
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_FAIRGROUND=false
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET1":"https://stagnet1.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_DELEGATIONS_PAGINATION=50
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet3-k8s.ops.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/main/announcements.json
NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
+2 -2
View File
@@ -3,7 +3,7 @@ NX_VEGA_ENV=CUSTOM
NX_ETHEREUM_PROVIDER_URL=http://localhost:8545
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_FAIRGROUND=false
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/test/announcements.json
NX_VEGA_CONFIG_URL=''
@@ -16,7 +16,7 @@ NX_LOCAL_PROVIDER_URL=http://localhost:8545/
NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_DELEGATIONS_PAGINATION=50
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet3-k8s.ops.vega.xyz
#Test configuration variables
CYPRESS_FAIRGROUND=false
+1 -1
View File
@@ -2,7 +2,7 @@
NX_VEGA_ENV=DEVNET
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml
NX_VEGA_URL=https://api.n00.devnet1.vega.xyz/graphql
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
+1 -1
View File
@@ -2,7 +2,7 @@
NX_VEGA_ENV=MAINNET
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
NX_VEGA_URL=https://api.vega.xyz/query
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
+1 -1
View File
@@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql
NX_VEGA_ENV=STAGNET1
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET1":"https://stagnet1.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","STAGNET1":"https://stagnet1.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
+11
View File
@@ -0,0 +1,11 @@
# App configuration variables
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
NX_VEGA_ENV=STAGNET3
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_EXPLORER_URL=https://stagnet3.explorer.vega.xyz
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_DELEGATIONS_PAGINATION=50
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet3-k8s.ops.vega.xyz
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
+1 -1
View File
@@ -2,7 +2,7 @@
NX_VEGA_ENV=TESTNET
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_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
+1 -1
View File
@@ -3,7 +3,7 @@ NX_VEGA_ENV=VALIDATOR_TESTNET
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.toml
NX_VEGA_URL=https://api-validators-testnet.vega.rocks/graphql
NX_VEGA_REST=https://api-validators-testnet.vega.rocks/
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
+2 -1
View File
@@ -27,11 +27,12 @@ Example configurations are provided here:
- [Mainnet](./.env.mainnet)
- [Devnet](./.env.devnet)
- [Testnet](./.env.testnet)
- [Stagnet3](./.env.stagnet3)
For convenience, you can boot the app injecting one of the configurations above by running:
```bash
yarn nx run governance:serve --env={env} # e.g. stagnet1
yarn nx run governance:serve --env={env} # e.g. stagnet3
```
There are a few different configuration options offered for this app:
+4
View File
@@ -33,6 +33,10 @@ export const ContractAddresses: {
claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error
lockedAddress: '0x0', // TODO not deployed to this env
},
STAGNET3: {
claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error
lockedAddress: '0x0', // TODO not deployed to this env
},
TESTNET: {
claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error
lockedAddress: '0x0', // TODO not deployed to this env
+3 -3
View File
@@ -15,6 +15,7 @@ import Routes from '../routes';
import { ExternalLinks, removePaginationWrapper } from '@vegaprotocol/utils';
import { useNodesQuery } from '../staking/home/__generated__/Nodes';
import { useProposalsQuery } from '../proposals/proposals/__generated__/Proposals';
import { useProtocolUpgradesQuery } from '../proposals/protocol-upgrade/__generated__/ProtocolUpgradeProposals';
import {
getNotRejectedProposals,
getNotRejectedProtocolUpgradeProposals,
@@ -24,8 +25,7 @@ import * as Schema from '@vegaprotocol/types';
import type { RouteChildProps } from '..';
import type { ProposalFieldsFragment } from '../proposals/proposals/__generated__/Proposals';
import type { NodesFragmentFragment } from '../staking/home/__generated__/Nodes';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
import type { ProtocolUpgradeProposalFieldsFragment } from '../proposals/protocol-upgrade/__generated__/ProtocolUpgradeProposals';
const nodesToShow = 6;
@@ -181,7 +181,7 @@ const GovernanceHome = ({ name }: RouteChildProps) => {
data: protocolUpgradesData,
loading: protocolUpgradesLoading,
error: protocolUpgradesError,
} = useProtocolUpgradeProposalsQuery({
} = useProtocolUpgradesQuery({
pollInterval: 5000,
fetchPolicy: 'network-only',
errorPolicy: 'ignore',
@@ -12,7 +12,7 @@ import { ExternalLinks } from '@vegaprotocol/utils';
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import type { ProtocolUpgradeProposalFieldsFragment } from '../../protocol-upgrade/__generated__/ProtocolUpgradeProposals';
interface ProposalsListProps {
proposals: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
@@ -5,7 +5,7 @@ import {
RoundedWrapper,
} from '@vegaprotocol/ui-toolkit';
import { SubHeading } from '../../../../components/heading';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import type { ProtocolUpgradeProposalFieldsFragment } from '../../protocol-upgrade/__generated__/ProtocolUpgradeProposals';
export interface ProtocolUpgradeProposalDetailInfoProps {
proposal: ProtocolUpgradeProposalFieldsFragment;
@@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';
import { ProtocolUpgradeProposalsListItem } from './protocol-upgrade-proposals-list-item';
import { ProtocolUpgradeProposalStatus } from '@vegaprotocol/types';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import type { ProtocolUpgradeProposalFieldsFragment } from '../../protocol-upgrade/__generated__/ProtocolUpgradeProposals';
const proposal = {
status:
@@ -11,8 +11,8 @@ import { stripFullStops } from '@vegaprotocol/utils';
import { ProtocolUpgradeProposalStatus } from '@vegaprotocol/types';
import { SubHeading } from '../../../../components/heading';
import type { ReactNode } from 'react';
import type { ProtocolUpgradeProposalFieldsFragment } from '../../protocol-upgrade/__generated__/ProtocolUpgradeProposals';
import Routes from '../../../routes';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
interface ProtocolProposalsListItemProps {
proposal: ProtocolUpgradeProposalFieldsFragment;
@@ -13,9 +13,10 @@ import {
} from '@vegaprotocol/types';
import type { NodeConnection, NodeEdge } from '@vegaprotocol/utils';
import type { ProposalFieldsFragment } from './__generated__/Proposals';
import type { ProtocolUpgradeProposalFieldsFragment } from '../protocol-upgrade/__generated__/ProtocolUpgradeProposals';
import orderBy from 'lodash/orderBy';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
import { useProtocolUpgradesQuery } from '../protocol-upgrade/__generated__/ProtocolUpgradeProposals';
const orderByDate = (arr: ProposalFieldsFragment[]) =>
orderBy(
@@ -72,7 +73,7 @@ export const ProposalsContainer = () => {
data: protocolUpgradesData,
loading: protocolUpgradesLoading,
error: protocolUpgradesError,
} = useProtocolUpgradeProposalsQuery({
} = useProtocolUpgradesQuery({
pollInterval: 5000,
fetchPolicy: 'network-only',
errorPolicy: 'ignore',
@@ -5,9 +5,9 @@ fragment ProtocolUpgradeProposalFields on ProtocolUpgradeProposal {
status
}
query ProtocolUpgradeProposals($inState: ProtocolUpgradeProposalStatus) {
query ProtocolUpgrades {
lastBlockHeight
protocolUpgradeProposals(inState: $inState) {
protocolUpgradeProposals {
edges {
node {
...ProtocolUpgradeProposalFields
@@ -0,0 +1,59 @@
import * as Types from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type ProtocolUpgradeProposalFieldsFragment = { __typename?: 'ProtocolUpgradeProposal', upgradeBlockHeight: string, vegaReleaseTag: string, approvers: Array<string>, status: Types.ProtocolUpgradeProposalStatus };
export type ProtocolUpgradesQueryVariables = Types.Exact<{ [key: string]: never; }>;
export type ProtocolUpgradesQuery = { __typename?: 'Query', lastBlockHeight: string, protocolUpgradeProposals?: { __typename?: 'ProtocolUpgradeProposalConnection', edges?: Array<{ __typename?: 'ProtocolUpgradeProposalEdge', node: { __typename?: 'ProtocolUpgradeProposal', upgradeBlockHeight: string, vegaReleaseTag: string, approvers: Array<string>, status: Types.ProtocolUpgradeProposalStatus } }> | null } | null };
export const ProtocolUpgradeProposalFieldsFragmentDoc = gql`
fragment ProtocolUpgradeProposalFields on ProtocolUpgradeProposal {
upgradeBlockHeight
vegaReleaseTag
approvers
status
}
`;
export const ProtocolUpgradesDocument = gql`
query ProtocolUpgrades {
lastBlockHeight
protocolUpgradeProposals {
edges {
node {
...ProtocolUpgradeProposalFields
}
}
}
}
${ProtocolUpgradeProposalFieldsFragmentDoc}`;
/**
* __useProtocolUpgradesQuery__
*
* To run a query within a React component, call `useProtocolUpgradesQuery` and pass it any options that fit your needs.
* When your component renders, `useProtocolUpgradesQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useProtocolUpgradesQuery({
* variables: {
* },
* });
*/
export function useProtocolUpgradesQuery(baseOptions?: Apollo.QueryHookOptions<ProtocolUpgradesQuery, ProtocolUpgradesQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<ProtocolUpgradesQuery, ProtocolUpgradesQueryVariables>(ProtocolUpgradesDocument, options);
}
export function useProtocolUpgradesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProtocolUpgradesQuery, ProtocolUpgradesQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<ProtocolUpgradesQuery, ProtocolUpgradesQueryVariables>(ProtocolUpgradesDocument, options);
}
export type ProtocolUpgradesQueryHookResult = ReturnType<typeof useProtocolUpgradesQuery>;
export type ProtocolUpgradesLazyQueryHookResult = ReturnType<typeof useProtocolUpgradesLazyQuery>;
export type ProtocolUpgradesQueryResult = Apollo.QueryResult<ProtocolUpgradesQuery, ProtocolUpgradesQueryVariables>;
@@ -6,14 +6,14 @@ import * as Schema from '@vegaprotocol/types';
import { ProtocolUpgradeProposal } from './protocol-upgrade-proposal';
import { ProposalNotFound } from '../components/proposal-not-found';
import { useProtocolUpgradesQuery } from './__generated__/ProtocolUpgradeProposals';
import { useNodesQuery } from '../../staking/home/__generated__/Nodes';
import { useRefreshAfterEpoch } from '../../../hooks/use-refresh-after-epoch';
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
export const ProtocolUpgradeProposalContainer = () => {
const params = useParams<{ proposalReleaseTag: string }>();
const { data, loading, error, refetch } = useProtocolUpgradeProposalsQuery({
const { data, loading, error, refetch } = useProtocolUpgradesQuery({
fetchPolicy: 'network-only',
errorPolicy: 'ignore',
skip: !params.proposalReleaseTag,
@@ -9,7 +9,7 @@ import {
import { ProtocolUpgradeProposalStatus } from '@vegaprotocol/types';
import { getNormalisedVotingPower } from '../../staking/shared';
import type { NodesFragmentFragment } from '../../staking/home/__generated__/Nodes';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import type { ProtocolUpgradeProposalFieldsFragment } from './__generated__/ProtocolUpgradeProposals';
const mockProposal: ProtocolUpgradeProposalFieldsFragment = {
vegaReleaseTag: 'v0.1.234',
@@ -3,8 +3,8 @@ import { ProtocolUpgradeProposalDetailHeader } from '../components/protocol-upgr
import { ProtocolUpdateProposalDetailApprovals } from '../components/protocol-upgrade-proposal-detail-approvals';
import { ProtocolUpgradeProposalDetailInfo } from '../components/protocol-upgrade-proposal-detail-info';
import { getNormalisedVotingPower } from '../../staking/shared';
import type { ProtocolUpgradeProposalFieldsFragment } from './__generated__/ProtocolUpgradeProposals';
import type { NodesFragmentFragment } from '../../staking/home/__generated__/Nodes';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
export interface ProtocolUpgradeProposalProps {
proposal: ProtocolUpgradeProposalFieldsFragment;
+1 -1
View File
@@ -23,5 +23,5 @@ NX_VEGA_URL="https://api.n07.testnet.vega.xyz/graphql"
NX_VEGA_WALLET_URL=http://localhost:1789
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
@@ -2,7 +2,7 @@
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_ENV=DEVNET
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz
@@ -5,4 +5,4 @@ NX_VEGA_ENV=STAGNET1
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
@@ -0,0 +1,8 @@
# App configuration variables
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
NX_VEGA_ENV=STAGNET3
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://staging2.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
+3 -3
View File
@@ -1,5 +1,5 @@
NX_VEGA_URL=https://api.stagnet1.vega.xyz/graphql
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_NETWORKS='{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}'
NX_VEGA_ENV=STAGNET1
NX_VEGA_ENV=STAGNET3
NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
+5
View File
@@ -0,0 +1,5 @@
# App configuration variables
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
NX_VEGA_NETWORKS='{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}'
NX_VEGA_ENV=STAGNET3
+2 -1
View File
@@ -22,11 +22,12 @@ Example configurations are provided here:
- [Devnet](./.env.devnet)
- [Capsule](./.env.capsule)
- [Testnet](./.env.testnet)
- [Stagnet3](./.env.stagnet3)
For convenience, you can boot the app injecting one of the configurations above by running:
```bash
yarn nx run multisig-signer:serve --env={env} # e.g. stagnet1
yarn nx run multisig-signer:serve --env={env} # e.g. stagnet3
```
There are a few different configuration options offered for this app:
+28 -94
View File
@@ -1,15 +1,4 @@
[
{
"tranche_id": 58,
"tranche_start": "2023-05-11T00:00:00.000Z",
"tranche_end": "2023-06-11T00:00:00.000Z",
"total_added": "0",
"total_removed": "0",
"locked_amount": "0",
"deposits": [],
"withdrawals": [],
"users": []
},
{
"tranche_id": 57,
"tranche_start": "2024-04-01T00:00:00.000Z",
@@ -48,8 +37,8 @@
"tranche_start": "2023-04-20T00:00:00.000Z",
"tranche_end": "2023-05-20T00:00:00.000Z",
"total_added": "19242.125",
"total_removed": "1214.9959502191275",
"locked_amount": "9457.0664415991503175975",
"total_removed": "959.3245960538025",
"locked_amount": "10418.7792376543211777",
"deposits": [
{
"amount": "188",
@@ -247,11 +236,6 @@
"amount": "422.1034736680125",
"user": "0xf915Da10e5136352Ba049acB0545Deb119054256",
"tx": "0x5932f574afe019060f5812fc89c7298ab9f768cddebe0a803c27e9914b45dc3d"
},
{
"amount": "255.671354165325",
"user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756",
"tx": "0x92cd553dcee22eb58abadc7aab2dc8d4d9b2285943b41aacea8ed09eff5a0914"
}
],
"users": [
@@ -313,17 +297,11 @@
"user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756",
"tranche_id": 56,
"tx": "0x5f544a659ae728cc7b1a29dcda14740425cadf1f47aa74bae92bf2ade3c8093d"
},
{
"amount": "255.671354165325",
"user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756",
"tranche_id": 56,
"tx": "0x92cd553dcee22eb58abadc7aab2dc8d4d9b2285943b41aacea8ed09eff5a0914"
}
],
"total_tokens": "1207.5",
"withdrawn_tokens": "597.002068860225",
"remaining_tokens": "610.497931139775"
"withdrawn_tokens": "341.3307146949",
"remaining_tokens": "866.1692853051"
},
{
"address": "0x33Ce1D9E53AFb7367E34749517C086405a651a95",
@@ -867,7 +845,7 @@
"tranche_end": "2023-05-06T00:00:00.000Z",
"total_added": "14520",
"total_removed": "5079.76864115505",
"locked_amount": "360.24949074073997136",
"locked_amount": "1085.952592592592978",
"deposits": [
{
"amount": "111",
@@ -4737,7 +4715,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "86666.297",
"total_removed": "0",
"locked_amount": "50751.8588230648417449891",
"locked_amount": "51107.876034425155701037",
"deposits": [
{
"amount": "86666.297",
@@ -4803,7 +4781,7 @@
"tranche_end": "2023-06-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
"locked_amount": "367.3669935388685",
"locked_amount": "387.962962962963",
"deposits": [
{
"amount": "2500",
@@ -4836,7 +4814,7 @@
"tranche_end": "2023-11-01T00:00:00.000Z",
"total_added": "15000.000000000000015",
"total_removed": "0",
"locked_amount": "14653.0693312198065146530693312198065",
"locked_amount": "14775.301932367149014775301932367149",
"deposits": [
{
"amount": "1.5e-14",
@@ -4924,7 +4902,7 @@
"tranche_end": "2023-09-01T00:00:00.000Z",
"total_added": "17500",
"total_removed": "0",
"locked_amount": "11293.61711830716525",
"locked_amount": "11436.2218196457315",
"deposits": [
{
"amount": "12500",
@@ -5191,7 +5169,7 @@
"tranche_end": "2023-08-01T00:00:00.000Z",
"total_added": "37500",
"total_removed": "17836.1796921",
"locked_amount": "18179.07122851442625",
"locked_amount": "18489.717618170655",
"deposits": [
{
"amount": "7500",
@@ -5599,7 +5577,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
"locked_amount": "50705.5541377325336221035",
"locked_amount": "51061.24652818329987399",
"deposits": [
{
"amount": "129999.45",
@@ -5632,7 +5610,7 @@
"tranche_end": "2024-04-01T00:00:00.000Z",
"total_added": "54144.7663",
"total_removed": "0",
"locked_amount": "49077.09978780568889746099",
"locked_amount": "49298.9138196269965560045",
"deposits": [
{
"amount": "54144.7663",
@@ -5665,7 +5643,7 @@
"tranche_end": "2023-09-03T00:00:00.000Z",
"total_added": "62600",
"total_removed": "0",
"locked_amount": "20708.477403602233016",
"locked_amount": "20965.63247082699134",
"deposits": [
{
"amount": "10000",
@@ -5858,7 +5836,7 @@
"tranche_end": "2023-09-17T00:00:00.000Z",
"total_added": "5000",
"total_removed": "0",
"locked_amount": "1845.81256341958375",
"locked_amount": "1866.352105530188",
"deposits": [
{
"amount": "5000",
@@ -6916,7 +6894,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "1709370.7872515768348",
"locked_amount": "147457.5018725717723958",
"locked_amount": "155426.5500030847769098336",
"deposits": [
{
"amount": "1852091.69",
@@ -40788,7 +40766,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "715655.108029600523393",
"locked_amount": "251092.165858100635559352498",
"locked_amount": "263337.818306825404305623187",
"deposits": [
{
"amount": "1998.95815",
@@ -42180,8 +42158,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15870102.715470999700000001",
"total_removed": "869802.17678213314859352",
"locked_amount": "6190044.28411574715560088425053188532414163",
"total_removed": "867610.78878511272497352",
"locked_amount": "6233466.5814528903248765151216390212111382",
"deposits": [
{
"amount": "16249.93",
@@ -42735,11 +42713,6 @@
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0xc5cea08b124cdf6264d5b0c7494d63d9de264b429822d9a4e4cfadc43e611a1b"
},
{
"amount": "2191.38799702042362",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tx": "0xa809dbfa0c31522127924306a6117331a578dfc402cf5fa464832baec46e4ac2"
},
{
"amount": "981.387731774910625",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -46638,12 +46611,6 @@
"tranche_id": 2,
"tx": "0x9d12dadb940c59a796a405a4971e73f24d7ad284528ec7ce676ae361a4ac1f51"
},
{
"amount": "2191.38799702042362",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tranche_id": 2,
"tx": "0xa809dbfa0c31522127924306a6117331a578dfc402cf5fa464832baec46e4ac2"
},
{
"amount": "2873.74755113623213",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
@@ -46916,8 +46883,8 @@
}
],
"total_tokens": "150551.801",
"withdrawn_tokens": "91577.204932811647",
"remaining_tokens": "58974.596067188353"
"withdrawn_tokens": "89385.81693579122338",
"remaining_tokens": "61165.98406420877662"
},
{
"address": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148",
@@ -48780,8 +48747,8 @@
"tranche_start": "2021-11-05T00:00:00.000Z",
"tranche_end": "2023-05-05T00:00:00.000Z",
"total_added": "14597706.0446472999",
"total_removed": "6169862.126766503085603932",
"locked_amount": "0",
"total_removed": "6168897.174282186485373182",
"locked_amount": "33251.32064708015607663338925032586",
"deposits": [
{
"amount": "129284.449",
@@ -49040,11 +49007,6 @@
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0x53d67a8df4d069f956ae1eb76d5e099642dcc8d7e40fa9357be0b8ae879b90c4"
},
{
"amount": "964.95248431660023075",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0x35f722557b9bc3a2dc314f9fac173013697c484059bd8d5c65497f8df72b9097"
},
{
"amount": "1360.32447632896938825",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
@@ -52387,12 +52349,6 @@
"tranche_id": 3,
"tx": "0x53d67a8df4d069f956ae1eb76d5e099642dcc8d7e40fa9357be0b8ae879b90c4"
},
{
"amount": "964.95248431660023075",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tranche_id": 3,
"tx": "0x35f722557b9bc3a2dc314f9fac173013697c484059bd8d5c65497f8df72b9097"
},
{
"amount": "1360.32447632896938825",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
@@ -55215,8 +55171,8 @@
}
],
"total_tokens": "359123.469575",
"withdrawn_tokens": "358757.41399896031421125",
"remaining_tokens": "366.05557603968578875"
"withdrawn_tokens": "357792.4615146437139805",
"remaining_tokens": "1331.0080603562860195"
},
{
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
@@ -58890,8 +58846,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
"total_removed": "44110.3307271943416",
"locked_amount": "39786.9889842268933819326661593",
"total_removed": "44078.8527972103416",
"locked_amount": "41727.382613860946149215697311012",
"deposits": [
{
"amount": "3000",
@@ -65545,11 +65501,6 @@
"user": "0x4d4AA3f302cbA998AAFC03F9d73484434ed9Fd53",
"tx": "0x1e4902d0a3cb7b4f2ba7119dfcaa681a784e1d724c984961767e9feaa078fe54"
},
{
"amount": "31.477929984",
"user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1",
"tx": "0x1b9ddd24634b4c6eab202f0a65dc0d3119fbc5502cbac5086352eab14ebd7b02"
},
{
"amount": "168.502276762",
"user": "0x38A292CB98Dc602ECAFF94E8E5fADD9800e4bA13",
@@ -84375,12 +84326,6 @@
}
],
"withdrawals": [
{
"amount": "31.477929984",
"user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1",
"tranche_id": 5,
"tx": "0x1b9ddd24634b4c6eab202f0a65dc0d3119fbc5502cbac5086352eab14ebd7b02"
},
{
"amount": "19.918569252",
"user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1",
@@ -84425,8 +84370,8 @@
}
],
"total_tokens": "400",
"withdrawn_tokens": "365.936821408",
"remaining_tokens": "34.063178592"
"withdrawn_tokens": "334.458891424",
"remaining_tokens": "65.541108576"
},
{
"address": "0x3738bec36216eA2F11B954891C65AAd1Bc852156",
@@ -144210,11 +144155,6 @@
}
],
"withdrawals": [
{
"amount": "0",
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
"tx": "0xbc31dbb6851f0e1a856afaedfe96fba29ed357ba1da151eb27c495aa49ab1f39"
},
{
"amount": "0",
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
@@ -144505,12 +144445,6 @@
}
],
"withdrawals": [
{
"amount": "0",
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
"tranche_id": 9,
"tx": "0xbc31dbb6851f0e1a856afaedfe96fba29ed357ba1da151eb27c495aa49ab1f39"
},
{
"amount": "0",
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
@@ -0,0 +1,3 @@
{
"hosts": ["https://api-stagnet3.vega.rocks/graphql"]
}
+1 -1
View File
@@ -6,7 +6,7 @@ NX_VEGA_CONFIG_URL=''
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_ENV=CUSTOM
NX_VEGA_EXPLORER_URL=https://explorer.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://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://token.fairground.wtf
NX_VEGA_URL=http://localhost:3008/graphql
NX_VEGA_WALLET_URL=http://localhost:1789
+1 -1
View File
@@ -5,7 +5,7 @@ NX_VEGA_CONFIG_URL=''
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_ENV=CUSTOM
NX_VEGA_EXPLORER_URL=https://explorer.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://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://token.fairground.wtf
NX_VEGA_URL=http://localhost:3008/graphql
NX_VEGA_WALLET_URL=http://localhost:1789
+24
View File
@@ -0,0 +1,24 @@
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_ENV=STAGNET3
NX_VEGA_EXPLORER_URL=https://stagnet3.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://stagnet3.token.vega.xyz
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
NX_VEGA_WALLET_URL=http://localhost:1789
CYPRESS_ETH_WALLET_MNEMONIC=
CYPRESS_ETHEREUM_WALLET_ADDRESS=0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F
CYPRESS_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
CYPRESS_EXPLORER_URL=https://stagnet3.explorer.vega.xyz
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY=1a18cd…0cf2e4
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY2=47836c…c7d278
CYPRESS_VEGA_ENV=STAGNET3
CYPRESS_VEGA_PUBLIC_KEY=1a18cdcaaa4f44a57b35a4e9b77e0701c17a476f2b407620f8c17371740cf2e4
CYPRESS_VEGA_PUBLIC_KEY2=47836c253520d2661bf5bed6339c0de08fd02cf5d4db0efee3b4373f20c7d278
CYPRESS_VEGA_TOKEN_URL=https://stagnet3.token.vega.xyz
CYPRESS_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
CYPRESS_VEGA_WALLET_API_TOKEN=
+4 -4
View File
@@ -3,10 +3,10 @@ NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
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_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
NX_VEGA_ENV=STAGNET1
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_ENV=STAGNET3
NX_VEGA_EXPLORER_URL=https://stagnet3.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://token.fairground.wtf
NX_VEGA_WALLET_URL=http://localhost:1789
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_VEGA_CONFIG_URL=''
NX_VEGA_ENV=CUSTOM
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_EXPLORER_URL=https://stagnet3.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://token.fairground.wtf
NX_VEGA_URL=http://localhost:3008/graphql
NX_VEGA_WALLET_URL=http://localhost:1789
+1 -1
View File
@@ -5,7 +5,7 @@ NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml
NX_VEGA_ENV=DEVNET
NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://token.fairground.wtf
NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
+1 -1
View File
@@ -4,7 +4,7 @@ NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
NX_VEGA_ENV=MAINNET
NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz
NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://token.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet
+1 -1
View File
@@ -5,7 +5,7 @@ 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_ENV=STAGNET1
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\"}
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
+14
View File
@@ -0,0 +1,14 @@
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
NX_VEGA_ENV=STAGNET3
NX_VEGA_EXPLORER_URL=https://stagnet3.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://token.fairground.wtf
NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega-dev-releases/releases
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
+1 -1
View File
@@ -5,7 +5,7 @@ NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml
NX_VEGA_ENV=TESTNET
NX_VEGA_EXPLORER_URL=https://explorer.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://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://token.fairground.wtf
NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
+2 -2
View File
@@ -5,8 +5,8 @@ NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.toml
NX_VEGA_ENV=VALIDATOR_TESTNET
NX_VEGA_EXPLORER_URL=https://validator-testnet.explorer.vega.xyz
NX_VEGA_NETWORKS={\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"}
NX_VEGA_TOKEN_URL=https://validator-testnet.governance.vega.xyz
NX_VEGA_NETWORKS={\"STAGNET3\":\"https://stagnet3.console.vega.xyz\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"}
NX_VEGA_TOKEN_URL=https://validator-testnet.governance.fairground.wtf
NX_VEGA_WALLET_URL=http://localhost:1789
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
+2 -1
View File
@@ -21,11 +21,12 @@ Example configurations are provided here:
- [Mainnet](./.env.mainnet)
- [Devnet](./.env.devnet)
- [Testnet](./.env.testnet)
- [Stagnet3](./.env.stagnet3)
For convenience, you can boot the app injecting one of the configurations above by running:
```bash
yarn nx run token:serve --env={env} # e.g. stagnet1
yarn nx run token:serve --env={env} # e.g. stagnet3
```
There are a few different configuration options offered for this app:
+1 -8
View File
@@ -24,10 +24,6 @@ import {
import { Links, Routes } from '../../pages/client-router';
import { createDocsLinks } from '@vegaprotocol/utils';
import { SettingsButton } from '../../client-pages/settings';
import {
ProtocolUpgradeCountdown,
ProtocolUpgradeCountdownMode,
} from '@vegaprotocol/proposals';
export const Navbar = ({
theme = 'system',
@@ -49,14 +45,11 @@ export const Navbar = ({
theme={theme}
actions={
<>
<ProtocolUpgradeCountdown
mode={ProtocolUpgradeCountdownMode.IN_ESTIMATED_TIME_REMAINING}
/>
<SettingsButton />
<VegaWalletConnectButton />
</>
}
breakpoints={[521, 1122]}
breakpoints={[521, 1067]}
>
<NavigationList
className="[.drawer-content_&]:border-b [.drawer-content_&]:border-b-vega-light-200 dark:[.drawer-content_&]:border-b-vega-dark-200 [.drawer-content_&]:pb-8 [.drawer-content_&]:mb-2"
@@ -5,5 +5,7 @@ export const ViewingBanner = () => {
const { isReadOnly, pubKey, disconnect } = useVegaWallet();
return isReadOnly ? (
<ViewingAsBanner pubKey={pubKey} disconnect={disconnect} />
) : null;
) : (
<div />
);
};
@@ -20,6 +20,7 @@ describe('Risk notice dialog', () => {
assertion | network
${'displays'} | ${Networks.CUSTOM}
${'displays'} | ${Networks.DEVNET}
${'displays'} | ${Networks.STAGNET3}
${'displays'} | ${Networks.TESTNET}
`(
'$assertion a generic message on $network',
+1 -10
View File
@@ -37,10 +37,6 @@ import { ENV } from '../lib/config';
import { useDataProvider } from '@vegaprotocol/react-helpers';
import { activeOrdersProvider, allOrdersProvider } from '@vegaprotocol/orders';
import { useTelemetryApproval } from '../lib/hooks/use-telemetry-approval';
import {
ProtocolUpgradeCountdownMode,
ProtocolUpgradeProposalNotification,
} from '@vegaprotocol/proposals';
const DEFAULT_TITLE = t('Welcome to Vega trading!');
@@ -93,12 +89,7 @@ function AppBody({ Component }: AppProps) {
<div className={gridClasses}>
<AnnouncementBanner />
<Navbar theme={VEGA_ENV === Networks.TESTNET ? 'yellow' : 'system'} />
<div data-testid="banners">
<ProtocolUpgradeProposalNotification
mode={ProtocolUpgradeCountdownMode.IN_ESTIMATED_TIME_REMAINING}
/>
<ViewingBanner />
</div>
<ViewingBanner />
<main data-testid={location.pathname}>
<Component />
</main>
+4 -41
View File
@@ -1,50 +1,13 @@
import { Option } from '@vegaprotocol/ui-toolkit';
import type { AssetFieldsFragment } from './__generated__/Asset';
import classNames from 'classnames';
import { t } from '@vegaprotocol/i18n';
import type { ReactNode } from 'react';
type AssetOptionProps = {
asset: AssetFieldsFragment;
balance?: ReactNode;
};
export const Balance = ({
balance,
symbol,
}: {
balance?: string;
symbol: string;
}) =>
balance ? (
<div className="mt-1 font-alpha">
{balance} {symbol}
</div>
) : (
<div className="text-vega-orange-500">{t('Fetching balance…')}</div>
);
export const AssetOption = ({ asset, balance }: AssetOptionProps) => {
export const AssetOption = ({ asset }: { asset: AssetFieldsFragment }) => {
return (
<Option key={asset.id} value={asset.id}>
<div className="flex flex-col items-start">
<div className="flex flex-row align-baseline gap-2">
<span>{asset.name}</span>{' '}
<span
className={classNames(
'bg-vega-light-200 dark:bg-vega-dark-200',
'text-black dark:text-white text-xs',
'py-[2px] px-[4px] rounded'
)}
>
{asset.symbol}
</span>
</div>
{balance}
<div className="text-[12px] font-mono w-full text-left break-all">
<span className="text-vega-light-300 dark:text-vega-dark-300">
{asset.id}
</span>
<span>{asset.name}</span>
<div className="text-[10px] font-mono w-full text-left break-all">
<span className="text-gray-500">{asset.id} -</span> {asset.symbol}
</div>
</div>
</Option>
+1 -2
View File
@@ -1,9 +1,8 @@
export * from './__generated__/Asset';
export * from './__generated__/Assets';
export * from './asset-data-provider';
export * from './assets-data-provider';
export * from './asset-details-dialog';
export * from './asset-details-table';
export * from './asset-option';
export * from './assets-data-provider';
export * from './constants';
export * from './use-balances-store';
-69
View File
@@ -1,69 +0,0 @@
import type BigNumber from 'bignumber.js';
import type { AssetFieldsFragment } from './__generated__/Asset';
import { create } from 'zustand';
import * as Sentry from '@sentry/react';
import { immer } from 'zustand/middleware/immer';
type AssetWithBalance = {
asset: AssetFieldsFragment;
balanceOnEth?: BigNumber;
balanceOnVega?: BigNumber;
updatedAt: number;
};
type SetBalanceArgs = Omit<AssetWithBalance, 'updatedAt'> & {
ethBalanceFetcher?: () => Promise<BigNumber | undefined>;
};
type BalancesStore = {
balances: (AssetWithBalance & { fetchFromEth?: () => void })[];
getBalance: (assetId: string) => AssetWithBalance | undefined;
setBalance: (args: SetBalanceArgs) => void;
refetch: (assetId: string) => void;
};
export const useBalancesStore = create(
immer<BalancesStore>((set, get) => ({
balances: [],
getBalance: (assetId) =>
get().balances.find(({ asset: a }) => a.id === assetId),
setBalance: ({ asset, balanceOnEth, balanceOnVega, ethBalanceFetcher }) => {
set((state) => {
const found = state.balances.find(({ asset: a }) => a.id === asset.id);
const fetchFromEth = ethBalanceFetcher
? () => {
if (!ethBalanceFetcher) return;
ethBalanceFetcher()
.then((balance) => {
if (balance) {
get().setBalance({ asset, balanceOnEth: balance });
}
})
.catch((err) => {
Sentry.captureException(err);
});
}
: undefined;
if (found) {
if (balanceOnEth) found.balanceOnEth = balanceOnEth;
if (balanceOnVega) found.balanceOnVega = balanceOnVega;
if (fetchFromEth) found.fetchFromEth = fetchFromEth;
found.updatedAt = Date.now();
} else {
state.balances.push({
asset,
balanceOnEth,
balanceOnVega,
fetchFromEth,
updatedAt: Date.now(),
});
}
});
},
refetch: (assetId) => {
const found = get().balances.find((a) => a.asset.id === assetId);
found?.fetchFromEth?.();
},
}))
);
-42
View File
@@ -1,42 +0,0 @@
import { useCallback, useEffect } from 'react';
import { useGetBalanceOfERC20Token } from './use-get-balance-of-erc20-token';
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
import { useBalancesStore } from '@vegaprotocol/assets';
import { Balance } from '@vegaprotocol/assets';
import { isAssetTypeERC20 } from '@vegaprotocol/utils';
import { useTokenContract } from '@vegaprotocol/web3';
const REFETCH_DELAY = 5000;
export const AssetBalance = ({ asset }: { asset: AssetFieldsFragment }) => {
const [setBalance, getBalance] = useBalancesStore((state) => [
state.setBalance,
state.getBalance,
]);
const tokenContract = useTokenContract(
isAssetTypeERC20(asset) ? asset.source.contractAddress : undefined
);
const ethBalanceFetcher = useGetBalanceOfERC20Token(tokenContract, asset);
const fetchFromEth = useCallback(async () => {
const balance = await ethBalanceFetcher();
if (balance) {
setBalance({ asset, balanceOnEth: balance, ethBalanceFetcher });
}
}, [asset, ethBalanceFetcher, setBalance]);
useEffect(() => {
const balance = getBalance(asset.id);
if (!balance || Date.now() - balance.updatedAt > REFETCH_DELAY) {
fetchFromEth();
}
}, [asset.id, fetchFromEth, getBalance]);
return (
<Balance
balance={getBalance(asset.id)?.balanceOnEth?.toString()}
symbol={asset.symbol}
/>
);
};
+3 -12
View File
@@ -41,7 +41,6 @@ import type { DepositBalances } from './use-deposit-balances';
import { FaucetNotification } from './faucet-notification';
import { ApproveNotification } from './approve-notification';
import { usePersistentDeposit } from './use-persistent-deposit';
import { AssetBalance } from './asset-balance';
interface FormFields {
asset: string;
@@ -254,17 +253,9 @@ export const DepositForm = ({
value={selectedAsset?.id}
hasError={Boolean(errors.asset?.message)}
>
{assets
.filter((asset) => isAssetTypeERC20(asset))
.map((asset) => (
<AssetOption
asset={asset}
key={asset.id}
balance={
isActive && account && <AssetBalance asset={asset} />
}
/>
))}
{assets.filter(isAssetTypeERC20).map((a) => (
<AssetOption asset={a} key={a.id} />
))}
</RichSelect>
)}
/>
+2 -3
View File
@@ -1,16 +1,15 @@
export * from './__generated__/Deposit';
export * from './asset-balance';
export * from './deposit-container';
export * from './deposit-dialog';
export * from './deposit-form';
export * from './deposit-limits';
export * from './deposit-manager';
export * from './deposits-provider';
export * from './deposits-table';
export * from './use-deposit-balances';
export * from './deposits-provider';
export * from './use-get-allowance';
export * from './use-get-balance-of-erc20-token';
export * from './use-get-deposit-maximum';
export * from './use-get-deposited-amount';
export * from './use-submit-approval';
export * from './use-submit-faucet';
export * from './deposit-dialog';
+1 -3
View File
@@ -5,7 +5,6 @@ import {
} from '@vegaprotocol/web3';
import { isAssetTypeERC20 } from '@vegaprotocol/utils';
import type { Asset } from '@vegaprotocol/assets';
import { useBalancesStore } from '@vegaprotocol/assets';
import { useEffect, useState } from 'react';
export const useSubmitFaucet = (
@@ -26,9 +25,8 @@ export const useSubmitFaucet = (
useEffect(() => {
if (tx?.status === EthTxStatus.Confirmed) {
getBalances();
if (asset) useBalancesStore.getState().refetch(asset.id);
}
}, [tx?.status, getBalances, asset]);
}, [tx?.status, getBalances]);
return {
id,
@@ -14,11 +14,12 @@ jest.mock('../../hooks/use-environment');
describe('Network switcher', () => {
it.each`
network | label
${Networks.CUSTOM} | ${envTriggerMapping[Networks.CUSTOM]}
${Networks.DEVNET} | ${envTriggerMapping[Networks.DEVNET]}
${Networks.TESTNET} | ${envTriggerMapping[Networks.TESTNET]}
${Networks.MAINNET} | ${envTriggerMapping[Networks.MAINNET]}
network | label
${Networks.CUSTOM} | ${envTriggerMapping[Networks.CUSTOM]}
${Networks.DEVNET} | ${envTriggerMapping[Networks.DEVNET]}
${Networks.STAGNET3} | ${envTriggerMapping[Networks.STAGNET3]}
${Networks.TESTNET} | ${envTriggerMapping[Networks.TESTNET]}
${Networks.MAINNET} | ${envTriggerMapping[Networks.MAINNET]}
`(
'displays the correct selection label for $network',
({ network, label }) => {
@@ -136,6 +137,7 @@ describe('Network switcher', () => {
[Networks.MAINNET]: 'https://main.net',
[Networks.TESTNET]: 'https://test.net',
[Networks.VALIDATOR_TESTNET]: 'https://validator-test.net',
[Networks.STAGNET3]: 'https://stag3.net',
[Networks.DEVNET]: 'https://dev.net',
[Networks.STAGNET1]: 'https://stag1.net',
};
@@ -152,7 +154,12 @@ describe('Network switcher', () => {
screen.getByRole('menuitem', { name: t('Advanced') })
);
[Networks.MAINNET, Networks.TESTNET, Networks.DEVNET].forEach((network) => {
[
Networks.MAINNET,
Networks.TESTNET,
Networks.STAGNET3,
Networks.DEVNET,
].forEach((network) => {
expect(
screen.getByRole('link', { name: envNameMapping[network] })
).toHaveAttribute('href', VEGA_NETWORKS[network]);
@@ -169,6 +176,7 @@ describe('Network switcher', () => {
[Networks.MAINNET]: 'https://main.net',
[Networks.VALIDATOR_TESTNET]: 'https://validator-test.net',
[Networks.TESTNET]: 'https://test.net',
[Networks.STAGNET3]: 'https://stag3.net',
[Networks.DEVNET]: 'https://dev.net',
[Networks.STAGNET1]: 'https://stag1.net',
};
@@ -200,6 +208,7 @@ describe('Network switcher', () => {
[Networks.MAINNET]: undefined,
[Networks.VALIDATOR_TESTNET]: 'https://validator-test.net',
[Networks.TESTNET]: 'https://test.net',
[Networks.STAGNET3]: 'https://stag3.net',
[Networks.DEVNET]: 'https://dev.net',
[Networks.STAGNET1]: 'https://stag1.net',
};
@@ -18,6 +18,7 @@ export const envNameMapping: Record<Networks, string> = {
[Networks.CUSTOM]: t('Custom'),
[Networks.DEVNET]: t('Devnet'),
[Networks.STAGNET1]: t('Stagnet'),
[Networks.STAGNET3]: t('Stagnet3'),
[Networks.TESTNET]: t('Fairground testnet'),
[Networks.MAINNET]: t('Mainnet'),
};
@@ -32,6 +33,7 @@ export const envDescriptionMapping: Record<Networks, string> = {
[Networks.VALIDATOR_TESTNET]: t('The validator deployed testnet'),
[Networks.DEVNET]: t('The latest Vega code auto-deployed'),
[Networks.STAGNET1]: t('A release candidate for the staging environment'),
[Networks.STAGNET3]: t('A staging environment with trading'),
[Networks.TESTNET]: t(
'Public testnet run by the Vega team, often used for incentives'
),
@@ -42,6 +44,7 @@ const standardNetworkKeys = [Networks.MAINNET, Networks.TESTNET];
const advancedNetworkKeys = [
Networks.MAINNET,
Networks.TESTNET,
Networks.STAGNET3,
Networks.DEVNET,
];
@@ -55,6 +55,7 @@ const mockEnvVars = {
VEGA_NETWORKS: {
DEVNET: 'https://devnet.url',
TESTNET: 'https://testnet.url',
STAGNET3: 'https://stagnet3.url',
MAINNET: 'https://mainnet.url',
},
VEGA_WALLET_URL: 'https://localhost:1234',
+4 -18
View File
@@ -2,7 +2,6 @@ import trim from 'lodash/trim';
import { useCallback } from 'react';
import { Networks } from '../types';
import { useEnvironment } from './use-environment';
import { stripFullStops } from '@vegaprotocol/utils';
type Net = Exclude<Networks, 'CUSTOM'>;
export enum DApp {
@@ -19,6 +18,7 @@ const EmptyLinks: DAppLinks = {
[Networks.VALIDATOR_TESTNET]: '',
[Networks.DEVNET]: '',
[Networks.STAGNET1]: '',
[Networks.STAGNET3]: '',
[Networks.TESTNET]: '',
[Networks.MAINNET]: '',
};
@@ -33,12 +33,14 @@ const ExplorerLinks = {
const ConsoleLinks = {
...EmptyLinks,
[Networks.STAGNET1]: 'https://stagnet1.console.vega.xyz',
[Networks.STAGNET3]: 'https://stagnet3.console.vega.xyz',
[Networks.TESTNET]: 'https://console.fairground.wtf',
};
const TokenLinks = {
...EmptyLinks,
[Networks.DEVNET]: 'https://dev.token.vega.xyz',
[Networks.STAGNET3]: 'https://stagnet3.token.vega.xyz',
[Networks.TESTNET]: 'https://token.fairground.wtf',
[Networks.VALIDATOR_TESTNET]: 'https://validator-testnet.governance.vega.xyz',
[Networks.MAINNET]: 'https://token.vega.xyz',
@@ -87,31 +89,15 @@ export const useEtherscanLink = () => {
// Vega blog
export const BLOG = 'https://blog.vega.xyz/';
// Governance pages
// Token pages
export const TOKEN_NEW_MARKET_PROPOSAL = '/proposals/propose/new-market';
export const TOKEN_NEW_NETWORK_PARAM_PROPOSAL =
'/proposals/propose/network-parameter';
export const TOKEN_GOVERNANCE = '/proposals';
export const TOKEN_PROPOSALS = '/proposals';
export const TOKEN_PROPOSAL = '/proposals/:id';
export const TOKEN_PROTOCOL_UPGRADE_PROPOSAL =
'/proposals/protocol-upgrade/:tag';
export const TOKEN_VALIDATOR = '/validators/:id';
/**
* Generates link to the protocol upgrade proposal details on Governance
*/
export const useProtocolUpgradeProposalLink = () => {
const governance = useLinks(DApp.Token);
return (releaseTag: string) =>
governance(
TOKEN_PROTOCOL_UPGRADE_PROPOSAL.replace(
':tag',
stripFullStops(releaseTag)
)
);
};
// Explorer pages
export const EXPLORER_TX = '/txs/:hash';
export const EXPLORER_ORACLE = '/oracles/:id';
+1
View File
@@ -7,6 +7,7 @@ export enum Networks {
CUSTOM = 'CUSTOM',
TESTNET = 'TESTNET',
STAGNET1 = 'STAGNET1',
STAGNET3 = 'STAGNET3',
DEVNET = 'DEVNET',
MAINNET = 'MAINNET',
}
@@ -5,6 +5,7 @@ export enum Networks {
CUSTOM = 'CUSTOM',
TESTNET = 'TESTNET',
STAGNET1 = 'STAGNET1',
STAGNET3 = 'STAGNET3',
DEVNET = 'DEVNET',
MAINNET = 'MAINNET',
}
@@ -22,6 +22,7 @@ import type {
LiquidityProvisionsQueryVariables,
LiquidityProvisionsUpdateSubscription,
} from './__generated__/MarketLiquidity';
import type { IterableElement } from 'type-fest';
export const liquidityProvisionsDataProvider = makeDataProvider<
LiquidityProvisionsQuery,
@@ -38,8 +39,8 @@ export const liquidityProvisionsDataProvider = makeDataProvider<
) => {
return produce(data || [], (draft) => {
deltas?.forEach((delta) => {
const id = delta.id;
const index = draft.findIndex((a) => delta.id === id);
const id = getId(delta);
const index = draft.findIndex((a) => getId(a) === id);
if (index !== -1) {
draft[index].commitmentAmount = delta.commitmentAmount;
draft[index].fee = delta.fee;
@@ -75,6 +76,27 @@ export const liquidityProvisionsDataProvider = makeDataProvider<
},
});
function isLpFragment(
entry:
| LiquidityProvisionFieldsFragment
| IterableElement<
LiquidityProvisionsUpdateSubscription['liquidityProvisions']
>
): entry is LiquidityProvisionFieldsFragment {
return entry.__typename === 'LiquidityProvision';
}
export const getId = (
entry:
| LiquidityProvisionFieldsFragment
| IterableElement<
LiquidityProvisionsUpdateSubscription['liquidityProvisions']
>
) =>
isLpFragment(entry)
? `${entry.party.id}${entry.status}${entry.createdAt}${entry.updatedAt}`
: `${entry.partyID}${entry.status}${entry.createdAt}${entry.updatedAt}`;
export const marketLiquidityDataProvider = makeDataProvider<
MarketLpQuery,
MarketLpQuery,
+2 -1
View File
@@ -17,6 +17,7 @@ import type { ValueFormatterParams } from 'ag-grid-community';
import BigNumber from 'bignumber.js';
import { LiquidityProvisionStatusMapping } from '@vegaprotocol/types';
import type { LiquidityProvisionData } from './liquidity-data-provider';
import { getId } from './liquidity-data-provider';
const percentageFormatter = ({ value }: ValueFormatterParams) => {
if (!value) return '-';
@@ -55,7 +56,7 @@ export const LiquidityTable = forwardRef<AgGridReact, LiquidityTableProps>(
<AgGrid
style={{ width: '100%', height: '100%' }}
overlayNoRowsTemplate={t('No liquidity provisions')}
getRowId={({ data }) => data.id}
getRowId={({ data }) => getId(data)}
ref={ref}
tooltipShowDelay={500}
defaultColDef={{
-2
View File
@@ -1,4 +1,2 @@
export * from './asset-proposal-notification';
export * from './market-proposal-notification';
export * from './protocol-upgrade-countdown';
export * from './protocol-upgrade-proposal-notification';
@@ -1,99 +0,0 @@
import { t } from '@vegaprotocol/i18n';
import { useNextProtocolUpgradeProposal, useTimeToUpgrade } from '../lib';
import { convertToCountdownString } from '@vegaprotocol/utils';
import { IconNames } from '@blueprintjs/icons';
import classNames from 'classnames';
import { Icon, NavigationContext } from '@vegaprotocol/ui-toolkit';
import { useProtocolUpgradeProposalLink } from '@vegaprotocol/environment';
import { useContext } from 'react';
export enum ProtocolUpgradeCountdownMode {
IN_BLOCKS,
IN_ESTIMATED_TIME_REMAINING,
}
type ProtocolUpgradeCountdownProps = {
mode?: ProtocolUpgradeCountdownMode;
};
export const ProtocolUpgradeCountdown = ({
mode = ProtocolUpgradeCountdownMode.IN_BLOCKS,
}: ProtocolUpgradeCountdownProps) => {
const { theme } = useContext(NavigationContext);
const { data, lastBlockHeight } = useNextProtocolUpgradeProposal();
const time = useTimeToUpgrade(
data && data.upgradeBlockHeight
? Number(data.upgradeBlockHeight)
: undefined
);
const detailsLink = useProtocolUpgradeProposalLink();
if (!data) return null;
const emphasis = classNames(
'text-vega-orange-500 dark:text-vega-orange-500',
{
'!text-black': theme === 'yellow',
}
);
let countdown;
switch (mode) {
case ProtocolUpgradeCountdownMode.IN_BLOCKS:
countdown = (
<>
<span className={emphasis}>
{Number(data.upgradeBlockHeight) - Number(lastBlockHeight)}
</span>{' '}
{t('blocks')}
</>
);
break;
case ProtocolUpgradeCountdownMode.IN_ESTIMATED_TIME_REMAINING:
countdown =
time !== undefined ? (
<span className={emphasis}>
{convertToCountdownString(time, '0:00:00:00')}
</span>
) : (
<span
className={classNames('italic lowercase text-vega-orange-600', {
'!text-black': theme === 'yellow',
})}
>
{t('estimating...')}
</span>
);
break;
}
return (
<a
href={detailsLink(data.vegaReleaseTag)}
target="_blank"
rel="noreferrer nofollow noopener"
>
<div
data-testid="protocol-upgrade-counter"
className={classNames(
'flex flex-nowrap items-center text-xs py-2 px-4',
'border rounded',
'border-vega-orange-500 dark:border-vega-orange-500',
'bg-vega-orange-300 dark:bg-vega-orange-700',
{
'!bg-transparent !border-black': theme === 'yellow',
}
)}
>
<Icon
name={IconNames.WARNING_SIGN}
size={3}
className={classNames('mr-2', emphasis)}
/>{' '}
<span className="flex gap-1 flex-nowrap whitespace-nowrap">
<span>{t('Network upgrade in')} </span>
{countdown}
</span>
</div>
</a>
);
};
@@ -1,79 +0,0 @@
import {
ExternalLink,
Intent,
NotificationBanner,
} from '@vegaprotocol/ui-toolkit';
import { useNextProtocolUpgradeProposal, useTimeToUpgrade } from '../lib';
import { t } from '@vegaprotocol/i18n';
import { useProtocolUpgradeProposalLink } from '@vegaprotocol/environment';
import { ProtocolUpgradeCountdownMode } from './protocol-upgrade-countdown';
import { convertToCountdownString } from '@vegaprotocol/utils';
import { useState } from 'react';
type ProtocolUpgradeProposalNotificationProps = {
mode?: ProtocolUpgradeCountdownMode;
};
export const ProtocolUpgradeProposalNotification = ({
mode = ProtocolUpgradeCountdownMode.IN_BLOCKS,
}: ProtocolUpgradeProposalNotificationProps) => {
const [visible, setVisible] = useState(true);
const { data, lastBlockHeight } = useNextProtocolUpgradeProposal();
const detailsLink = useProtocolUpgradeProposalLink();
const time = useTimeToUpgrade(
data && data.upgradeBlockHeight
? Number(data.upgradeBlockHeight)
: undefined
);
if (!data || !lastBlockHeight || !visible) return null;
const { vegaReleaseTag, upgradeBlockHeight } = data;
let countdown;
switch (mode) {
case ProtocolUpgradeCountdownMode.IN_BLOCKS:
countdown = (
<>
<span className="text-vega-orange-500">
{Number(upgradeBlockHeight) - Number(lastBlockHeight)}
</span>{' '}
{t('blocks')}
</>
);
break;
case ProtocolUpgradeCountdownMode.IN_ESTIMATED_TIME_REMAINING:
countdown =
time !== undefined ? (
<span className="text-vega-orange-500">
{convertToCountdownString(time, '0:00:00:00')}
</span>
) : (
<span className="text-vega-orange-600 lowercase italic">
{t('estimating...')}
</span>
);
break;
}
return (
<NotificationBanner
intent={Intent.Warning}
onClose={() => {
setVisible(false);
}}
>
<div className="uppercase ">
{t('The network will upgrade to %s in ', [data.vegaReleaseTag])}
{countdown}
</div>
<div>
{t(
'Trading activity will be interrupted, manage your risk appropriately.'
)}{' '}
<ExternalLink href={detailsLink(vegaReleaseTag)}>
{t('View details')}
</ExternalLink>
</div>
</NotificationBanner>
);
};
-1
View File
@@ -3,4 +3,3 @@ export * from './voting-hooks';
export * from './proposals-data-provider';
export * from './proposals-list';
export * from './voting-progress';
export * from './protocol-upgrade-proposals';
@@ -1,6 +0,0 @@
query BlockStatistics {
statistics {
blockHeight
blockDuration
}
}
@@ -1,46 +0,0 @@
import * as Types from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type BlockStatisticsQueryVariables = Types.Exact<{ [key: string]: never; }>;
export type BlockStatisticsQuery = { __typename?: 'Query', statistics: { __typename?: 'Statistics', blockHeight: string, blockDuration: string } };
export const BlockStatisticsDocument = gql`
query BlockStatistics {
statistics {
blockHeight
blockDuration
}
}
`;
/**
* __useBlockStatisticsQuery__
*
* To run a query within a React component, call `useBlockStatisticsQuery` and pass it any options that fit your needs.
* When your component renders, `useBlockStatisticsQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useBlockStatisticsQuery({
* variables: {
* },
* });
*/
export function useBlockStatisticsQuery(baseOptions?: Apollo.QueryHookOptions<BlockStatisticsQuery, BlockStatisticsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<BlockStatisticsQuery, BlockStatisticsQueryVariables>(BlockStatisticsDocument, options);
}
export function useBlockStatisticsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<BlockStatisticsQuery, BlockStatisticsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<BlockStatisticsQuery, BlockStatisticsQueryVariables>(BlockStatisticsDocument, options);
}
export type BlockStatisticsQueryHookResult = ReturnType<typeof useBlockStatisticsQuery>;
export type BlockStatisticsLazyQueryHookResult = ReturnType<typeof useBlockStatisticsLazyQuery>;
export type BlockStatisticsQueryResult = Apollo.QueryResult<BlockStatisticsQuery, BlockStatisticsQueryVariables>;
@@ -1,62 +0,0 @@
import * as Types from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type ProtocolUpgradeProposalFieldsFragment = { __typename?: 'ProtocolUpgradeProposal', upgradeBlockHeight: string, vegaReleaseTag: string, approvers: Array<string>, status: Types.ProtocolUpgradeProposalStatus };
export type ProtocolUpgradeProposalsQueryVariables = Types.Exact<{
inState?: Types.InputMaybe<Types.ProtocolUpgradeProposalStatus>;
}>;
export type ProtocolUpgradeProposalsQuery = { __typename?: 'Query', lastBlockHeight: string, protocolUpgradeProposals?: { __typename?: 'ProtocolUpgradeProposalConnection', edges?: Array<{ __typename?: 'ProtocolUpgradeProposalEdge', node: { __typename?: 'ProtocolUpgradeProposal', upgradeBlockHeight: string, vegaReleaseTag: string, approvers: Array<string>, status: Types.ProtocolUpgradeProposalStatus } }> | null } | null };
export const ProtocolUpgradeProposalFieldsFragmentDoc = gql`
fragment ProtocolUpgradeProposalFields on ProtocolUpgradeProposal {
upgradeBlockHeight
vegaReleaseTag
approvers
status
}
`;
export const ProtocolUpgradeProposalsDocument = gql`
query ProtocolUpgradeProposals($inState: ProtocolUpgradeProposalStatus) {
lastBlockHeight
protocolUpgradeProposals(inState: $inState) {
edges {
node {
...ProtocolUpgradeProposalFields
}
}
}
}
${ProtocolUpgradeProposalFieldsFragmentDoc}`;
/**
* __useProtocolUpgradeProposalsQuery__
*
* To run a query within a React component, call `useProtocolUpgradeProposalsQuery` and pass it any options that fit your needs.
* When your component renders, `useProtocolUpgradeProposalsQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useProtocolUpgradeProposalsQuery({
* variables: {
* inState: // value for 'inState'
* },
* });
*/
export function useProtocolUpgradeProposalsQuery(baseOptions?: Apollo.QueryHookOptions<ProtocolUpgradeProposalsQuery, ProtocolUpgradeProposalsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<ProtocolUpgradeProposalsQuery, ProtocolUpgradeProposalsQueryVariables>(ProtocolUpgradeProposalsDocument, options);
}
export function useProtocolUpgradeProposalsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProtocolUpgradeProposalsQuery, ProtocolUpgradeProposalsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<ProtocolUpgradeProposalsQuery, ProtocolUpgradeProposalsQueryVariables>(ProtocolUpgradeProposalsDocument, options);
}
export type ProtocolUpgradeProposalsQueryHookResult = ReturnType<typeof useProtocolUpgradeProposalsQuery>;
export type ProtocolUpgradeProposalsLazyQueryHookResult = ReturnType<typeof useProtocolUpgradeProposalsLazyQuery>;
export type ProtocolUpgradeProposalsQueryResult = Apollo.QueryResult<ProtocolUpgradeProposalsQuery, ProtocolUpgradeProposalsQueryVariables>;
@@ -1,3 +0,0 @@
export * from './__generated__/ProtocolUpgradeProposals';
export * from './use-next-protocol-upgrade-proposals';
export * from './use-time-to-upgrade';
@@ -1,53 +0,0 @@
import { useMemo } from 'react';
import * as Schema from '@vegaprotocol/types';
import { removePaginationWrapper } from '@vegaprotocol/utils';
import { useProtocolUpgradeProposalsQuery } from './__generated__/ProtocolUpgradeProposals';
export const useNextProtocolUpgradeProposals = (since?: number) => {
const { data, loading, error } = useProtocolUpgradeProposalsQuery({
pollInterval: 5000,
fetchPolicy: 'network-only',
errorPolicy: 'ignore',
variables: {
inState:
Schema.ProtocolUpgradeProposalStatus
.PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED,
},
});
const nextUpgrades = useMemo(() => {
if (!data) return [];
const proposals = removePaginationWrapper(
data?.protocolUpgradeProposals?.edges
);
return proposals
.filter(
(p) =>
Number(p.upgradeBlockHeight) > (since || Number(data.lastBlockHeight))
)
.sort(
(a, b) => Number(a.upgradeBlockHeight) - Number(b.upgradeBlockHeight)
);
}, [data, since]);
return {
data: nextUpgrades,
lastBlockHeight: data?.lastBlockHeight,
loading,
error,
};
};
export const useNextProtocolUpgradeProposal = (since?: number) => {
const { data, lastBlockHeight, loading, error } =
useNextProtocolUpgradeProposals(since);
return {
data: !data ? undefined : data[0],
lastBlockHeight,
loading,
error,
};
};
@@ -1,32 +0,0 @@
import { renderHook, waitFor } from '@testing-library/react';
import { useTimeToUpgrade } from './use-time-to-upgrade';
jest.mock('./__generated__/BlockStatistics', () => ({
...jest.requireActual('./__generated__/BlockStatistics'),
useBlockStatisticsQuery: jest.fn(() => {
return {
data: {
statistics: {
blockHeight: 1,
blockDuration: 500,
},
},
};
}),
}));
describe('useTimeToUpgrade', () => {
it.each([
[-1, -1000],
[0, -500],
[1, 0],
[2, 500],
[3, 1000],
[10, 4500],
])('time in %d block(s) should be %d ms', async (block, avg) => {
const { result } = renderHook(() => useTimeToUpgrade(block, 1));
await waitFor(() => {
expect(result.current).toEqual(avg);
});
});
});
@@ -1,64 +0,0 @@
import { useEffect, useState } from 'react';
import { useBlockStatisticsQuery } from './__generated__/BlockStatistics';
import sum from 'lodash/sum';
const DEFAULT_POLLS = 10;
const INTERVAL = 1000;
const durations = [] as number[];
const useAverageBlockDuration = (polls = DEFAULT_POLLS) => {
const [avg, setAvg] = useState<number | undefined>(undefined);
const { data } = useBlockStatisticsQuery({
pollInterval: INTERVAL,
fetchPolicy: 'network-only',
errorPolicy: 'ignore',
skip: durations.length === polls,
});
useEffect(() => {
if (durations.length < polls && data) {
durations.push(parseFloat(data.statistics.blockDuration));
}
if (durations.length === polls) {
const averageBlockDuration = sum(durations) / durations.length; // ms
console.log('setting avg', averageBlockDuration);
setAvg(averageBlockDuration);
}
}, [data, polls]);
return avg;
};
export const useTimeToUpgrade = (
upgradeBlockHeight?: number,
polls = DEFAULT_POLLS
) => {
const [time, setTime] = useState<number | undefined>(undefined);
const avg = useAverageBlockDuration(polls);
const { data } = useBlockStatisticsQuery({
fetchPolicy: 'network-only',
errorPolicy: 'ignore',
});
useEffect(() => {
const t =
(Number(upgradeBlockHeight) - Number(data?.statistics.blockHeight)) *
Number(avg);
if (!isNaN(t)) {
setTime(t);
}
}, [avg, data?.statistics.blockHeight, upgradeBlockHeight]);
useEffect(() => {
const i = setInterval(() => {
if (time !== undefined) {
setTime(time - 1000);
}
}, 1000);
return () => {
clearInterval(i);
};
}, [time]);
return time;
};
+1 -1
View File
@@ -7,7 +7,7 @@ interface Asset {
};
}
export interface ERC20Asset {
interface ERC20Asset {
__typename?: 'Asset';
source: {
__typename: 'ERC20';
+1 -46
View File
@@ -1,8 +1,4 @@
import {
convertToCountdown,
convertToCountdownString,
getSecondsFromInterval,
} from './time';
import { getSecondsFromInterval } from './time';
describe('getSecondsFromInterval', () => {
it('returns 0 for bad data', () => {
@@ -38,44 +34,3 @@ describe('getSecondsFromInterval', () => {
expect(getSecondsFromInterval('1D1h30m1s')).toEqual(91801);
});
});
describe('convertToCountdown', () => {
it.each([
[1 * 1000, [0, 0, 0, 1]],
[2 * 1000, [0, 0, 0, 2]],
[3999, [0, 0, 0, 3]],
[1 * 60 * 1000 + 3 * 1000, [0, 0, 1, 3]],
[12 * 60 * 1000 + 3 * 1000, [0, 0, 12, 3]],
[3 * 60 * 60 * 1000 + 12 * 60 * 1000 + 3 * 1000, [0, 3, 12, 3]],
[
30 * 24 * 60 * 60 * 1000 + 3 * 60 * 60 * 1000 + 12 * 60 * 1000 + 3 * 1000,
[30, 3, 12, 3],
],
[
-1 *
(30 * 24 * 60 * 60 * 1000 +
3 * 60 * 60 * 1000 +
12 * 60 * 1000 +
3 * 1000),
[30, 3, 12, 3],
],
])('converts %d ms to %s', (time, countdown) => {
expect(convertToCountdown(time)).toEqual(countdown);
});
});
describe('convertToCountdownString', () => {
it.each([
[1 * 1000, '00m01s'],
[2 * 1000, '00m02s'],
[1 * 60 * 1000 + 3 * 1000, '01m03s'],
[12 * 60 * 1000 + 3 * 1000, '12m03s'],
[3 * 60 * 60 * 1000 + 12 * 60 * 1000 + 3 * 1000, '03h12m03s'],
[
30 * 24 * 60 * 60 * 1000 + 3 * 60 * 60 * 1000 + 12 * 60 * 1000 + 3 * 1000,
'30d03h12m03s',
],
])('converts %d ms to %s', (time, countdown) => {
expect(convertToCountdownString(time)).toEqual(countdown);
});
});
-44
View File
@@ -46,47 +46,3 @@ export function getSecondsFromInterval(str: string) {
}
return seconds;
}
export const convertToCountdown = (time: number) => {
const s = 1000;
const m = 1000 * 60;
const h = 1000 * 60 * 60;
const d = 1000 * 60 * 60 * 24;
const t = Math.abs(time);
const days = Math.floor(t / d);
const hours = Math.floor((t - days * d) / h);
const minutes = Math.floor((t - days * d - hours * h) / m);
const seconds = Math.floor((t - days * d - hours * h - minutes * m) / s);
return [days, hours, minutes, seconds];
};
/**
* Converts given time in ms to countdown string, e.g. 1d20h34m10s
*/
export const convertToCountdownString = (
time: number,
pattern = '0d00h00m00s'
) => {
const values = convertToCountdown(time);
let i = 0;
const countdown = pattern
.replace(/00*/g, (match) => {
const value = String(values[i++]);
if (value.length < match.length) {
const filler = Array(match.length - value.length)
.fill('0')
.join('');
return `${filler}${value}`;
}
return value;
})
.replace(/^00*[^\d]*/g, '') // replace leading 00, e.g. 00d01h23m45s -> 01h23m45s
.replace(/^00[^\d]*/g, ''); // replace leading 00, e.g. 00d00h23m45s -> 23m45s
return countdown;
};
-30
View File
@@ -1,30 +0,0 @@
import { useAccountBalance } from '@vegaprotocol/accounts';
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
import { useBalancesStore } from '@vegaprotocol/assets';
import { Balance } from '@vegaprotocol/assets';
import { addDecimal } from '@vegaprotocol/utils';
import BigNumber from 'bignumber.js';
import { useEffect } from 'react';
export const AssetBalance = ({ asset }: { asset: AssetFieldsFragment }) => {
const [setBalance, getBalance] = useBalancesStore((state) => [
state.setBalance,
state.getBalance,
]);
const { accountBalance, accountDecimals } = useAccountBalance(asset?.id);
useEffect(() => {
const balance =
accountBalance && accountDecimals
? new BigNumber(addDecimal(accountBalance, accountDecimals))
: undefined;
setBalance({ asset, balanceOnVega: balance });
}, [accountBalance, accountDecimals, asset, setBalance]);
return (
<Balance
balance={getBalance(asset.id)?.balanceOnVega?.toString()}
symbol={asset.symbol}
/>
);
};
@@ -1,7 +1,6 @@
import { render, screen, act, waitFor } from '@testing-library/react';
import { MockedProvider } from '@apollo/client/testing';
import type { Account } from '@vegaprotocol/accounts';
import { useAccountBalance } from '@vegaprotocol/accounts';
import { WithdrawFormContainer } from './withdraw-form-container';
import * as Types from '@vegaprotocol/types';
import { useWeb3React } from '@web3-react/core';
@@ -13,7 +12,6 @@ jest.mock('@vegaprotocol/react-helpers', () => ({
}),
}));
jest.mock('@web3-react/core');
jest.mock('@vegaprotocol/accounts');
describe('WithdrawFormContainer', () => {
const props = {
@@ -93,10 +91,6 @@ describe('WithdrawFormContainer', () => {
beforeEach(() => {
(useWeb3React as jest.Mock).mockReturnValue({ account: MOCK_ETH_ADDRESS });
(useAccountBalance as jest.Mock).mockReturnValue({
accountBalance: 0,
accountDecimals: null,
});
});
afterEach(() => {
jest.resetAllMocks();
@@ -8,11 +8,6 @@ import type { Asset } from '@vegaprotocol/assets';
jest.mock('@web3-react/core');
jest.mock('@vegaprotocol/accounts', () => ({
...jest.requireActual('@vegaprotocol/accounts'),
useAccountBalance: jest.fn(() => ({ accountBalance: 0, accountDecimals: 0 })),
}));
const MOCK_ETH_ADDRESS = '0x72c22822A19D20DE7e426fB84aa047399Ddd8853';
let assets: Asset[];
+1 -6
View File
@@ -33,7 +33,6 @@ import {
useWeb3ConnectStore,
useWeb3Disconnect,
} from '@vegaprotocol/web3';
import { AssetBalance } from './asset-balance';
interface FormFields {
asset: string;
@@ -155,11 +154,7 @@ export const WithdrawForm = ({
hasError={Boolean(errors.asset?.message)}
>
{assets.filter(isAssetTypeERC20).map((a) => (
<AssetOption
key={a.id}
asset={a}
balance={<AssetBalance asset={a} />}
/>
<AssetOption key={a.id} asset={a} />
))}
</RichSelect>
);
@@ -25,11 +25,6 @@ jest.mock('./use-withdraw-asset', () => ({
useWithdrawAsset: () => withdrawAsset,
}));
jest.mock('@vegaprotocol/accounts', () => ({
...jest.requireActual('@vegaprotocol/accounts'),
useAccountBalance: jest.fn(() => ({ accountBalance: 0, accountDecimals: 0 })),
}));
jest.mock('@vegaprotocol/web3', () => ({
...jest.requireActual('@vegaprotocol/web3'),
useGetWithdrawThreshold: () => {