From 95280f5b26715fbbbbe23a181906338495c636fe Mon Sep 17 00:00:00 2001 From: Maciek Date: Tue, 14 Mar 2023 16:02:43 +0100 Subject: [PATCH] chore(environment): fetch networks configuration from repo (#3145) --- apps/explorer-e2e/.env | 2 +- apps/explorer/.env | 2 +- apps/explorer/.env.devnet | 4 +-- apps/explorer/.env.mainnet | 4 +-- apps/explorer/.env.mirror | 2 +- apps/explorer/.env.sandbox | 2 +- apps/explorer/.env.stagnet1 | 2 +- apps/explorer/.env.stagnet3 | 2 +- apps/explorer/.env.testnet | 4 +-- apps/explorer/.env.validator-testnet | 2 +- apps/governance/.env | 2 +- apps/governance/.env.devnet | 4 +-- apps/governance/.env.mainnet | 4 +-- apps/governance/.env.mirror | 2 +- apps/governance/.env.sandbox | 2 +- apps/governance/.env.stagnet1 | 4 +-- apps/governance/.env.stagnet3 | 4 +-- apps/governance/.env.testnet | 4 +-- apps/governance/.env.validator-testnet | 2 +- apps/liquidity-provision-dashboard/.env | 2 +- .../liquidity-provision-dashboard/.env.devnet | 4 +-- .../.env.mainnet | 2 +- .../.env.stagnet1 | 2 +- .../.env.stagnet3 | 4 +-- .../.env.testnet | 2 +- apps/multisig-signer/.env | 2 +- apps/multisig-signer/.env.devnet | 2 +- apps/multisig-signer/.env.mainnet | 2 +- apps/multisig-signer/.env.sandbox | 4 +-- apps/multisig-signer/.env.stagnet3 | 2 +- apps/multisig-signer/.env.testnet | 2 +- apps/multisig-signer/.env.validator-testnet | 2 +- apps/trading-e2e/.env.stagnet3 | 2 +- apps/trading/.env | 2 +- apps/trading/.env.devnet | 2 +- apps/trading/.env.mainnet | 2 +- apps/trading/.env.mirror | 2 +- apps/trading/.env.sandbox | 3 +-- apps/trading/.env.stagnet1 | 2 +- apps/trading/.env.stagnet3 | 2 +- apps/trading/.env.testnet | 2 +- apps/trading/.env.validator-testnet | 2 +- .../src/hooks/use-environment.spec.ts | 25 +++++++++++-------- libs/environment/src/hooks/use-environment.ts | 15 ++++++++--- libs/environment/src/types.ts | 4 +-- .../src/utils/validate-configuration.ts | 4 +-- package.json | 1 + yarn.lock | 5 ++++ 48 files changed, 89 insertions(+), 72 deletions(-) diff --git a/apps/explorer-e2e/.env b/apps/explorer-e2e/.env index b48aad733..ec072e6c6 100644 --- a/apps/explorer-e2e/.env +++ b/apps/explorer-e2e/.env @@ -3,7 +3,7 @@ NX_TENDERMINT_URL=http://localhost:26617 NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket NX_VEGA_URL=http://localhost:3028/query NX_VEGA_ENV=CUSTOM -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/capsule-network.json +NX_VEGA_CONFIG_URL= CYPRESS_VEGA_TENDERMINT_URL=http://localhost:26617 diff --git a/apps/explorer/.env b/apps/explorer/.env index ee3a6926f..dbdbcd3d4 100644 --- a/apps/explorer/.env +++ b/apps/explorer/.env @@ -1,6 +1,6 @@ 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://static.vega.xyz/assets/stagnet3-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml NX_VEGA_NETWORKS='{"SANDBOX":"https://sandbox.explorer.vega.xyz","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 diff --git a/apps/explorer/.env.devnet b/apps/explorer/.env.devnet index 8c965abac..22b999009 100644 --- a/apps/explorer/.env.devnet +++ b/apps/explorer/.env.devnet @@ -1,10 +1,10 @@ # App configuration variables NX_TENDERMINT_URL=https://tm.be.devnet1.vega.xyz/tm NX_TENDERMINT_WEBSOCKET_URL=wss://be.devnet1.vega.xyz/websocket -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml NX_VEGA_ENV=DEVNET NX_BLOCK_EXPLORER=https://be.devnet1.vega.xyz/rest NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_VEGA_GOVERNANCE_URL=https://dev.token.vega.xyz NX_VEGA_URL=https://api.devnet1.vega.xyz/graphql -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet1-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml diff --git a/apps/explorer/.env.mainnet b/apps/explorer/.env.mainnet index c9db6ca60..73a40c4b9 100644 --- a/apps/explorer/.env.mainnet +++ b/apps/explorer/.env.mainnet @@ -1,8 +1,8 @@ # App configuration variables NX_TENDERMINT_URL=https://be.explorer.vega.xyz NX_TENDERMINT_WEBSOCKET_URL=wss://be.explorer.vega.xyz/websocket -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml NX_VEGA_ENV=MAINNET NX_BLOCK_EXPLORER=https://be.explorer.vega.xyz/rest/ NX_ETHERSCAN_URL=https://etherscan.io -NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz \ No newline at end of file +NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz diff --git a/apps/explorer/.env.mirror b/apps/explorer/.env.mirror index 282267035..3ad5277e9 100644 --- a/apps/explorer/.env.mirror +++ b/apps/explorer/.env.mirror @@ -1,7 +1,7 @@ # App configuration variables NX_TENDERMINT_URL=https://tm.be.mainnet-mirror.vega.xyz NX_TENDERMINT_WEBSOCKET_URL=wss://be.mainnet-mirror.vega.xyz/websocket -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mirror-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/mainnet-mirror/vegawallet-mainnet-mirror.toml NX_VEGA_ENV=MIRROR NX_BLOCK_EXPLORER=https://be.mainnet-mirror.vega.xyz/rest/ NX_ETHERSCAN_URL=https://sepolia.etherscan.io diff --git a/apps/explorer/.env.sandbox b/apps/explorer/.env.sandbox index 83e351f43..41b01badc 100644 --- a/apps/explorer/.env.sandbox +++ b/apps/explorer/.env.sandbox @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=SANDBOX -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/sandbox-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/sandbox/vegawallet-sandbox.toml NX_VEGA_EXPLORER_URL=https://sandbox.explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 diff --git a/apps/explorer/.env.stagnet1 b/apps/explorer/.env.stagnet1 index d3d225505..56ecf5dbf 100644 --- a/apps/explorer/.env.stagnet1 +++ b/apps/explorer/.env.stagnet1 @@ -1,7 +1,7 @@ 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://static.vega.xyz/assets/stagnet1-network.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_TOKEN_URL=https://stagnet1.token.vega.xyz diff --git a/apps/explorer/.env.stagnet3 b/apps/explorer/.env.stagnet3 index 41c944c12..461d4cf8b 100644 --- a/apps/explorer/.env.stagnet3 +++ b/apps/explorer/.env.stagnet3 @@ -1,6 +1,6 @@ NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz NX_TENDERMINT_WEBSOCKET_URL=wss://be.stagnet3.vega.xyz/websocket -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +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 diff --git a/apps/explorer/.env.testnet b/apps/explorer/.env.testnet index 6da08ce66..d79d0623d 100644 --- a/apps/explorer/.env.testnet +++ b/apps/explorer/.env.testnet @@ -2,9 +2,9 @@ NX_TENDERMINT_URL=https://tm.be.testnet.vega.xyz NX_BLOCK_EXPLORER=https://be.testnet.vega.xyz/rest NX_TENDERMINT_WEBSOCKET_URL=wss://be.testnet.vega.xyz/websocket -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml NX_VEGA_ENV=TESTNET NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_ETHERSCAN_URL=https://sepolia.etherscan.io -NX_VEGA_GOVERNANCE_URL=https://token.fairground.wtf \ No newline at end of file +NX_VEGA_GOVERNANCE_URL=https://token.fairground.wtf diff --git a/apps/explorer/.env.validator-testnet b/apps/explorer/.env.validator-testnet index 38acc6b7a..8371a14c3 100644 --- a/apps/explorer/.env.validator-testnet +++ b/apps/explorer/.env.validator-testnet @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=VALIDATOR_TESTNET -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/validator-testnet-network.json +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.xyz/ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 diff --git a/apps/governance/.env b/apps/governance/.env index ad2cc883c..70a8aa548 100644 --- a/apps/governance/.env +++ b/apps/governance/.env @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=STAGNET3 -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +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 diff --git a/apps/governance/.env.devnet b/apps/governance/.env.devnet index b5f9f3ce1..633e6e244 100644 --- a/apps/governance/.env.devnet +++ b/apps/governance/.env.devnet @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=DEVNET -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json +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","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 @@ -9,4 +9,4 @@ NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_DELEGATIONS_PAGINATION=50 -NX_TRANCHES_SERVICE_URL=https://tranches-devnet1-k8s.ops.vega.xyz \ No newline at end of file +NX_TRANCHES_SERVICE_URL=https://tranches-devnet1-k8s.ops.vega.xyz diff --git a/apps/governance/.env.mainnet b/apps/governance/.env.mainnet index 005fd0f45..4f23f934c 100644 --- a/apps/governance/.env.mainnet +++ b/apps/governance/.env.mainnet @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=MAINNET -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json +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","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 @@ -10,4 +10,4 @@ NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40:87edc2605e544f888305d7fc4a9141bd@o286262.ingest.sentry.io/5882996 NX_DELEGATIONS_PAGINATION=50 -NX_TRANCHES_SERVICE_URL=https://tranches-mainnet-k8s.ops.vega.xyz \ No newline at end of file +NX_TRANCHES_SERVICE_URL=https://tranches-mainnet-k8s.ops.vega.xyz diff --git a/apps/governance/.env.mirror b/apps/governance/.env.mirror index 2013c4ec4..b19e33cb4 100644 --- a/apps/governance/.env.mirror +++ b/apps/governance/.env.mirror @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=MIRROR -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mirror-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/mainnet-mirror/vegawallet-mainnet-mirror.toml NX_VEGA_URL=https://api.n00.mainnet-mirror.vega.xyz/graphql 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 diff --git a/apps/governance/.env.sandbox b/apps/governance/.env.sandbox index 47298aeb8..375c40dd8 100644 --- a/apps/governance/.env.sandbox +++ b/apps/governance/.env.sandbox @@ -2,7 +2,7 @@ NX_VEGA_URL=https://api.sandbox.vega.xyz/graphql NX_VEGA_ENV=SANDBOX 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://static.vega.xyz/assets/sandbox-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/sandbox/vegawallet-sandbox.toml NX_VEGA_EXPLORER_URL=https://sandbox.explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_DELEGATIONS_PAGINATION=50 diff --git a/apps/governance/.env.stagnet1 b/apps/governance/.env.stagnet1 index 77ca95fa8..02f8dead9 100644 --- a/apps/governance/.env.stagnet1 +++ b/apps/governance/.env.stagnet1 @@ -2,8 +2,8 @@ NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql NX_VEGA_ENV=STAGNET1 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://static.vega.xyz/assets/stagnet1-network.json +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 NX_DELEGATIONS_PAGINATION=50 -NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz \ No newline at end of file +NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz diff --git a/apps/governance/.env.stagnet3 b/apps/governance/.env.stagnet3 index 49cec2fc8..900fdf20b 100644 --- a/apps/governance/.env.stagnet3 +++ b/apps/governance/.env.stagnet3 @@ -2,9 +2,9 @@ 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://static.vega.xyz/assets/stagnet3-network.json +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 \ No newline at end of file +NX_TRANCHES_SERVICE_URL=https://tranches-stagnet3-k8s.ops.vega.xyz diff --git a/apps/governance/.env.testnet b/apps/governance/.env.testnet index 84823e8a2..aca146870 100644 --- a/apps/governance/.env.testnet +++ b/apps/governance/.env.testnet @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=TESTNET -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml NX_VEGA_URL=https://api.n08.testnet.vega.xyz/graphql 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 @@ -10,4 +10,4 @@ NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf 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-testnet-k8s.ops.vega.xyz \ No newline at end of file +NX_TRANCHES_SERVICE_URL=https://tranches-testnet-k8s.ops.vega.xyz diff --git a/apps/governance/.env.validator-testnet b/apps/governance/.env.validator-testnet index fef01803c..72e0cf24d 100644 --- a/apps/governance/.env.validator-testnet +++ b/apps/governance/.env.validator-testnet @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=VALIDATOR_TESTNET -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/validator-testnet-network.json +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.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"}' diff --git a/apps/liquidity-provision-dashboard/.env b/apps/liquidity-provision-dashboard/.env index 24965cf0a..6573e8bbc 100644 --- a/apps/liquidity-provision-dashboard/.env +++ b/apps/liquidity-provision-dashboard/.env @@ -17,7 +17,7 @@ NX_INCOMING_HOOK_BODY=$INCOMING_HOOK_BODY NX_URL=$URL NX_DEPLOY_URL=$DEPLOY_URL NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL -NX_VEGA_CONFIG_URL="https://static.vega.xyz/assets/testnet-network.json" +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml NX_VEGA_ENV = 'TESTNET' NX_VEGA_URL="https://api.n11.testnet.vega.xyz/graphql" NX_VEGA_WALLET_URL=http://localhost:1789 diff --git a/apps/liquidity-provision-dashboard/.env.devnet b/apps/liquidity-provision-dashboard/.env.devnet index e45e00c9f..5afd02920 100644 --- a/apps/liquidity-provision-dashboard/.env.devnet +++ b/apps/liquidity-provision-dashboard/.env.devnet @@ -1,8 +1,8 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json +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\",\"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 \ No newline at end of file +NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz diff --git a/apps/liquidity-provision-dashboard/.env.mainnet b/apps/liquidity-provision-dashboard/.env.mainnet index f04c69cf0..c3d30ae52 100644 --- a/apps/liquidity-provision-dashboard/.env.mainnet +++ b/apps/liquidity-provision-dashboard/.env.mainnet @@ -1,5 +1,5 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml NX_VEGA_URL=https://api.vega.xyz/query NX_VEGA_ENV=MAINNET NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"} diff --git a/apps/liquidity-provision-dashboard/.env.stagnet1 b/apps/liquidity-provision-dashboard/.env.stagnet1 index d4a51d22b..bb7a88eb9 100644 --- a/apps/liquidity-provision-dashboard/.env.stagnet1 +++ b/apps/liquidity-provision-dashboard/.env.stagnet1 @@ -1,5 +1,5 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json +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=STAGNET1 NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 diff --git a/apps/liquidity-provision-dashboard/.env.stagnet3 b/apps/liquidity-provision-dashboard/.env.stagnet3 index f5918216d..27e58cd05 100644 --- a/apps/liquidity-provision-dashboard/.env.stagnet3 +++ b/apps/liquidity-provision-dashboard/.env.stagnet3 @@ -1,8 +1,8 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +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\"} \ No newline at end of file +NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"} diff --git a/apps/liquidity-provision-dashboard/.env.testnet b/apps/liquidity-provision-dashboard/.env.testnet index 89abc1ec3..fded68ffa 100644 --- a/apps/liquidity-provision-dashboard/.env.testnet +++ b/apps/liquidity-provision-dashboard/.env.testnet @@ -1,5 +1,5 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql NX_VEGA_ENV=TESTNET NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"} diff --git a/apps/multisig-signer/.env b/apps/multisig-signer/.env index ddb4546bd..11619d228 100644 --- a/apps/multisig-signer/.env +++ b/apps/multisig-signer/.env @@ -1,5 +1,5 @@ NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +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=STAGNET3 diff --git a/apps/multisig-signer/.env.devnet b/apps/multisig-signer/.env.devnet index 4155154bf..83e563ab3 100644 --- a/apps/multisig-signer/.env.devnet +++ b/apps/multisig-signer/.env.devnet @@ -1,5 +1,5 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json +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_NETWORKS='{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}' NX_VEGA_ENV=DEVNET diff --git a/apps/multisig-signer/.env.mainnet b/apps/multisig-signer/.env.mainnet index 59c595f17..7b7c76d24 100644 --- a/apps/multisig-signer/.env.mainnet +++ b/apps/multisig-signer/.env.mainnet @@ -1,5 +1,5 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json +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='{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}' NX_VEGA_ENV=MAINNET diff --git a/apps/multisig-signer/.env.sandbox b/apps/multisig-signer/.env.sandbox index baa7a9415..09c51a52b 100644 --- a/apps/multisig-signer/.env.sandbox +++ b/apps/multisig-signer/.env.sandbox @@ -1,5 +1,5 @@ -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/sandbox-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/sandbox/vegawallet-sandbox.toml NX_VEGA_URL=https://api.sandbox.vega.xyz/graphql NX_VEGA_ENV=SANDBOX 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://static.vega.xyz/assets/sandbox-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/sandbox/vegawallet-sandbox.toml diff --git a/apps/multisig-signer/.env.stagnet3 b/apps/multisig-signer/.env.stagnet3 index 93045d219..c044d7f1d 100644 --- a/apps/multisig-signer/.env.stagnet3 +++ b/apps/multisig-signer/.env.stagnet3 @@ -1,5 +1,5 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +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 diff --git a/apps/multisig-signer/.env.testnet b/apps/multisig-signer/.env.testnet index ae63ae5af..de6b3a29f 100644 --- a/apps/multisig-signer/.env.testnet +++ b/apps/multisig-signer/.env.testnet @@ -1,5 +1,5 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml NX_VEGA_URL=https://api.n09.testnet.vega.xyz/graphql NX_VEGA_NETWORKS='{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}' NX_VEGA_ENV=TESTNET diff --git a/apps/multisig-signer/.env.validator-testnet b/apps/multisig-signer/.env.validator-testnet index 238965336..203a40d64 100644 --- a/apps/multisig-signer/.env.validator-testnet +++ b/apps/multisig-signer/.env.validator-testnet @@ -1,5 +1,5 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/validator-testnet-network.json +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_NETWORKS='{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}' NX_VEGA_ENV=VALIDATOR_TESTNET diff --git a/apps/trading-e2e/.env.stagnet3 b/apps/trading-e2e/.env.stagnet3 index 0d5c911b6..886447ead 100644 --- a/apps/trading-e2e/.env.stagnet3 +++ b/apps/trading-e2e/.env.stagnet3 @@ -1,7 +1,7 @@ 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://static.vega.xyz/assets/stagnet3-network.json +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 diff --git a/apps/trading/.env b/apps/trading/.env index ace275e46..aac3932ec 100644 --- a/apps/trading/.env +++ b/apps/trading/.env @@ -1,7 +1,7 @@ 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://static.vega.xyz/assets/stagnet3-network.json +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\"} diff --git a/apps/trading/.env.devnet b/apps/trading/.env.devnet index 5e5ed1071..d6d453fbe 100644 --- a/apps/trading/.env.devnet +++ b/apps/trading/.env.devnet @@ -1,7 +1,7 @@ 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://static.vega.xyz/assets/devnet-network.json +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\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"} diff --git a/apps/trading/.env.mainnet b/apps/trading/.env.mainnet index 452ba2b82..2d6769a8d 100644 --- a/apps/trading/.env.mainnet +++ b/apps/trading/.env.mainnet @@ -1,6 +1,6 @@ NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://etherscan.io -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json +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\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"} diff --git a/apps/trading/.env.mirror b/apps/trading/.env.mirror index aac76148e..ab8d0bc47 100644 --- a/apps/trading/.env.mirror +++ b/apps/trading/.env.mirror @@ -1,7 +1,7 @@ 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://static.vega.xyz/assets/mirror-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/mainnet-mirror/vegawallet-mainnet-mirror.toml NX_VEGA_ENV=MIRROR NX_VEGA_EXPLORER_URL=https://mainnet-mirror.explorer.vega.xyz NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"} diff --git a/apps/trading/.env.sandbox b/apps/trading/.env.sandbox index e175f464e..51d102e8d 100644 --- a/apps/trading/.env.sandbox +++ b/apps/trading/.env.sandbox @@ -1,10 +1,9 @@ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_HOSTED_WALLET_URL=https://wallet.sandbox.vega.xyz -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/sandbox-network.json +NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/sandbox/vegawallet-sandbox.toml NX_VEGA_ENV=SANDBOX 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://static.vega.xyz/assets/sandbox-network.json NX_VEGA_EXPLORER_URL=https://sandbox.explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases diff --git a/apps/trading/.env.stagnet1 b/apps/trading/.env.stagnet1 index 37ddfbb13..8ba1958a8 100644 --- a/apps/trading/.env.stagnet1 +++ b/apps/trading/.env.stagnet1 @@ -1,7 +1,7 @@ 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://static.vega.xyz/assets/stagnet1-network.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\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"} diff --git a/apps/trading/.env.stagnet3 b/apps/trading/.env.stagnet3 index 416664690..4fa62908e 100644 --- a/apps/trading/.env.stagnet3 +++ b/apps/trading/.env.stagnet3 @@ -1,7 +1,7 @@ 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://static.vega.xyz/assets/stagnet3-network.json +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\"} diff --git a/apps/trading/.env.testnet b/apps/trading/.env.testnet index d347286d1..65dd44bc4 100644 --- a/apps/trading/.env.testnet +++ b/apps/trading/.env.testnet @@ -1,7 +1,7 @@ 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://static.vega.xyz/assets/testnet-network.json +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\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"} diff --git a/apps/trading/.env.validator-testnet b/apps/trading/.env.validator-testnet index 0cdb1fd8d..d8bf44b47 100644 --- a/apps/trading/.env.validator-testnet +++ b/apps/trading/.env.validator-testnet @@ -1,7 +1,7 @@ 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://static.vega.xyz/assets/validator-testnet-network.json +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={\"STAGNET3\":\"https://stagnet3.console.vega.xyz\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"} diff --git a/libs/environment/src/hooks/use-environment.spec.ts b/libs/environment/src/hooks/use-environment.spec.ts index efbd26a62..d4b793e7c 100644 --- a/libs/environment/src/hooks/use-environment.spec.ts +++ b/libs/environment/src/hooks/use-environment.spec.ts @@ -36,11 +36,16 @@ const createDefaultMockClient = () => { global.fetch = jest.fn(); // eslint-disable-next-line -const setupFetch = (result: any) => { +const setupFetch = ({ hosts }: any) => { + const result = ` + [API] + [API.GraphQL] + Hosts = ${JSON.stringify(hosts)} + `; return () => { return Promise.resolve({ ok: true, - json: () => Promise.resolve(result), + text: () => Promise.resolve(result), }); }; }; @@ -102,7 +107,7 @@ describe('useEnvironment', () => { }; it('exposes env vars and sets VEGA_URL from config nodes', async () => { - const configUrl = 'https://vega.xyz/testnet-config.json'; + const configUrl = 'https://vega.xyz/testnet-config.toml'; process.env['NX_VEGA_CONFIG_URL'] = configUrl; const nodes = [ 'https://api.n00.foo.vega.xyz', @@ -137,7 +142,7 @@ describe('useEnvironment', () => { it('uses the first successfully responding node', async () => { jest.useFakeTimers(); - const configUrl = 'https://vega.xyz/testnet-config.json'; + const configUrl = 'https://vega.xyz/testnet-config.toml'; process.env['NX_VEGA_CONFIG_URL'] = configUrl; const slowNode = 'https://api.n00.foo.vega.xyz'; @@ -204,7 +209,7 @@ describe('useEnvironment', () => { }); it('passes a node if both queries and subscriptions working', async () => { - const configUrl = 'https://vega.xyz/testnet-config.json'; + const configUrl = 'https://vega.xyz/testnet-config.toml'; process.env['NX_VEGA_CONFIG_URL'] = configUrl; const successNode = 'https://api.n01.foo.vega.xyz'; const failNode = 'https://api.n00.foo.vega.xyz'; @@ -254,7 +259,7 @@ describe('useEnvironment', () => { }); it('fails initialization if no suitable node is found', async () => { - const configUrl = 'https://vega.xyz/testnet-config.json'; + const configUrl = 'https://vega.xyz/testnet-config.toml'; process.env['NX_VEGA_CONFIG_URL'] = configUrl; const nodes = [ 'https://api.n00.foo.vega.xyz', @@ -345,7 +350,7 @@ describe('useEnvironment', () => { }); it('allows for undefined VEGA_URL if VEGA_CONFIG_URL is set', async () => { - const configUrl = 'https://vega.xyz/testnet-config.json'; + const configUrl = 'https://vega.xyz/testnet-config.toml'; process.env['NX_VEGA_CONFIG_URL'] = configUrl; process.env['NX_VEGA_URL'] = undefined; const nodes = [ @@ -365,7 +370,7 @@ describe('useEnvironment', () => { }); it('handles error if node config cannot be fetched', async () => { - const configUrl = 'https://vega.xyz/testnet-config.json'; + const configUrl = 'https://vega.xyz/testnet-config.toml'; process.env['NX_VEGA_CONFIG_URL'] = configUrl; process.env['NX_VEGA_URL'] = undefined; // @ts-ignore setup mock fetch for config url @@ -385,7 +390,7 @@ describe('useEnvironment', () => { }); it('handles an invalid node config', async () => { - const configUrl = 'https://vega.xyz/testnet-config.json'; + const configUrl = 'https://vega.xyz/testnet-config.toml'; process.env['NX_VEGA_CONFIG_URL'] = configUrl; process.env['NX_VEGA_URL'] = undefined; // @ts-ignore: typscript doesn't recognise the mock implementation @@ -403,7 +408,7 @@ describe('useEnvironment', () => { }); it('uses stored url', async () => { - const configUrl = 'https://vega.xyz/testnet-config.json'; + const configUrl = 'https://vega.xyz/testnet-config.toml'; process.env['NX_VEGA_CONFIG_URL'] = configUrl; // @ts-ignore setup mock fetch for config url global.fetch.mockImplementation( diff --git a/libs/environment/src/hooks/use-environment.ts b/libs/environment/src/hooks/use-environment.ts index 1e60bdd51..aa3fc1b14 100644 --- a/libs/environment/src/hooks/use-environment.ts +++ b/libs/environment/src/hooks/use-environment.ts @@ -1,3 +1,4 @@ +import { parse as tomlParse } from 'toml'; import { isValidUrl, LocalStorage } from '@vegaprotocol/utils'; import { t } from '@vegaprotocol/i18n'; import { useEffect } from 'react'; @@ -13,7 +14,7 @@ import type { Environment } from '../types'; import { Networks } from '../types'; import { compileErrors } from '../utils/compile-errors'; import { envSchema } from '../utils/validate-environment'; -import { configSchema } from '../utils/validate-configuration'; +import { tomlConfigSchema } from '../utils/validate-configuration'; type Client = ReturnType; type ClientCollection = { @@ -159,9 +160,15 @@ export const useInitializeEnv = () => { const fetchConfig = async (url?: string) => { if (!url) return []; const res = await fetch(url); - const cfg = await res.json(); - const result = configSchema.parse(cfg); - return result.hosts; + const content = await res.text(); + const parsed = tomlParse(content); + const tomlResults = tomlConfigSchema.parse(parsed); + const { + API: { + GraphQL: { Hosts }, + }, + } = tomlResults; + return Hosts; }; /** diff --git a/libs/environment/src/types.ts b/libs/environment/src/types.ts index 333725c43..bfd4b78e3 100644 --- a/libs/environment/src/types.ts +++ b/libs/environment/src/types.ts @@ -1,5 +1,5 @@ import type z from 'zod'; -import type { configSchema } from './utils/validate-configuration'; +import type { tomlConfigSchema } from './utils/validate-configuration'; import type { envSchema } from './utils/validate-environment'; export enum Networks { @@ -14,5 +14,5 @@ export enum Networks { MIRROR = 'MIRROR', } export type Environment = z.infer; -export type Configuration = z.infer; +export type Configuration = z.infer; export const CUSTOM_NODE_KEY = 'custom' as const; diff --git a/libs/environment/src/utils/validate-configuration.ts b/libs/environment/src/utils/validate-configuration.ts index f3c202bd3..5f2605390 100644 --- a/libs/environment/src/utils/validate-configuration.ts +++ b/libs/environment/src/utils/validate-configuration.ts @@ -1,5 +1,5 @@ import z from 'zod'; -export const configSchema = z.object({ - hosts: z.array(z.string()), +export const tomlConfigSchema = z.object({ + API: z.object({ GraphQL: z.object({ Hosts: z.array(z.string()) }) }), }); diff --git a/package.json b/package.json index df7a411df..c83f00816 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "recharts": "^2.1.2", "recursive-key-filter": "^1.0.2", "regenerator-runtime": "0.13.7", + "toml": "^3.0.0", "tslib": "^2.0.0", "uuid": "^8.3.2", "web-vitals": "^2.1.4", diff --git a/yarn.lock b/yarn.lock index 67eeaefba..dfe9fe2bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21825,6 +21825,11 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== +toml@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee" + integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== + tough-cookie@^4.0.0: version "4.1.2" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.2.tgz#e53e84b85f24e0b65dd526f46628db6c85f6b874"