Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e2c51f7c0 | ||
|
|
67afff2baf |
@@ -71,8 +71,8 @@ function App() {
|
||||
)}
|
||||
>
|
||||
<div>
|
||||
<MainnetSimAd />
|
||||
<Header />
|
||||
<MainnetSimAd />
|
||||
</div>
|
||||
<div>
|
||||
<Main />
|
||||
|
||||
@@ -21,9 +21,9 @@ export function TemplateSidebar({ children, sidebar }: TemplateSidebarProps) {
|
||||
<>
|
||||
<AnnouncementBanner>
|
||||
<div className="font-alpha calt uppercase text-center text-lg text-white">
|
||||
<span className="pr-4">Wait no longer, SIM3 is here!</span>
|
||||
<ExternalLink href="https://fairground.wtf/sim3">
|
||||
Learn more
|
||||
<span className="pr-4">Mainnet sim 3 is live!</span>
|
||||
<ExternalLink href="https://fairground.wtf/">
|
||||
Come help stress test the network
|
||||
</ExternalLink>
|
||||
</div>
|
||||
</AnnouncementBanner>
|
||||
|
||||
@@ -5,7 +5,6 @@ import * as Schema from '@vegaprotocol/types';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
|
||||
import { Indicator } from '../indicator';
|
||||
import type { AuctionTrigger } from '@vegaprotocol/types';
|
||||
|
||||
export const Status = ({
|
||||
tradingMode,
|
||||
@@ -32,8 +31,7 @@ export const Status = ({
|
||||
};
|
||||
|
||||
const status = getStatus();
|
||||
const tooltipDescription =
|
||||
tradingMode && getTooltipDescription(tradingMode, trigger);
|
||||
const tooltipDescription = t(getTooltipDescription(status));
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -54,43 +52,24 @@ export const Status = ({
|
||||
);
|
||||
};
|
||||
|
||||
const getTooltipDescription = (
|
||||
status: Schema.MarketTradingMode,
|
||||
trigger?: Schema.AuctionTrigger
|
||||
) => {
|
||||
const getTooltipDescription = (status: string) => {
|
||||
let tooltipDescription = '';
|
||||
switch (status) {
|
||||
case Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS:
|
||||
return t(
|
||||
'This is the standard trading mode where trades are executed whenever orders are received'
|
||||
);
|
||||
case Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION:
|
||||
return getMonitoringDescriptionTooltip(trigger);
|
||||
case Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION:
|
||||
return t(
|
||||
'This is a new market in an opening auction to determine a fair mid-price before starting continuous trading.'
|
||||
);
|
||||
case Schema.MarketTradingModeMapping.TRADING_MODE_CONTINUOUS:
|
||||
tooltipDescription =
|
||||
'This is the standard trading mode where trades are executed whenever orders are received';
|
||||
break;
|
||||
case `${Schema.MarketTradingModeMapping.TRADING_MODE_MONITORING_AUCTION} - ${Schema.AuctionTriggerMapping.AUCTION_TRIGGER_LIQUIDITY}`:
|
||||
tooltipDescription =
|
||||
'This market is in auction until it reaches sufficient liquidity';
|
||||
break;
|
||||
case Schema.MarketTradingModeMapping.TRADING_MODE_OPENING_AUCTION:
|
||||
tooltipDescription =
|
||||
'This is a new market in an opening auction to determine a fair mid-price before starting continuous trading.';
|
||||
break;
|
||||
default:
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
const getMonitoringDescriptionTooltip = (trigger?: AuctionTrigger) => {
|
||||
switch (trigger) {
|
||||
case Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET:
|
||||
return t(
|
||||
`This market is in auction until it reaches sufficient liquidity.`
|
||||
);
|
||||
case Schema.AuctionTrigger.AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS:
|
||||
return t(
|
||||
`This market may have sufficient liquidity but there are not enough priced limit orders in the order book, which are required to deploy liquidity commitment pegged orders.`
|
||||
);
|
||||
case Schema.AuctionTrigger.AUCTION_TRIGGER_PRICE:
|
||||
return t(`This market is in auction due to high price volatility.`);
|
||||
case Schema.AuctionTrigger.AUCTION_TRIGGER_OPENING:
|
||||
return t(
|
||||
`This is a new market in an opening auction to determine a fair mid-price before starting continuous trading`
|
||||
);
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
return tooltipDescription;
|
||||
};
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"tranche_id": 54,
|
||||
"tranche_start": "2023-04-06T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-06T00:00:00.000Z",
|
||||
"total_added": "2427",
|
||||
"total_added": "2118",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "2427",
|
||||
"locked_amount": "2118",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "111",
|
||||
@@ -76,11 +76,6 @@
|
||||
"amount": "33",
|
||||
"user": "0x92A1e98C6f09970e45645Cbe57c6DcaF4547c8FE",
|
||||
"tx": "0x27cf29a5e602dfa51987ac99aa3bc05fbf042095f32d249b65429311405c10f5"
|
||||
},
|
||||
{
|
||||
"amount": "309",
|
||||
"user": "0xf9c6C5F942B94Db9dedC550956865cf99D743959",
|
||||
"tx": "0x8a0328460c26941859c8ce400e7b18d41701fd620535f757f17e4c1d2c930831"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
@@ -294,21 +289,6 @@
|
||||
"total_tokens": "33",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "33"
|
||||
},
|
||||
{
|
||||
"address": "0xf9c6C5F942B94Db9dedC550956865cf99D743959",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "309",
|
||||
"user": "0xf9c6C5F942B94Db9dedC550956865cf99D743959",
|
||||
"tranche_id": 54,
|
||||
"tx": "0x8a0328460c26941859c8ce400e7b18d41701fd620535f757f17e4c1d2c930831"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"total_tokens": "309",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "309"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -417,7 +397,7 @@
|
||||
"tranche_end": "2023-04-06T00:00:00.000Z",
|
||||
"total_added": "14099",
|
||||
"total_removed": "103.66810558436",
|
||||
"locked_amount": "6933.0716539725216677",
|
||||
"locked_amount": "7501.242824820788581",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "30",
|
||||
@@ -3170,7 +3150,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "86666.297",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "61317.9495991804308225853",
|
||||
"locked_amount": "61614.5761032707477280162",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "86666.297",
|
||||
@@ -3236,7 +3216,7 @@
|
||||
"tranche_end": "2023-06-01T00:00:00.000Z",
|
||||
"total_added": "2500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "978.62643722018725",
|
||||
"locked_amount": "995.78659188034185",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "2500",
|
||||
@@ -3357,7 +3337,7 @@
|
||||
"tranche_end": "2023-09-01T00:00:00.000Z",
|
||||
"total_added": "17500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "15525.924353361513",
|
||||
"locked_amount": "15644.7397720410615",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "12500",
|
||||
@@ -3624,7 +3604,7 @@
|
||||
"tranche_end": "2023-08-01T00:00:00.000Z",
|
||||
"total_added": "37500",
|
||||
"total_removed": "4168.8799683",
|
||||
"locked_amount": "27398.61974370779625",
|
||||
"locked_amount": "27657.44417587477125",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -3878,7 +3858,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "129999.45",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "61262.0046854914292089665",
|
||||
"locked_amount": "61558.360555219738687428",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129999.45",
|
||||
@@ -3944,7 +3924,7 @@
|
||||
"tranche_end": "2023-09-03T00:00:00.000Z",
|
||||
"total_added": "62600",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "28340.47860223236496",
|
||||
"locked_amount": "28554.73512176560218",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10000",
|
||||
@@ -4137,7 +4117,7 @@
|
||||
"tranche_end": "2023-09-17T00:00:00.000Z",
|
||||
"total_added": "5000",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "2455.3973236935567",
|
||||
"locked_amount": "2472.5104642313545",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "5000",
|
||||
@@ -4348,7 +4328,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "97499.58",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "3314.52140550582917584548",
|
||||
"locked_amount": "3605.2189069112998031292",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "97499.58",
|
||||
@@ -4381,7 +4361,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "135173.4239508",
|
||||
"total_removed": "98230.390980249184455396",
|
||||
"locked_amount": "4530.378533077848949654770624",
|
||||
"locked_amount": "4927.711830669167463838379676",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "135173.4239508",
|
||||
@@ -4427,7 +4407,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "32499.86",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "1394.3619165732359501624",
|
||||
"locked_amount": "1516.65333533718349853464",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "32499.86",
|
||||
@@ -4460,7 +4440,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "10833.29",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "453.8512732768242099508",
|
||||
"locked_amount": "493.6559433966499033786",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10833.29",
|
||||
@@ -4493,7 +4473,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "22749.93",
|
||||
"total_removed": "4720.860935375",
|
||||
"locked_amount": "1696.5974253599477214444",
|
||||
"locked_amount": "1845.3961724803675845138",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "6500",
|
||||
@@ -4645,7 +4625,7 @@
|
||||
"tranche_end": "2023-05-01T00:00:00.000Z",
|
||||
"total_added": "22500",
|
||||
"total_removed": "5705.915726625",
|
||||
"locked_amount": "5002.707757826888325",
|
||||
"locked_amount": "5158.00241712707175",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -5019,7 +4999,7 @@
|
||||
"tranche_end": "2023-06-02T00:00:00.000Z",
|
||||
"total_added": "1939928.38",
|
||||
"total_removed": "928642.9598472029154",
|
||||
"locked_amount": "383967.6571667668798158586",
|
||||
"locked_amount": "390607.3105668073434008876",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1852091.69",
|
||||
@@ -38580,7 +38560,7 @@
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "3732368.4671",
|
||||
"total_removed": "700133.348465855088393",
|
||||
"locked_amount": "614525.930455046054881246538",
|
||||
"locked_amount": "624728.766049120329868954865",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1998.95815",
|
||||
@@ -39961,8 +39941,8 @@
|
||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "15870102.715470999700000001",
|
||||
"total_removed": "808832.39946288360722952",
|
||||
"locked_amount": "7478757.07869852247549289379890489263071097",
|
||||
"total_removed": "807976.47753785751485452",
|
||||
"locked_amount": "7514935.67863045306513944505981554181184104",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "16249.93",
|
||||
@@ -40526,11 +40506,6 @@
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x84000963fb8b81484d7cd641b32217b055e5e519d362ae29a5c394a5d55b2039"
|
||||
},
|
||||
{
|
||||
"amount": "855.921925026092375",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0xae15931491edeaf05f0a40e050accbcada4fbe1e334eba29c6ab9695d52698f9"
|
||||
},
|
||||
{
|
||||
"amount": "827.191309560501875",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -42486,12 +42461,6 @@
|
||||
"tranche_id": 2,
|
||||
"tx": "0x84000963fb8b81484d7cd641b32217b055e5e519d362ae29a5c394a5d55b2039"
|
||||
},
|
||||
{
|
||||
"amount": "855.921925026092375",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0xae15931491edeaf05f0a40e050accbcada4fbe1e334eba29c6ab9695d52698f9"
|
||||
},
|
||||
{
|
||||
"amount": "827.191309560501875",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -43808,8 +43777,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "259998.8875",
|
||||
"withdrawn_tokens": "137376.419061122500875",
|
||||
"remaining_tokens": "122622.468438877499125"
|
||||
"withdrawn_tokens": "136520.4971360964085",
|
||||
"remaining_tokens": "123478.3903639035915"
|
||||
},
|
||||
{
|
||||
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
|
||||
@@ -46154,8 +46123,8 @@
|
||||
"tranche_start": "2021-11-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-05T00:00:00.000Z",
|
||||
"total_added": "14597706.0446472999",
|
||||
"total_removed": "5740540.888190674320549506",
|
||||
"locked_amount": "1182895.556449354387341987555426783",
|
||||
"total_removed": "5739280.046176576455435006",
|
||||
"locked_amount": "1216295.408903970030331419919234392",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129284.449",
|
||||
@@ -46399,11 +46368,6 @@
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0x47b32458e0da8ee3098f784bcf0c61c74de25f5e5cee1953ad1abfce96bfc9c3"
|
||||
},
|
||||
{
|
||||
"amount": "1260.8420140978651145",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0x213f51233a9a9a12c9881e020b75a31e215e2a81f6e6a7e4b7375a80dfc257af"
|
||||
},
|
||||
{
|
||||
"amount": "1147.2913244855584015",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
@@ -49526,12 +49490,6 @@
|
||||
"tranche_id": 3,
|
||||
"tx": "0x47b32458e0da8ee3098f784bcf0c61c74de25f5e5cee1953ad1abfce96bfc9c3"
|
||||
},
|
||||
{
|
||||
"amount": "1260.8420140978651145",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0x213f51233a9a9a12c9881e020b75a31e215e2a81f6e6a7e4b7375a80dfc257af"
|
||||
},
|
||||
{
|
||||
"amount": "1147.2913244855584015",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
@@ -52150,8 +52108,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "359123.469575",
|
||||
"withdrawn_tokens": "329886.488754609231952",
|
||||
"remaining_tokens": "29236.980820390768048"
|
||||
"withdrawn_tokens": "328625.6467405113668375",
|
||||
"remaining_tokens": "30497.8228344886331625"
|
||||
},
|
||||
{
|
||||
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
|
||||
@@ -53543,7 +53501,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "5778205.3912159303",
|
||||
"total_removed": "3381706.364737906998719578",
|
||||
"locked_amount": "150465.7849057231734728403341999979",
|
||||
"locked_amount": "163662.268611167760817574213190939",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "552496.6455",
|
||||
@@ -55670,8 +55628,8 @@
|
||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "472355.6199999996",
|
||||
"total_removed": "38333.9918862181949",
|
||||
"locked_amount": "97375.146460579560464573244241512",
|
||||
"total_removed": "38160.8304770401949",
|
||||
"locked_amount": "98991.844082355328981811201217648",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "3000",
|
||||
@@ -62355,16 +62313,6 @@
|
||||
"user": "0xDE11ed98FeDe5253d2352272292C72B5bD5A10c1",
|
||||
"tx": "0xb0e33a0a4f5b9fd30341e399361470089901580f1e8e2c2dd54f2bc272dffe4c"
|
||||
},
|
||||
{
|
||||
"amount": "15.02267884",
|
||||
"user": "0x4eD2b3c68BB4fda084ce1591a210F4aC8b71234A",
|
||||
"tx": "0x96b4489c1be11b1cca095af84ce8f0e1a90a8750cdf0f941da686fa2febfe402"
|
||||
},
|
||||
{
|
||||
"amount": "158.138730338",
|
||||
"user": "0x059564aD4400a54D8442d59746A89ac5B51bD502",
|
||||
"tx": "0xf906b4925d5b67c8e516612123d88ec03235d6edd91d7a380d595659851f2540"
|
||||
},
|
||||
{
|
||||
"amount": "129.867928716",
|
||||
"user": "0x09996E1a67c371400bD5f52DF841f77B1741eB9d",
|
||||
@@ -75668,17 +75616,10 @@
|
||||
"tx": "0x716a7be06da5a7a3d8038907974887a31805ea8eeab5d130cba528e4d2094d9f"
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "158.138730338",
|
||||
"user": "0x059564aD4400a54D8442d59746A89ac5B51bD502",
|
||||
"tranche_id": 5,
|
||||
"tx": "0xf906b4925d5b67c8e516612123d88ec03235d6edd91d7a380d595659851f2540"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"total_tokens": "200",
|
||||
"withdrawn_tokens": "158.138730338",
|
||||
"remaining_tokens": "41.861269662"
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "200"
|
||||
},
|
||||
{
|
||||
"address": "0x86a3b7ED5EA887Bd0262ED6C4d2AD17dB3301530",
|
||||
@@ -76106,12 +76047,6 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "15.02267884",
|
||||
"user": "0x4eD2b3c68BB4fda084ce1591a210F4aC8b71234A",
|
||||
"tranche_id": 5,
|
||||
"tx": "0x96b4489c1be11b1cca095af84ce8f0e1a90a8750cdf0f941da686fa2febfe402"
|
||||
},
|
||||
{
|
||||
"amount": "18.456316592",
|
||||
"user": "0x4eD2b3c68BB4fda084ce1591a210F4aC8b71234A",
|
||||
@@ -76204,8 +76139,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "400",
|
||||
"withdrawn_tokens": "316.228754436",
|
||||
"remaining_tokens": "83.771245564"
|
||||
"withdrawn_tokens": "301.206075596",
|
||||
"remaining_tokens": "98.793924404"
|
||||
},
|
||||
{
|
||||
"address": "0x5c90765F50629570738fEe7b7FA82ae118f81Ed1",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
NX_ETHEREUM_PROVIDER_URL=http://localhost:8545
|
||||
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=''
|
||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
||||
|
||||
@@ -75,8 +75,7 @@ describe('market info is displayed', { tags: '@smoke' }, () => {
|
||||
validateMarketDataRow(3, 'Quote Name', 'BTC');
|
||||
});
|
||||
|
||||
// need to check why data are not visible
|
||||
it.skip('settlement asset displayed', () => {
|
||||
it('settlement asset displayed', () => {
|
||||
cy.getByTestId(marketTitle).contains('Settlement asset').click();
|
||||
cy.window().then((win) => {
|
||||
cy.stub(win, 'prompt').returns('DISABLED WINDOW PROMPT');
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('Market proposal notification', { tags: '@smoke' }, () => {
|
||||
cy.mockTradingPage(
|
||||
Schema.MarketState.STATE_ACTIVE,
|
||||
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY
|
||||
);
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(
|
||||
@@ -62,7 +62,7 @@ describe('Market trading page', () => {
|
||||
cy.mockTradingPage(
|
||||
Schema.MarketState.STATE_ACTIVE,
|
||||
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY
|
||||
);
|
||||
cy.mockSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
@@ -148,7 +148,7 @@ describe('Market trading page', () => {
|
||||
cy.getByTestId(itemHeader).should('have.text', 'Trading mode');
|
||||
cy.getByTestId(itemValue).should(
|
||||
'have.text',
|
||||
'Monitoring auction - liquidity (target not met)'
|
||||
'Monitoring auction - liquidity'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('markets table', { tags: '@smoke' }, () => {
|
||||
cy.mockTradingPage(
|
||||
Schema.MarketState.STATE_ACTIVE,
|
||||
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY
|
||||
);
|
||||
cy.mockSubscription();
|
||||
cy.visit('/');
|
||||
|
||||
@@ -25,23 +25,6 @@ describe('Desktop view', { tags: '@smoke' }, () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Resources dropdown should be correctly rendered', () => {
|
||||
const resourceSelector = 'ul li:last-child';
|
||||
['Docs', 'Give Feedback'].forEach((text, index) => {
|
||||
cy.get('nav').find(resourceSelector).contains('Resources').click();
|
||||
cy.get('nav')
|
||||
.find(resourceSelector)
|
||||
.find('.navigation-content li')
|
||||
.eq(index)
|
||||
.find('a')
|
||||
.then((element) => {
|
||||
expect(element.attr('target')).to.eq('_blank');
|
||||
expect(element.attr('href')).to.not.be.empty;
|
||||
expect(element.text()).to.eq(text);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ describe(
|
||||
cy.mockTradingPage(
|
||||
Schema.MarketState.STATE_SUSPENDED,
|
||||
Schema.MarketTradingMode.TRADING_MODE_BATCH_AUCTION,
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY
|
||||
);
|
||||
cy.mockSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
@@ -230,7 +230,7 @@ describe(
|
||||
cy.mockTradingPage(
|
||||
Schema.MarketState.STATE_SUSPENDED,
|
||||
Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION,
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY
|
||||
);
|
||||
cy.mockSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
@@ -299,7 +299,7 @@ describe(
|
||||
cy.mockTradingPage(
|
||||
Schema.MarketState.STATE_SUSPENDED,
|
||||
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY
|
||||
);
|
||||
cy.mockSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
@@ -585,7 +585,7 @@ describe('suspended market validation', { tags: '@regression' }, () => {
|
||||
cy.mockTradingPage(
|
||||
Schema.MarketState.STATE_SUSPENDED,
|
||||
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY
|
||||
);
|
||||
const accounts = accountsQuery();
|
||||
cy.mockGQL((req) => {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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=''
|
||||
NX_VEGA_ENV=CUSTOM
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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/devnet1/vegawallet-devnet1.toml
|
||||
NX_VEGA_ENV=DEVNET
|
||||
@@ -10,4 +9,3 @@ 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_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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
|
||||
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
|
||||
@@ -9,4 +8,3 @@ NX_VEGA_TOKEN_URL=https://token.vega.xyz
|
||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet
|
||||
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
|
||||
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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/mainnet-mirror/vegawallet-mainnet-mirror.toml
|
||||
NX_VEGA_ENV=MIRROR
|
||||
@@ -10,4 +9,3 @@ NX_VEGA_TOKEN_URL=https://mainnet-mirror.token.vega.xyz
|
||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet
|
||||
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
|
||||
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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.sandbox.vega.xyz
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/sandbox/vegawallet-sandbox.toml
|
||||
NX_VEGA_ENV=SANDBOX
|
||||
@@ -8,4 +7,3 @@ NX_VEGA_NETWORKS={\"DEVNET\":\"https://dev.token.vega.xyz\",\"STAGNET3\":\"https
|
||||
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
|
||||
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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/stagnet1/vegawallet-stagnet1.toml
|
||||
NX_VEGA_ENV=STAGNET1
|
||||
@@ -10,4 +9,3 @@ 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
|
||||
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
|
||||
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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
|
||||
@@ -10,4 +9,3 @@ 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_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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/fairground/vegawallet-fairground.toml
|
||||
NX_VEGA_ENV=TESTNET
|
||||
@@ -10,4 +9,3 @@ 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/releases
|
||||
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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/master/testnet2/testnet2.toml
|
||||
NX_VEGA_ENV=VALIDATOR_TESTNET
|
||||
@@ -10,4 +9,4 @@ 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
|
||||
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ export const LiquidityViewContainer = ({
|
||||
<div className="break-word">{marketId}</div>
|
||||
</HeaderStat>
|
||||
</Header>
|
||||
<Tabs defaultValue={getActiveDefaultId()}>
|
||||
<Tabs active={getActiveDefaultId()}>
|
||||
<Tab
|
||||
id={LiquidityTabs.MyLiquidityProvision}
|
||||
name={t('My liquidity provision')}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { DepthChartContainer } from '@vegaprotocol/market-depth';
|
||||
import { CandlesChartContainer } from '@vegaprotocol/candles-chart';
|
||||
import {
|
||||
Tab,
|
||||
LocalStoragePersistTabs as Tabs,
|
||||
Tabs,
|
||||
ResizableGrid,
|
||||
ResizableGridPanel,
|
||||
Splash,
|
||||
@@ -96,7 +96,7 @@ const MarketBottomPanel = memo(
|
||||
minSize={50}
|
||||
>
|
||||
<TradeGridChild>
|
||||
<Tabs storageKey="console-trade-grid-orders">
|
||||
<Tabs>
|
||||
<Tab id="orders" name={t('Orders')}>
|
||||
<VegaWalletContainer>
|
||||
<TradingViews.Orders
|
||||
@@ -122,7 +122,7 @@ const MarketBottomPanel = memo(
|
||||
minSize={50}
|
||||
>
|
||||
<TradeGridChild>
|
||||
<Tabs storageKey="console-trade-grid-positions">
|
||||
<Tabs>
|
||||
<Tab id="positions" name={t('Positions')}>
|
||||
<VegaWalletContainer>
|
||||
<TradingViews.Positions
|
||||
@@ -146,7 +146,7 @@ const MarketBottomPanel = memo(
|
||||
</ResizableGrid>
|
||||
) : (
|
||||
<TradeGridChild>
|
||||
<Tabs storageKey="console-trade-grid-positions">
|
||||
<Tabs>
|
||||
<Tab id="positions" name={t('Positions')}>
|
||||
<VegaWalletContainer>
|
||||
<TradingViews.Positions onMarketClick={onMarketClick} />
|
||||
@@ -201,7 +201,7 @@ const MainGrid = memo(
|
||||
preferredSize="50%"
|
||||
>
|
||||
<TradeGridChild>
|
||||
<Tabs storageKey="console-trade-grid-chart">
|
||||
<Tabs>
|
||||
<Tab id="chart" name={t('Chart')}>
|
||||
<TradingViews.Candles marketId={marketId} />
|
||||
</Tab>
|
||||
@@ -220,7 +220,7 @@ const MainGrid = memo(
|
||||
minSize={300}
|
||||
>
|
||||
<TradeGridChild>
|
||||
<Tabs storageKey="console-trade-grid-ticket">
|
||||
<Tabs>
|
||||
<Tab id="ticket" name={t('Ticket')}>
|
||||
<TradingViews.Ticket
|
||||
marketId={marketId}
|
||||
@@ -244,7 +244,7 @@ const MainGrid = memo(
|
||||
minSize={200}
|
||||
>
|
||||
<TradeGridChild>
|
||||
<Tabs storageKey="console-trade-grid-orderbook">
|
||||
<Tabs>
|
||||
<Tab id="orderbook" name={t('Orderbook')}>
|
||||
<TradingViews.Orderbook marketId={marketId} />
|
||||
</Tab>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { titlefy } from '@vegaprotocol/utils';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { LocalStoragePersistTabs as Tabs, Tab } from '@vegaprotocol/ui-toolkit';
|
||||
import { Tabs, Tab } from '@vegaprotocol/ui-toolkit';
|
||||
import { Markets } from './markets';
|
||||
import { Proposed } from './proposed';
|
||||
import { usePageTitleStore } from '../../stores';
|
||||
@@ -14,7 +14,7 @@ export const MarketsPage = () => {
|
||||
updateTitle(titlefy(['Markets']));
|
||||
}, [updateTitle]);
|
||||
return (
|
||||
<Tabs storageKey="console-markets">
|
||||
<Tabs>
|
||||
<Tab id="all-markets" name={t('All markets')}>
|
||||
<Markets />
|
||||
</Tab>
|
||||
|
||||
@@ -2,11 +2,7 @@ import { titlefy } from '@vegaprotocol/utils';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { PositionsContainer } from '@vegaprotocol/positions';
|
||||
import { OrderListContainer } from '@vegaprotocol/orders';
|
||||
import {
|
||||
ResizableGridPanel,
|
||||
Tab,
|
||||
LocalStoragePersistTabs as Tabs,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { ResizableGridPanel, Tab, Tabs } from '@vegaprotocol/ui-toolkit';
|
||||
import { WithdrawalsContainer } from './withdrawals-container';
|
||||
import { FillsContainer } from '@vegaprotocol/fills';
|
||||
import type { ReactNode } from 'react';
|
||||
@@ -45,7 +41,7 @@ export const Portfolio = () => {
|
||||
<ResizableGrid vertical>
|
||||
<ResizableGridPanel minSize={75}>
|
||||
<PortfolioGridChild>
|
||||
<Tabs storageKey="console-portfolio-account-history">
|
||||
<Tabs>
|
||||
<Tab id="account-history" name={t('Account history')}>
|
||||
<VegaWalletContainer>
|
||||
<AccountHistoryContainer />
|
||||
@@ -83,7 +79,7 @@ export const Portfolio = () => {
|
||||
minSize={50}
|
||||
>
|
||||
<PortfolioGridChild>
|
||||
<Tabs storageKey="console-portfolio-collateral">
|
||||
<Tabs>
|
||||
<Tab id="collateral" name={t('Collateral')}>
|
||||
<VegaWalletContainer>
|
||||
<AccountsContainer />
|
||||
|
||||
@@ -6,10 +6,9 @@ import { Intent } from '@vegaprotocol/ui-toolkit';
|
||||
|
||||
jest.mock('@vegaprotocol/environment', () => ({
|
||||
...jest.requireActual('@vegaprotocol/environment'),
|
||||
useEnvironment: jest.fn().mockImplementation(() => ({
|
||||
VEGA_URL: 'https://vega-url.wtf',
|
||||
VEGA_INCIDENT_URL: 'https://blog.vega.community',
|
||||
})),
|
||||
useEnvironment: jest
|
||||
.fn()
|
||||
.mockImplementation(() => ({ VEGA_URL: 'https://vega-url.wtf' })),
|
||||
}));
|
||||
|
||||
const mockSetNodeSwitcher = jest.fn();
|
||||
@@ -27,13 +26,6 @@ describe('NodeHealth', () => {
|
||||
await userEvent.click(screen.getByRole('button'));
|
||||
expect(mockSetNodeSwitcher).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('External link to blog should be present', () => {
|
||||
render(<NodeHealth />, { wrapper: MockedProvider });
|
||||
expect(
|
||||
screen.getByRole('link', { name: /^Mainnet status & incidents/ })
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('NodeUrl', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useCallback } from 'react';
|
||||
import { useEnvironment, useNodeHealth } from '@vegaprotocol/environment';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import type { Intent } from '@vegaprotocol/ui-toolkit';
|
||||
import { Indicator, ExternalLink } from '@vegaprotocol/ui-toolkit';
|
||||
import { Indicator } from '@vegaprotocol/ui-toolkit';
|
||||
import classNames from 'classnames';
|
||||
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
||||
import { useGlobalStore } from '../../stores';
|
||||
@@ -19,7 +19,7 @@ export const Footer = () => {
|
||||
};
|
||||
|
||||
export const NodeHealth = () => {
|
||||
const { VEGA_URL, VEGA_INCIDENT_URL } = useEnvironment();
|
||||
const { VEGA_URL } = useEnvironment();
|
||||
const setNodeSwitcher = useGlobalStore(
|
||||
(store) => (open: boolean) => store.update({ nodeSwitcherDialog: open })
|
||||
);
|
||||
@@ -27,36 +27,19 @@ export const NodeHealth = () => {
|
||||
const onClick = useCallback(() => {
|
||||
setNodeSwitcher(true);
|
||||
}, [setNodeSwitcher]);
|
||||
const incidentsLink = VEGA_INCIDENT_URL && (
|
||||
<ExternalLink className="ml-1" href={VEGA_INCIDENT_URL}>
|
||||
{t('Mainnet status & incidents')}
|
||||
</ExternalLink>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
{VEGA_URL && (
|
||||
<FooterButton onClick={onClick} data-testid="node-health">
|
||||
<FooterButtonPart>
|
||||
<HealthIndicator text={text} intent={intent} />
|
||||
</FooterButtonPart>
|
||||
<FooterButtonPart>
|
||||
<NodeUrl url={VEGA_URL} />
|
||||
</FooterButtonPart>
|
||||
{/* create a monospace effect - avoiding jumps of width */}
|
||||
<FooterButtonPart
|
||||
width={`${
|
||||
datanodeBlockHeight
|
||||
? String(datanodeBlockHeight).length + 'ch'
|
||||
: 'auto'
|
||||
}`}
|
||||
>
|
||||
<span title={t('Block height')}>{datanodeBlockHeight}</span>
|
||||
</FooterButtonPart>
|
||||
</FooterButton>
|
||||
)}
|
||||
{incidentsLink}
|
||||
</>
|
||||
);
|
||||
return VEGA_URL ? (
|
||||
<FooterButton onClick={onClick} data-testid="node-health">
|
||||
<FooterButtonPart>
|
||||
<HealthIndicator text={text} intent={intent} />
|
||||
</FooterButtonPart>
|
||||
<FooterButtonPart>
|
||||
<NodeUrl url={VEGA_URL} />
|
||||
</FooterButtonPart>
|
||||
<FooterButtonPart>
|
||||
<span title={t('Block height')}>{datanodeBlockHeight}</span>
|
||||
</FooterButtonPart>
|
||||
</FooterButton>
|
||||
) : null;
|
||||
};
|
||||
|
||||
interface NodeUrlProps {
|
||||
@@ -95,16 +78,9 @@ const FooterButton = (props: FooterButtonProps) => {
|
||||
return <button {...props} className={buttonClasses} />;
|
||||
};
|
||||
|
||||
const FooterButtonPart = ({
|
||||
width = 'auto',
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
width?: string;
|
||||
}) => {
|
||||
const FooterButtonPart = ({ children }: { children: ReactNode }) => {
|
||||
return (
|
||||
<span
|
||||
style={{ width }}
|
||||
className={classNames(
|
||||
'relative inline-block mr-2 last:mr-0 pr-2 last:pr-0',
|
||||
'last:after:hidden',
|
||||
|
||||
@@ -93,8 +93,7 @@ export const MarketLiquiditySupplied = ({
|
||||
percentage.gte(100) &&
|
||||
market?.marketTradingMode ===
|
||||
MarketTradingMode.TRADING_MODE_MONITORING_AUCTION &&
|
||||
market.trigger ===
|
||||
AuctionTrigger.AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS;
|
||||
market.trigger === AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY;
|
||||
|
||||
const description = marketId ? (
|
||||
<section>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import type { ComponentProps, ReactNode } from 'react';
|
||||
import type { ComponentProps } from 'react';
|
||||
import {
|
||||
DApp,
|
||||
NetworkSwitcher,
|
||||
TOKEN_GOVERNANCE,
|
||||
useEnvironment,
|
||||
useLinks,
|
||||
} from '@vegaprotocol/environment';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
@@ -18,8 +17,6 @@ import {
|
||||
ExternalLink,
|
||||
Icon,
|
||||
NavigationBreakpoint,
|
||||
NavigationTrigger,
|
||||
NavigationContent,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
|
||||
import { Links, Routes } from '../../pages/client-router';
|
||||
@@ -29,7 +26,6 @@ export const Navbar = ({
|
||||
}: {
|
||||
theme: ComponentProps<typeof Navigation>['theme'];
|
||||
}) => {
|
||||
const { VEGA_DOCS_URL, GITHUB_FEEDBACK_URL } = useEnvironment();
|
||||
const tokenLink = useLinks(DApp.Token);
|
||||
const { marketId } = useGlobalStore((store) => ({
|
||||
marketId: store.marketId,
|
||||
@@ -79,29 +75,13 @@ export const Navbar = ({
|
||||
</NavigationLink>
|
||||
</NavigationItem>
|
||||
<NavigationItem>
|
||||
<NavExternalLink href={tokenLink(TOKEN_GOVERNANCE)}>
|
||||
{t('Governance')}
|
||||
</NavExternalLink>
|
||||
<ExternalLink href={tokenLink(TOKEN_GOVERNANCE)}>
|
||||
<span className="flex items-center gap-2">
|
||||
<span>{t('Governance')}</span>{' '}
|
||||
<Icon name="arrow-top-right" size={3} />
|
||||
</span>
|
||||
</ExternalLink>
|
||||
</NavigationItem>
|
||||
{VEGA_DOCS_URL && GITHUB_FEEDBACK_URL && (
|
||||
<NavigationItem>
|
||||
<NavigationTrigger>{t('Resources')}</NavigationTrigger>
|
||||
<NavigationContent>
|
||||
<NavigationList>
|
||||
<NavigationItem>
|
||||
<NavExternalLink href={VEGA_DOCS_URL}>
|
||||
{t('Docs')}
|
||||
</NavExternalLink>
|
||||
</NavigationItem>
|
||||
<NavigationItem>
|
||||
<NavExternalLink href={GITHUB_FEEDBACK_URL}>
|
||||
{t('Give Feedback')}
|
||||
</NavExternalLink>
|
||||
</NavigationItem>
|
||||
</NavigationList>
|
||||
</NavigationContent>
|
||||
</NavigationItem>
|
||||
)}
|
||||
</NavigationList>
|
||||
<NavigationList
|
||||
className="[.drawer-content_&]:border-t [.drawer-content_&]:border-t-vega-light-200 dark:[.drawer-content_&]:border-t-vega-dark-200 [.drawer-content_&]:pt-8 [.drawer-content_&]:mt-4"
|
||||
@@ -118,20 +98,3 @@ export const Navbar = ({
|
||||
</Navigation>
|
||||
);
|
||||
};
|
||||
|
||||
const NavExternalLink = ({
|
||||
children,
|
||||
href,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
href: string;
|
||||
}) => {
|
||||
return (
|
||||
<ExternalLink href={href}>
|
||||
<span className="flex items-center gap-2">
|
||||
<span>{children}</span>
|
||||
<Icon name="arrow-top-right" size={3} />
|
||||
</span>
|
||||
</ExternalLink>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -30,12 +30,9 @@ export const compileGridData = (
|
||||
): { label: ReactNode; value?: ReactNode }[] => {
|
||||
const grid: SimpleGridProps['grid'] = [];
|
||||
const isLiquidityMonitoringAuction =
|
||||
(marketData?.marketTradingMode ===
|
||||
marketData?.marketTradingMode ===
|
||||
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION &&
|
||||
marketData?.trigger ===
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET) ||
|
||||
marketData?.trigger ===
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS;
|
||||
marketData?.trigger === Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY;
|
||||
|
||||
const formatStake = (value: string) => {
|
||||
const formattedValue = addDecimalsFormatNumber(
|
||||
|
||||
@@ -9,6 +9,7 @@ import * as Schema from '@vegaprotocol/types';
|
||||
import { ExternalLink, SimpleGrid } from '@vegaprotocol/ui-toolkit';
|
||||
import { compileGridData } from './compile-grid-data';
|
||||
import { useMarket, useStaticMarketData } from '@vegaprotocol/market-list';
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
type TradingModeTooltipProps = {
|
||||
marketId?: string;
|
||||
@@ -114,39 +115,23 @@ export const TradingModeTooltip = ({
|
||||
}
|
||||
case Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION: {
|
||||
switch (trigger) {
|
||||
case Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET: {
|
||||
case Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY: {
|
||||
const notEnoughLiquidity = new BigNumber(
|
||||
marketData.suppliedStake || 0
|
||||
).isLessThan(marketData.targetStake || 0);
|
||||
return (
|
||||
<section data-testid="trading-mode-tooltip">
|
||||
<p className={classNames({ 'mb-4': Boolean(compiledGrid) })}>
|
||||
<span className="mb-2">
|
||||
{t(
|
||||
'This market is in auction until it reaches sufficient liquidity.'
|
||||
)}
|
||||
</span>
|
||||
{VEGA_DOCS_URL && (
|
||||
<ExternalLink
|
||||
href={
|
||||
createDocsLinks(VEGA_DOCS_URL)
|
||||
.AUCTION_TYPE_LIQUIDITY_MONITORING
|
||||
}
|
||||
>
|
||||
{t('Find out more')}
|
||||
</ExternalLink>
|
||||
)}
|
||||
</p>
|
||||
{compiledGrid && <SimpleGrid grid={compiledGrid} />}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
case Schema.AuctionTrigger.AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS: {
|
||||
return (
|
||||
<section data-testid="trading-mode-tooltip">
|
||||
<p className={classNames({ 'mb-4': Boolean(compiledGrid) })}>
|
||||
<span className="mb-2">
|
||||
{t(
|
||||
'This market may have sufficient liquidity but there are not enough priced limit orders in the order book, which are required to deploy liquidity commitment pegged orders.'
|
||||
)}
|
||||
</span>
|
||||
{notEnoughLiquidity &&
|
||||
t(
|
||||
'This market is in auction until it reaches sufficient liquidity.'
|
||||
)}
|
||||
{!notEnoughLiquidity &&
|
||||
t(
|
||||
'This market may have sufficient liquidity but there are not enough priced limit orders in the order book, which are required to deploy liquidity commitment pegged orders.'
|
||||
)}
|
||||
</span>{' '}
|
||||
{VEGA_DOCS_URL && (
|
||||
<ExternalLink
|
||||
href={
|
||||
|
||||
@@ -13,10 +13,7 @@ export const validateTimeInForce = (
|
||||
const isPriceTrigger =
|
||||
trigger === Schema.AuctionTrigger.AUCTION_TRIGGER_PRICE;
|
||||
const isLiquidityTrigger =
|
||||
trigger ===
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET ||
|
||||
trigger ===
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS;
|
||||
trigger === Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY;
|
||||
|
||||
if (isMarketInAuction(marketTradingMode)) {
|
||||
if (
|
||||
|
||||
@@ -17,10 +17,7 @@ export const validateType = (
|
||||
const isPriceTrigger =
|
||||
trigger === Schema.AuctionTrigger.AUCTION_TRIGGER_PRICE;
|
||||
const isLiquidityTrigger =
|
||||
trigger ===
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET ||
|
||||
trigger ===
|
||||
Schema.AuctionTrigger.AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS;
|
||||
trigger === Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY;
|
||||
|
||||
if (isMonitoringAuction && isPriceTrigger) {
|
||||
return MarketModeValidationType.PriceMonitoringAuction;
|
||||
|
||||
@@ -285,7 +285,6 @@ function compileEnvVars() {
|
||||
GIT_BRANCH: process.env['GIT_COMMIT_BRANCH'],
|
||||
GIT_COMMIT_HASH: process.env['GIT_COMMIT_HASH'],
|
||||
GIT_ORIGIN_URL: process.env['GIT_ORIGIN_URL'],
|
||||
VEGA_INCIDENT_URL: process.env['NX_VEGA_INCIDENT_URL'],
|
||||
};
|
||||
|
||||
return env;
|
||||
|
||||
@@ -50,7 +50,6 @@ const schemaObject = {
|
||||
MAINTENANCE_PAGE: z.optional(z.boolean()),
|
||||
ETH_LOCAL_PROVIDER_URL: z.optional(z.string()),
|
||||
ETH_WALLET_MNEMONIC: z.optional(z.string()),
|
||||
VEGA_INCIDENT_URL: z.optional(z.string()),
|
||||
};
|
||||
|
||||
// combine schema above with custom rule to ensure either
|
||||
|
||||
@@ -74,7 +74,7 @@ describe('updateLevels', () => {
|
||||
|
||||
const updates = [{ price: '132', volume: '200' }];
|
||||
|
||||
expect(updateLevels(priceLevels, updates, 2, 0, false)).toEqual([
|
||||
expect(updateLevels(priceLevels, updates, 2, 0, true)).toEqual([
|
||||
{ price: 1.35, volume: 200 },
|
||||
{ price: 1.32, volume: 200 },
|
||||
{ price: 1.28, volume: 100 },
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { addDecimal } from '@vegaprotocol/utils';
|
||||
import uniqBy from 'lodash/uniqBy';
|
||||
import reverse from 'lodash/reverse';
|
||||
|
||||
interface PriceLevel {
|
||||
price: number;
|
||||
@@ -43,9 +41,9 @@ export const updateLevels = (
|
||||
updates: RawPriceLevel[],
|
||||
decimalPlaces: number,
|
||||
positionDecimalPlaces: number,
|
||||
ascending = true
|
||||
reverse = false
|
||||
) => {
|
||||
uniqBy(reverse(updates || []), 'price').forEach((update) => {
|
||||
updates.forEach((update) => {
|
||||
const updateLevel = parseLevel(
|
||||
update,
|
||||
decimalPlaces,
|
||||
@@ -65,9 +63,9 @@ export const updateLevels = (
|
||||
}
|
||||
} else if (update.volume !== '0') {
|
||||
index = levels.findIndex((level) =>
|
||||
ascending
|
||||
? level.price > updateLevel.price
|
||||
: level.price < updateLevel.price
|
||||
reverse
|
||||
? level.price < updateLevel.price
|
||||
: level.price > updateLevel.price
|
||||
);
|
||||
if (index !== -1) {
|
||||
levels.splice(index, 0, updateLevel);
|
||||
|
||||
@@ -9,7 +9,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list';
|
||||
import type { MarketData } from '@vegaprotocol/market-list';
|
||||
import type {
|
||||
MarketDepthQuery,
|
||||
MarketDepthUpdateSubscription,
|
||||
PriceLevelFieldsFragment,
|
||||
} from './__generated__/MarketDepth';
|
||||
@@ -23,18 +22,6 @@ interface DepthChartManagerProps {
|
||||
const formatMidPrice = (midPrice: string, decimalPlaces: number) =>
|
||||
Number(addDecimal(midPrice, decimalPlaces));
|
||||
|
||||
const getMidPrice = (
|
||||
sell: PriceLevelFieldsFragment[] | null | undefined,
|
||||
buy: PriceLevelFieldsFragment[] | null | undefined,
|
||||
decimalPlaces: number
|
||||
) =>
|
||||
buy?.length && sell?.length
|
||||
? formatMidPrice(
|
||||
((BigInt(buy[0].price) + BigInt(sell[0].price)) / BigInt(2)).toString(),
|
||||
decimalPlaces
|
||||
)
|
||||
: undefined;
|
||||
|
||||
type DepthData = Pick<DepthChartProps, 'data' | 'midPrice'>;
|
||||
|
||||
export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
@@ -43,7 +30,6 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
const [depthData, setDepthData] = useState<DepthData | null>(null);
|
||||
const dataRef = useRef<DepthData | null>(null);
|
||||
const marketDataRef = useRef<MarketData | null>(null);
|
||||
const rawDataRef = useRef<MarketDepthQuery['market'] | null>(null);
|
||||
const deltaRef = useRef<{
|
||||
sell: PriceLevelFieldsFragment[];
|
||||
buy: PriceLevelFieldsFragment[];
|
||||
@@ -70,28 +56,28 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
}
|
||||
dataRef.current = {
|
||||
...dataRef.current,
|
||||
midPrice: getMidPrice(
|
||||
rawDataRef.current?.depth.sell,
|
||||
rawDataRef.current?.depth.buy,
|
||||
market.decimalPlaces
|
||||
),
|
||||
midPrice: marketDataRef.current?.staticMidPrice
|
||||
? formatMidPrice(
|
||||
marketDataRef.current?.staticMidPrice,
|
||||
market.decimalPlaces
|
||||
)
|
||||
: undefined,
|
||||
data: {
|
||||
buy: deltaRef.current.buy.length
|
||||
buy: deltaRef.current.buy
|
||||
? updateLevels(
|
||||
dataRef.current.data.buy,
|
||||
deltaRef.current.buy,
|
||||
market.decimalPlaces,
|
||||
market.positionDecimalPlaces,
|
||||
false
|
||||
true
|
||||
)
|
||||
: dataRef.current.data.buy,
|
||||
sell: deltaRef.current.sell.length
|
||||
sell: deltaRef.current.sell
|
||||
? updateLevels(
|
||||
dataRef.current.data.sell,
|
||||
deltaRef.current.sell,
|
||||
market.decimalPlaces,
|
||||
market.positionDecimalPlaces,
|
||||
true
|
||||
market.positionDecimalPlaces
|
||||
)
|
||||
: dataRef.current.data.sell,
|
||||
},
|
||||
@@ -99,23 +85,16 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
deltaRef.current.buy = [];
|
||||
deltaRef.current.sell = [];
|
||||
setDepthData(dataRef.current);
|
||||
}, 250),
|
||||
}, 1000),
|
||||
[market]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
deltaRef.current.buy = [];
|
||||
deltaRef.current.sell = [];
|
||||
}, [marketId]);
|
||||
|
||||
// Apply updates to the table
|
||||
const update = useCallback(
|
||||
({
|
||||
delta: deltas,
|
||||
data: rawData,
|
||||
}: {
|
||||
delta?: MarketDepthUpdateSubscription['marketsDepthUpdate'] | null;
|
||||
data: NonNullable<MarketDepthQuery['market']> | null;
|
||||
delta?: MarketDepthUpdateSubscription['marketsDepthUpdate'];
|
||||
}) => {
|
||||
if (!dataRef.current) {
|
||||
return false;
|
||||
@@ -130,7 +109,6 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
if (delta.buy) {
|
||||
deltaRef.current.buy.push(...delta.buy);
|
||||
}
|
||||
rawDataRef.current = rawData;
|
||||
updateDepthData();
|
||||
}
|
||||
return true;
|
||||
@@ -138,11 +116,7 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
[marketId, updateDepthData]
|
||||
);
|
||||
|
||||
const { data, error, loading } = useDataProvider<
|
||||
NonNullable<MarketDepthQuery['market']> | null,
|
||||
MarketDepthUpdateSubscription['marketsDepthUpdate'],
|
||||
{ marketId: string }
|
||||
>({
|
||||
const { data, error, loading } = useDataProvider({
|
||||
dataProvider: marketDepthProvider,
|
||||
update,
|
||||
variables,
|
||||
@@ -181,11 +155,9 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
return;
|
||||
}
|
||||
dataRef.current = {
|
||||
midPrice: getMidPrice(
|
||||
data.depth.sell,
|
||||
data.depth.buy,
|
||||
market.decimalPlaces
|
||||
),
|
||||
midPrice: marketData.staticMidPrice
|
||||
? formatMidPrice(marketData.staticMidPrice, market.decimalPlaces)
|
||||
: undefined,
|
||||
data: {
|
||||
buy:
|
||||
data.depth.buy?.map((priceLevel) =>
|
||||
@@ -205,12 +177,8 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
) ?? [],
|
||||
},
|
||||
};
|
||||
rawDataRef.current = data;
|
||||
setDepthData(dataRef.current);
|
||||
return () => {
|
||||
updateDepthData.cancel();
|
||||
};
|
||||
}, [data, marketData, market, updateDepthData]);
|
||||
}, [data, marketData, market]);
|
||||
|
||||
const volumeFormat = useCallback(
|
||||
(volume: number) =>
|
||||
|
||||
@@ -75,11 +75,6 @@ export const OrderbookManager = ({ marketId }: OrderbookManagerProps) => {
|
||||
}, 250)
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
deltaRef.current.buy = [];
|
||||
deltaRef.current.sell = [];
|
||||
}, [marketId]);
|
||||
|
||||
const update = useCallback(
|
||||
({
|
||||
delta: deltas,
|
||||
|
||||
@@ -74,7 +74,7 @@ const marketsDataFieldsFragments: MarketsDataFieldsFragment[] = [
|
||||
bestBidPrice: '0',
|
||||
bestOfferPrice: '0',
|
||||
markPrice: '4612690058',
|
||||
trigger: Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET,
|
||||
trigger: Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY,
|
||||
__typename: 'MarketData',
|
||||
},
|
||||
{
|
||||
@@ -91,7 +91,7 @@ const marketsDataFieldsFragments: MarketsDataFieldsFragment[] = [
|
||||
bestBidPrice: '0',
|
||||
bestOfferPrice: '0',
|
||||
markPrice: '4612690058',
|
||||
trigger: Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET,
|
||||
trigger: Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY,
|
||||
__typename: 'MarketData',
|
||||
},
|
||||
];
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type PositionFieldsFragment = { __typename?: 'Position', realisedPNL: string, openVolume: string, unrealisedPNL: string, averageEntryPrice: string, updatedAt?: any | null, positionStatus: Types.PositionStatus, lossSocializationAmount: string, market: { __typename?: 'Market', id: string } };
|
||||
|
||||
export type PositionsQueryVariables = Types.Exact<{
|
||||
export type PositionsQueryVariables = {
|
||||
partyId: Types.Scalars['ID'];
|
||||
}>;
|
||||
};
|
||||
|
||||
|
||||
export type PositionsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, positionsConnection?: { __typename?: 'PositionConnection', edges?: Array<{ __typename?: 'PositionEdge', node: { __typename?: 'Position', realisedPNL: string, openVolume: string, unrealisedPNL: string, averageEntryPrice: string, updatedAt?: any | null, positionStatus: Types.PositionStatus, lossSocializationAmount: string, market: { __typename?: 'Market', id: string } } }> | null } | null } | null };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import { useLocalStorage, useLocalStorageSnapshot } from './use-local-storage';
|
||||
import { useLocalStorage } from './use-local-storage';
|
||||
|
||||
describe('useLocalStorage', () => {
|
||||
afterEach(() => window.localStorage.clear());
|
||||
@@ -50,51 +50,3 @@ describe('useLocalStorage', () => {
|
||||
expect(B.current[0]).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('useLocalStorageSnapshot', () => {
|
||||
afterEach(() => window.localStorage.clear());
|
||||
it("should return null if there's no value set", () => {
|
||||
const { result } = renderHook(() => useLocalStorageSnapshot('test'));
|
||||
const [value] = result.current;
|
||||
expect(value).toBeNull();
|
||||
});
|
||||
it('should return already saved value', () => {
|
||||
window.localStorage.setItem('test', '123');
|
||||
const { result } = renderHook(() => useLocalStorageSnapshot('test'));
|
||||
const [value] = result.current;
|
||||
expect(value).toEqual('123');
|
||||
});
|
||||
it('should save given value', () => {
|
||||
const { result } = renderHook(() => useLocalStorageSnapshot('test'));
|
||||
const setValue = result.current[1];
|
||||
expect(result.current[0]).toBeNull();
|
||||
act(() => setValue('123'));
|
||||
expect(result.current[0]).toEqual('123');
|
||||
act(() => setValue('456'));
|
||||
expect(result.current[0]).toEqual('456');
|
||||
});
|
||||
it('should remove given value', () => {
|
||||
const { result } = renderHook(() => useLocalStorageSnapshot('test'));
|
||||
const setValue = result.current[1];
|
||||
const removeValue = result.current[2];
|
||||
act(() => setValue('123'));
|
||||
expect(result.current[0]).toEqual('123');
|
||||
act(() => removeValue());
|
||||
expect(result.current[0]).toBeNull();
|
||||
});
|
||||
it('should not return value set by storage event (by another tab)', () => {
|
||||
const { result: A } = renderHook(() => useLocalStorageSnapshot('test-a'));
|
||||
act(() => {
|
||||
window.localStorage.setItem('test-a', '123');
|
||||
window.dispatchEvent(
|
||||
new StorageEvent('storage', {
|
||||
key: 'test-a',
|
||||
oldValue: window.localStorage.getItem('test-a'),
|
||||
storageArea: window.localStorage,
|
||||
newValue: '123',
|
||||
})
|
||||
);
|
||||
});
|
||||
expect(A.current[0]).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useSyncExternalStore,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { useCallback, useEffect, useMemo, useSyncExternalStore } from 'react';
|
||||
import { LocalStorage } from '@vegaprotocol/utils';
|
||||
|
||||
type LocalStorageCallback = (key: string) => void;
|
||||
@@ -16,12 +10,6 @@ const unregisterCallback = (callback: LocalStorageCallback) =>
|
||||
const triggerCallbacks = (key: string) =>
|
||||
LOCAL_STORAGE_CALLBACKS.forEach((cb) => cb(key));
|
||||
|
||||
type UseLocalStorageHook = [
|
||||
string | null | undefined,
|
||||
(value: string) => void,
|
||||
() => void
|
||||
];
|
||||
|
||||
export const useLocalStorage = (key: string) => {
|
||||
const subscribe = useCallback(
|
||||
(onStoreChange: () => void) => {
|
||||
@@ -64,27 +52,7 @@ export const useLocalStorage = (key: string) => {
|
||||
return () => window.removeEventListener('storage', onStorage);
|
||||
}, [key, onStorage]);
|
||||
|
||||
return useMemo<UseLocalStorageHook>(
|
||||
() => [value, setValue, removeValue],
|
||||
[removeValue, setValue, value]
|
||||
);
|
||||
};
|
||||
|
||||
export const useLocalStorageSnapshot = (key: string) => {
|
||||
const [value, setStoredValue] = useState(LocalStorage.getItem(key));
|
||||
const setValue = useCallback(
|
||||
(value: string) => {
|
||||
LocalStorage.setItem(key, value);
|
||||
setStoredValue(value);
|
||||
},
|
||||
[key]
|
||||
);
|
||||
const removeValue = useCallback(() => {
|
||||
LocalStorage.removeItem(key);
|
||||
setStoredValue(null);
|
||||
}, [key]);
|
||||
return useMemo<UseLocalStorageHook>(
|
||||
() => [value, setValue, removeValue],
|
||||
[removeValue, setValue, value]
|
||||
);
|
||||
return useMemo<
|
||||
[string | null | undefined, (value: string) => void, () => void]
|
||||
>(() => [value, setValue, removeValue], [removeValue, setValue, value]);
|
||||
};
|
||||
|
||||
Generated
+2
-4
@@ -313,14 +313,12 @@ export type AuctionEvent = {
|
||||
export enum AuctionTrigger {
|
||||
/** Auction because market has a frequent batch auction trading mode */
|
||||
AUCTION_TRIGGER_BATCH = 'AUCTION_TRIGGER_BATCH',
|
||||
/** Liquidity monitoring due to unmet target stake */
|
||||
AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET = 'AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET',
|
||||
/** Liquidity monitoring */
|
||||
AUCTION_TRIGGER_LIQUIDITY = 'AUCTION_TRIGGER_LIQUIDITY',
|
||||
/** Opening auction */
|
||||
AUCTION_TRIGGER_OPENING = 'AUCTION_TRIGGER_OPENING',
|
||||
/** Price monitoring */
|
||||
AUCTION_TRIGGER_PRICE = 'AUCTION_TRIGGER_PRICE',
|
||||
/** Liquidity monitoring due to not being able to deploy LP orders because there's nothing to peg on one or both sides of the book */
|
||||
AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS = 'AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS',
|
||||
/** Invalid trigger (or no auction) */
|
||||
AUCTION_TRIGGER_UNSPECIFIED = 'AUCTION_TRIGGER_UNSPECIFIED'
|
||||
}
|
||||
|
||||
@@ -63,9 +63,7 @@ export const AuctionTriggerMapping: {
|
||||
[T in AuctionTrigger]: string;
|
||||
} = {
|
||||
AUCTION_TRIGGER_BATCH: 'batch',
|
||||
AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET: 'liquidity (target not met)',
|
||||
AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS:
|
||||
'liquidity (unable to deploy liquidity provision orders)',
|
||||
AUCTION_TRIGGER_LIQUIDITY: 'liquidity',
|
||||
AUCTION_TRIGGER_OPENING: 'opening',
|
||||
AUCTION_TRIGGER_PRICE: 'price',
|
||||
AUCTION_TRIGGER_UNSPECIFIED: 'unspecified',
|
||||
|
||||
@@ -32,7 +32,7 @@ it(`Applies class for danger intent`, () => {
|
||||
|
||||
it(`Applies class for primary intent`, () => {
|
||||
render(<Callout intent={Intent.Primary} />);
|
||||
expect(screen.getByTestId('callout')).toHaveClass('border-vega-blue-300');
|
||||
expect(screen.getByTestId('callout')).toHaveClass('border-neutral-500');
|
||||
});
|
||||
|
||||
it(`Applies class for none intent`, () => {
|
||||
|
||||
@@ -1,31 +1,23 @@
|
||||
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
||||
import { useLocalStorageSnapshot } from '@vegaprotocol/react-helpers';
|
||||
import classNames from 'classnames';
|
||||
import type { ReactElement, ReactNode } from 'react';
|
||||
import { Children, isValidElement, useState } from 'react';
|
||||
export interface TabsProps extends TabsPrimitive.TabsProps {
|
||||
|
||||
interface TabsProps {
|
||||
children: ReactElement<TabProps>[];
|
||||
active?: string;
|
||||
}
|
||||
|
||||
export const Tabs = ({
|
||||
children,
|
||||
defaultValue,
|
||||
value,
|
||||
onValueChange,
|
||||
...props
|
||||
}: TabsProps) => {
|
||||
export const Tabs = ({ children, active: activeDefaultId }: TabsProps) => {
|
||||
const [activeTab, setActiveTab] = useState<string>(() => {
|
||||
if (defaultValue) {
|
||||
return defaultValue;
|
||||
}
|
||||
return children[0].props.id;
|
||||
return activeDefaultId ?? children[0].props.id;
|
||||
});
|
||||
|
||||
return (
|
||||
<TabsPrimitive.Root
|
||||
{...props}
|
||||
value={value || activeTab}
|
||||
onValueChange={onValueChange || setActiveTab}
|
||||
value={activeTab}
|
||||
className="h-full grid grid-rows-[min-content_1fr]"
|
||||
onValueChange={(value) => setActiveTab(value)}
|
||||
>
|
||||
<div className="border-b border-default">
|
||||
<TabsPrimitive.List
|
||||
@@ -34,7 +26,7 @@ export const Tabs = ({
|
||||
>
|
||||
{Children.map(children, (child) => {
|
||||
if (!isValidElement(child) || child.props.hidden) return null;
|
||||
const isActive = child.props.id === (value || activeTab);
|
||||
const isActive = child.props.id === activeTab;
|
||||
const triggerClass = classNames(
|
||||
'relative px-4 py-1 border-r border-default',
|
||||
'uppercase',
|
||||
@@ -90,15 +82,3 @@ interface TabProps {
|
||||
export const Tab = ({ children, ...props }: TabProps) => {
|
||||
return <div {...props}>{children}</div>;
|
||||
};
|
||||
|
||||
export const LocalStoragePersistTabs = ({
|
||||
storageKey,
|
||||
...props
|
||||
}: Omit<TabsProps, 'value' | 'onValueChange'> & { storageKey: string }) => {
|
||||
const [value, onValueChange] = useLocalStorageSnapshot(
|
||||
`active-tab-${storageKey}`
|
||||
);
|
||||
return (
|
||||
<Tabs {...props} value={value || undefined} onValueChange={onValueChange} />
|
||||
);
|
||||
};
|
||||
|
||||
@@ -11,8 +11,7 @@ export const getIntentBorder = (intent = Intent.None) => {
|
||||
border: true,
|
||||
'border-danger': intent === Intent.Danger,
|
||||
'border-warning': intent === Intent.Warning,
|
||||
'border-neutral-500': intent === Intent.None,
|
||||
'border-vega-blue-300': intent === Intent.Primary,
|
||||
'border-neutral-500': intent === Intent.None || intent === Intent.Primary,
|
||||
'border-success': intent === Intent.Success,
|
||||
};
|
||||
};
|
||||
@@ -21,7 +20,7 @@ export const getIntentBackground = (intent?: Intent) => {
|
||||
return {
|
||||
'bg-neutral-200 dark:bg-neutral-800': intent === undefined,
|
||||
'bg-black dark:bg-white': intent === Intent.None,
|
||||
'bg-vega-blue-300 dark:bg-vega-blue-700': intent === Intent.Primary,
|
||||
'bg-vega-pink dark:bg-vega-yellow': intent === Intent.Primary,
|
||||
'bg-danger': intent === Intent.Danger,
|
||||
'bg-warning': intent === Intent.Warning,
|
||||
// contrast issues with light mode
|
||||
@@ -32,7 +31,8 @@ export const getIntentBackground = (intent?: Intent) => {
|
||||
export const getIntentText = (intent?: Intent) => {
|
||||
return {
|
||||
'text-white dark:text-black': intent === Intent.None,
|
||||
'text-white': intent === Intent.Danger || intent === Intent.Primary,
|
||||
'text-black dark:text-black-normal': intent === Intent.Primary,
|
||||
'text-white': intent === Intent.Danger,
|
||||
'text-black': intent === Intent.Warning || intent === Intent.Success,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ export const Web3ConnectDialog = ({
|
||||
<Dialog
|
||||
open={dialogOpen}
|
||||
onChange={setDialogOpen}
|
||||
intent={Intent.None}
|
||||
intent={Intent.Primary}
|
||||
title={t('Connect to your Ethereum wallet')}
|
||||
>
|
||||
<ul data-testid="web3-connector-list">
|
||||
|
||||
Reference in New Issue
Block a user