Feat/sandbox env (#1774)

* chore: add sandbox network json

* style: lint

* test: make tests environment agnostic
This commit is contained in:
Dexter Edwards 2022-10-19 13:36:16 +01:00 committed by GitHub
parent 9a56fc9b6f
commit 033ee14009
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,3 @@
{
"hosts": ["https://api.n01.sandbox.vega.xyz/graphql"]
}

View File

@ -0,0 +1 @@
[]

7
apps/token/.env.sandbox Normal file
View File

@ -0,0 +1,7 @@
# App configuration variables
NX_VEGA_URL=https://api.n01.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_EXPLORER_URL=https://sandbox.explorer.vega.xyz
NX_VEGA_DOCS_URL=https://docs.vega.xyz/docs/testnet

View File

@ -36,6 +36,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
},
SANDBOX: {
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

View File

@ -9,6 +9,7 @@ import { BigNumber } from '../lib/bignumber';
const TRANCHES_URLS: { [N in Networks]: string } = {
MAINNET: 'https://static.vega.xyz/assets/mainnet-tranches.json',
TESTNET: 'https://static.vega.xyz/assets/testnet-tranches.json',
SANDBOX: 'https://static.vega.xyz/assets/sandbox-tranches.json',
STAGNET1: 'https://static.vega.xyz/assets/stagnet1-tranches.json',
STAGNET3: 'https://static.vega.xyz/assets/stagnet3-tranches.json',
DEVNET: 'https://static.vega.xyz/assets/devnet-tranches.json',

View File

@ -13,6 +13,7 @@ import { Networks } from '../../types';
export const envNameMapping: Record<Networks, string> = {
[Networks.CUSTOM]: t('Custom'),
[Networks.DEVNET]: t('Devnet'),
[Networks.SANDBOX]: t('Sandbox'),
[Networks.STAGNET1]: t('Stagnet'),
[Networks.STAGNET3]: t('Stagnet3'),
[Networks.TESTNET]: t('Fairground testnet'),
@ -26,6 +27,7 @@ export const envTriggerMapping: Record<Networks, string> = {
export const envDescriptionMapping: Record<Networks, string> = {
[Networks.CUSTOM]: '',
[Networks.SANDBOX]: t('A playground test environment'),
[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'),

View File

@ -159,7 +159,9 @@ describe('throws error', () => {
});
expect(result).toThrow(
`Error processing the vega app environment:
- All keys in NX_VEGA_NETWORKS must represent a valid environment: CUSTOM | TESTNET | STAGNET1 | STAGNET3 | DEVNET | MAINNET`
- All keys in NX_VEGA_NETWORKS must represent a valid environment: ${Object.keys(
Networks
).join(' | ')}`
);
});
@ -183,7 +185,9 @@ describe('throws error', () => {
});
expect(result).toThrow(
`Error processing the vega app environment:
- NX_VEGA_ENV is invalid, received "undefined" instead of: 'CUSTOM' | 'TESTNET' | 'STAGNET1' | 'STAGNET3' | 'DEVNET' | 'MAINNET'`
- NX_VEGA_ENV is invalid, received "undefined" instead of: '${Object.keys(
Networks
).join("' | '")}'`
);
});
@ -195,7 +199,9 @@ describe('throws error', () => {
});
expect(result).not.toThrow(
`Error processing the vega app environment:
- NX_VEGA_ENV is invalid, received "SOMETHING" instead of: CUSTOM | TESTNET | STAGNET1 | STAGNET3 | DEVNET | MAINNET`
- NX_VEGA_ENV is invalid, received "SOMETHING" instead of: '${Object.keys(
Networks
).join("' | '")}'`
);
});
});

View File

@ -5,6 +5,7 @@ import { compileErrors } from './compile-errors';
export enum Networks {
CUSTOM = 'CUSTOM',
SANDBOX = 'SANDBOX',
TESTNET = 'TESTNET',
STAGNET1 = 'STAGNET1',
STAGNET3 = 'STAGNET3',