Compare commits

..
Author SHA1 Message Date
maciek 6ceb4d0588 chore: tweaking catching no market data error 2023-03-01 12:17:19 +01:00
maciek fe8a8fa3ec chore: tweaking catching no market data error 2023-03-01 12:03:31 +01:00
35 changed files with 342 additions and 421 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ on:
type: choice
options:
- explorer-e2e
- governance-e2e
- token-e2e
- trading-e2e
tags:
description: 'Test tags to run'
+1 -1
View File
@@ -10,5 +10,5 @@ jobs:
uses: ./.github/workflows/cypress-run.yml
secrets: inherit
with:
projects: '["explorer-e2e","governance-e2e","trading-e2e"]'
projects: '["explorer-e2e","token-e2e","trading-e2e"]'
tags: '@smoke @regression @slow'
+2 -2
View File
@@ -42,10 +42,10 @@ jobs:
affected=$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects)
echo -n "Affected projects: $affected"
projects=""
if [[ $affected == *"governance"* ]]; then projects+='"governance-e2e" '; fi
if [[ $affected == *"token"* ]]; then projects+='"token-e2e" '; fi
if [[ $affected == *"trading"* ]]; then projects+='"trading-e2e" '; fi
if [[ $affected == *"explorer"* ]]; then projects+='"explorer-e2e" '; fi
if [[ -z "$projects" ]]; then projects+='"governance-e2e" "trading-e2e" "explorer-e2e" '; fi
if [[ -z "$projects" ]]; then projects+='"token-e2e" "trading-e2e" "explorer-e2e" '; fi
projects=${projects%?}
projects=[${projects// /,}]
echo PROJECTS=$projects >> $GITHUB_ENV
-2
View File
@@ -12,8 +12,6 @@ on:
- react-helpers
- tailwindcss-config
- types
- utils
- i18n
jobs:
publish:
+1 -1
View File
@@ -161,7 +161,7 @@ In order to setup and run vegawallet for e2e capsule tests, in a separate termin
bash setup-vegawallet.sh
```
3. copy generated `api-token` and paste the token into `CYPRESS_VEGA_WALLET_API_TOKEN` environment variable in either `apps/governance-e2e/.env` or `apps/explorer-e2e/.env` depending on which project needs testing.
3. copy generated `api-token` and paste the token into `CYPRESS_VEGA_WALLET_API_TOKEN` environment variable in either `apps/token-e2e/.env` or `apps/explorer-e2e/.env` depending on which project needs testing.
Note: The script is only needed if capsule was built for first time or fresh. To run existing wallet service for capsule:
+1 -1
View File
@@ -1,6 +1,6 @@
# App configuration variables
NX_TENDERMINT_URL=https://tm.be.devnet1.vega.xyz/tm
NX_TENDERMINT_WEBSOCKET_URL=wss://be.devnet1.vega.xyz/websocket
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.be.devnet1.vega.xyz/websocket
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
NX_VEGA_ENV=DEVNET
+2 -2
View File
@@ -1,10 +1,10 @@
# App configuration variables
NX_TENDERMINT_URL=https://be.explorer.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://be.explorer.vega.xyz/websocket
NX_TENDERMINT_WEBSOCKET_URL=wss://be.explorer.vega.xyz
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
NX_VEGA_ENV=MAINNET
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_BLOCK_EXPLORER=https://be.explorer.vega.xyz/rest/
NX_ETHERSCAN_URL=https://etherscan.io
NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz
NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz
+1 -1
View File
@@ -1,6 +1,6 @@
# App configuration variables
NX_TENDERMINT_URL=https://tm.be.mainnet-mirror.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://be.mainnet-mirror.vega.xyz/websocket
NX_TENDERMINT_WEBSOCKET_URL=https://tm.be.mainnet-mirror.vega.xyz
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mirror-network.json
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_ENV=MIRROR
+1 -1
View File
@@ -7,6 +7,6 @@ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
NX_TENDERMINT_URL=https://tm.sandbox.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://be.sandbox.vega.xyz/websocket
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.sandbox.vega.xyz/websocket
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_GOVERNANCE_URL=https://sandbox.token.vega.xyz
+1 -1
View File
@@ -1,5 +1,5 @@
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
NX_TENDERMINT_WEBSOCKET_URL=wss://be.stagnet3.vega.xyz/websocket
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n00.stagnet3.vega.xyz/websocket
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
NX_VEGA_ENV=STAGNET3
+1 -1
View File
@@ -1,7 +1,7 @@
# App configuration variables
NX_TENDERMINT_URL=https://tm.be.testnet.vega.xyz
NX_BLOCK_EXPLORER=https://be.testnet.vega.xyz/rest
NX_TENDERMINT_WEBSOCKET_URL=wss://be.testnet.vega.xyz/websocket
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.be.testnet.vega.xyz/websocket/
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
NX_VEGA_ENV=TESTNET
+1 -1
View File
@@ -11,4 +11,4 @@ NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
NX_VEGA_GOVERNANCE_URL=https://validator-testnet.governance.vega.xyz
NX_TENDERMINT_URL=https://tm.be.validators-testnet.vega.xyz
NX_BLOCK_EXPLORER=https://be.validators-testnet.vega.xyz/rest
NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega.xyz/websocket
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.be.validators-testnet.vega.xyz/websocket/
@@ -22,3 +22,29 @@ query ExplorerFutureEpoch {
}
}
}
# query ExplorerEpoch($id: ID!) {
#
##### This could be useful for calculating roughly when a future epoch will
##### occur, but epoch not exist results in a total error
# networkParameter(key: "validators.epoch.length") {
# value
# }
#
##### This could be useful for relating where we are in time, but as above
##### the total failure caused by epoch(id) not existing
##### means this is useful
# currentEpoch: epoch {
# id
# }
#
# epoch(id: $id) {
# id
# timestamps {
# start
# end
# firstBlock
# lastBlock
# }
# }
#}
@@ -101,7 +101,7 @@ const DeterministicOrderDetails = ({
{t('Remaining')}
</h2>
<h5 className="text-lg font-medium text-gray-500 mb-0">
<SizeInMarket size={o.remaining} marketId={o.market.id} />
{o.remaining}
</h5>
</div>
)}
+2 -2
View File
@@ -19,8 +19,8 @@ module.exports = defineConfig({
supportFile: './src/support/index.js',
video: false,
videoUploadOnPasses: false,
videosFolder: '../../dist/cypress/apps/governance-e2e/videos',
screenshotsFolder: '../../dist/cypress/apps/governance-e2e/screenshots',
videosFolder: '../../dist/cypress/apps/token-e2e/videos',
screenshotsFolder: '../../dist/cypress/apps/token-e2e/screenshots',
chromeWebSecurity: false,
viewportWidth: 1440,
viewportHeight: 900,
@@ -11,7 +11,7 @@ export const EthConnectPrompt = () => {
const { appDispatch } = useAppState();
return (
<Button
variant="default"
variant="primary"
onClick={() =>
appDispatch({
type: AppStateActionType.SET_ETH_WALLET_OVERLAY,
@@ -336,7 +336,6 @@
"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",
@@ -483,7 +482,6 @@
"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",
@@ -554,6 +552,9 @@
"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,12 +15,7 @@ export const DisassociateContainer = () => {
<>
<Heading title={t('pageTitleDisassociate')} />
{!account ? (
<>
<p className="mb-8">{t('DisassociateVegaTokensFromWallet')}</p>
<div className="max-w-[400px]">
<EthConnectPrompt />
</div>
</>
<EthConnectPrompt />
) : (
<DisassociatePage address={account} vegaKey={pubKey ?? ''} />
)}
@@ -1,12 +1,15 @@
import { useWeb3React } from '@web3-react/core';
import { useState } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
import { useEthereumConfig } from '@vegaprotocol/web3';
import { SubHeading } from '../../components/heading';
import { TrancheItem } from '../redemption/tranche-item';
import { TrancheLabel } from './tranche-label';
import { useTranches } from '../../lib/tranches/tranches-store';
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 { useTranches } from '../../lib/tranches/tranches-store';
const trancheMinimum = 10;
@@ -15,7 +18,7 @@ const shouldShowTranche = (t: Tranche) =>
export const Tranches = () => {
const tranches = useTranches((state) => state.tranches);
const [showAll, setShowAll] = useState<boolean>(false);
const [showAll, setShowAll] = React.useState<boolean>(false);
const { t } = useTranslation();
const { chainId } = useWeb3React();
const { config } = useEthereumConfig();
@@ -27,6 +30,10 @@ 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) => {
@@ -48,7 +55,6 @@ export const Tranches = () => {
) : (
<p>{t('No tranches')}</p>
)}
<section className="text-center mt-4">
<ButtonLink onClick={() => setShowAll(!showAll)}>
{showAll
@@ -0,0 +1,149 @@
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,14 +17,12 @@ 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>
{() => <WithdrawPendingContainer />}
{(currVegaKey) => <WithdrawPendingContainer />}
</VegaWalletContainer>
</>
);
@@ -1,5 +0,0 @@
# App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/validator-testnet-network.json
NX_VEGA_URL=https://api.validators-testnet.vega.xyz/graphql
NX_VEGA_NETWORKS='{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}'
NX_VEGA_ENV=VALIDATOR_TESTNET
+43 -208
View File
@@ -2761,7 +2761,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "86666.297",
"total_removed": "0",
"locked_amount": "65752.1635199045224671036",
"locked_amount": "66243.522619730595190252",
"deposits": [
{
"amount": "86666.297",
@@ -2827,7 +2827,7 @@
"tranche_end": "2023-06-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
"locked_amount": "1235.1503675722425",
"locked_amount": "1263.57600732600725",
"deposits": [
{
"amount": "2500",
@@ -2948,7 +2948,7 @@
"tranche_end": "2023-09-01T00:00:00.000Z",
"total_added": "17500",
"total_removed": "0",
"locked_amount": "17302.07374069041875",
"locked_amount": "17498.8903985507255",
"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": "3500.377436025",
"locked_amount": "31267.73758824432375",
"total_removed": "3376.096819125",
"locked_amount": "31696.477900552485",
"deposits": [
{
"amount": "7500",
@@ -3239,16 +3239,6 @@
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x1a73c48a20c37eb5f8214ecb3c1986d0b6a24ae6472533c556ec6c264814abb6"
},
{
"amount": "75.466160175",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x7d9d6e2a37fbe030faf08b7b1b0fc5b09f1f4295c4d7f4e28e0bdac1bdd294ac"
},
{
"amount": "48.814456725",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x9e42c457fa017043dbbcb189fb3a574719ce66ce348eee850db3bd809014b1fd"
},
{
"amount": "142.173112275",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -3309,18 +3299,6 @@
"tranche_id": 34,
"tx": "0x1a73c48a20c37eb5f8214ecb3c1986d0b6a24ae6472533c556ec6c264814abb6"
},
{
"amount": "75.466160175",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 34,
"tx": "0x7d9d6e2a37fbe030faf08b7b1b0fc5b09f1f4295c4d7f4e28e0bdac1bdd294ac"
},
{
"amount": "48.814456725",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 34,
"tx": "0x9e42c457fa017043dbbcb189fb3a574719ce66ce348eee850db3bd809014b1fd"
},
{
"amount": "142.173112275",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -3359,8 +3337,8 @@
}
],
"total_tokens": "7500",
"withdrawn_tokens": "1225.264253325",
"remaining_tokens": "6274.735746675"
"withdrawn_tokens": "1100.983636425",
"remaining_tokens": "6399.016363575"
},
{
"address": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600",
@@ -3392,7 +3370,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
"locked_amount": "65692.1729439470503785",
"locked_amount": "66183.0837404197105596",
"deposits": [
{
"amount": "129999.45",
@@ -3458,7 +3436,7 @@
"tranche_end": "2023-09-03T00:00:00.000Z",
"total_added": "62600",
"total_removed": "0",
"locked_amount": "31543.35908802638962",
"locked_amount": "31898.27305936073208",
"deposits": [
{
"amount": "10000",
@@ -3651,7 +3629,7 @@
"tranche_end": "2023-09-17T00:00:00.000Z",
"total_added": "5000",
"total_removed": "0",
"locked_amount": "2711.2184487569765",
"locked_amount": "2739.566210045662",
"deposits": [
{
"amount": "5000",
@@ -3862,7 +3840,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "97499.58",
"total_removed": "0",
"locked_amount": "7660.1037782103571237062",
"locked_amount": "8141.6415391408092444606",
"deposits": [
{
"amount": "97499.58",
@@ -3895,7 +3873,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "135173.4239508",
"total_removed": "98230.390980249184455396",
"locked_amount": "10470.039403066276125235594836",
"locked_amount": "11128.218388231931879326063704",
"deposits": [
{
"amount": "135173.4239508",
@@ -3941,7 +3919,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "32499.86",
"total_removed": "0",
"locked_amount": "3222.4733765764461183784",
"locked_amount": "3425.0479968875506615442",
"deposits": [
{
"amount": "32499.86",
@@ -3974,7 +3952,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "10833.29",
"total_removed": "0",
"locked_amount": "1048.8838139341641135251",
"locked_amount": "1114.8198871078435790832",
"deposits": [
{
"amount": "10833.29",
@@ -4007,7 +3985,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "22749.93",
"total_removed": "4720.860935375",
"locked_amount": "3920.9619604548439563678",
"locked_amount": "4167.4457285340302852478",
"deposits": [
{
"amount": "6500",
@@ -4158,8 +4136,8 @@
"tranche_start": "2022-11-01T00:00:00.000Z",
"tranche_end": "2023-05-01T00:00:00.000Z",
"total_added": "22500",
"total_removed": "5037.424704525",
"locked_amount": "7324.17846454880325",
"total_removed": "4913.13257745",
"locked_amount": "7581.4226519337009",
"deposits": [
{
"amount": "7500",
@@ -4183,16 +4161,6 @@
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0xe5b0236fdb114d861139db0bdec5bdc26b4e107ff73eb66bc4ba262a003fd872"
},
{
"amount": "75.4719153",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x27d0868963dc1e725d9b4da891a4df20b48107f1b0c803dd3f752362aa1d4335"
},
{
"amount": "48.820211775",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x1690b7e9232984baf6a441b517de44cb2c9c547f100e9e8acc8d7e144e01b2b8"
},
{
"amount": "142.17311235",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -4308,18 +4276,6 @@
"tranche_id": 33,
"tx": "0xe5b0236fdb114d861139db0bdec5bdc26b4e107ff73eb66bc4ba262a003fd872"
},
{
"amount": "75.4719153",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 33,
"tx": "0x27d0868963dc1e725d9b4da891a4df20b48107f1b0c803dd3f752362aa1d4335"
},
{
"amount": "48.820211775",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 33,
"tx": "0x1690b7e9232984baf6a441b517de44cb2c9c547f100e9e8acc8d7e144e01b2b8"
},
{
"amount": "142.17311235",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -4430,8 +4386,8 @@
}
],
"total_tokens": "7500",
"withdrawn_tokens": "5037.424704525",
"remaining_tokens": "2462.575295475"
"withdrawn_tokens": "4913.13257745",
"remaining_tokens": "2586.86742255"
},
{
"address": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1",
@@ -4456,7 +4412,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "928642.9598472029154",
"locked_amount": "483222.589309578295592792",
"locked_amount": "494221.11463625557046169",
"deposits": [
{
"amount": "1852091.69",
@@ -36835,8 +36791,8 @@
"tranche_start": "2022-03-05T00:00:00.000Z",
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "618385.665327542135993",
"locked_amount": "767046.204261494651069018807",
"total_removed": "615950.831401702010493",
"locked_amount": "783947.108408790236382843098",
"deposits": [
{
"amount": "1998.95815",
@@ -37005,11 +36961,6 @@
}
],
"withdrawals": [
{
"amount": "2434.8339258401255",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tx": "0xcba878ae28c2c84219f8281dc2a57d0d9b6c99b7920900d5344c76aabe8f1e84"
},
{
"amount": "16659.576193025747093",
"user": "0xB523235B6c7C74DDB26b10E78bFb2d0Cb63Ae289",
@@ -37384,12 +37335,6 @@
}
],
"withdrawals": [
{
"amount": "2434.8339258401255",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tranche_id": 1,
"tx": "0xcba878ae28c2c84219f8281dc2a57d0d9b6c99b7920900d5344c76aabe8f1e84"
},
{
"amount": "6293.20485405503",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
@@ -37674,8 +37619,8 @@
}
],
"total_tokens": "187637.95",
"withdrawn_tokens": "148489.3376297531685",
"remaining_tokens": "39148.6123702468315"
"withdrawn_tokens": "146054.503703913043",
"remaining_tokens": "41583.446296086957"
},
{
"address": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e",
@@ -38195,8 +38140,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15870102.715470999700000001",
"total_removed": "587055.52353142020335452",
"locked_amount": "8019584.17687863003095029918098754518113",
"total_removed": "584996.67274505202169452",
"locked_amount": "8079513.697843178693280892781044398053528",
"deposits": [
{
"amount": "16249.93",
@@ -38735,36 +38680,6 @@
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tx": "0x3c76f03b71481a44c6ba2c7cea407f5f1bac60bcaa9242af18de287f94c8ed90"
},
{
"amount": "445.6540155068705",
"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",
@@ -40552,24 +40467,6 @@
"tranche_id": 2,
"tx": "0x1438fbbc780cb382033855d295fa2511deed15cd64506a62ae4e3cfe82b3678e"
},
{
"amount": "445.6540155068705",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"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",
@@ -41784,8 +41681,8 @@
}
],
"total_tokens": "259998.8875",
"withdrawn_tokens": "128372.00706198100925",
"remaining_tokens": "131626.88043801899075"
"withdrawn_tokens": "127367.16038718373625",
"remaining_tokens": "132631.72711281626375"
},
{
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
@@ -42018,12 +41915,6 @@
"tranche_id": 2,
"tx": "0x3c76f03b71481a44c6ba2c7cea407f5f1bac60bcaa9242af18de287f94c8ed90"
},
{
"amount": "394.58033601838216",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tranche_id": 2,
"tx": "0xe479984e1fc0f4a0040603b528c841013d6da2c890361ce5f4152256ea9dd009"
},
{
"amount": "1640.93679110232897",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
@@ -42266,8 +42157,8 @@
}
],
"total_tokens": "150551.801",
"withdrawn_tokens": "74280.53684729959763",
"remaining_tokens": "76271.26415270040237"
"withdrawn_tokens": "73885.95651128121547",
"remaining_tokens": "76665.84448871878453"
},
{
"address": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148",
@@ -42475,12 +42366,6 @@
"tranche_id": 2,
"tx": "0x1887d1fb77d9fa555dd5b55da307edc91e395f3a7e0ca5f874740f5a10077cdf"
},
{
"amount": "525.648824",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
"tranche_id": 2,
"tx": "0x132a15c0b5f8c6016ac1a90437b9dca119ebc2479cde9c702327653fa3c11750"
},
{
"amount": "2820.55961",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
@@ -42693,8 +42578,8 @@
}
],
"total_tokens": "200000",
"withdrawn_tokens": "98678.473066",
"remaining_tokens": "101321.526934"
"withdrawn_tokens": "98152.824242",
"remaining_tokens": "101847.175758"
},
{
"address": "0x1b956E6c00E238194B331eddEFF72Cb5f28A8d01",
@@ -43154,12 +43039,6 @@
}
],
"withdrawals": [
{
"amount": "133.7749515525265",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tranche_id": 2,
"tx": "0xed77ed534414a1949b1473707782223907e0ac001f899037ff822f10bd4a358a"
},
{
"amount": "345.7620519411935",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
@@ -43426,8 +43305,8 @@
}
],
"total_tokens": "12362.05",
"withdrawn_tokens": "6082.9485904763035",
"remaining_tokens": "6279.1014095236965"
"withdrawn_tokens": "5949.173638923777",
"remaining_tokens": "6412.876361076223"
},
{
"address": "0xb091D456d0dFCB94dcba6f355379056C5bb995fC",
@@ -44058,8 +43937,8 @@
"tranche_start": "2021-11-05T00:00:00.000Z",
"tranche_end": "2023-05-05T00:00:00.000Z",
"total_added": "14597706.0446472999",
"total_removed": "5578506.105997036447643656",
"locked_amount": "1682183.680275606109201953939978039",
"total_removed": "5577113.077460725181649906",
"locked_amount": "1737510.231376472448763806568635843",
"deposits": [
{
"amount": "129284.449",
@@ -44288,21 +44167,6 @@
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0x904f971f68cc70ba987688b8b26bcbd4e16ab1964b095de013e364f3ae7530c6"
},
{
"amount": "617.72306195194457525",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0xcc545119eac3fe838555697dae55ce68273cb4c5f414c8983bac9f7ef8338f2c"
},
{
"amount": "362.02846600644321975",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0xbecb2d5ad72cdfe972b450c388f111d9262c39896c71acceecb5f672e50c3ce9"
},
{
"amount": "413.27700835287819875",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0xa266ac6aa7627d396b9d1c668f80e26d95de431e9ed861922df4472e9158204b"
},
{
"amount": "800.792718381487871",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
@@ -47282,24 +47146,6 @@
"tranche_id": 3,
"tx": "0x904f971f68cc70ba987688b8b26bcbd4e16ab1964b095de013e364f3ae7530c6"
},
{
"amount": "617.72306195194457525",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"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",
@@ -49816,8 +49662,8 @@
}
],
"total_tokens": "359123.469575",
"withdrawn_tokens": "317403.12966652957263025",
"remaining_tokens": "41720.33990847042736975"
"withdrawn_tokens": "316010.1011302183066365",
"remaining_tokens": "43113.3684447816933635"
},
{
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
@@ -51161,7 +51007,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "5778205.3912159303",
"total_removed": "3077573.36197477479025324",
"locked_amount": "347737.542298906744323236374749015",
"locked_amount": "369597.397251054113600109778074383",
"deposits": [
{
"amount": "552496.6455",
@@ -53232,8 +53078,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
"total_removed": "35033.4420916090685",
"locked_amount": "121542.855688265356170957439167948",
"total_removed": "34992.4553336210685",
"locked_amount": "124220.90056009124187109393607304",
"deposits": [
{
"amount": "3000",
@@ -59887,11 +59733,6 @@
"user": "0x454D87e666a106F3545B7cde91F32aE8B9616a72",
"tx": "0xcefe8932dc5a8ef8bbbb4f4ac1ec86c2de0e064cab91c381e222411c4661d34a"
},
{
"amount": "40.986757988",
"user": "0xf751033D4e6864a88Be93E36258246F26AEf577c",
"tx": "0x2f4a8c1de411b2a4c858e06633748bd342c23e0ad30910fc30d562f59c86de36"
},
{
"amount": "57.900076104",
"user": "0x96d882E908C06cD697Ea07266Fb8D14ae129A50b",
@@ -78483,12 +78324,6 @@
}
],
"withdrawals": [
{
"amount": "40.986757988",
"user": "0xf751033D4e6864a88Be93E36258246F26AEf577c",
"tranche_id": 5,
"tx": "0x2f4a8c1de411b2a4c858e06633748bd342c23e0ad30910fc30d562f59c86de36"
},
{
"amount": "108.551141552",
"user": "0xf751033D4e6864a88Be93E36258246F26AEf577c",
@@ -78503,8 +78338,8 @@
}
],
"total_tokens": "400",
"withdrawn_tokens": "296.884766612",
"remaining_tokens": "103.115233388"
"withdrawn_tokens": "255.898008624",
"remaining_tokens": "144.101991376"
},
{
"address": "0x667ee9816155807e4120dba069CC42aED064399b",
+4 -3
View File
@@ -1,11 +1,12 @@
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://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_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_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,7 +24,6 @@ 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" />
+58
View File
@@ -0,0 +1,58 @@
.pre-loader {
display: flex;
width: 100%;
min-height: 100vh;
justify-content: center;
align-items: center;
.loader-item {
width: 10px;
height: 10px;
background: black;
}
.pre-loader-center {
align-items: center;
display: flex;
flex-direction: column;
}
.pre-loader-wrapper {
width: 50px;
height: 50px;
display: flex;
flex-wrap: wrap;
}
@for $i from 0 through 16 {
.loader-item:nth-child(#{$i}) {
@if $i % 2 == 0 {
animation-delay: #{$i * 50 * random(5)}ms;
animation-direction: reverse;
} @else {
animation-delay: #{$i * -50 * random(5)}ms;
animation-direction: alternate;
}
}
}
.loader-item {
animation: flickering 0.4s linear alternate infinite;
}
@keyframes flickering {
0% {
opacity: 1;
}
25% {
opacity: 1;
}
26% {
opacity: 0;
}
100% {
opacity: 0;
}
}
}
html.dark {
.pre-loader {
.loader-item {
background: white;
}
}
}
@@ -1,6 +1,5 @@
import { Tooltip } from '@vegaprotocol/ui-toolkit';
import type { ReactNode } from 'react';
import { useMemo } from 'react';
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
import type { Market, MarketData } from '@vegaprotocol/market-list';
import {
@@ -27,7 +26,7 @@ export const DealTicketFeeDetails = ({
marketData,
}: DealTicketFeeDetailsProps) => {
const feeDetails = useFeeDealTicketDetails(order, market, marketData);
const details = useMemo(() => getFeeDetailsValues(feeDetails), [feeDetails]);
const details = getFeeDetailsValues(feeDetails);
return (
<div>
{details.map(({ label, value, labelDescription, symbol }) => (
@@ -36,7 +36,6 @@ import {
usePersistedOrderStore,
usePersistedOrderStoreSubscription,
} from '@vegaprotocol/orders';
import { OrderType } from '@vegaprotocol/types';
export type TransactionStatus = 'default' | 'pending';
@@ -83,12 +82,7 @@ export const DealTicket = ({
const order = watch();
watch((orderData) => {
const persistable = !(
orderData.type === OrderType.TYPE_LIMIT && orderData.price === ''
);
if (persistable) {
setPersistedOrder(orderData as DealTicketFormFields);
}
setPersistedOrder(orderData as DealTicketFormFields);
});
usePersistedOrderStoreSubscription(market.id, (storedOrder) => {
@@ -375,7 +369,7 @@ const SummaryMessage = memo(
if (balanceError) {
return (
<div className="mb-2">
<MarginWarning balance={balance} margin={margin} asset={asset} />
<MarginWarning balance={balance} margin={margin} asset={asset} />;
</div>
);
}
@@ -27,7 +27,6 @@ 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 } =
@@ -47,18 +46,9 @@ export const RowData = ({
} = useBlockTimeSubscription();
useEffect(() => {
const timeout = setTimeout(() => {
if (!subData) {
setSubFailed(true);
}
}, 3000);
// stop polling if row has errored
}, [error, stopPolling]);
return () => {
clearTimeout(timeout);
};
}, [subData]);
// handle polling
useEffect(() => {
const handleStartPoll = () => startPolling(POLL_INTERVAL);
const handleStopPoll = () => stopPolling();
@@ -78,7 +68,6 @@ export const RowData = ({
};
}, [startPolling, stopPolling, error]);
// measure response time
useEffect(() => {
if (!isValidUrl(url)) return;
// every time we get data measure response speed
@@ -142,15 +131,6 @@ 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 && (
@@ -181,11 +161,11 @@ export const RowData = ({
</LayoutCell>
<LayoutCell
label={t('Subscription')}
isLoading={subFailed ? false : subLoading}
hasError={getSubFailed(subError, subFailed)}
isLoading={subLoading}
hasError={Boolean(subError)}
dataTestId="subscription-cell"
>
{getSubscriptionDisplayValue(subFailed, subData?.busEvents, subError)}
{getSubscriptionDisplayValue(subData?.busEvents, subError)}
</LayoutCell>
</>
);
@@ -215,11 +195,10 @@ const getBlockDisplayValue = (block?: number, error?: ApolloError) => {
};
const getSubscriptionDisplayValue = (
subFailed: boolean,
events?: { id: string }[] | null,
error?: ApolloError
) => {
if (subFailed || error) {
if (error) {
return t('No');
}
if (events?.length) {
@@ -22,11 +22,7 @@ import {
normalizeOrderAmendment,
useVegaTransactionStore,
} from '@vegaprotocol/wallet';
import type {
VegaTxState,
TransactionResult,
OrderTxUpdateFieldsFragment,
} from '@vegaprotocol/wallet';
import type { VegaTxState, TransactionResult } from '@vegaprotocol/wallet';
import { OrderEditDialog } from '../order-list/order-edit-dialog';
import type { OrderSubFieldsFragment } from '../../order-hooks';
import * as Schema from '@vegaprotocol/types';
@@ -207,19 +203,7 @@ export const OrderListManager = ({
fields.limitPrice,
fields.size
);
const originalOrder: OrderTxUpdateFieldsFragment = {
type: editOrder.type,
id: editOrder.id,
status: editOrder.status,
createdAt: editOrder.createdAt,
size: editOrder.size,
price: editOrder.price,
timeInForce: editOrder.timeInForce,
expiresAt: editOrder.expiresAt,
side: editOrder.side,
marketId: editOrder.market.id,
};
create({ orderAmendment }, originalOrder);
create({ orderAmendment });
setEditOrder(null);
}}
/>
@@ -1,6 +1,6 @@
import { captureException } from '@sentry/react';
import debounce from 'lodash/debounce';
import { useCallback, useEffect, useMemo } from 'react';
import { localLoggerFactory } from '@vegaprotocol/utils';
import { useEffect, useMemo } from 'react';
type ResizeObserverConfiguration = {
debounceTime: number;
@@ -19,26 +19,20 @@ 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(wrappedCb);
}, [wrappedCb]);
return new ResizeObserver(
options.debounceTime > 0
? debounce(callback, options.debounceTime)
: callback
);
}, [callback, options.debounceTime]);
useEffect(() => {
if (!observer || !target) return;
try {
observer.observe(target, options.config);
} catch (err) {
localLoggerFactory({ application: 'react-helpers' }).debug(err as Error);
captureException(err);
}
return () => observer?.disconnect();
}, [observer, options.config, target]);
@@ -82,7 +82,7 @@ export const Notification = ({
{title}
</div>
)}
<div className="text-sm [word-break:break-word]">{message}</div>
<div className="text-sm">{message}</div>
{buttonProps && (
<Button
size={buttonProps.size || 'sm'}
+4 -14
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,23 +148,13 @@ export class LocalLogger {
public get logLevel() {
return this._logLevel;
}
public get application() {
return this._application;
}
}
let singleLoggerInstances: LocalLogger[];
let singleLoggerInstance: 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);
@@ -2,16 +2,9 @@ import { useVegaTransactionStore } from './use-vega-transaction-store';
import { VegaTxStatus } from './use-vega-transaction';
import type { VegaStoredTxState } from './use-vega-transaction-store';
import type {
OrderAmendmentBody,
OrderCancellationBody,
WithdrawSubmissionBody,
} from './connectors/vega-connector';
import {
OrderStatus,
OrderTimeInForce,
OrderType,
Side,
} from '@vegaprotocol/types';
jest.mock('./utils', () => ({
...jest.requireActual('./utils'),
@@ -31,33 +24,6 @@ describe('useVegaTransactionStore', () => {
},
},
};
const orderAmendment: OrderAmendmentBody = {
orderAmendment: {
orderId:
'6a4fcd0ba478df2f284ef5f6d3c64a478cb8043d3afe36f66f92c0ed92631e64',
marketId:
'3aa2a828687cc3d59e92445d294891cbbd40e2165bbfb15674158ef5d4e8848d',
price: '1122',
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
sizeDelta: 0,
},
};
const originalOrder = {
type: OrderType.TYPE_LIMIT,
id: '6902dea1fa01f0b98cceb382cb9c95df244747fa27ba591de084cdd876d2f7c2',
status: OrderStatus.STATUS_ACTIVE,
createdAt: '2023-03-01T14:08:13.48478Z',
size: '12',
price: '1125',
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
expiresAt: null,
side: Side.SIDE_BUY,
marketId:
'3aa2a828687cc3d59e92445d294891cbbd40e2165bbfb15674158ef5d4e8848d',
};
const processedTransactionUpdate = {
status: VegaTxStatus.Pending,
txHash: 'txHash',
@@ -97,45 +63,6 @@ describe('useVegaTransactionStore', () => {
VegaTxStatus.Requested,
]);
});
it('updates an order with order amendment', () => {
useVegaTransactionStore.getState().create(orderAmendment, originalOrder);
useVegaTransactionStore.getState().create(orderAmendment, originalOrder);
useVegaTransactionStore.getState().create(orderAmendment, originalOrder);
const transaction = useVegaTransactionStore.getState().transactions[1];
useVegaTransactionStore
.getState()
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
.update(transaction!.id, { status: VegaTxStatus.Pending });
expect(
useVegaTransactionStore.getState().transactions.map((t) => t?.status)
).toEqual([
VegaTxStatus.Requested,
VegaTxStatus.Pending,
VegaTxStatus.Requested,
]);
expect(
useVegaTransactionStore
.getState()
.transactions.map((t) => t?.order?.price)
).toEqual(['1125', '1125', '1125']);
const result = {
orderAmendment: {
marketId:
'3aa2a828687cc3d59e92445d294891cbbd40e2165bbfb15674158ef5d4e8848d',
orderId:
'6a4fcd0ba478df2f284ef5f6d3c64a478cb8043d3afe36f66f92c0ed92631e64',
price: '1122',
sizeDelta: 0,
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
},
};
expect(
useVegaTransactionStore.getState().transactions.map((t) => t?.body)
).toStrictEqual([result, result, result]);
});
it('sets dialogOpen to false on dismiss', () => {
useVegaTransactionStore.getState().create(orderCancellation);
useVegaTransactionStore.getState().dismiss(0);
@@ -143,7 +70,6 @@ describe('useVegaTransactionStore', () => {
useVegaTransactionStore.getState().transactions[0]?.dialogOpen
).toEqual(false);
});
it('updates transaction result', () => {
useVegaTransactionStore.getState().create(withdrawSubmission);
useVegaTransactionStore.getState().update(0, processedTransactionUpdate);
@@ -154,7 +80,6 @@ describe('useVegaTransactionStore', () => {
useVegaTransactionStore.getState().transactions[0]?.transactionResult
).toEqual(transactionResult);
});
it('updates withdrawal', () => {
useVegaTransactionStore.getState().create(withdrawSubmission);
useVegaTransactionStore.getState().update(0, processedTransactionUpdate);
@@ -33,7 +33,7 @@ export interface VegaStoredTxState extends VegaTxState {
}
export interface VegaTransactionStore {
transactions: (VegaStoredTxState | undefined)[];
create: (tx: Transaction, order?: OrderTxUpdateFieldsFragment) => number;
create: (tx: Transaction) => number;
update: (
index: number,
update: Partial<
@@ -55,7 +55,7 @@ export interface VegaTransactionStore {
export const useVegaTransactionStore = create(
subscribeWithSelector<VegaTransactionStore>((set, get) => ({
transactions: [] as VegaStoredTxState[],
create: (body: Transaction, order?: OrderTxUpdateFieldsFragment) => {
create: (body: Transaction) => {
const transactions = get().transactions;
const now = new Date();
const transaction: VegaStoredTxState = {
@@ -68,7 +68,6 @@ export const useVegaTransactionStore = create(
signature: null,
status: VegaTxStatus.Requested,
dialogOpen: true,
order,
};
set({ transactions: transactions.concat(transaction) });
return transaction.id;
@@ -166,11 +165,7 @@ export const useVegaTransactionStore = create(
// TODO: handle multiple orders from batch market instructions
// Note: If multiple orders are submitted the first order ID is determined by hashing the signature of the transaction
// (see determineId function). For each subsequent order's ID, a hash of the previous orders ID is used
transaction.order =
isOrderAmendmentTransaction(transaction?.body) &&
transaction.order
? transaction.order // the transaction.order would be the original order amended
: order;
transaction.order = order;
transaction.status = VegaTxStatus.Complete;
transaction.dialogOpen = true;
transaction.updatedAt = new Date();