;
+ dialog: (props: DialogProps) => JSX.Element;
+ voteState: VoteState | null;
+ voteDatetime: Date | null;
+}
+
+export const UserVote = ({
+ proposal,
+ minVoterBalance,
+ spamProtectionMinTokens,
+ submit,
+ transaction,
+ dialog,
+ voteState,
+ voteDatetime,
+}: UserVoteProps) => {
+ const { pubKey } = useVegaWallet();
+
+ const { t } = useTranslation();
+
+ return (
+
+ {proposal?.state === ProposalState.STATE_OPEN ? (
+
+ ) : (
+
+ )}
+
+ {pubKey ? (
+ proposal && (
+
+ )
+ ) : (
+
+
+
+
+
{t('connectAVegaWalletToVote')}
+
+
+ {t('findOutMoreAboutHowToVote')}
+
+
+
+
+ )}
+
+ );
+};
diff --git a/apps/governance/src/routes/proposals/components/vote-details/vote-buttons.tsx b/apps/governance/src/routes/proposals/components/vote-details/vote-buttons.tsx
index 7199c9365..911c2d41a 100644
--- a/apps/governance/src/routes/proposals/components/vote-details/vote-buttons.tsx
+++ b/apps/governance/src/routes/proposals/components/vote-details/vote-buttons.tsx
@@ -190,14 +190,15 @@ export const VoteButtons = ({
(voteState === VoteState.Yes || voteState === VoteState.No) && (
{t('youVoted')}: {' '}
-
+
{t(`voteState_${voteState}`)}
{' '}
{voteDatetime ? (
- {format(voteDatetime, DATE_FORMAT_LONG)}.
+ on {format(voteDatetime, DATE_FORMAT_LONG)}.
) : null}
{proposalVotable ? (
{
setChangeVote(true);
diff --git a/apps/governance/src/routes/proposals/components/vote-details/vote-details.tsx b/apps/governance/src/routes/proposals/components/vote-details/vote-details.tsx
deleted file mode 100644
index b8fbb7c0a..000000000
--- a/apps/governance/src/routes/proposals/components/vote-details/vote-details.tsx
+++ /dev/null
@@ -1,255 +0,0 @@
-import { useTranslation } from 'react-i18next';
-import { formatDistanceToNow } from 'date-fns';
-import { RoundedWrapper, Icon, ExternalLink } from '@vegaprotocol/ui-toolkit';
-import { useVegaWallet } from '@vegaprotocol/wallet';
-import { ProposalState } from '@vegaprotocol/types';
-import { VoteProgress } from '@vegaprotocol/proposals';
-import { formatNumber } from '../../../../lib/format-number';
-import { ConnectToVega } from '../../../../components/connect-to-vega';
-import { useVoteInformation } from '../../hooks';
-import { CurrentProposalStatus } from '../current-proposal-status';
-import { VoteButtonsContainer } from './vote-buttons';
-import { SubHeading } from '../../../../components/heading';
-import { ProposalType } from '../proposal/proposal';
-import type { VoteValue } from '@vegaprotocol/types';
-import type { DialogProps, VegaTxState } from '@vegaprotocol/wallet';
-import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
-import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
-import type { VoteState } from './use-user-vote';
-
-interface VoteDetailsProps {
- proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
- minVoterBalance: string | null | undefined;
- spamProtectionMinTokens: string | null | undefined;
- proposalType: ProposalType | null;
- transaction: VegaTxState | null;
- submit: (voteValue: VoteValue, proposalId: string | null) => Promise;
- dialog: (props: DialogProps) => JSX.Element;
- voteState: VoteState | null;
- voteDatetime: Date | null;
-}
-
-export const VoteDetails = ({
- proposal,
- minVoterBalance,
- spamProtectionMinTokens,
- proposalType,
- submit,
- transaction,
- dialog,
- voteState,
- voteDatetime,
-}: VoteDetailsProps) => {
- const { pubKey } = useVegaWallet();
- const {
- totalTokensPercentage,
- participationMet,
- totalTokensVoted,
- totalLPTokensPercentage,
- noPercentage,
- noLPPercentage,
- yesPercentage,
- yesLPPercentage,
- yesTokens,
- noTokens,
- requiredMajorityPercentage,
- requiredMajorityLPPercentage,
- requiredParticipation,
- requiredParticipationLP,
- participationLPMet,
- } = useVoteInformation({ proposal });
-
- const { t } = useTranslation();
-
- const defaultDecimals = 2;
- const daysLeft = t('daysLeft', {
- daysLeft: formatDistanceToNow(new Date(proposal?.terms.closingDatetime)),
- });
-
- return (
- <>
- {proposalType === ProposalType.PROPOSAL_UPDATE_MARKET && (
-
-
-
-
-
-
- {'. '}
- {proposal?.state === ProposalState.STATE_OPEN ? daysLeft : null}
-
-
-
-
-
- {t('for')}
-
-
-
-
-
- {t('against')}
-
-
-
-
-
-
- {yesLPPercentage.toFixed(defaultDecimals)}%
-
-
- {t('majorityRequired')}{' '}
- {requiredMajorityLPPercentage.toFixed(defaultDecimals)}%
-
-
- {noLPPercentage.toFixed(defaultDecimals)}%
-
-
-
-
-
-
- {t('participation')}
- {': '}
- {participationLPMet ? (
- {t('met')}
- ) : (
- {t('notMet')}
- )}{' '}
- {formatNumber(totalLPTokensPercentage, defaultDecimals)}%
-
- {requiredParticipationLP && (
- <>
- ({formatNumber(requiredParticipationLP, defaultDecimals)}%{' '}
- {t('governanceRequired')})
- >
- )}
-
-
-
- )}
-
-
-
-
-
-
- {'. '}
- {proposal?.state === ProposalState.STATE_OPEN ? daysLeft : null}
-
-
-
-
- {t('for')}
-
-
-
- {t('against')}
-
-
-
-
-
- {yesPercentage.toFixed(defaultDecimals)}%
-
-
- {t('majorityRequired')}{' '}
- {requiredMajorityPercentage.toFixed(defaultDecimals)}%
-
-
- {noPercentage.toFixed(defaultDecimals)}%
-
-
-
-
- {' '}
- {formatNumber(yesTokens, defaultDecimals)}{' '}
-
-
-
- {formatNumber(noTokens, defaultDecimals)}
-
-
-
-
-
- {t('participation')}
- {': '}
- {participationMet ? (
- {t('met')}
- ) : (
- {t('notMet')}
- )}{' '}
- {formatNumber(totalTokensVoted, defaultDecimals)}{' '}
- {formatNumber(totalTokensPercentage, defaultDecimals)}%
-
- ({formatNumber(requiredParticipation, defaultDecimals)}%{' '}
- {t('governanceRequired')})
-
-
- {proposalType === ProposalType.PROPOSAL_UPDATE_MARKET && (
- {t('votingThresholdInfo')}
- )}
-
-
- {proposal?.state === ProposalState.STATE_OPEN ? (
-
- ) : (
-
- )}
-
- {pubKey ? (
- proposal && (
-
- )
- ) : (
-
-
-
-
-
{t('connectAVegaWalletToVote')}
-
-
- {t('findOutMoreAboutHowToVote')}
-
-
-
-
- )}
-
-
- >
- );
-};
diff --git a/apps/trading-e2e/src/integration/order-book.cy.ts b/apps/trading-e2e/src/integration/order-book.cy.ts
deleted file mode 100644
index 34cb68fce..000000000
--- a/apps/trading-e2e/src/integration/order-book.cy.ts
+++ /dev/null
@@ -1,117 +0,0 @@
-const orderbookTab = 'Orderbook';
-const orderbookTable = 'tab-orderbook';
-const askPrice = 'price-9894185';
-const bidPrice = 'price-9889001';
-const askVolume = 'ask-vol-9894185';
-const bidVolume = 'bid-vol-9889001';
-const askCumulative = 'cumulative-vol-9894185';
-const bidCumulative = 'cumulative-vol-9889001';
-const midPrice = 'last-traded-4612690000';
-const priceResolution = 'resolution';
-const dealTicketPrice = 'order-price';
-const dealTicketSize = 'order-size';
-const resPrice = 'price-990';
-
-describe('order book', { tags: '@smoke' }, () => {
- before(() => {
- cy.setOnBoardingViewed();
- cy.mockTradingPage();
- cy.mockSubscription();
- cy.visit('/#/markets/market-0');
- cy.wait('@Markets');
- });
-
- beforeEach(() => {
- cy.mockTradingPage();
- });
-
- it('show order book', () => {
- // 6003-ORDB-001
- // 6003-ORDB-002
- cy.getByTestId(orderbookTab).click();
- cy.getByTestId(orderbookTable).should('be.visible');
- cy.getByTestId(orderbookTable).should('not.be.empty');
- });
-
- it('show orders prices', () => {
- // 6003-ORDB-003
- cy.getByTestId(askPrice).should('have.text', '98.94185');
- cy.getByTestId(bidPrice).should('have.text', '98.89001');
- });
-
- it('show prices volumes', () => {
- // 6003-ORDB-004
- cy.getByTestId(askVolume).should('have.text', '1');
- cy.getByTestId(bidVolume).should('have.text', '1');
- });
-
- it('show prices cumulative volumes', () => {
- // 6003-ORDB-005
- cy.getByTestId(askCumulative).should('have.text', '38');
- cy.getByTestId(bidCumulative).should('have.text', '7');
- });
-
- it('show mid price', () => {
- // 6003-ORDB-006
- cy.getByTestId(midPrice).should('have.text', '46,126.90');
- });
-
- it('sort prices descending', () => {
- // 6003-ORDB-007
- const prices: number[] = [];
- cy.getByTestId(orderbookTable).within(() => {
- cy.get('[data-testid*=price]')
- .each(($el) => {
- prices.push(Number($el.text()));
- })
- .then(() => {
- expect(prices).to.deep.equal(prices.sort((a, b) => b - a));
- });
- });
- });
-
- it('copy price to deal ticket form', () => {
- // 6003-ORDB-009
- cy.getByTestId(askPrice).click();
- cy.getByTestId(dealTicketPrice).should('have.value', '98.94185');
- });
-
- it('copy size to deal ticket form', () => {
- // 6003-ORDB-009
- cy.getByTestId(bidCumulative).click();
- cy.getByTestId(dealTicketSize).should('have.value', '7');
- });
-
- it('copy size to deal ticket form', () => {
- // 6003-ORDB-009
- cy.getByTestId(bidVolume).click();
- cy.getByTestId(dealTicketSize).should('have.value', '1');
- });
-
- it('change price resolution', () => {
- // 6003-ORDB-008
- const resolutions = [
- '0.00000',
- '0.0000',
- '0.000',
- '0.00',
- '0.0',
- '0',
- '10',
- '100',
- '1,000',
- '10,000',
- ];
- cy.getByTestId(priceResolution).click();
- cy.get('[role="menu"]')
- .find('[role="menuitem"]')
- .each(($el, index) => {
- expect($el.text()).to.equal(resolutions[index]);
- });
-
- cy.get('[role="menuitem"]').eq(4).click();
- cy.getByTestId(resPrice).should('have.text', '99.0');
- cy.getByTestId(askPrice).should('not.exist');
- cy.getByTestId(bidPrice).should('not.exist');
- });
-});
diff --git a/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts b/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts
index fe82aee3e..d2bd1c0d6 100644
--- a/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts
+++ b/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts
@@ -24,6 +24,9 @@ describe('deal ticker order validation', { tags: '@smoke' }, () => {
beforeEach(() => {
cy.mockTradingPage();
+ cy.getByTestId('deal-ticket-fee-margin-required').within(() => {
+ cy.get('button').click();
+ });
});
describe('limit order', () => {
diff --git a/apps/trading/.env.mainnet b/apps/trading/.env.mainnet
index df13750fa..b02a11b93 100644
--- a/apps/trading/.env.mainnet
+++ b/apps/trading/.env.mainnet
@@ -16,12 +16,12 @@ NX_VEGA_CONSOLE_URL=https://console.vega.xyz
NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-mainnet/codfcglpplgmmlokgilfkpcjnmkbfiel
NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-mainnet
# TAG name of the current app version - TODO: bump to the latest upon release
-NX_APP_VERSION=v0.20.21-core-0.71.6
+NX_APP_VERSION=v0.21.0-core-0.72.14
# Cosmic elevator flags
-NX_SUCCESSOR_MARKETS=false
-NX_STOP_ORDERS=false
-# NX_ICEBERG_ORDERS
+NX_SUCCESSOR_MARKETS=true
+NX_STOP_ORDERS=true
+NX_ICEBERG_ORDERS=true
# NX_PRODUCT_PERPETUALS
NX_METAMASK_SNAPS=false
diff --git a/apps/trading/.env.mainnet-mirror b/apps/trading/.env.mainnet-mirror
index 9a575f33c..bde8e334b 100644
--- a/apps/trading/.env.mainnet-mirror
+++ b/apps/trading/.env.mainnet-mirror
@@ -19,9 +19,9 @@ NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-ma
NX_APP_VERSION=v0.20.19-core-0.71.6
# Cosmic elevator flags
-NX_SUCCESSOR_MARKETS=false
-NX_STOP_ORDERS=false
-# NX_ICEBERG_ORDERS
+NX_SUCCESSOR_MARKETS=true
+NX_STOP_ORDERS=true
+NX_ICEBERG_ORDERS=true
# NX_PRODUCT_PERPETUALS
NX_METAMASK_SNAPS=false
diff --git a/apps/trading/.env.stagnet1 b/apps/trading/.env.stagnet1
index 4a9bc1e46..f2e4129c8 100644
--- a/apps/trading/.env.stagnet1
+++ b/apps/trading/.env.stagnet1
@@ -19,6 +19,6 @@ NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-fa
# Cosmic elevator flags
NX_SUCCESSOR_MARKETS=true
NX_STOP_ORDERS=true
-# NX_ICEBERG_ORDERS
+NX_ICEBERG_ORDERS=true
# NX_PRODUCT_PERPETUALS
NX_METAMASK_SNAPS=true
diff --git a/apps/trading/.env.validators-testnet b/apps/trading/.env.validators-testnet
index c8e48e938..21af40de4 100644
--- a/apps/trading/.env.validators-testnet
+++ b/apps/trading/.env.validators-testnet
@@ -19,9 +19,9 @@ NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fa
NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-fairground
# Cosmic elevator flags
-NX_SUCCESSOR_MARKETS=false
-NX_STOP_ORDERS=false
-# NX_ICEBERG_ORDERS
+NX_SUCCESSOR_MARKETS=true
+NX_STOP_ORDERS=true
+NX_ICEBERG_ORDERS=true
# NX_PRODUCT_PERPETUALS
NX_METAMASK_SNAPS=false
diff --git a/apps/trading/client-pages/markets/markets-page.tsx b/apps/trading/client-pages/markets/markets-page.tsx
index b2403ccc9..b2f3e7bef 100644
--- a/apps/trading/client-pages/markets/markets-page.tsx
+++ b/apps/trading/client-pages/markets/markets-page.tsx
@@ -1,27 +1,49 @@
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 {
+ LocalStoragePersistTabs as Tabs,
+ Tab,
+ TradingAnchorButton,
+} from '@vegaprotocol/ui-toolkit';
import { Markets } from './markets';
import { Proposed } from './proposed';
import { usePageTitleStore } from '../../stores';
import { Closed } from './closed';
+import {
+ DApp,
+ TOKEN_NEW_MARKET_PROPOSAL,
+ useLinks,
+} from '@vegaprotocol/environment';
export const MarketsPage = () => {
const { updateTitle } = usePageTitleStore((store) => ({
updateTitle: store.updateTitle,
}));
+
+ const tokenLink = useLinks(DApp.Token);
+ const externalLink = tokenLink(TOKEN_NEW_MARKET_PROPOSAL);
+
useEffect(() => {
updateTitle(titlefy(['Markets']));
}, [updateTitle]);
+
return (
-
+
-
+
+ {t('Propose a new market')}
+
+ }
+ >
diff --git a/apps/trading/client-pages/markets/proposed.tsx b/apps/trading/client-pages/markets/proposed.tsx
index 009190e17..67a20cbc9 100644
--- a/apps/trading/client-pages/markets/proposed.tsx
+++ b/apps/trading/client-pages/markets/proposed.tsx
@@ -1,24 +1,6 @@
-import { t } from '@vegaprotocol/i18n';
-import {
- DApp,
- TOKEN_NEW_MARKET_PROPOSAL,
- useLinks,
-} from '@vegaprotocol/environment';
import { ProposalsList } from '@vegaprotocol/proposals';
-import { ExternalLink } from '@vegaprotocol/ui-toolkit';
import { SuccessorMarketRenderer } from './successor-market-cell';
export const Proposed = () => {
- const tokenLink = useLinks(DApp.Token);
- const externalLink = tokenLink(TOKEN_NEW_MARKET_PROPOSAL);
- return (
- <>
-
-
- {t('Propose a new market')}
-
- >
- );
+ return ;
};
diff --git a/apps/trading/client-pages/portfolio/account-history-container.tsx b/apps/trading/client-pages/portfolio/account-history-container.tsx
index 1dfb3d75f..90e2a88b6 100644
--- a/apps/trading/client-pages/portfolio/account-history-container.tsx
+++ b/apps/trading/client-pages/portfolio/account-history-container.tsx
@@ -4,7 +4,7 @@ import { useVegaWallet } from '@vegaprotocol/wallet';
import compact from 'lodash/compact';
import uniqBy from 'lodash/uniqBy';
import type { ChangeEvent } from 'react';
-import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useCallback, useMemo, useState } from 'react';
import type { AccountHistoryQuery } from './__generated__/AccountHistory';
import { useAccountHistoryQuery } from './__generated__/AccountHistory';
import * as Schema from '@vegaprotocol/types';
@@ -12,12 +12,13 @@ import type { AssetFieldsFragment } from '@vegaprotocol/assets';
import { useAssetsDataProvider } from '@vegaprotocol/assets';
import {
AsyncRenderer,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
Splash,
Toggle,
+ TradingButton,
+ TradingDropdown,
+ TradingDropdownContent,
+ TradingDropdownItem,
+ TradingDropdownTrigger,
} from '@vegaprotocol/ui-toolkit';
import { AccountTypeMapping } from '@vegaprotocol/types';
import { PriceChart } from 'pennant';
@@ -151,6 +152,7 @@ const AccountHistoryManager = ({
)
: null;
}, [accounts, marketFilterCb]);
+
const resolveMarket = useCallback(
(m: Market) => {
setMarket(m);
@@ -175,111 +177,110 @@ const AccountHistoryManager = ({
}),
[pubKey, asset, accountType, range, market?.id]
);
+
const { data } = useAccountHistoryQuery({
variables,
skip: !asset || !pubKey,
});
- const accountTypeMenu = useMemo(() => {
- return (
-
- {accountType
- ? `${
- AccountTypeMapping[
- accountType as keyof typeof Schema.AccountType
- ]
- } Account`
- : t('Select account type')}
-
- }
- >
-
- {[
- Schema.AccountType.ACCOUNT_TYPE_GENERAL,
- Schema.AccountType.ACCOUNT_TYPE_BOND,
- Schema.AccountType.ACCOUNT_TYPE_MARGIN,
- ].map((type) => (
- setAccountType(type as Schema.AccountType)}
- >
- {AccountTypeMapping[type as keyof typeof Schema.AccountType]}
-
- ))}
-
-
- );
- }, [accountType]);
- const assetsMenu = useMemo(() => {
- return (
-
- {asset ? asset.symbol : t('Select asset')}
-
- }
- >
-
- {assets.map((a) => (
- setAssetId(a.id)}>
- {a.symbol}
-
- ))}
-
-
- );
- }, [asset, assets, setAssetId]);
- const marketsMenu = useMemo(() => {
- return accountType === Schema.AccountType.ACCOUNT_TYPE_MARGIN &&
- markets?.length ? (
-
- {market
- ? market.tradableInstrument.instrument.code
- : t('Select market')}
-
- }
- >
-
- {market && (
- setMarket(null)}>
- {t('All markets')}
-
- )}
- {markets?.map((m) => (
- resolveMarket(m)}>
- {m.tradableInstrument.instrument.code}
-
- ))}
-
-
- ) : null;
- }, [markets, market, accountType, resolveMarket]);
-
- useEffect(() => {
- const itemAsset = market && getAsset(market);
- if (
- accountType !== Schema.AccountType.ACCOUNT_TYPE_MARGIN ||
- itemAsset?.id !== asset?.id
- ) {
- setMarket(null);
- }
- }, [accountType, asset?.id, market]);
-
return (
-
-
-
- <>
- {accountTypeMenu}
- {assetsMenu}
- {marketsMenu}
- >
+
+
+
+
+
+ {accountType
+ ? `${
+ AccountTypeMapping[
+ accountType as keyof typeof Schema.AccountType
+ ]
+ } Account`
+ : t('Select account type')}
+
+
+ }
+ >
+
+ {[
+ Schema.AccountType.ACCOUNT_TYPE_GENERAL,
+ Schema.AccountType.ACCOUNT_TYPE_BOND,
+ Schema.AccountType.ACCOUNT_TYPE_MARGIN,
+ ].map((type) => (
+ {
+ setAccountType(type as Schema.AccountType);
+
+ // if not a margin account clear any market selection
+ if (type !== Schema.AccountType.ACCOUNT_TYPE_MARGIN) {
+ setMarket(null);
+ }
+ }}
+ >
+ {AccountTypeMapping[type as keyof typeof Schema.AccountType]}
+
+ ))}
+
+
+
+
+
+ {asset ? asset.symbol : t('Select asset')}
+
+
+ }
+ >
+
+ {assets.map((a) => (
+ {
+ setAssetId(a.id);
+
+ // if the selected asset is different to the selected market clear the market
+ if (market && a.id !== getAsset(market).id) {
+ setMarket(null);
+ }
+ }}
+ >
+ {a.symbol}
+
+ ))}
+
+
+
+
+ {market
+ ? market.tradableInstrument.instrument.code
+ : t('Select market')}
+
+
+ }
+ >
+
+ {market && (
+ setMarket(null)}>
+ {t('All markets')}
+
+ )}
+ {markets?.map((m) => (
+ resolveMarket(m)}
+ >
+ {m.tradableInstrument.instrument.code}
+
+ ))}
+
+
-
+
) =>
setRange(e.target.value as keyof typeof DateRange)
}
+ size="sm"
/>
-
diff --git a/apps/trading/components/market-selector/asset-dropdown.tsx b/apps/trading/components/market-selector/asset-dropdown.tsx
index aed0b0cb4..d0bcefb0c 100644
--- a/apps/trading/components/market-selector/asset-dropdown.tsx
+++ b/apps/trading/components/market-selector/asset-dropdown.tsx
@@ -1,13 +1,12 @@
import { t } from '@vegaprotocol/i18n';
import {
- DropdownMenu,
- DropdownMenuCheckboxItem,
- DropdownMenuContent,
- DropdownMenuItemIndicator,
- DropdownMenuTrigger,
- VegaIcon,
- VegaIconNames,
+ TradingDropdown,
+ TradingDropdownCheckboxItem,
+ TradingDropdownContent,
+ TradingDropdownItemIndicator,
+ TradingDropdownTrigger,
} from '@vegaprotocol/ui-toolkit';
+import { MarketSelectorButton } from './market-selector-button';
type Assets = Array<{ id: string; symbol: string }>;
@@ -25,17 +24,19 @@ export const AssetDropdown = ({
}
return (
-
-
-
+
+
+ {triggerText({ assets, checkedAssets })}
+
+
}
>
-
- {assets.filter(Boolean).map((a) => {
+
+ {assets?.map((a) => {
return (
- {
@@ -46,16 +47,16 @@ export const AssetDropdown = ({
data-testid={`asset-id-${a.id}`}
>
{a.symbol}
-
-
+
+
);
})}
-
-
+
+
);
};
-const TriggerText = ({
+const triggerText = ({
assets,
checkedAssets,
}: {
@@ -72,9 +73,5 @@ const TriggerText = ({
text = t(`${checkedAssets.length} Assets`);
}
- return (
-
- {text}
-
- );
+ return text;
};
diff --git a/apps/trading/components/market-selector/index.ts b/apps/trading/components/market-selector/index.ts
index ddd159890..6a16773bb 100644
--- a/apps/trading/components/market-selector/index.ts
+++ b/apps/trading/components/market-selector/index.ts
@@ -1,2 +1,3 @@
export * from './market-selector';
export * from './market-selector-item';
+export * from './market-selector-button';
diff --git a/apps/trading/components/market-selector/market-selector-button.tsx b/apps/trading/components/market-selector/market-selector-button.tsx
new file mode 100644
index 000000000..90ae6cacf
--- /dev/null
+++ b/apps/trading/components/market-selector/market-selector-button.tsx
@@ -0,0 +1,23 @@
+import { VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit';
+import classNames from 'classnames';
+import type { ButtonHTMLAttributes } from 'react';
+import { forwardRef } from 'react';
+
+export const MarketSelectorButton = forwardRef<
+ HTMLButtonElement,
+ ButtonHTMLAttributes
+>((props, ref) => (
+
+ {props.children}
+
+
+));
+MarketSelectorButton.displayName = 'MarketSelectorButton';
diff --git a/apps/trading/components/market-selector/market-selector-item.tsx b/apps/trading/components/market-selector/market-selector-item.tsx
index 094e0a7e6..65583f6fa 100644
--- a/apps/trading/components/market-selector/market-selector-item.tsx
+++ b/apps/trading/components/market-selector/market-selector-item.tsx
@@ -31,7 +31,7 @@ export const MarketSelectorItem = ({
-
+
{market.tradableInstrument.instrument.code}{' '}
{allProducts && productType && (
@@ -107,25 +106,23 @@ const MarketData = ({
)}
- {instrument.product && (
-
- {price} {symbol}
-
- )}
+ {price} {symbol}
+
+
{volume}
-
+
{oneDayCandles && (
+
{Object.keys(Product).map((t) => {
- const classes = classNames('px-3 py-1.5 rounded', {
- 'bg-vega-clight-500 dark:bg-vega-cdark-500 text-default':
- t === product,
- 'text-secondary': t !== product,
- });
+ const classes = classNames(
+ 'text-sm px-3 py-1.5 rounded hover:text-vega-clight-50 dark:hover:text-vega-cdark-50',
+ {
+ 'bg-vega-clight-500 dark:bg-vega-cdark-500 text-default':
+ t === product,
+ 'text-secondary': t !== product,
+ }
+ );
return (
{t('Browse')}
diff --git a/apps/trading/components/market-selector/sort-dropdown.tsx b/apps/trading/components/market-selector/sort-dropdown.tsx
index 285d6d566..c2ba4097f 100644
--- a/apps/trading/components/market-selector/sort-dropdown.tsx
+++ b/apps/trading/components/market-selector/sort-dropdown.tsx
@@ -1,13 +1,14 @@
import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItemIndicator,
- DropdownMenuRadioGroup,
- DropdownMenuRadioItem,
- DropdownMenuTrigger,
+ TradingDropdown,
+ TradingDropdownContent,
+ TradingDropdownItemIndicator,
+ TradingDropdownRadioGroup,
+ TradingDropdownRadioItem,
+ TradingDropdownTrigger,
VegaIcon,
VegaIconNames,
} from '@vegaprotocol/ui-toolkit';
+import { MarketSelectorButton } from './market-selector-button';
export const Sort = {
Gained: 'Gained',
@@ -44,24 +45,23 @@ export const SortDropdown = ({
onSelect: (sort: SortType) => void;
}) => {
return (
-
-
+
+
{SortTypeMapping[currentSort]}
-
-
-
+
+
}
>
-
-
+ onSelect(value as SortType)}
>
{Object.keys(Sort).map((key) => {
return (
- {' '}
{SortTypeMapping[key as SortType]}
-
-
+
+
);
})}
-
-
-
+
+
+
);
};
diff --git a/apps/trading/components/vega-wallet-container/index.ts b/apps/trading/components/vega-wallet-container/index.ts
deleted file mode 100644
index 58aa4c53c..000000000
--- a/apps/trading/components/vega-wallet-container/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './vega-wallet-container';
diff --git a/apps/trading/components/vega-wallet-container/vega-wallet-container.spec.tsx b/apps/trading/components/vega-wallet-container/vega-wallet-container.spec.tsx
deleted file mode 100644
index d4ee4d5cb..000000000
--- a/apps/trading/components/vega-wallet-container/vega-wallet-container.spec.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { render, screen } from '@testing-library/react';
-import { VegaWalletContainer } from './vega-wallet-container';
-import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
-import { VegaWalletContext } from '@vegaprotocol/wallet';
-import type { PartialDeep } from 'type-fest';
-
-const generateJsx = (context: PartialDeep) => {
- return (
-
-
-
-
-
- );
-};
-
-describe('VegaWalletContainer', () => {
- it('doesnt render children if not connected', () => {
- render(generateJsx({ pubKey: null }));
- expect(screen.queryByTestId('child')).not.toBeInTheDocument();
- });
-
- it('renders children if connected', () => {
- render(generateJsx({ pubKey: '0x123' }));
- expect(screen.getByTestId('child')).toBeInTheDocument();
- });
-});
diff --git a/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx b/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx
deleted file mode 100644
index 18d72ecae..000000000
--- a/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import type { ReactNode } from 'react';
-import { t } from '@vegaprotocol/i18n';
-import { Button, Splash } from '@vegaprotocol/ui-toolkit';
-import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet';
-
-interface VegaWalletContainerProps {
- children: ReactNode;
-}
-
-export const VegaWalletContainer = ({ children }: VegaWalletContainerProps) => {
- const { openVegaWalletDialog } = useVegaWalletDialogStore((store) => ({
- openVegaWalletDialog: store.openVegaWalletDialog,
- }));
- const { pubKey } = useVegaWallet();
-
- if (!pubKey) {
- return (
-
-
-
- {t('Connect your Vega wallet')}
-
-
- {t('Connect')}
-
-
-
- );
- }
-
- return <>{children}>;
-};
diff --git a/apps/trading/components/welcome-dialog/telemetry-approval.tsx b/apps/trading/components/welcome-dialog/telemetry-approval.tsx
index 5b38c2963..0c21a4cd3 100644
--- a/apps/trading/components/welcome-dialog/telemetry-approval.tsx
+++ b/apps/trading/components/welcome-dialog/telemetry-approval.tsx
@@ -16,29 +16,32 @@ export const TelemetryApproval = ({
setTelemetryValue,
}: Props) => {
return (
-
+
-
+
{t(
'Help us identify bugs and improve Vega Governance by sharing anonymous usage data.'
)}
-
-
-
-
-
{t('Anonymous')}
-
{t('Your identity is always anonymous on Vega')}
+
+
+
+
+
{t('Anonymous')}
+
+ {t('Your identity is always anonymous on Vega')}
+
-
-
-
-
-
{t('Optional')}
-
{t('You can opt out any time via settings')}
+
+
+
+
{t('Optional')}
+
+ {t('You can opt out any time via settings')}
+
-
+
setTelemetryValue('false')}
size="small"
diff --git a/apps/trading/components/welcome-dialog/welcome-dialog.tsx b/apps/trading/components/welcome-dialog/welcome-dialog.tsx
index a3c42cdf1..7f7cbb06e 100644
--- a/apps/trading/components/welcome-dialog/welcome-dialog.tsx
+++ b/apps/trading/components/welcome-dialog/welcome-dialog.tsx
@@ -92,7 +92,7 @@ export const WelcomeDialog = () => {
intent: Intent.Primary,
content: (
<>
-
+
{t('Improve vega console')}
-
{t('Deposit')}
-
-
+
{t('Withdraw')}
-
-
+
{t('Transfer')}
-
-
+
{t('View usage breakdown')}
-
-
+ {
openAssetDialog(assetId, e.target as HTMLElement);
}}
>
{t('View asset details')}
-
-
+
+
{assetContractAddress && (
-
+
-
+
)}
);
diff --git a/libs/accounts/src/lib/accounts-table.tsx b/libs/accounts/src/lib/accounts-table.tsx
index 847868230..413eb9338 100644
--- a/libs/accounts/src/lib/accounts-table.tsx
+++ b/libs/accounts/src/lib/accounts-table.tsx
@@ -11,9 +11,13 @@ import type {
VegaValueFormatterParams,
} from '@vegaprotocol/datagrid';
import { COL_DEFS } from '@vegaprotocol/datagrid';
-import { Button, VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit';
-
-import { TooltipCellComponent } from '@vegaprotocol/ui-toolkit';
+import {
+ Intent,
+ TradingButton,
+ VegaIcon,
+ VegaIconNames,
+ TooltipCellComponent,
+} from '@vegaprotocol/ui-toolkit';
import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid';
import type {
IGetRowsParams,
@@ -186,7 +190,7 @@ export const AccountTable = ({
) : (
<>
{valueFormatted}
-
+
{t('0.00%')}
>
@@ -248,26 +252,26 @@ export const AccountTable = ({
colId: 'accounts-actions',
field: 'asset.id',
...COL_DEFS.actions,
- minWidth: showDepositButton ? 130 : COL_DEFS.actions.minWidth,
- maxWidth: showDepositButton ? 130 : COL_DEFS.actions.maxWidth,
+ minWidth: showDepositButton ? 105 : COL_DEFS.actions.minWidth,
+ maxWidth: showDepositButton ? 105 : COL_DEFS.actions.maxWidth,
cellRenderer: ({
value: assetId,
node,
}: VegaICellRendererParams) => {
if (!assetId) return null;
- if (node.rowPinned && node.data?.total === '0') {
+ if (node.rowPinned && node.data?.balance === '0') {
return (
- {
onClickDeposit && onClickDeposit(assetId);
}}
>
{t('Deposit')}
-
+
);
}
diff --git a/libs/accounts/src/lib/transfer-form.tsx b/libs/accounts/src/lib/transfer-form.tsx
index a3e81c4c7..f0adcba94 100644
--- a/libs/accounts/src/lib/transfer-form.tsx
+++ b/libs/accounts/src/lib/transfer-form.tsx
@@ -8,7 +8,6 @@ import {
} from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import {
- Button,
TradingFormGroup,
TradingInput,
TradingInputError,
@@ -16,6 +15,7 @@ import {
TradingSelect,
Tooltip,
TradingCheckbox,
+ TradingButton,
} from '@vegaprotocol/ui-toolkit';
import type { Transfer } from '@vegaprotocol/wallet';
import { normalizeTransfer } from '@vegaprotocol/wallet';
@@ -276,9 +276,9 @@ export const TransferForm = ({
decimals={asset?.decimals}
/>
)}
-
+
{t('Confirm transfer')}
-
+
);
};
@@ -309,8 +309,8 @@ export const TransferFee = ({
const totalValue = new BigNumber(transferAmount).plus(fee).toString();
return (
-
-
+
+
-
+
-
+
!curr);
onChange();
}}
- className="ml-auto text-sm absolute top-0 right-0 underline"
+ className="absolute top-0 right-0 ml-auto text-sm underline"
>
{isInput ? t('Select from wallet') : t('Enter manually')}
diff --git a/libs/assets/src/lib/asset-details-dialog.tsx b/libs/assets/src/lib/asset-details-dialog.tsx
index 1fb26fe48..9f2fa7503 100644
--- a/libs/assets/src/lib/asset-details-dialog.tsx
+++ b/libs/assets/src/lib/asset-details-dialog.tsx
@@ -2,9 +2,10 @@ import { t } from '@vegaprotocol/i18n';
import {
Button,
Dialog,
- Icon,
Splash,
SyntaxHighlighter,
+ VegaIcon,
+ VegaIconNames,
} from '@vegaprotocol/ui-toolkit';
import { create } from 'zustand';
import { AssetDetailsTable } from './asset-details-table';
@@ -82,7 +83,7 @@ export const AssetDetailsDialog = ({
return (
}
+ icon={ }
open={open}
onChange={(isOpen) => onChange(isOpen)}
onCloseAutoFocus={(e) => {
@@ -97,7 +98,7 @@ export const AssetDetailsDialog = ({
}}
>
{content}
-
+
{t(
'There is 1 unit of the settlement asset (%s) to every 1 quote unit.',
[assetSymbol]
diff --git a/libs/assets/src/lib/asset-details-table.tsx b/libs/assets/src/lib/asset-details-table.tsx
index eca9a30a3..f6ef156a9 100644
--- a/libs/assets/src/lib/asset-details-table.tsx
+++ b/libs/assets/src/lib/asset-details-table.tsx
@@ -3,11 +3,8 @@ import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import type * as Schema from '@vegaprotocol/types';
import type { KeyValueTableRowProps } from '@vegaprotocol/ui-toolkit';
-import {
- CopyWithTooltip,
- Icon,
- truncateMiddle,
-} from '@vegaprotocol/ui-toolkit';
+import { VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit';
+import { CopyWithTooltip, truncateMiddle } from '@vegaprotocol/ui-toolkit';
import {
KeyValueTable,
KeyValueTableRow,
@@ -118,7 +115,7 @@ export const rows: Rows = [
{' '}
-
+
>
diff --git a/libs/candles-chart/src/lib/candles-menu.spec.tsx b/libs/candles-chart/src/lib/candles-menu.spec.tsx
index 85f8b5b24..9289581bd 100644
--- a/libs/candles-chart/src/lib/candles-menu.spec.tsx
+++ b/libs/candles-chart/src/lib/candles-menu.spec.tsx
@@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event';
import { CandlesMenu } from './candles-menu';
describe('CandlesMenu', () => {
- it('should render with volume study showing by default', async () => {
+ it('should render with the correct default studies', async () => {
render( );
await userEvent.click(
@@ -13,5 +13,21 @@ describe('CandlesMenu', () => {
);
expect(await screen.findByRole('menu')).toBeInTheDocument();
expect(screen.getByText('Volume')).toHaveAttribute('data-state', 'checked');
+ expect(screen.getByText('MACD')).toHaveAttribute('data-state', 'checked');
+ });
+
+ it('should render with the correct default overlays', async () => {
+ render( );
+
+ await userEvent.click(
+ screen.getByRole('button', {
+ name: 'Overlays',
+ })
+ );
+ expect(await screen.findByRole('menu')).toBeInTheDocument();
+ expect(screen.getByText('Moving average')).toHaveAttribute(
+ 'data-state',
+ 'checked'
+ );
});
});
diff --git a/libs/candles-chart/src/lib/use-candles-chart-settings.ts b/libs/candles-chart/src/lib/use-candles-chart-settings.ts
index 78e5f81f9..cce6fb5b5 100644
--- a/libs/candles-chart/src/lib/use-candles-chart-settings.ts
+++ b/libs/candles-chart/src/lib/use-candles-chart-settings.ts
@@ -15,8 +15,8 @@ interface StoredSettings {
const DEFAULT_CHART_SETTINGS = {
interval: Interval.I15M,
type: ChartType.CANDLE,
- overlays: [],
- studies: [Study.VOLUME],
+ overlays: [Overlay.MOVING_AVERAGE],
+ studies: [Study.MACD, Study.VOLUME],
};
export const useCandlesChartSettingsStore = create<
diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx
index 776426450..4275a10cd 100644
--- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx
+++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx
@@ -12,6 +12,8 @@ import { formatRange, formatValue } from '@vegaprotocol/utils';
import { marketMarginDataProvider } from '@vegaprotocol/accounts';
import { useDataProvider } from '@vegaprotocol/data-provider';
+import * as Accordion from '@radix-ui/react-accordion';
+
import {
MARGIN_DIFF_TOOLTIP_TEXT,
DEDUCTION_FROM_COLLATERAL_TOOLTIP_TEXT,
@@ -22,6 +24,7 @@ import {
} from '../../constants';
import { useEstimateFees } from '../../hooks';
import { KeyValue } from './key-value';
+import { TOOLTIP_TRIGGER_CLASS_NAME } from '@vegaprotocol/ui-toolkit';
const emptyValue = '-';
@@ -242,55 +245,72 @@ export const DealTicketMarginDetails = ({
return (
<>
-
-
- {deductionFromCollateral}
- setBreakdownDialog(true) : undefined
- }
- value={formatValue(marginAccountBalance, assetDecimals)}
- symbol={assetSymbol}
- labelDescription={MARGIN_ACCOUNT_TOOLTIP_TEXT}
- formattedValue={formatValue(
- marginAccountBalance,
- assetDecimals,
- quantum
- )}
- />
+
+
+
+ {t('Margin required')}
+
+ }
+ value={formatRange(
+ marginRequiredBestCase,
+ marginRequiredWorstCase,
+ assetDecimals
+ )}
+ formattedValue={formatRange(
+ marginRequiredBestCase,
+ marginRequiredWorstCase,
+ assetDecimals,
+ quantum
+ )}
+ labelDescription={MARGIN_DIFF_TOOLTIP_TEXT(assetSymbol)}
+ symbol={assetSymbol}
+ />
+
+
+ {deductionFromCollateral}
+ setBreakdownDialog(true)
+ : undefined
+ }
+ value={formatValue(marginAccountBalance, assetDecimals)}
+ symbol={assetSymbol}
+ labelDescription={MARGIN_ACCOUNT_TOOLTIP_TEXT}
+ formattedValue={formatValue(
+ marginAccountBalance,
+ assetDecimals,
+ quantum
+ )}
+ />
+
+
+
{projectedMargin}
{
target: { value: '8' },
});
- fireEvent.click(
- screen.getByText('Deposit', { selector: '[type="submit"]' })
- );
+ fireEvent.click(screen.getByRole('button', { name: 'Deposit' }));
await waitFor(() => {
expect(props.submitDeposit).toHaveBeenCalledWith({
diff --git a/libs/deposits/src/lib/deposit-form.tsx b/libs/deposits/src/lib/deposit-form.tsx
index 0044592c2..0bee8999f 100644
--- a/libs/deposits/src/lib/deposit-form.tsx
+++ b/libs/deposits/src/lib/deposit-form.tsx
@@ -13,7 +13,6 @@ import {
import { t } from '@vegaprotocol/i18n';
import { useLocalStorage } from '@vegaprotocol/react-helpers';
import {
- Button,
TradingFormGroup,
TradingInput,
TradingInputError,
@@ -23,6 +22,7 @@ import {
ButtonLink,
TradingSelect,
truncateMiddle,
+ TradingButton,
} from '@vegaprotocol/ui-toolkit';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { useWeb3React } from '@web3-react/core';
@@ -186,14 +186,14 @@ export const DepositForm = ({
);
}
return (
-
{t('Connect')}
-
+
);
}}
/>
@@ -435,15 +435,14 @@ const FormButton = ({ approved, selectedAsset }: FormButtonProps) => {
/>
)}
-
{t('Deposit')}
-
+
>
);
};
@@ -455,7 +454,7 @@ const UseButton = (props: UseButtonProps) => {
);
};
@@ -513,7 +512,7 @@ export const AddressField = ({
setIsInput((curr) => !curr);
onChange();
}}
- className="ml-auto text-sm absolute top-0 right-0 underline"
+ className="absolute top-0 right-0 ml-auto text-sm underline"
data-testid="enter-pubkey-manually"
>
{isInput ? t('Select from wallet') : t('Enter manually')}
diff --git a/libs/ledger/src/lib/ledger-export-form.tsx b/libs/ledger/src/lib/ledger-export-form.tsx
index 8ef4fcff2..708314e89 100644
--- a/libs/ledger/src/lib/ledger-export-form.tsx
+++ b/libs/ledger/src/lib/ledger-export-form.tsx
@@ -1,7 +1,7 @@
import { useRef, useState } from 'react';
import { z } from 'zod';
import {
- Button,
+ TradingButton,
Loader,
TradingFormGroup,
TradingInput,
@@ -157,15 +157,14 @@ export const LedgerExportForm = ({ partyId, vegaUrl, assets }: Props) => {
)}
-
{t('Download')}
-
+
);
diff --git a/libs/market-depth/src/lib/orderbook-controls.tsx b/libs/market-depth/src/lib/orderbook-controls.tsx
index 62c3f6b0a..b41e146e2 100644
--- a/libs/market-depth/src/lib/orderbook-controls.tsx
+++ b/libs/market-depth/src/lib/orderbook-controls.tsx
@@ -7,7 +7,7 @@ import {
TradingDropdownContent,
TradingDropdownItem,
} from '@vegaprotocol/ui-toolkit';
-import { formatNumberFixed } from '@vegaprotocol/utils';
+import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
export const OrderbookControls = ({
lastTradedPrice,
@@ -15,27 +15,14 @@ export const OrderbookControls = ({
decimalPlaces,
setResolution,
}: {
- lastTradedPrice: string | undefined;
+ lastTradedPrice: string;
resolution: number;
decimalPlaces: number;
setResolution: (resolution: number) => void;
}) => {
const [isOpen, setOpen] = useState(false);
- const resolutions = new Array(
- Math.max(lastTradedPrice?.toString().length ?? 0, decimalPlaces + 1)
- )
- .fill(null)
- .map((v, i) => Math.pow(10, i));
-
- const formatResolution = (r: number) => {
- return formatNumberFixed(
- Math.log10(r) - decimalPlaces > 0
- ? Math.pow(10, Math.log10(r) - decimalPlaces)
- : 0,
- decimalPlaces - Math.log10(r)
- );
- };
+ const resolutions = createResolutions(lastTradedPrice, decimalPlaces);
const increaseResolution = () => {
const index = resolutions.indexOf(resolution);
@@ -56,7 +43,7 @@ export const OrderbookControls = ({
= resolutions.length - 1}
- className="flex items-center px-2 border-r cursor-pointer border-default"
+ className="flex items-center px-2 border-r cursor-pointer border-default disabled:cursor-default"
data-testid="plus-button"
>
@@ -67,12 +54,14 @@ export const OrderbookControls = ({
trigger={
formatResolution(item).length)
+ resolutions.map(
+ (item) => formatResolution(item, decimalPlaces).length
+ )
) + 5
}ch`,
}}
@@ -83,15 +72,19 @@ export const OrderbookControls = ({
isOpen ? VegaIconNames.CHEVRON_UP : VegaIconNames.CHEVRON_DOWN
}
/>
- {formatResolution(resolution)}
+ {formatResolution(resolution, decimalPlaces)}
}
>
{resolutions.map((r) => (
- setResolution(r)}>
- {formatResolution(r)}
+ setResolution(r)}
+ className="justify-end"
+ >
+ {formatResolution(r, decimalPlaces)}
))}
@@ -99,7 +92,7 @@ export const OrderbookControls = ({
@@ -107,3 +100,49 @@ export const OrderbookControls = ({
);
};
+
+export const formatResolution = (r: number, decimalPlaces: number) => {
+ let num = addDecimalsFormatNumber(r, decimalPlaces);
+
+ // Remove trailing zeroes
+ num = num.replace(/\.?0+$/, '');
+
+ return num;
+};
+
+/**
+ * Create a list of resolutions based on the largest and smallest
+ * possible values using the last traded price and the market
+ * decimal places
+ */
+export const createResolutions = (
+ lastTradedPrice: string,
+ decimalPlaces: number
+) => {
+ // number of levels determined by either the number
+ // of digits in the last traded price OR the number of decimal
+ // places. For example:
+ //
+ // last traded = 1 (0.001)
+ // dps = 3
+ // result = 3
+ //
+ // last traded = 100001 (1000.01
+ // dps = 2
+ // result = 6
+ const levelCount = Math.max(lastTradedPrice.length ?? 0, decimalPlaces + 1);
+ const generatedResolutions = new Array(levelCount)
+ .fill(null)
+ .map((_, i) => Math.pow(10, i));
+ const customResolutions = [2, 5, 20, 50, 200, 500];
+ const combined = customResolutions.concat(generatedResolutions);
+ combined.sort((a, b) => a - b);
+
+ // Remove any resolutions higher than the generated ones as
+ // we dont want a custom resolution higher than necessary
+ const resolutions = combined.filter((r) => {
+ return r <= generatedResolutions[generatedResolutions.length - 1];
+ });
+
+ return resolutions;
+};
diff --git a/libs/market-depth/src/lib/orderbook-data.ts b/libs/market-depth/src/lib/orderbook-data.ts
index 31be1491a..2b81eb6e5 100644
--- a/libs/market-depth/src/lib/orderbook-data.ts
+++ b/libs/market-depth/src/lib/orderbook-data.ts
@@ -12,7 +12,7 @@ export interface OrderbookRowData {
cumulativeVol: number;
}
-export const getPriceLevel = (price: string | bigint, resolution: number) => {
+export const getPriceLevel = (price: string, resolution: number) => {
const p = BigInt(price);
const r = BigInt(resolution);
let priceLevel = (p / r) * r;
@@ -43,7 +43,7 @@ const updateCumulativeVolumeByType = (
};
export const compactRows = (
- data: PriceLevelFieldsFragment[] | null | undefined,
+ data: PriceLevelFieldsFragment[],
dataType: VolumeType,
resolution: number
) => {
diff --git a/libs/market-depth/src/lib/orderbook-row.tsx b/libs/market-depth/src/lib/orderbook-row.tsx
index 82cc238c1..e6e2ffcb2 100644
--- a/libs/market-depth/src/lib/orderbook-row.tsx
+++ b/libs/market-depth/src/lib/orderbook-row.tsx
@@ -13,6 +13,7 @@ interface OrderbookRowProps {
cumulativeVolume: number;
decimalPlaces: number;
positionDecimalPlaces: number;
+ priceFormatDecimalPlaces: number;
price: string;
onClick: (args: { price?: string; size?: string }) => void;
type: VolumeType;
@@ -26,6 +27,7 @@ export const OrderbookRow = memo(
cumulativeVolume,
decimalPlaces,
positionDecimalPlaces,
+ priceFormatDecimalPlaces,
price,
onClick,
type,
@@ -35,6 +37,7 @@ export const OrderbookRow = memo(
const txtId = type === VolumeType.bid ? 'bid' : 'ask';
const cols =
width >= HIDE_CUMULATIVE_VOL_WIDTH ? 3 : width >= HIDE_VOL_WIDTH ? 2 : 1;
+
return (
{
jest.clearAllMocks();
mockOffsetSize(800, 768);
});
- it('markPrice should be in the middle', async () => {
+
+ it('lastTradedPrice should be in the middle', async () => {
render(
{
expect(
await screen.findByTestId(`last-traded-${params.lastTradedPrice}`)
).toBeInTheDocument();
+
// Before resolution change the price is 122.934
await userEvent.click(screen.getByTestId('price-122901'));
expect(onClickSpy).toBeCalledWith({ price: '122.901' });
@@ -86,15 +89,16 @@ describe('Orderbook', () => {
expect(orderbookData.compactRows).toHaveBeenCalledWith(
mockedData.bids,
VolumeType.bid,
- 10
+ 2
);
expect(orderbookData.compactRows).toHaveBeenCalledWith(
mockedData.asks,
VolumeType.ask,
- 10
+ 2
);
- await userEvent.click(screen.getByTestId('price-12294'));
- expect(onClickSpy).toBeCalledWith({ price: '122.94' });
+
+ await userEvent.click(screen.getByTestId('price-122938'));
+ expect(onClickSpy).toBeCalledWith({ price: '122.938' });
});
it('plus - minus buttons should change resolution', async () => {
@@ -114,26 +118,30 @@ describe('Orderbook', () => {
1
);
expect(screen.getByTestId('minus-button')).toBeDisabled();
- userEvent.click(screen.getByTestId('plus-button'));
+ await userEvent.click(screen.getByTestId('plus-button'));
+ expect((orderbookData.compactRows as jest.Mock).mock.lastCall[2]).toEqual(
+ 2
+ );
+
+ await userEvent.click(screen.getByTestId('plus-button'));
+ expect((orderbookData.compactRows as jest.Mock).mock.lastCall[2]).toEqual(
+ 5
+ );
+
+ expect(screen.getByTestId('minus-button')).not.toBeDisabled();
+ await userEvent.click(screen.getByTestId('minus-button'));
await waitFor(() => {
expect((orderbookData.compactRows as jest.Mock).mock.lastCall[2]).toEqual(
- 10
+ 2
);
});
expect(screen.getByTestId('minus-button')).not.toBeDisabled();
- userEvent.click(screen.getByTestId('minus-button'));
- await waitFor(() => {
- expect((orderbookData.compactRows as jest.Mock).mock.lastCall[2]).toEqual(
- 1
- );
- });
- expect(screen.getByTestId('minus-button')).toBeDisabled();
- await userEvent.click(screen.getByTestId('resolution'));
+ await userEvent.click(screen.getByTestId('resolution'));
await waitFor(() => {
expect(screen.getByRole('menu')).toBeInTheDocument();
});
- await userEvent.click(screen.getAllByRole('menuitem')[5]);
+ await userEvent.click(screen.getAllByRole('menuitem')[11]);
await waitFor(() => {
expect((orderbookData.compactRows as jest.Mock).mock.lastCall[2]).toEqual(
100000
@@ -223,3 +231,58 @@ describe('OrderbookMid', () => {
expect(screen.getByTestId('icon-arrow-down')).toBeInTheDocument();
});
});
+
+describe('createResolutions', () => {
+ it('create resolutions relative to the market', () => {
+ expect(
+ createResolutions(
+ '1', // 0.001
+ 3
+ )
+ ).toEqual([1, 2, 5, 10, 20, 50, 100, 200, 500, 1000]);
+
+ expect(
+ createResolutions(
+ '190017', // 1900.17
+ 2
+ )
+ ).toEqual([1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 10000, 100000]);
+
+ expect(
+ createResolutions(
+ '123456789', // 1234.56789
+ 5
+ )
+ ).toEqual([
+ 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 10000, 100000, 1000000,
+ 10000000, 100000000,
+ ]);
+ });
+
+ it('removes resolutions that arent precise enough for the market', () => {
+ expect(
+ createResolutions(
+ '1', // 0.01
+ 2
+ )
+ ).toEqual([1, 2, 5, 10, 20, 50, 100]);
+ });
+});
+
+describe('formatResolution', () => {
+ it('formats less than 1', () => {
+ expect(formatResolution(1, 2)).toEqual('0.01');
+ expect(formatResolution(1, 3)).toEqual('0.001');
+ expect(formatResolution(2, 4)).toEqual('0.0002');
+ expect(formatResolution(5, 8)).toEqual('0.00000005');
+ expect(formatResolution(10000, 5)).toEqual('0.1');
+ });
+
+ it('formats greater than 1', () => {
+ expect(formatResolution(1000, 2)).toEqual('10');
+ expect(formatResolution(100000, 4)).toEqual('10');
+ expect(formatResolution(10000000, 2)).toEqual('100,000');
+ expect(formatResolution(500, 2)).toEqual('5');
+ expect(formatResolution(500, 1)).toEqual('50');
+ });
+});
diff --git a/libs/market-depth/src/lib/orderbook.tsx b/libs/market-depth/src/lib/orderbook.tsx
index 145ddbb30..8d4878817 100644
--- a/libs/market-depth/src/lib/orderbook.tsx
+++ b/libs/market-depth/src/lib/orderbook.tsx
@@ -23,6 +23,7 @@ const OrderbookSide = ({
type,
decimalPlaces,
positionDecimalPlaces,
+ priceFormatDecimalPlaces,
onClick,
width,
maxVol,
@@ -31,6 +32,7 @@ const OrderbookSide = ({
resolution: number;
decimalPlaces: number;
positionDecimalPlaces: number;
+ priceFormatDecimalPlaces: number;
type: VolumeType;
onClick: (args: { price?: string; size?: string }) => void;
width: number;
@@ -53,10 +55,11 @@ const OrderbookSide = ({
{rows.map((data) => (
@@ -203,6 +212,7 @@ export const Orderbook = ({
resolution={resolution}
decimalPlaces={decimalPlaces}
positionDecimalPlaces={positionDecimalPlaces}
+ priceFormatDecimalPlaces={priceFormatDecimalPlaces}
onClick={onClick}
width={width}
maxVol={maxVol}
@@ -220,6 +230,7 @@ export const Orderbook = ({
resolution={resolution}
decimalPlaces={decimalPlaces}
positionDecimalPlaces={positionDecimalPlaces}
+ priceFormatDecimalPlaces={priceFormatDecimalPlaces}
onClick={onClick}
width={width}
maxVol={maxVol}
diff --git a/libs/markets/src/lib/markets-provider.ts b/libs/markets/src/lib/markets-provider.ts
index 5fe37a720..021b78fca 100644
--- a/libs/markets/src/lib/markets-provider.ts
+++ b/libs/markets/src/lib/markets-provider.ts
@@ -199,7 +199,7 @@ export const allMarketsWithLiveDataProvider = makeDerivedDataProvider<
return data.find(
(market) =>
market.id ===
- (parts[1].delta as MarketDataUpdateFieldsFragment).marketId
+ (parts[1].delta as MarketDataUpdateFieldsFragment)?.marketId
);
}
);
diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx
index 4710035b7..4ccfd2aa9 100644
--- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx
+++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx
@@ -12,9 +12,10 @@ import {
TradingFormGroup,
TradingInput,
TradingInputError,
- Button,
Dialog,
- Icon,
+ VegaIcon,
+ VegaIconNames,
+ TradingButton,
} from '@vegaprotocol/ui-toolkit';
import { useForm } from 'react-hook-form';
import type { Order } from '../order-data-provider';
@@ -37,7 +38,7 @@ export const OrderEditDialog = ({
order,
onSubmit,
}: OrderEditDialogProps) => {
- const headerClassName = 'text-lg font-bold text-black dark:text-white';
+ const headerClassName = 'text-xs font-bold text-black dark:text-white';
const {
register,
formState: { errors },
@@ -57,13 +58,13 @@ export const OrderEditDialog = ({
open={isOpen}
onChange={onChange}
title={t('Edit order')}
- icon={
}
+ icon={
}
>
{order.market && (
{t(`Market`)}
-
{t(`${order.market.tradableInstrument.instrument.name}`)}
+
{order.market.tradableInstrument.instrument.code}
)}
{order.type === Schema.OrderType.TYPE_LIMIT && order.market && (
@@ -149,9 +150,7 @@ export const OrderEditDialog = ({
)}
-
- {t('Update')}
-
+
{t('Update')}
);
diff --git a/libs/orders/src/lib/components/order-list/order-list.tsx b/libs/orders/src/lib/components/order-list/order-list.tsx
index aca064bd0..a98821a53 100644
--- a/libs/orders/src/lib/components/order-list/order-list.tsx
+++ b/libs/orders/src/lib/components/order-list/order-list.tsx
@@ -10,7 +10,7 @@ import {
ActionsDropdown,
ButtonLink,
TradingDropdownCopyItem,
- DropdownMenuItem,
+ TradingDropdownItem,
VegaIcon,
VegaIconNames,
} from '@vegaprotocol/ui-toolkit';
@@ -271,19 +271,20 @@ export const OrderListTable = memo<
{
colId: 'amend',
...COL_DEFS.actions,
- minWidth: showAllActions ? 90 : COL_DEFS.actions.minWidth,
- maxWidth: showAllActions ? 90 : COL_DEFS.actions.minWidth,
+ minWidth: showAllActions ? 80 : COL_DEFS.actions.minWidth,
+ maxWidth: showAllActions ? 80 : COL_DEFS.actions.minWidth,
cellRenderer: ({ data }: { data?: Order }) => {
if (!data) return null;
return (
-
+
{isOrderAmendable(data) && !props.isReadOnly && (
<>
{!data.icebergOrder && (
onEdit(data)}
+ title={t('Edit order')}
>
@@ -291,6 +292,7 @@ export const OrderListTable = memo<
onCancel(data)}
+ title={t('Cancel order')}
>
@@ -301,14 +303,14 @@ export const OrderListTable = memo<
value={data.id}
text={t('Copy order ID')}
/>
- onView(data)}
>
{t('View order details')}
-
+
);
diff --git a/libs/orders/src/lib/components/stop-orders-table/stop-orders-table.tsx b/libs/orders/src/lib/components/stop-orders-table/stop-orders-table.tsx
index 9af429a0e..5c8a9e049 100644
--- a/libs/orders/src/lib/components/stop-orders-table/stop-orders-table.tsx
+++ b/libs/orders/src/lib/components/stop-orders-table/stop-orders-table.tsx
@@ -12,7 +12,7 @@ import {
ButtonLink,
VegaIcon,
VegaIconNames,
- DropdownMenuItem,
+ TradingDropdownItem,
TradingDropdownCopyItem,
Pill,
} from '@vegaprotocol/ui-toolkit';
@@ -246,7 +246,7 @@ export const StopOrdersTable = memo(
if (!data) return null;
return (
-
+
{data.status === Schema.StopOrderStatus.STATUS_PENDING &&
!props.isReadOnly && (
-
@@ -273,7 +273,7 @@ export const StopOrdersTable = memo(
>
{t('View order details')}
-
+
)}
diff --git a/libs/positions/src/lib/positions-table.spec.tsx b/libs/positions/src/lib/positions-table.spec.tsx
index 7dc85c5d1..ed2aebf4c 100644
--- a/libs/positions/src/lib/positions-table.spec.tsx
+++ b/libs/positions/src/lib/positions-table.spec.tsx
@@ -61,7 +61,7 @@ describe('Positions', () => {
'Market',
'Size / Notional',
'Entry / Mark',
- 'Margin',
+ 'Margin / Leverage',
'Liquidation',
'Realised PNL',
'Unrealised PNL',
diff --git a/libs/positions/src/lib/positions-table.tsx b/libs/positions/src/lib/positions-table.tsx
index 11d7ce1c1..a7ef20e93 100644
--- a/libs/positions/src/lib/positions-table.tsx
+++ b/libs/positions/src/lib/positions-table.tsx
@@ -292,7 +292,7 @@ export const PositionsTable = ({
},
},
{
- headerName: t('Margin'),
+ headerName: t('Margin / Leverage'),
colId: 'margin',
type: 'rightAligned',
cellClass: 'font-mono text-right',
@@ -456,13 +456,14 @@ export const PositionsTable = ({
...COL_DEFS.actions,
cellRenderer: ({ data }: VegaICellRendererParams
) => {
return (
-
+
{data?.openVolume &&
data?.openVolume !== '0' &&
data.partyId === pubKey ? (
data && onClose(data)}
+ title={t('Close position')}
>
@@ -548,9 +549,9 @@ const WarningCell = ({
showIcon?: boolean;
}) => {
return (
-
+
{showIcon && (
-
+
)}
diff --git a/libs/proposals/src/components/proposals-list/proposals-list.tsx b/libs/proposals/src/components/proposals-list/proposals-list.tsx
index 38ab2b753..9cdb01aef 100644
--- a/libs/proposals/src/components/proposals-list/proposals-list.tsx
+++ b/libs/proposals/src/components/proposals-list/proposals-list.tsx
@@ -35,16 +35,13 @@ export const ProposalsList = ({
const { columnDefs, defaultColDef } = useColumnDefs();
return (
-
-
data.id}
- overlayNoRowsTemplate={t('No markets')}
- components={{ SuccessorMarketRenderer, MarketNameProposalCell }}
- />
-
+ data.id}
+ overlayNoRowsTemplate={t('No markets')}
+ components={{ SuccessorMarketRenderer, MarketNameProposalCell }}
+ />
);
};
diff --git a/libs/react-helpers/src/hooks/use-number-parts.ts b/libs/react-helpers/src/hooks/use-number-parts.ts
index 606e854a8..2c3ba399d 100644
--- a/libs/react-helpers/src/hooks/use-number-parts.ts
+++ b/libs/react-helpers/src/hooks/use-number-parts.ts
@@ -5,6 +5,6 @@ import { toNumberParts } from '@vegaprotocol/utils';
export const useNumberParts = (
value: BigNumber | null | undefined,
decimals: number
-): [integers: string, decimalPlaces: string] => {
+): [integers: string, decimalPlaces: string, separator: string | undefined] => {
return useMemo(() => toNumberParts(value, decimals), [decimals, value]);
};
diff --git a/libs/ui-toolkit/src/components/icon/blueprint-icons/icon.tsx b/libs/ui-toolkit/src/components/icon/blueprint-icons/icon.tsx
index ca238b76a..5118d720f 100644
--- a/libs/ui-toolkit/src/components/icon/blueprint-icons/icon.tsx
+++ b/libs/ui-toolkit/src/components/icon/blueprint-icons/icon.tsx
@@ -7,7 +7,7 @@ export type { IconName } from '@blueprintjs/icons';
export interface IconProps {
name: IconName;
className?: string;
- size?: 2 | 3 | 4 | 6 | 8 | 10 | 12 | 14 | 16;
+ size?: 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 14 | 16;
ariaLabel?: string;
}
@@ -23,6 +23,7 @@ export const Icon = ({ size = 4, name, className, ariaLabel }: IconProps) => {
'w-2 h-2': size === 2,
'w-3 h-3': size === 3,
'w-4 h-4': size === 4,
+ 'w-5 h-5': size === 5,
'w-6 h-6': size === 6,
'w-8 h-8': size === 8,
'w-10 h-10': size === 10,
diff --git a/libs/ui-toolkit/src/components/icon/vega-icons/svg-icons/icon-info.tsx b/libs/ui-toolkit/src/components/icon/vega-icons/svg-icons/icon-info.tsx
index 84467122f..4005187f7 100644
--- a/libs/ui-toolkit/src/components/icon/vega-icons/svg-icons/icon-info.tsx
+++ b/libs/ui-toolkit/src/components/icon/vega-icons/svg-icons/icon-info.tsx
@@ -1,11 +1,6 @@
export const IconInfo = ({ size = 14 }: { size: number }) => {
return (
-
+
);
diff --git a/libs/ui-toolkit/src/components/toast/toast.tsx b/libs/ui-toolkit/src/components/toast/toast.tsx
index 89d7155cf..5c4b1c5c9 100644
--- a/libs/ui-toolkit/src/components/toast/toast.tsx
+++ b/libs/ui-toolkit/src/components/toast/toast.tsx
@@ -10,7 +10,7 @@ import { useCallback } from 'react';
import { useLayoutEffect } from 'react';
import { useRef } from 'react';
import { Intent } from '../../utils/intent';
-import { Icon } from '../icon';
+import { Icon, VegaIcon, VegaIconNames } from '../icon';
import { Loader } from '../loader';
import { t } from '@vegaprotocol/i18n';
@@ -317,18 +317,14 @@ export const Toast = ({
}
)}
>
-
+
-
+
diff --git a/libs/ui-toolkit/src/components/toast/toasts-container.tsx b/libs/ui-toolkit/src/components/toast/toasts-container.tsx
index 00fc88e4e..ae380b16d 100644
--- a/libs/ui-toolkit/src/components/toast/toasts-container.tsx
+++ b/libs/ui-toolkit/src/components/toast/toasts-container.tsx
@@ -3,7 +3,7 @@ import { usePrevious } from '@vegaprotocol/react-helpers';
import classNames from 'classnames';
import type { Ref } from 'react';
import { useLayoutEffect, useRef } from 'react';
-import { Button } from '../button';
+import { TradingButton } from '../trading-button';
import { Toast } from './toast';
import type { Toasts } from './use-toasts';
import { ToastPosition, useToasts, useToastsConfiguration } from './use-toasts';
@@ -87,26 +87,27 @@ export const ToastsContainer = ({
);
})}
- {
- closeAll();
- }}
- variant={'default'}
>
- {t('Dismiss all')}
-
+ {
+ closeAll();
+ }}
+ >
+ {t('Dismiss all')}
+
+
);
diff --git a/libs/ui-toolkit/src/components/tooltip/tooltip.tsx b/libs/ui-toolkit/src/components/tooltip/tooltip.tsx
index 9c629d785..fdbae9814 100644
--- a/libs/ui-toolkit/src/components/tooltip/tooltip.tsx
+++ b/libs/ui-toolkit/src/components/tooltip/tooltip.tsx
@@ -20,6 +20,9 @@ export interface TooltipProps {
sideOffset?: number;
}
+export const TOOLTIP_TRIGGER_CLASS_NAME =
+ 'underline underline-offset-2 decoration-neutral-400 dark:decoration-neutral-400 decoration-dashed';
+
// Conditionally rendered tooltip if description content is provided.
export const Tooltip = ({
children,
@@ -32,10 +35,7 @@ export const Tooltip = ({
description ? (
-
+
{children}
{description && (
diff --git a/libs/ui-toolkit/src/components/trading-dropdown/trading-dropdown.tsx b/libs/ui-toolkit/src/components/trading-dropdown/trading-dropdown.tsx
index 7d3db2ad3..fba456688 100644
--- a/libs/ui-toolkit/src/components/trading-dropdown/trading-dropdown.tsx
+++ b/libs/ui-toolkit/src/components/trading-dropdown/trading-dropdown.tsx
@@ -146,7 +146,7 @@ export const TradingDropdownItemIndicator = forwardRef<
diff --git a/libs/ui-toolkit/src/components/trading-input/input.tsx b/libs/ui-toolkit/src/components/trading-input/input.tsx
index 20345f08a..e50b4eda1 100644
--- a/libs/ui-toolkit/src/components/trading-input/input.tsx
+++ b/libs/ui-toolkit/src/components/trading-input/input.tsx
@@ -84,10 +84,8 @@ const getAffixElement = ({
'absolute z-10 top-0 bottom-0 flex items-center',
{
'fill-black dark:fill-white': prependIconName || appendIconName,
- 'left-3': prependIconName,
- 'right-3': appendIconName,
- 'left-1': prependElement,
- 'right-1': appendElement,
+ 'left-3': prependIconName || prependElement,
+ 'right-3': appendIconName || appendElement,
}
);
diff --git a/libs/ui-toolkit/src/components/trading-select/select.tsx b/libs/ui-toolkit/src/components/trading-select/select.tsx
index a8869a661..acae3b473 100644
--- a/libs/ui-toolkit/src/components/trading-select/select.tsx
+++ b/libs/ui-toolkit/src/components/trading-select/select.tsx
@@ -2,7 +2,7 @@ import type { Ref, SelectHTMLAttributes } from 'react';
import { useRef } from 'react';
import { forwardRef } from 'react';
import classNames from 'classnames';
-import { Icon } from '..';
+import { VegaIcon, VegaIconNames } from '..';
import { defaultSelectElement } from '../../utils/shared';
import * as SelectPrimitive from '@radix-ui/react-select';
@@ -16,7 +16,7 @@ export interface TradingSelectProps
export const TradingSelect = forwardRef(
({ className, hasError, ...props }, ref) => (
-
+
(
'appearance-none rounded-md'
)}
/>
-
+
+
+
)
);
@@ -52,7 +51,7 @@ export const TradingRichSelect = forwardRef<
return (
}
- className="flex items-center relative"
+ className="relative flex items-center"
>
-
-
+
+
@@ -85,12 +84,12 @@ export const TradingRichSelect = forwardRef<
side={'bottom'}
align={'center'}
>
-
-
+
+
{children}
-
-
+
+
@@ -123,7 +122,7 @@ export const TradingOption = forwardRef<
>
{children}
-
+
));
diff --git a/libs/utils/src/lib/format/number.spec.ts b/libs/utils/src/lib/format/number.spec.ts
index 119087fca..d30e14ab7 100644
--- a/libs/utils/src/lib/format/number.spec.ts
+++ b/libs/utils/src/lib/format/number.spec.ts
@@ -86,17 +86,17 @@ describe('number utils', () => {
describe('toNumberParts', () => {
it.each([
- { v: null, d: 3, o: ['0', '000'] },
- { v: undefined, d: 3, o: ['0', '000'] },
- { v: new BigNumber(123), d: 3, o: ['123', '00'] },
- { v: new BigNumber(123.123), d: 3, o: ['123', '123'] },
- { v: new BigNumber(123.123), d: 6, o: ['123', '123'] },
- { v: new BigNumber(123.123), d: 0, o: ['123', ''] },
- { v: new BigNumber(123), d: undefined, o: ['123', '00'] },
+ { v: null, d: 3, o: ['0', '000', '.'] },
+ { v: undefined, d: 3, o: ['0', '000', '.'] },
+ { v: new BigNumber(123), d: 3, o: ['123', '00', '.'] },
+ { v: new BigNumber(123.123), d: 3, o: ['123', '123', '.'] },
+ { v: new BigNumber(123.123), d: 6, o: ['123', '123', '.'] },
+ { v: new BigNumber(123.123), d: 0, o: ['123', '', '.'] },
+ { v: new BigNumber(123), d: undefined, o: ['123', '00', '.'] },
{
v: new BigNumber(30000),
d: undefined,
- o: ['30,000', '00'],
+ o: ['30,000', '00', '.'],
},
])('returns correct tuple given the different arguments', ({ v, d, o }) => {
expect(toNumberParts(v, d)).toStrictEqual(o);
diff --git a/libs/utils/src/lib/format/number.ts b/libs/utils/src/lib/format/number.ts
index bf5a93ff4..261502a38 100644
--- a/libs/utils/src/lib/format/number.ts
+++ b/libs/utils/src/lib/format/number.ts
@@ -165,15 +165,15 @@ export const formatNumberPercentage = (value: BigNumber, decimals?: number) => {
export const toNumberParts = (
value: BigNumber | null | undefined,
decimals = 18
-): [integers: string, decimalPlaces: string] => {
+): [integers: string, decimalPlaces: string, separator: string] => {
if (!value) {
- return ['0', '0'.repeat(decimals)];
+ return ['0', '0'.repeat(decimals), '.'];
}
const separator = getDecimalSeparator() || '.';
const [integers, decimalsPlaces] = formatNumber(value, decimals)
.toString()
.split(separator);
- return [integers, decimalsPlaces || ''];
+ return [integers, decimalsPlaces || '', separator];
};
export const isNumeric = (
diff --git a/libs/web3/src/lib/use-vega-transaction-toasts.tsx b/libs/web3/src/lib/use-vega-transaction-toasts.tsx
index 94cbb46a8..2400affef 100644
--- a/libs/web3/src/lib/use-vega-transaction-toasts.tsx
+++ b/libs/web3/src/lib/use-vega-transaction-toasts.tsx
@@ -591,7 +591,7 @@ const VegaTxCompleteToastsContent = ({ tx }: VegaTxToastContentProps) => {
if (isWithdrawTransaction(tx.body)) {
const completeWithdrawalButton = tx.withdrawal && (
-
+
-
+
+
{t('There are two steps required to make a withdrawal')}
-
+
{t('Step 1 - Release funds from Vega')}
{t('Step 2 - Transfer funds to your Ethereum wallet')}
@@ -289,14 +289,13 @@ export const WithdrawForm = ({
)}
-
- Release funds
-
+ {t('Release funds')}
+
>
);
@@ -309,7 +308,7 @@ const UseButton = (props: UseButtonProps) => {
);
};