Compare commits

...
Author SHA1 Message Date
Matthew Russell 2142ba5d34 fix: add a timeout to show subscriptions as failed 2023-03-02 22:10:25 -08:00
dexturr 93dbc32f22 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-03 01:56:44 +00:00
dexturr fd1827ef67 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-02 18:09:24 +00:00
Sam Keen 9c9948e4c1 feat(governance): final wallet not connected views (#3037) 2023-03-02 14:36:04 +00:00
Sam Keen 79b0868ff7 feat(governance): remove graph from tranches page (#3049) 2023-03-02 14:35:46 +00:00
dexturr a8401d4c6f chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-02 12:07:58 +00:00
Maciek c030264211 chore(react-helpers): improve error catching in useResizeObserver (#3058) 2023-03-02 10:32:42 +01:00
Maciek 068f7b3fc3 chore(trading): tweaking catching no market data error (#3044) 2023-03-02 08:25:57 +01:00
dexturr 4430f0c5f6 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-02 06:09:50 +00:00
dexturr 0a14000708 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-02 00:15:49 +00:00
Matthew Russell 9ca6fe3cbf fix(trading): env vars for validator testnet (#3061) 2023-03-01 10:08:45 -08:00
dexturr 4f96472375 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-01 18:07:09 +00:00
14 changed files with 312 additions and 279 deletions
@@ -11,7 +11,7 @@ export const EthConnectPrompt = () => {
const { appDispatch } = useAppState();
return (
<Button
variant="primary"
variant="default"
onClick={() =>
appDispatch({
type: AppStateActionType.SET_ETH_WALLET_OVERLAY,
@@ -336,6 +336,7 @@
"withdrawLpNoneDeposited": "You have no SLP tokens deposited or rewards accumulated",
"withdrawAllLpSuccessCalloutTitle": "Your SLP tokens and rewards have been sent to your Ethereum address",
"Dissociate VEGA tokens": "Disassociate $VEGA tokens",
"DisassociateVegaTokensFromWallet": "Disassociate $VEGA tokens from your Vega wallet",
"Early Investors": "Early Investors",
"Team": "Team",
"Community": "Community",
@@ -482,6 +483,7 @@
"withdrawFormSubmitButtonIdle": "Withdraw {{amount}} {{symbol}} tokens",
"withdrawFormSubmitButtonPending": "Preparing",
"withdrawalsTitle": "Withdrawals",
"withdrawalsSubtitle": "Connect your Vega wallet to complete a withdrawal. These withdrawals will be completed with an Ethereum transaction.",
"withdrawalsText": "These withdrawals need to be completed with an Ethereum transaction.",
"withdrawalsNone": "You don't have any pending withdrawals.",
"withdrawalsCompleteButton": "Finish withdrawal",
@@ -552,9 +554,6 @@
"resourceNotFound": "Resource Not Found",
"Or": "Or",
"addTokenToWallet": "Show this token in your Ethereum wallet",
"chartBelow": "*Certain activities, for example community incentive tokens, do not have specific dates to be credited and so an approximation has been used. ",
"chartTitle": "Token unlocking schedule",
"chartAbove": "This chart shows the approximate* schedule for how tokens will unlock from vesting tranches over time.",
"date": "Date",
"noEthereumProviderError": "No Ethereum browser extension detected, install MetaMask on desktop or visit from a dApp browser on mobile",
"unsupportedChainIdError": "You're connected to an unsupported network",
@@ -15,7 +15,12 @@ export const DisassociateContainer = () => {
<>
<Heading title={t('pageTitleDisassociate')} />
{!account ? (
<EthConnectPrompt />
<>
<p className="mb-8">{t('DisassociateVegaTokensFromWallet')}</p>
<div className="max-w-[400px]">
<EthConnectPrompt />
</div>
</>
) : (
<DisassociatePage address={account} vegaKey={pubKey ?? ''} />
)}
@@ -1,15 +1,12 @@
import { useWeb3React } from '@web3-react/core';
import React from 'react';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { SubHeading } from '../../components/heading';
import { TrancheItem } from '../redemption/tranche-item';
import { TrancheLabel } from './tranche-label';
import { VestingChart } from './vesting-chart';
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
import { useEthereumConfig } from '@vegaprotocol/web3';
import type { Tranche } from '../../lib/tranches/tranches-store';
import { TrancheItem } from '../redemption/tranche-item';
import { TrancheLabel } from './tranche-label';
import { useTranches } from '../../lib/tranches/tranches-store';
import type { Tranche } from '../../lib/tranches/tranches-store';
const trancheMinimum = 10;
@@ -18,7 +15,7 @@ const shouldShowTranche = (t: Tranche) =>
export const Tranches = () => {
const tranches = useTranches((state) => state.tranches);
const [showAll, setShowAll] = React.useState<boolean>(false);
const [showAll, setShowAll] = useState<boolean>(false);
const { t } = useTranslation();
const { chainId } = useWeb3React();
const { config } = useEthereumConfig();
@@ -30,10 +27,6 @@ export const Tranches = () => {
return (
<section>
<SubHeading title={t('chartTitle')} />
<p>{t('chartAbove')}</p>
<VestingChart />
<p>{t('chartBelow')}</p>
{tranches?.length ? (
<ul role="list">
{(showAll ? tranches : filteredTranches).map((tranche) => {
@@ -55,6 +48,7 @@ export const Tranches = () => {
) : (
<p>{t('No tranches')}</p>
)}
<section className="text-center mt-4">
<ButtonLink onClick={() => setShowAll(!showAll)}>
{showAll
@@ -1,149 +0,0 @@
import { format, startOfMonth } from 'date-fns';
import React from 'react';
import { useTranslation } from 'react-i18next';
import {
Area,
AreaChart,
Label,
Legend,
ReferenceLine,
ResponsiveContainer,
Tooltip,
XAxis,
YAxis,
} from 'recharts';
import colors from 'tailwindcss/colors';
import { DATE_FORMAT_LONG } from '../../lib/date-formats';
import data from './data.json';
import { theme } from '@vegaprotocol/tailwindcss-config';
const Colors = theme.colors;
const ORDER = ['community', 'publicSale', 'earlyInvestors', 'team'];
export const VestingChart = () => {
const { t } = useTranslation();
const currentDate = React.useMemo(
() => format(startOfMonth(new Date()), DATE_FORMAT_LONG),
[]
);
return (
<div style={{ marginBottom: 25 }}>
<ResponsiveContainer height={400} width="100%">
<AreaChart data={data}>
<defs>
{[
['pink', Colors.vega.pink.DEFAULT],
['green', Colors.vega.green.DEFAULT],
['orange', Colors.warning],
['yellow', Colors.vega.yellow.DEFAULT],
].map(([key, color]) => (
<linearGradient key={key} id={key} x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor={color} stopOpacity={0.85} />
<stop offset="100%" stopColor={color} stopOpacity={0} />
</linearGradient>
))}
</defs>
<Tooltip
contentStyle={{ backgroundColor: colors.black }}
separator=":"
// @ts-ignore formatter doesnt seem to allow returning JSX but nonetheless it works
formatter={(value: number) => {
return (
<div
style={{
display: 'flex',
textAlign: 'right',
}}
>
{Intl.NumberFormat().format(value)}
</div>
);
}}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
itemSorter={(label: any) => {
return ORDER.indexOf(label.dataKey) + 1;
}}
/>
<YAxis type="number" width={100}>
<Label
angle={270}
value={t('VEGA').toString()}
position="left"
offset={-5}
fill={colors.white}
/>
</YAxis>
<XAxis dataKey="date">
<Label
value={t('date').toString()}
position="bottom"
offset={5}
fill={colors.white}
/>
</XAxis>
<ReferenceLine
x={currentDate}
stroke={colors.white}
strokeWidth={2}
label={{
position: 'left',
value: currentDate,
fill: colors.white,
}}
/>
<Area
dot={false}
type="linear"
dataKey="team"
stroke={Colors.vega.pink.DEFAULT}
fill="url(#pink)"
yAxisId={0}
strokeWidth={2}
fillOpacity={0.85}
stackId="1"
name={t('Team')}
/>
<Area
dot={false}
type="monotone"
dataKey="earlyInvestors"
stroke={Colors.vega.green.DEFAULT}
fill="url(#green)"
yAxisId={0}
strokeWidth={2}
fillOpacity={0.85}
stackId="1"
name={t('Early Investors')}
/>
<Area
dot={false}
type="monotone"
dataKey="publicSale"
stroke={Colors.vega.yellow.DEFAULT}
fill="url(#yellow)"
yAxisId={0}
strokeWidth={2}
stackId="1"
fillOpacity={0.85}
name={t('Public Sale')}
/>
<Area
dot={false}
type="monotone"
dataKey="community"
stroke={Colors.warning}
fill="url(#orange)"
yAxisId={0}
strokeWidth={2}
fillOpacity={0.85}
stackId="1"
name={t('Community')}
/>
<Legend wrapperStyle={{ position: 'relative' }} />
</AreaChart>
</ResponsiveContainer>
</div>
);
};
@@ -17,12 +17,14 @@ import type { RouteChildProps } from '../index';
const Withdrawals = ({ name }: RouteChildProps) => {
useDocumentTitle(name);
const { t } = useTranslation();
const { pubKey } = useVegaWallet();
return (
<>
<Heading title={t('withdrawalsTitle')} />
{!pubKey && <p className="mb-8">{t('withdrawalsSubtitle')}</p>}
<VegaWalletContainer>
{(currVegaKey) => <WithdrawPendingContainer />}
{() => <WithdrawPendingContainer />}
</VegaWalletContainer>
</>
);
+164 -43
View File
@@ -2761,7 +2761,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "86666.297",
"total_removed": "0",
"locked_amount": "66126.2911732114998055325",
"locked_amount": "65752.1635199045224671036",
"deposits": [
{
"amount": "86666.297",
@@ -2827,7 +2827,7 @@
"tranche_end": "2023-06-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
"locked_amount": "1256.794045075295",
"locked_amount": "1235.1503675722425",
"deposits": [
{
"amount": "2500",
@@ -2948,7 +2948,7 @@
"tranche_end": "2023-09-01T00:00:00.000Z",
"total_added": "17500",
"total_removed": "0",
"locked_amount": "17451.93268166264",
"locked_amount": "17302.07374069041875",
"deposits": [
{
"amount": "12500",
@@ -3214,8 +3214,8 @@
"tranche_start": "2023-02-01T00:00:00.000Z",
"tranche_end": "2023-08-01T00:00:00.000Z",
"total_added": "37500",
"total_removed": "3451.5629793",
"locked_amount": "31594.18642572130125",
"total_removed": "3500.377436025",
"locked_amount": "31267.73758824432375",
"deposits": [
{
"amount": "7500",
@@ -3244,6 +3244,11 @@
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x7d9d6e2a37fbe030faf08b7b1b0fc5b09f1f4295c4d7f4e28e0bdac1bdd294ac"
},
{
"amount": "48.814456725",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x9e42c457fa017043dbbcb189fb3a574719ce66ce348eee850db3bd809014b1fd"
},
{
"amount": "142.173112275",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -3310,6 +3315,12 @@
"tranche_id": 34,
"tx": "0x7d9d6e2a37fbe030faf08b7b1b0fc5b09f1f4295c4d7f4e28e0bdac1bdd294ac"
},
{
"amount": "48.814456725",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 34,
"tx": "0x9e42c457fa017043dbbcb189fb3a574719ce66ce348eee850db3bd809014b1fd"
},
{
"amount": "142.173112275",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -3348,8 +3359,8 @@
}
],
"total_tokens": "7500",
"withdrawn_tokens": "1176.4497966",
"remaining_tokens": "6323.5502034"
"withdrawn_tokens": "1225.264253325",
"remaining_tokens": "6274.735746675"
},
{
"address": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600",
@@ -3381,7 +3392,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
"locked_amount": "66065.95925284494122844",
"locked_amount": "65692.1729439470503785",
"deposits": [
{
"amount": "129999.45",
@@ -3447,7 +3458,7 @@
"tranche_end": "2023-09-03T00:00:00.000Z",
"total_added": "62600",
"total_removed": "0",
"locked_amount": "31813.59552257737524",
"locked_amount": "31543.35908802638962",
"deposits": [
{
"amount": "10000",
@@ -3640,7 +3651,7 @@
"tranche_end": "2023-09-17T00:00:00.000Z",
"total_added": "5000",
"total_removed": "0",
"locked_amount": "2732.8028285134455",
"locked_amount": "2711.2184487569765",
"deposits": [
{
"amount": "5000",
@@ -3851,7 +3862,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "97499.58",
"total_removed": "0",
"locked_amount": "8026.753327469502229788",
"locked_amount": "7660.1037782103571237062",
"deposits": [
{
"amount": "97499.58",
@@ -3884,7 +3895,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "135173.4239508",
"total_removed": "98230.390980249184455396",
"locked_amount": "10971.186037499547718723312584",
"locked_amount": "10470.039403066276125235594836",
"deposits": [
{
"amount": "135173.4239508",
@@ -3930,7 +3941,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "32499.86",
"total_removed": "0",
"locked_amount": "3376.7165102507267945488",
"locked_amount": "3222.4733765764461183784",
"deposits": [
{
"amount": "32499.86",
@@ -3963,7 +3974,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "10833.29",
"total_removed": "0",
"locked_amount": "1099.0884572052014268704",
"locked_amount": "1048.8838139341641135251",
"deposits": [
{
"amount": "10833.29",
@@ -3996,7 +4007,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "22749.93",
"total_removed": "4720.860935375",
"locked_amount": "4108.63813000654408794",
"locked_amount": "3920.9619604548439563678",
"deposits": [
{
"amount": "6500",
@@ -4147,8 +4158,8 @@
"tranche_start": "2022-11-01T00:00:00.000Z",
"tranche_end": "2023-05-01T00:00:00.000Z",
"total_added": "22500",
"total_removed": "4988.60449275",
"locked_amount": "7520.047767034992",
"total_removed": "5037.424704525",
"locked_amount": "7324.17846454880325",
"deposits": [
{
"amount": "7500",
@@ -4177,6 +4188,11 @@
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x27d0868963dc1e725d9b4da891a4df20b48107f1b0c803dd3f752362aa1d4335"
},
{
"amount": "48.820211775",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x1690b7e9232984baf6a441b517de44cb2c9c547f100e9e8acc8d7e144e01b2b8"
},
{
"amount": "142.17311235",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -4298,6 +4314,12 @@
"tranche_id": 33,
"tx": "0x27d0868963dc1e725d9b4da891a4df20b48107f1b0c803dd3f752362aa1d4335"
},
{
"amount": "48.820211775",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 33,
"tx": "0x1690b7e9232984baf6a441b517de44cb2c9c547f100e9e8acc8d7e144e01b2b8"
},
{
"amount": "142.17311235",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -4408,8 +4430,8 @@
}
],
"total_tokens": "7500",
"withdrawn_tokens": "4988.60449275",
"remaining_tokens": "2511.39550725"
"withdrawn_tokens": "5037.424704525",
"remaining_tokens": "2462.575295475"
},
{
"address": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1",
@@ -4434,7 +4456,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "928642.9598472029154",
"locked_amount": "491597.019480432441937998",
"locked_amount": "483222.589309578295592792",
"deposits": [
{
"amount": "1852091.69",
@@ -36813,8 +36835,8 @@
"tranche_start": "2022-03-05T00:00:00.000Z",
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "615950.831401702010493",
"locked_amount": "779914.787767187799364679587",
"total_removed": "618385.665327542135993",
"locked_amount": "767046.204261494651069018807",
"deposits": [
{
"amount": "1998.95815",
@@ -36983,6 +37005,11 @@
}
],
"withdrawals": [
{
"amount": "2434.8339258401255",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tx": "0xcba878ae28c2c84219f8281dc2a57d0d9b6c99b7920900d5344c76aabe8f1e84"
},
{
"amount": "16659.576193025747093",
"user": "0xB523235B6c7C74DDB26b10E78bFb2d0Cb63Ae289",
@@ -37357,6 +37384,12 @@
}
],
"withdrawals": [
{
"amount": "2434.8339258401255",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tranche_id": 1,
"tx": "0xcba878ae28c2c84219f8281dc2a57d0d9b6c99b7920900d5344c76aabe8f1e84"
},
{
"amount": "6293.20485405503",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
@@ -37641,8 +37674,8 @@
}
],
"total_tokens": "187637.95",
"withdrawn_tokens": "146054.503703913043",
"remaining_tokens": "41583.446296086957"
"withdrawn_tokens": "148489.3376297531685",
"remaining_tokens": "39148.6123702468315"
},
{
"address": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e",
@@ -38162,8 +38195,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15870102.715470999700000001",
"total_removed": "585442.32676055889219452",
"locked_amount": "8065215.3477477860118006909778900766450392",
"total_removed": "587055.52353142020335452",
"locked_amount": "8019584.17687863003095029918098754518113",
"deposits": [
{
"amount": "16249.93",
@@ -38707,6 +38740,31 @@
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0xb54d54fd5a6211e97495020ad17e9f045d032999ed94ea31994958304010aa85"
},
{
"amount": "133.7749515525265",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tx": "0xed77ed534414a1949b1473707782223907e0ac001f899037ff822f10bd4a358a"
},
{
"amount": "261.60674662018875",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0xdbd9367c0d60c1bd9165752d8fab223aa43c7c2e85568a4e98e86ad0e0c97a01"
},
{
"amount": "394.58033601838216",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tx": "0xe479984e1fc0f4a0040603b528c841013d6da2c890361ce5f4152256ea9dd009"
},
{
"amount": "525.648824",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
"tx": "0x132a15c0b5f8c6016ac1a90437b9dca119ebc2479cde9c702327653fa3c11750"
},
{
"amount": "297.58591267021375",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x7fa0448cd21e20e3a40743d0f294b6d83618e5167b83809c1c91a82afaba57a5"
},
{
"amount": "535.4042378778335",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -40500,6 +40558,18 @@
"tranche_id": 2,
"tx": "0xb54d54fd5a6211e97495020ad17e9f045d032999ed94ea31994958304010aa85"
},
{
"amount": "261.60674662018875",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 2,
"tx": "0xdbd9367c0d60c1bd9165752d8fab223aa43c7c2e85568a4e98e86ad0e0c97a01"
},
{
"amount": "297.58591267021375",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 2,
"tx": "0x7fa0448cd21e20e3a40743d0f294b6d83618e5167b83809c1c91a82afaba57a5"
},
{
"amount": "535.4042378778335",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -41714,8 +41784,8 @@
}
],
"total_tokens": "259998.8875",
"withdrawn_tokens": "127812.81440269060675",
"remaining_tokens": "132186.07309730939325"
"withdrawn_tokens": "128372.00706198100925",
"remaining_tokens": "131626.88043801899075"
},
{
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
@@ -41948,6 +42018,12 @@
"tranche_id": 2,
"tx": "0x3c76f03b71481a44c6ba2c7cea407f5f1bac60bcaa9242af18de287f94c8ed90"
},
{
"amount": "394.58033601838216",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tranche_id": 2,
"tx": "0xe479984e1fc0f4a0040603b528c841013d6da2c890361ce5f4152256ea9dd009"
},
{
"amount": "1640.93679110232897",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
@@ -42190,8 +42266,8 @@
}
],
"total_tokens": "150551.801",
"withdrawn_tokens": "73885.95651128121547",
"remaining_tokens": "76665.84448871878453"
"withdrawn_tokens": "74280.53684729959763",
"remaining_tokens": "76271.26415270040237"
},
{
"address": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148",
@@ -42399,6 +42475,12 @@
"tranche_id": 2,
"tx": "0x1887d1fb77d9fa555dd5b55da307edc91e395f3a7e0ca5f874740f5a10077cdf"
},
{
"amount": "525.648824",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
"tranche_id": 2,
"tx": "0x132a15c0b5f8c6016ac1a90437b9dca119ebc2479cde9c702327653fa3c11750"
},
{
"amount": "2820.55961",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
@@ -42611,8 +42693,8 @@
}
],
"total_tokens": "200000",
"withdrawn_tokens": "98152.824242",
"remaining_tokens": "101847.175758"
"withdrawn_tokens": "98678.473066",
"remaining_tokens": "101321.526934"
},
{
"address": "0x1b956E6c00E238194B331eddEFF72Cb5f28A8d01",
@@ -43072,6 +43154,12 @@
}
],
"withdrawals": [
{
"amount": "133.7749515525265",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tranche_id": 2,
"tx": "0xed77ed534414a1949b1473707782223907e0ac001f899037ff822f10bd4a358a"
},
{
"amount": "345.7620519411935",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
@@ -43338,8 +43426,8 @@
}
],
"total_tokens": "12362.05",
"withdrawn_tokens": "5949.173638923777",
"remaining_tokens": "6412.876361076223"
"withdrawn_tokens": "6082.9485904763035",
"remaining_tokens": "6279.1014095236965"
},
{
"address": "0xb091D456d0dFCB94dcba6f355379056C5bb995fC",
@@ -43970,8 +44058,8 @@
"tranche_start": "2021-11-05T00:00:00.000Z",
"tranche_end": "2023-05-05T00:00:00.000Z",
"total_added": "14597706.0446472999",
"total_removed": "5577730.800522677126225156",
"locked_amount": "1724310.085864232345131785821604681",
"total_removed": "5578506.105997036447643656",
"locked_amount": "1682183.680275606109201953939978039",
"deposits": [
{
"amount": "129284.449",
@@ -44205,6 +44293,16 @@
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0xcc545119eac3fe838555697dae55ce68273cb4c5f414c8983bac9f7ef8338f2c"
},
{
"amount": "362.02846600644321975",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0xbecb2d5ad72cdfe972b450c388f111d9262c39896c71acceecb5f672e50c3ce9"
},
{
"amount": "413.27700835287819875",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0xa266ac6aa7627d396b9d1c668f80e26d95de431e9ed861922df4472e9158204b"
},
{
"amount": "800.792718381487871",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
@@ -47190,6 +47288,18 @@
"tranche_id": 3,
"tx": "0xcc545119eac3fe838555697dae55ce68273cb4c5f414c8983bac9f7ef8338f2c"
},
{
"amount": "362.02846600644321975",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tranche_id": 3,
"tx": "0xbecb2d5ad72cdfe972b450c388f111d9262c39896c71acceecb5f672e50c3ce9"
},
{
"amount": "413.27700835287819875",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tranche_id": 3,
"tx": "0xa266ac6aa7627d396b9d1c668f80e26d95de431e9ed861922df4472e9158204b"
},
{
"amount": "800.792718381487871",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
@@ -49706,8 +49816,8 @@
}
],
"total_tokens": "359123.469575",
"withdrawn_tokens": "316627.82419217025121175",
"remaining_tokens": "42495.64538282974878825"
"withdrawn_tokens": "317403.12966652957263025",
"remaining_tokens": "41720.33990847042736975"
},
{
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
@@ -51051,7 +51161,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "5778205.3912159303",
"total_removed": "3077573.36197477479025324",
"locked_amount": "364381.939925353626624604984386745",
"locked_amount": "347737.542298906744323236374749015",
"deposits": [
{
"amount": "552496.6455",
@@ -53122,8 +53232,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
"total_removed": "34992.4553336210685",
"locked_amount": "123581.941326403371637891942567224",
"total_removed": "35033.4420916090685",
"locked_amount": "121542.855688265356170957439167948",
"deposits": [
{
"amount": "3000",
@@ -59777,6 +59887,11 @@
"user": "0x454D87e666a106F3545B7cde91F32aE8B9616a72",
"tx": "0xcefe8932dc5a8ef8bbbb4f4ac1ec86c2de0e064cab91c381e222411c4661d34a"
},
{
"amount": "40.986757988",
"user": "0xf751033D4e6864a88Be93E36258246F26AEf577c",
"tx": "0x2f4a8c1de411b2a4c858e06633748bd342c23e0ad30910fc30d562f59c86de36"
},
{
"amount": "57.900076104",
"user": "0x96d882E908C06cD697Ea07266Fb8D14ae129A50b",
@@ -78368,6 +78483,12 @@
}
],
"withdrawals": [
{
"amount": "40.986757988",
"user": "0xf751033D4e6864a88Be93E36258246F26AEf577c",
"tranche_id": 5,
"tx": "0x2f4a8c1de411b2a4c858e06633748bd342c23e0ad30910fc30d562f59c86de36"
},
{
"amount": "108.551141552",
"user": "0xf751033D4e6864a88Be93E36258246F26AEf577c",
@@ -78382,8 +78503,8 @@
}
],
"total_tokens": "400",
"withdrawn_tokens": "255.898008624",
"remaining_tokens": "144.101991376"
"withdrawn_tokens": "296.884766612",
"remaining_tokens": "103.115233388"
},
{
"address": "0x667ee9816155807e4120dba069CC42aED064399b",
@@ -20,46 +20,78 @@ describe('positions', { tags: '@smoke' }, () => {
cy.getByTestId('Positions').click();
validatePositionsDisplayed();
});
it('renders position among some graphql errors', () => {
const errors = [
{
message: 'no market data for market: market-2',
path: ['market', 'data'],
extensions: {
code: 13,
type: 'Internal',
describe('renders position among some graphql errors', () => {
it('rows should be displayed despite errors', () => {
const errors = [
{
message:
'no market data for market: 9c55fb644c6f7de5422d40d691a62bffd5898384c70135bab29ba1e3e2e5280a',
path: ['marketsConnection', 'edges'],
extensions: {
code: 13,
type: 'Internal',
},
},
},
];
const marketData = marketsDataQuery();
const edges = marketData.marketsConnection?.edges.map((market) => {
const replace =
market.node.data?.market.id === 'market-2' ? null : market.node.data;
return { ...market, node: { ...market.node, data: replace } };
});
const overrides = {
...marketData,
marketsConnection: { ...marketData.marketsConnection, edges },
};
cy.mockGQL((req) => {
aliasGQLQuery(req, 'MarketsData', overrides, errors);
});
cy.visit('/#/markets/market-0');
const emptyCells = [
'notional',
'markPrice',
'liquidationPrice',
'currentLeverage',
'averageEntryPrice',
];
cy.getByTestId('tab-positions').within(() => {
cy.get('[row-id="market-2"]').within(() => {
emptyCells.forEach((cell) => {
cy.get(`[col-id="${cell}"]`).should('contain.text', '-');
];
const marketData = marketsDataQuery();
const edges = marketData.marketsConnection?.edges.map((market) => {
const replace =
market.node.data?.market.id === 'market-2' ? null : market.node.data;
return { ...market, node: { ...market.node, data: replace } };
});
const overrides = {
...marketData,
marketsConnection: { ...marketData.marketsConnection, edges },
};
cy.mockGQL((req) => {
aliasGQLQuery(req, 'MarketsData', overrides, errors);
});
cy.visit('/#/markets/market-0');
const emptyCells = [
'notional',
'markPrice',
'liquidationPrice',
'currentLeverage',
'averageEntryPrice',
];
cy.getByTestId('tab-positions').within(() => {
cy.get('[row-id="market-2"]').within(() => {
emptyCells.forEach((cell) => {
cy.get(`[col-id="${cell}"]`).should('contain.text', '-');
});
});
});
});
it('error message should be displayed', () => {
const errors = [
{
message:
'no market data for asset: 9c55fb644c6f7de5422d40d691a62bffd5898384c70135bab29ba1e3e2e5280a',
path: ['assets', 'edges'],
extensions: {
code: 13,
type: 'Internal',
},
},
];
const marketData = marketsDataQuery();
const edges = marketData.marketsConnection?.edges.map((market) => {
const replace =
market.node.data?.market.id === 'market-2' ? null : market.node.data;
return { ...market, node: { ...market.node, data: replace } };
});
const overrides = {
...marketData,
marketsConnection: { ...marketData.marketsConnection, edges },
};
cy.mockGQL((req) => {
aliasGQLQuery(req, 'MarketsData', overrides, errors);
});
cy.visit('/#/markets/market-0');
cy.get('.pointer-events-none.absolute.inset-0').contains(
'Something went wrong:'
);
});
});
describe('sorting by ag-grid columns should work well', () => {
+3 -4
View File
@@ -1,12 +1,11 @@
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_ENV=VALIDATOR_TESTNET
NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_TOKEN_URL=https://token.fairground.wtf
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\"}
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
@@ -24,6 +24,7 @@ export const Banner = () => {
<AnnouncementBanner>
<div className="grid grid-cols-[auto_1fr] gap-4 font-alpha calt uppercase text-center text-lg text-white">
<button
className="flex items-center"
onClick={() => update({ shouldDisplayAnnouncementBanner: false })}
>
<Icon name="cross" className="w-6 h-6" ariaLabel="dismiss" />
@@ -27,6 +27,7 @@ export const RowData = ({
highestBlock,
onBlockHeight,
}: RowDataProps) => {
const [subFailed, setSubFailed] = useState(false);
const [time, setTime] = useState<number>();
// no use of data here as we need the data nodes reference to block height
const { data, error, loading, startPolling, stopPolling } =
@@ -46,9 +47,18 @@ export const RowData = ({
} = useBlockTimeSubscription();
useEffect(() => {
// stop polling if row has errored
}, [error, stopPolling]);
const timeout = setTimeout(() => {
if (!subData) {
setSubFailed(true);
}
}, 3000);
return () => {
clearTimeout(timeout);
};
}, [subData]);
// handle polling
useEffect(() => {
const handleStartPoll = () => startPolling(POLL_INTERVAL);
const handleStopPoll = () => stopPolling();
@@ -68,6 +78,7 @@ export const RowData = ({
};
}, [startPolling, stopPolling, error]);
// measure response time
useEffect(() => {
if (!isValidUrl(url)) return;
// every time we get data measure response speed
@@ -131,6 +142,15 @@ export const RowData = ({
return false;
};
const getSubFailed = (
subError: ApolloError | undefined,
subFailed: boolean
) => {
if (subError) return true;
if (subFailed) return true;
return false;
};
return (
<>
{id !== CUSTOM_NODE_KEY && (
@@ -161,11 +181,11 @@ export const RowData = ({
</LayoutCell>
<LayoutCell
label={t('Subscription')}
isLoading={subLoading}
hasError={Boolean(subError)}
isLoading={subFailed ? false : subLoading}
hasError={getSubFailed(subError, subFailed)}
dataTestId="subscription-cell"
>
{getSubscriptionDisplayValue(subData?.busEvents, subError)}
{getSubscriptionDisplayValue(subFailed, subData?.busEvents, subError)}
</LayoutCell>
</>
);
@@ -195,10 +215,11 @@ const getBlockDisplayValue = (block?: number, error?: ApolloError) => {
};
const getSubscriptionDisplayValue = (
subFailed: boolean,
events?: { id: string }[] | null,
error?: ApolloError
) => {
if (error) {
if (subFailed || error) {
return t('No');
}
if (events?.length) {
@@ -1,6 +1,6 @@
import { captureException } from '@sentry/react';
import debounce from 'lodash/debounce';
import { useEffect, useMemo } from 'react';
import { useCallback, useEffect, useMemo } from 'react';
import { localLoggerFactory } from '@vegaprotocol/utils';
type ResizeObserverConfiguration = {
debounceTime: number;
@@ -19,20 +19,26 @@ export function useResizeObserver(
callback: ResizeObserverCallback,
options: ResizeObserverConfiguration = DEFAULT_OPTIONS
) {
const wrappedCb = useCallback(
(entries: ResizeObserverEntry[], observer: ResizeObserver) =>
window.requestAnimationFrame(() => {
options.debounceTime > 0
? debounce(callback, options.debounceTime)(entries, observer)
: callback(entries, observer);
}),
[callback, options.debounceTime]
);
const observer = useMemo(() => {
return new ResizeObserver(
options.debounceTime > 0
? debounce(callback, options.debounceTime)
: callback
);
}, [callback, options.debounceTime]);
return new ResizeObserver(wrappedCb);
}, [wrappedCb]);
useEffect(() => {
if (!observer || !target) return;
try {
observer.observe(target, options.config);
} catch (err) {
captureException(err);
localLoggerFactory({ application: 'react-helpers' }).debug(err as Error);
}
return () => observer?.disconnect();
}, [observer, options.config, target]);
+2 -10
View File
@@ -2,7 +2,6 @@ import type { ApolloError } from '@apollo/client';
import type { GraphQLErrors } from '@apollo/client/errors';
const NOT_FOUND = 'NotFound';
const INTERNAL = 'Internal';
const isApolloGraphQLError = (
error: ApolloError | Error | undefined
@@ -29,12 +28,5 @@ export const isNotFoundGraphQLError = (
);
};
export const marketDataErrorPolicyGuard = (errors: GraphQLErrors) => {
const path = ['market', 'data'];
return errors.every(
(e) =>
e.extensions &&
e.extensions['type'] === INTERNAL &&
(!path || path.every((item, i) => item === e?.path?.[i]))
);
};
export const marketDataErrorPolicyGuard = (errors: GraphQLErrors) =>
errors.every((e) => e.message.match(/no market data for market:/i));
+14 -4
View File
@@ -49,10 +49,10 @@ export class LocalLogger {
return LocalLogger.levelLogMap[this._logLevel];
}
private tags: string[] = [];
private application = 'trading';
private _application = 'trading';
constructor(conf: LoggerConf) {
if (conf.application) {
this.application = conf.application;
this._application = conf.application;
}
this.tags = [...(conf.tags || [])];
this._logLevel = conf.logLevel || this._logLevel;
@@ -85,7 +85,7 @@ export class LocalLogger {
) {
if (this.numberLogLevel <= LocalLogger.levelLogMap[level]) {
console[logMethod].apply(console, [
`${this.application}:${level}: `,
`${this._application}:${level}: `,
...args,
]);
}
@@ -148,13 +148,23 @@ export class LocalLogger {
public get logLevel() {
return this._logLevel;
}
public get application() {
return this._application;
}
}
let singleLoggerInstance: LocalLogger;
let singleLoggerInstances: LocalLogger[];
export const localLoggerFactory = (conf: LoggerConf) => {
if (!singleLoggerInstances) {
singleLoggerInstances = [];
}
let singleLoggerInstance = singleLoggerInstances.find(
(instance) => instance.application === conf.application
);
if (!singleLoggerInstance) {
singleLoggerInstance = new LocalLogger(conf);
singleLoggerInstances.push(singleLoggerInstance);
}
if (conf.logLevel && singleLoggerInstance.logLevel !== conf.logLevel) {
singleLoggerInstance.setLogLevel(conf.logLevel);