Compare commits

..
Author SHA1 Message Date
Matthew Russell 529a724f6b chore: add wait for dialog to display 2024-03-01 09:59:15 +00:00
Matthew Russell 851f721934 chore: remove test for view as pubkey using query string 2024-03-01 09:30:20 +00:00
Matthew Russell 96821f8f04 fix: add wallet to i18n default namespaces 2024-03-01 08:51:03 +00:00
Matthew Russell 8d39981eb7 chore: fixes for cypress 2024-02-29 16:21:29 +00:00
Matthew Russell fe67a83a96 chore: add wallet-react to i18n namespace so its immediately loaded 2024-02-29 16:21:29 +00:00
Matthew Russell e4756c5d68 chore: adjust wallet store config for cypress testsw 2024-02-29 16:21:29 +00:00
Matthew Russell eeedc19e8b fix: tests 2024-02-29 16:21:29 +00:00
Matthew Russell d50dc4dbdd chore: remove pointless return type for disconnect connector method 2024-02-29 16:21:29 +00:00
Matthew Russell f96e423e15 chore: fix incorrect testnet prop for mainnet 2024-02-29 16:21:29 +00:00
bwallacee 45a74680c9 chore(trading): fix e2e tests 2024-02-29 16:21:29 +00:00
Matthew Russell 766012e389 chore: switch to use eventemitter3 as its already bundled 2024-02-29 16:21:29 +00:00
Matthew Russell d16deb4c19 chore: simplify window.ethereum check 2024-02-29 16:21:29 +00:00
Matthew Russell 7d5addad2e chore: make methods only needed for snap/json-rpc private 2024-02-29 16:21:29 +00:00
Matthew Russell b698bd2e40 fix: add more context to errors, fix stack, and proposal error dialog 2024-02-29 16:21:29 +00:00
Matthew Russell 996a29690f fix: ensure propose tx dialog can be closed 2024-02-29 16:21:29 +00:00
bwallacee 5ee54e7cc2 chore(trading): fix default pub key for python tests 2024-02-29 16:21:29 +00:00
Matthew Russell 6d7a63e0e6 chore: fix lint 2024-02-29 16:21:29 +00:00
Matthew Russell 5c03450463 chore: fix lint 2024-02-29 16:21:29 +00:00
bwallacee 64c8af8cb0 chore(trading): fix wallet store for e2e test 2024-02-29 16:21:28 +00:00
Matthew Russell a06b861724 chore: change view party to view as public key 2024-02-29 16:21:28 +00:00
Matthew Russell e2cde1efb6 fix: explore button not dismissing dialog 2024-02-29 16:21:28 +00:00
Matthew Russell 7b9645a603 fix: risk ack layout 2024-02-29 16:21:28 +00:00
Matthew Russell 0352096e78 feat: make browser wallet icon bg always black 2024-02-29 16:21:28 +00:00
Matthew Russell f7a423205c fix: tooltips 2024-02-29 16:21:28 +00:00
Matthew Russell 866afe0a82 fix: throw correct error for send transaction 2024-02-29 16:21:28 +00:00
Matthew Russell 6443a7ea35 chore: move errors to own file 2024-02-29 16:21:28 +00:00
Matthew Russell 538927fe19 fix: propsal spec 2024-02-29 16:21:28 +00:00
Matthew Russell 4c28bfa60c chore: use connector error for use-vega-transaction hook 2024-02-29 16:21:28 +00:00
Matthew Russell 01e2902239 fix: layout and functionality on mobile 2024-02-29 16:21:28 +00:00
Matthew Russell 7c84e62532 chore: add comment for extension detection 2024-02-29 16:21:28 +00:00
Matthew Russell c5e33d01f2 chore: delete no longer required snap status hook 2024-02-29 16:21:28 +00:00
Matthew Russell a2b5f54fb7 feat: dry up connection option ui 2024-02-29 16:21:28 +00:00
Matthew Russell db2eb4d0dd fix: hit box for dont have wallet link 2024-02-29 16:21:28 +00:00
Matthew Russell 64d327c3f2 fix: snap not working in firefox 2024-02-29 16:21:28 +00:00
Matthew Russell 66bff41e0b fix: snap version 2024-02-29 16:21:28 +00:00
Matthew Russell ec8e4e2b58 fix: remove translations 2024-02-29 16:21:28 +00:00
Matthew Russell f6c0031403 fix: swap wallet link in for welcome dialog 2024-02-29 16:21:28 +00:00
Matthew Russell 09e678e151 fix: re add reconnect toast if wallet becomes disconnected 2024-02-29 16:21:28 +00:00
Matthew Russell 8fde527e05 feat: fix disconnected toast by adding polling for snap and json rpc connectors 2024-02-29 16:21:28 +00:00
Matthew Russell 6d484907f7 fix: polling in snap connector 2024-02-29 16:21:28 +00:00
Matthew Russell 4336e2f1f7 fix: remove unnecessary ts-ignore 2024-02-29 16:21:28 +00:00
Matthew Russell 2af090f2ba chore: handle custom connection option better 2024-02-29 16:21:28 +00:00
Matthew Russell 7ea69b3a85 fix: deal ticket stop order ts-ignores 2024-02-29 16:21:28 +00:00
Matthew Russell 38a33dddf3 feat: switch vega wallet button to link if not installed 2024-02-29 16:21:28 +00:00
Matthew Russell 4719703481 chore: remove hard coded translations 2024-02-29 16:21:28 +00:00
Matthew Russell 2bed3d5c26 fix: types in snap connector 2024-02-29 16:21:28 +00:00
Matthew Russell 0e55e50dc4 chore: rename read only connector to view-party 2024-02-29 16:21:28 +00:00
Matthew Russell 2b9a002248 feat: re add view as connection to sidebar 2024-02-29 16:21:28 +00:00
Matthew Russell 5ac0917764 fix: useVegaWallet sendTx func, remove unused code 2024-02-29 16:21:28 +00:00
Matthew Russell dbc535ddfc chore: split onboarding store from onboarding step hook 2024-02-29 16:21:28 +00:00
Matthew Russell f5ec7277bd chore: readonly connector typescript error 2024-02-29 16:21:27 +00:00
Matthew Russell cb59fb741a fix: use hooks for connectors which depend on VEGA_ENV 2024-02-29 16:21:27 +00:00
Matthew Russell 8bf9e17fdd chore: minor misc fixes 2024-02-29 16:21:27 +00:00
Matthew Russell 9f211bc5ba feat: use risk dialog in governance 2024-02-29 16:21:27 +00:00
Matthew Russell 6ddbe5486a chore: move risk act to wallet-react 2024-02-29 16:21:27 +00:00
Matthew Russell af42a78bcd chore: dont show risk ack if not mainnet 2024-02-29 16:21:27 +00:00
Matthew Russell 5ee813e65e feat: make titles consistent, fix interaction between dialogs 2024-02-29 16:21:27 +00:00
Matthew Russell 7ea8544473 feat: add dont have wallet link to welcome dialog 2024-02-29 16:21:27 +00:00
Matthew Russell 5f4c7388cd feat: wrap connect dialog so to show risk ack 2024-02-29 16:21:27 +00:00
Matthew Russell 1b478364d1 feat: add risk acknowledgement to onboarding 2024-02-29 16:21:27 +00:00
Matthew Russell 24c5afc1dc chore: re-enable telemetry 2024-02-29 16:21:27 +00:00
Matthew Russell d3079b5cfa feat: add link to wallet page 2024-02-29 16:21:27 +00:00
Matthew Russell 72236c35e9 feat: change injected icon color depending on network 2024-02-29 16:21:27 +00:00
Matthew Russell 78b6966e36 fix: broken tests due to mockKeys 2024-02-29 16:21:27 +00:00
Matthew Russell 28a4455f42 refactor: dialog store properties 2024-02-29 16:21:27 +00:00
Matthew Russell 08b32553a1 chore: remove view as sidebar button 2024-02-29 16:21:27 +00:00
Matthew Russell a76899f581 chore: fix components after rebase 2024-02-29 16:21:27 +00:00
Matthew Russell ce8d3adf13 test: add test for connector dialog 2024-02-29 16:21:27 +00:00
Matthew Russell 56005fa522 chore: move translations to wallet react lib 2024-02-29 16:21:27 +00:00
Matthew Russell 443732d0df chore: remove unused test setup 2024-02-29 16:21:27 +00:00
Matthew Russell f432386398 test: add tests for wallet config 2024-02-29 16:21:27 +00:00
Matthew Russell b84f62b73d chore: add some ts-ignore for readonly instances 2024-02-29 16:21:27 +00:00
Matthew Russell 0b75aefeb6 fix: additional entry point config 2024-02-29 16:21:27 +00:00
Matthew Russell 5073416e21 chore: fix types of mocked browser wallet 2024-02-29 16:21:27 +00:00
Matthew Russell 48f50ce92c fix: status check after connect 2024-02-29 16:21:27 +00:00
Matthew Russell 7e29b30312 chore: fix user rejected error test for transaction hook 2024-02-29 16:21:27 +00:00
Matthew Russell e6d0c406f2 fix: create separate entry point so mock config isnt bundled 2024-02-29 16:21:27 +00:00
Matthew Russell de6575659b fix: tx handling for use-transaction hook in proposals 2024-02-29 16:21:27 +00:00
Matthew Russell b9643afed5 chore: dont create mock config in module 2024-02-29 16:21:27 +00:00
Matthew Russell a332246da3 chore: remove @vegaprotocol/wallet-client 2024-02-29 16:21:27 +00:00
Matthew Russell 94937f3593 feat: improve error handling 2024-02-29 16:21:27 +00:00
Matthew Russell 7b82882fdc feat: make consistent errors for connectors 2024-02-29 16:21:26 +00:00
Matthew Russell d1ec5f5136 feat: dialog layout 2024-02-29 16:21:26 +00:00
Matthew Russell 0add85690b feat: hover states for dialogs 2024-02-29 16:21:26 +00:00
Matthew Russell 38962f397f chore: re add welcome dialog 2024-02-29 16:21:26 +00:00
Matthew Russell 3ef9b9f8af fix: tests relying on mocks for wallet 2024-02-29 16:21:26 +00:00
Matthew Russell 49a0cec9df refactor: mocked provider 2024-02-29 16:21:26 +00:00
Matthew Russell 6e0df4678d chore: convert tests to mock provider 2024-02-29 16:21:26 +00:00
Matthew Russell 50295dc040 chore: WIP amend me, changed to mocked provider component 2024-02-29 16:21:26 +00:00
Matthew Russell 871bfb0a40 fix: ensure on event not binded twice, remove unused method 2024-02-29 16:21:26 +00:00
Matthew Russell e49148b203 chore: add missing test setup for i18n funding payments 2024-02-29 16:21:26 +00:00
Matthew Russell 77453881e4 fix: gov tests after removing linked transaction dialog 2024-02-29 16:21:26 +00:00
Matthew Russell 642175d183 chore: dont render dialog from hook 2024-02-29 16:21:26 +00:00
Matthew Russell b45db36f7f fix: web3 test fixes 2024-02-29 16:21:26 +00:00
Matthew Russell 9846a30475 fix: orders tests 2024-02-29 16:21:26 +00:00
Matthew Russell 33612d22dc fix: deal ticket and deposit tests 2024-02-29 16:21:26 +00:00
Matthew Russell 07278f15e8 fix: governance tests 2024-02-29 16:21:26 +00:00
Matthew Russell 4df801f067 chore: fix imports 2024-02-29 16:21:25 +00:00
Matthew Russell fd919ebc21 fix: tests and welcome dialog 2024-02-29 16:20:15 +00:00
Matthew Russell c62f189982 chore: re add welcome dialog 2024-02-29 16:20:15 +00:00
Matthew Russell ed7d9678c0 fix: navbar test 2024-02-29 16:20:15 +00:00
Matthew Russell 5fb542daf5 fix: imports and add vega global 2024-02-29 16:20:15 +00:00
Matthew Russell bdbdf309b6 fix: connect button tests 2024-02-29 16:20:15 +00:00
Matthew Russell 5fde0d3b3e fix: imports 2024-02-29 16:20:15 +00:00
Matthew Russell 1b0780d6ba chore: conver apps/trading wallet imports 2024-02-29 16:20:15 +00:00
Matthew Russell 8fa808051a chore: add wallet react lib 2024-02-29 16:20:15 +00:00
Matthew Russell f43a59817f chore: remove hooks we dont need anymore 2024-02-29 16:20:14 +00:00
Matthew Russell ab5d3fe2b1 fix: wallet not running error and key refresh 2024-02-29 16:20:14 +00:00
Matthew Russell e245675a79 chore: rename v2 to default, move manage dialog 2024-02-29 16:20:14 +00:00
Matthew Russell 0ab83d6248 feat: update useVegaWallet usage where needed 2024-02-29 16:20:14 +00:00
Matthew Russell 2c505c7500 feat: try connector id type, adjust dialog layout 2024-02-29 16:20:14 +00:00
Matthew Russell b9d031c573 feat: bind listener for injected connector 2024-02-29 16:20:14 +00:00
Matthew Russell f8cd249fe1 feat: bind store to connectors to access local storage values 2024-02-29 16:20:14 +00:00
Matthew Russell a3380407b1 refactor: change to use slice for single key 2024-02-29 16:20:14 +00:00
Matthew Russell 7c5ac31b73 feat: add some ui for the connect dialog v2 2024-02-29 16:20:14 +00:00
Matthew Russell 30bc99a455 feat: eager connection 2024-02-29 16:20:14 +00:00
Matthew Russell c7560eff7e feat: connect dialog rewrite start, add wrapper hook for selected key 2024-02-29 16:20:14 +00:00
Matthew Russell c6e6021f01 chore: start moving code to lib 2024-02-29 16:20:14 +00:00
Matthew Russell bacea950fb chore: wire up sendTransaction 2024-02-29 16:20:14 +00:00
Matthew Russell 4e38be7763 chore: remove unused reconnecting 2024-02-29 16:20:14 +00:00
Matthew Russell 906fbbabc2 feat: refactor wallet store and connections 2024-02-29 16:20:14 +00:00
11 changed files with 126 additions and 290 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
# Cosmic elevator flags
NX_SUCCESSOR_MARKETS=true
NX_STOP_ORDERS=true
NX_ISOLATED_MARGIN=true
NX_ISOLATED_MARGIN=false
NX_ICEBERG_ORDERS=true
NX_METAMASK_SNAPS=true
NX_REFERRALS=true
@@ -1,5 +1,5 @@
import { useT } from '../../lib/use-t';
import { addDecimalsFormatNumber, formatNumber } from '@vegaprotocol/utils';
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
import classNames from 'classnames';
import {
type VegaIconSize,
@@ -24,9 +24,6 @@ import {
type DispatchStrategy,
IndividualScopeMapping,
IndividualScopeDescriptionMapping,
AccountType,
DistributionStrategy,
IndividualScope,
type Asset,
} from '@vegaprotocol/types';
import { Card } from '../card/card';
@@ -65,27 +62,22 @@ export const applyFilter = (
filter: Filter
) => {
const { transfer } = node;
// if the transfer is a staking reward then it should be displayed
if (transfer.toAccountType === AccountType.ACCOUNT_TYPE_GLOBAL_REWARD) {
return true;
}
if (transfer.kind.__typename !== 'RecurringTransfer') {
if (
transfer.kind.__typename !== 'RecurringTransfer' ||
!transfer.kind.dispatchStrategy?.dispatchMetric
) {
return false;
}
if (
(transfer.kind.dispatchStrategy?.dispatchMetric &&
DispatchMetricLabels[transfer.kind.dispatchStrategy.dispatchMetric]
.toLowerCase()
.includes(filter.searchTerm.toLowerCase())) ||
DispatchMetricLabels[transfer.kind.dispatchStrategy.dispatchMetric]
.toLowerCase()
.includes(filter.searchTerm.toLowerCase()) ||
transfer.asset?.symbol
.toLowerCase()
.includes(filter.searchTerm.toLowerCase()) ||
(
(transfer.kind.dispatchStrategy &&
EntityScopeLabelMapping[transfer.kind.dispatchStrategy.entityScope]) ||
EntityScopeLabelMapping[transfer.kind.dispatchStrategy.entityScope] ||
'Unspecified'
)
.toLowerCase()
@@ -101,7 +93,6 @@ export const applyFilter = (
) {
return true;
}
return false;
};
@@ -183,29 +174,6 @@ export const ActiveRewardCard = ({
return null;
}
if (
!transferNode.transfer.kind.dispatchStrategy &&
transferNode.transfer.toAccountType ===
AccountType.ACCOUNT_TYPE_GLOBAL_REWARD
) {
return (
<StakingRewardCard
colour={CardColour.WHITE}
rewardAmount={addDecimalsFormatNumber(
transferNode.transfer.amount,
transferNode.transfer.asset?.decimals || 0,
6
)}
rewardAsset={transferNode.transfer.asset || undefined}
endsIn={
transferNode.transfer.kind.endEpoch != null
? transferNode.transfer.kind.endEpoch - currentEpoch
: undefined
}
/>
);
}
let colour =
DispatchMetricColourMap[
transferNode.transfer.kind.dispatchStrategy.dispatchMetric
@@ -350,7 +318,7 @@ const RewardCard = ({
</div>
</div>
<span className="border-[0.5px] dark:border-vega-cdark-500 border-vega-clight-500" />
<span className="border-[0.5px] border-gray-700" />
{/** DISPATCH METRIC */}
{dispatchMetricInfo ? (
dispatchMetricInfo
@@ -387,11 +355,11 @@ const RewardCard = ({
</div>
{/** DISPATCH METRIC DESCRIPTION */}
{dispatchStrategy?.dispatchMetric && (
<p className="text-muted text-sm h-[3rem]">
<span className="text-muted text-sm h-[3rem]">
{t(DispatchMetricDescription[dispatchStrategy?.dispatchMetric])}
</p>
</span>
)}
<span className="border-[0.5px] dark:border-vega-cdark-500 border-vega-clight-500" />
<span className="border-[0.5px] border-gray-700" />
{/** REQUIREMENTS */}
{dispatchStrategy && (
<RewardRequirements
@@ -406,190 +374,6 @@ const RewardCard = ({
);
};
const StakingRewardCard = ({
colour,
rewardAmount,
rewardAsset,
endsIn,
}: {
colour: CardColour;
rewardAmount: string;
/** The asset linked to the dispatch strategy via `dispatchMetricAssetId` property. */
rewardAsset?: Asset;
/** The number of epochs until the transfer stops. */
endsIn?: number;
/** The VEGA asset details, required to format the min staking amount. */
vegaAsset?: BasicAssetDetails;
}) => {
const t = useT();
return (
<div>
<div
className={classNames(
'bg-gradient-to-r col-span-full p-0.5 lg:col-auto h-full',
'rounded-lg',
CardColourStyles[colour].gradientClassName
)}
data-testid="active-rewards-card"
>
<div
className={classNames(
CardColourStyles[colour].mainClassName,
'bg-gradient-to-b bg-vega-clight-800 dark:bg-vega-cdark-800 h-full w-full rounded-md p-4 flex flex-col gap-4'
)}
>
<div className="flex justify-between gap-4">
{/** ENTITY SCOPE */}
<div className="flex flex-col gap-2 items-center text-center">
<EntityIcon entityScope={EntityScope.ENTITY_SCOPE_INDIVIDUALS} />
{
<span className="text-muted text-xs" data-testid="entity-scope">
{EntityScopeLabelMapping[
EntityScope.ENTITY_SCOPE_INDIVIDUALS
] || t('Unspecified')}
</span>
}
</div>
{/** AMOUNT AND DISTRIBUTION STRATEGY */}
<div className="flex flex-col gap-2 items-center text-center">
{/** AMOUNT */}
<h3 className="flex flex-col gap-1 text-2xl shrink-1 text-center">
<span className="font-glitch" data-testid="reward-value">
{rewardAmount}
</span>
<span className="font-alpha">{rewardAsset?.symbol || ''}</span>
</h3>
{/** DISTRIBUTION STRATEGY */}
<Tooltip
description={t(
DistributionStrategyDescriptionMapping[
DistributionStrategy.DISTRIBUTION_STRATEGY_PRO_RATA
]
)}
underline={true}
>
<span className="text-xs" data-testid="distribution-strategy">
{
DistributionStrategyMapping[
DistributionStrategy.DISTRIBUTION_STRATEGY_PRO_RATA
]
}
</span>
</Tooltip>
</div>
{/** DISTRIBUTION DELAY */}
<div className="flex flex-col gap-2 items-center text-center">
<CardIcon
iconName={VegaIconNames.LOCK}
tooltip={t(
'Number of epochs after distribution to delay vesting of rewards by'
)}
/>
<span
className="text-muted text-xs whitespace-nowrap"
data-testid="locked-for"
>
{t('numberEpochs', '{{count}} epochs', {
count: 0,
})}
</span>
</div>
</div>
<span className="border-[0.5px] dark:border-vega-cdark-500 border-vega-clight-500" />
{/** DISPATCH METRIC */}
{
<span data-testid="dispatch-metric-info">
{t('Staking rewards')}
</span>
}
<div className="flex items-center gap-8 flex-wrap">
{/** ENDS IN */}
{endsIn != null && (
<span className="flex flex-col">
<span className="text-muted text-xs">{t('Ends in')} </span>
<span data-testid="ends-in" data-endsin={endsIn}>
{endsIn >= 0
? t('numberEpochs', '{{count}} epochs', {
count: endsIn,
})
: t('Ended')}
</span>
</span>
)}
{/** WINDOW LENGTH */}
<span className="flex flex-col">
<span className="text-muted text-xs">{t('Assessed over')}</span>
<span data-testid="assessed-over">
{t('numberEpochs', '{{count}} epochs', {
count: 1,
})}
</span>
</span>
</div>
{/** DISPATCH METRIC DESCRIPTION */}
{
<p className="text-muted text-sm h-[3rem]">
{t(
'Global staking reward for staking $VEGA on the network via the Governance app'
)}
</p>
}
<span className="border-[0.5px] dark:border-vega-cdark-500 border-vega-clight-500" />
{/** REQUIREMENTS */}
<dl className="flex justify-between flex-wrap items-center gap-3 text-xs">
<div className="flex flex-col gap-1">
<dt className="flex items-center gap-1 text-muted">
{t('Team scope')}
</dt>
<dd className="flex items-center gap-1" data-testid="scope">
<Tooltip
description={
IndividualScopeDescriptionMapping[
IndividualScope.INDIVIDUAL_SCOPE_ALL
]
}
>
<span>{t('Individual')}</span>
</Tooltip>
</dd>
</div>
<div className="flex flex-col gap-1">
<dt className="flex items-center gap-1 text-muted">
{t('Staked VEGA')}
</dt>
<dd
className="flex items-center gap-1"
data-testid="staking-requirement"
>
{formatNumber(1, 2)}
</dd>
</div>
<div className="flex flex-col gap-1">
<dt className="flex items-center gap-1 text-muted">
{t('Average position')}
</dt>
<dd
className="flex items-center gap-1"
data-testid="average-position"
>
{formatNumber(0, 2)}
</dd>
</div>
</dl>
</div>
</div>
</div>
);
};
export const DispatchMetricInfo = ({
reward,
}: {
+6 -9
View File
@@ -16,7 +16,6 @@ import {
EntityScope,
IndividualScope,
MarketState,
AccountType,
} from '@vegaprotocol/types';
import { type ApolloError } from '@apollo/client';
import compact from 'lodash/compact';
@@ -47,9 +46,8 @@ export type EnrichedRewardTransfer = RewardTransfer & {
*/
export const isReward = (node: TransferNode): node is RewardTransfer => {
if (
(node.transfer.kind.__typename === 'RecurringTransfer' &&
node.transfer.kind.dispatchStrategy != null) ||
node.transfer.toAccountType === AccountType.ACCOUNT_TYPE_GLOBAL_REWARD
node.transfer.kind.__typename === 'RecurringTransfer' &&
node.transfer.kind.dispatchStrategy != null
) {
return true;
}
@@ -81,13 +79,13 @@ export const isActiveReward = (node: RewardTransfer, currentEpoch: number) => {
*/
export const isScopedToTeams = (node: EnrichedRewardTransfer) =>
// scoped to teams
node.transfer.kind.dispatchStrategy?.entityScope ===
node.transfer.kind.dispatchStrategy.entityScope ===
EntityScope.ENTITY_SCOPE_TEAMS ||
// or to individuals
(node.transfer.kind.dispatchStrategy?.entityScope ===
(node.transfer.kind.dispatchStrategy.entityScope ===
EntityScope.ENTITY_SCOPE_INDIVIDUALS &&
// but they have to be in a team
node.transfer.kind.dispatchStrategy?.individualScope ===
node.transfer.kind.dispatchStrategy.individualScope ===
IndividualScope.INDIVIDUAL_SCOPE_IN_TEAM);
/** Retrieves rewards (transfers) */
@@ -144,7 +142,6 @@ export const useRewards = ({
.filter((node) => (scopeToTeams ? isScopedToTeams(node) : true))
// enrich with dispatch asset and markets in scope details
.map((node) => {
if (!node.transfer.kind.dispatchStrategy) return node;
const dispatchAsset =
(assets &&
assets[node.transfer.kind.dispatchStrategy.dispatchMetricAssetId]) ||
@@ -173,7 +170,7 @@ export const useRewards = ({
...node,
dispatchAsset,
isAssetTraded: isAssetTraded != null ? isAssetTraded : undefined,
markets: marketsInScope?.length > 0 ? marketsInScope : undefined,
markets: marketsInScope.length > 0 ? marketsInScope : undefined,
};
});
+2
View File
@@ -24,6 +24,7 @@ import {
ProtocolUpgradeInProgressNotification,
ProtocolUpgradeProposalNotification,
} from '@vegaprotocol/proposals';
import { ViewingBanner } from '../components/viewing-banner';
import { Telemetry } from '../components/telemetry';
import { SSRLoader } from './ssr-loader';
import { PartyActiveOrdersHandler } from './party-active-orders-handler';
@@ -76,6 +77,7 @@ function AppBody({ Component }: AppProps) {
mode={ProtocolUpgradeCountdownMode.IN_ESTIMATED_TIME_REMAINING}
/>
<ProtocolUpgradeInProgressNotification />
<ViewingBanner />
</div>
<div data-testid={`pathname-${location.pathname}`}>
<Component />
@@ -1,7 +1,11 @@
import { useMemo } from 'react';
import { parseISO, isValid, isAfter } from 'date-fns';
import classNames from 'classnames';
import { useProposalOfMarketQuery } from '@vegaprotocol/proposals';
import {
useProposalOfMarketQuery,
type ProposalOfMarketQuery,
type SingleProposal,
} from '@vegaprotocol/proposals';
import { DocsLinks } from '@vegaprotocol/environment';
import { getDateTimeFormat } from '@vegaprotocol/utils';
import * as Schema from '@vegaprotocol/types';
@@ -36,21 +40,15 @@ export const TradingModeTooltip = ({
marketTradingMode,
});
// We only fetch Proposals (and not BatchProposals)
const proposal = proposalData?.proposal as SingleProposal<
ProposalOfMarketQuery['proposal']
>;
if (!market || !marketData) {
return null;
}
let enactmentDate;
const proposal = proposalData?.proposal;
if (proposal?.__typename === 'Proposal') {
enactmentDate = parseISO(proposal.terms.enactmentDatetime);
} else if (proposal?.__typename === 'BatchProposal') {
const change = proposal.batchTerms?.changes.find(
(c) => c?.change.__typename === 'NewMarket'
);
enactmentDate = change ? parseISO(change.enactmentDatetime) : undefined;
}
const enactmentDate = parseISO(proposal?.terms.enactmentDatetime);
const compiledGrid =
!skipGrid && compileGridData(t, market, marketData, onSelect);
@@ -69,16 +67,14 @@ export const TradingModeTooltip = ({
return (
<section data-testid="trading-mode-tooltip">
<p
className={classNames('flex flex-col items-start gap-2', {
className={classNames('flex flex-col', {
'mb-4': Boolean(compiledGrid),
})}
>
{enactmentDate &&
isValid(enactmentDate) &&
isAfter(new Date(), enactmentDate) ? (
{isValid(enactmentDate) && isAfter(new Date(), enactmentDate) ? (
<>
<span
className="justify-center font-bold"
className="justify-center font-bold my-2"
data-testid="opening-auction-sub-status"
>
{`${Schema.MarketTradingModeMapping[marketTradingMode]}: ${t(
@@ -95,7 +91,7 @@ export const TradingModeTooltip = ({
<>
{isValid(enactmentDate) && (
<span
className="justify-center font-bold"
className="justify-center font-bold my-2"
data-testid="opening-auction-sub-status"
>
{`${
@@ -113,7 +109,10 @@ export const TradingModeTooltip = ({
</>
)}
{DocsLinks && (
<ExternalLink href={DocsLinks.AUCTION_TYPE_OPENING}>
<ExternalLink
href={DocsLinks.AUCTION_TYPE_OPENING}
className="ml-1"
>
{t('Find out more')}
</ExternalLink>
)}
+1 -2
View File
@@ -135,7 +135,6 @@
"Governance vote for this market is valid and has been accepted": "Governance vote for this market is valid and has been accepted",
"Governance vote has passed and market is awaiting opening auction exit": "Governance vote has passed and market is awaiting opening auction exit",
"Governance vote passed to close the market": "Governance vote passed to close the market",
"Global staking reward for staking $VEGA on the network via the Governance app": "Global staking reward for staking $VEGA on the network via the Governance app",
"Help identify bugs and improve the service by sharing anonymous usage data.": "Help identify bugs and improve the service by sharing anonymous usage data.",
"Help us identify bugs and improve Vega Governance by sharing anonymous usage data.": "Help us identify bugs and improve Vega Governance by sharing anonymous usage data.",
"Hide closed markets": "Hide closed markets",
@@ -368,12 +367,12 @@
"TradingView": "TradingView",
"Transfer": "Transfer",
"Type": "Type",
"Staking rewards": "Staking rewards",
"Unknown": "Unknown",
"Unknown settlement date": "Unknown settlement date",
"Update team": "Update team",
"URL": "URL",
"Use a comma separated list to allow only specific public keys to join the team": "Use a comma separated list to allow only specific public keys to join the team",
"Vega chart": "Vega chart",
"Vega Reward pot": "Vega Reward pot",
"Vega Wallet <0>full featured</0>": "Vega Wallet <0>full featured</0>",
"Vega chart": "Vega chart",
@@ -45,19 +45,6 @@ query ProposalOfMarket($marketId: ID!) {
enactmentDatetime
}
}
... on BatchProposal {
id
batchTerms {
changes {
enactmentDatetime
change {
... on NewMarket {
__typename
}
}
}
}
}
}
}
@@ -25,7 +25,7 @@ export type ProposalOfMarketQueryVariables = Types.Exact<{
}>;
export type ProposalOfMarketQuery = { __typename?: 'Query', proposal?: { __typename?: 'BatchProposal', id?: string | null, batchTerms?: { __typename?: 'BatchProposalTerms', changes: Array<{ __typename?: 'BatchProposalTermsChange', enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename: 'NewMarket' } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter' } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } } | null> } | null } | { __typename?: 'Proposal', id?: string | null, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null } } | null };
export type ProposalOfMarketQuery = { __typename?: 'Query', proposal?: { __typename?: 'BatchProposal' } | { __typename?: 'Proposal', id?: string | null, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null } } | null };
export type SuccessorMarketProposalDetailsQueryVariables = Types.Exact<{
proposalId: Types.Scalars['ID'];
@@ -152,19 +152,6 @@ export const ProposalOfMarketDocument = gql`
enactmentDatetime
}
}
... on BatchProposal {
id
batchTerms {
changes {
enactmentDatetime
change {
... on NewMarket {
__typename
}
}
}
}
}
}
}
`;
-2
View File
@@ -256,8 +256,6 @@ export type AggregatedLedgerEntry = {
toAccountPartyId?: Maybe<Scalars['ID']>;
/** Account type, if query was grouped by receiver account type - else null */
toAccountType?: Maybe<AccountType>;
/** Transfer ID associated with this aggregated ledger entry */
transferId: Scalars['ID'];
/** Type of the transfer for this ledger entry */
transferType?: Maybe<TransferType>;
/** RFC3339Nano time from at which this ledger entries records were relevant */
+1
View File
@@ -199,6 +199,7 @@
"flush-promises": "^1.0.2",
"glob": "^8.0.3",
"husky": "^7.0.4",
"inquirer": "^8.0.0",
"jest": "29.4.3",
"jest-canvas-mock": "^2.3.1",
"jest-environment-jsdom": "^29.4.1",
+82
View File
@@ -0,0 +1,82 @@
const { execSync } = require('child_process');
const inquirer = require('inquirer');
const getTags = (take) => {
const tags = execSync(
"git for-each-ref --sort=taggerdate --format '%(refname)' refs/tags"
)
.toString()
.trim()
.split('\n')
.map((t) => t.replace('refs/tags/', ''))
.reverse()
.slice(0, take);
return tags;
};
const getReleaseBranches = () => {
const branches = execSync('git branch --remote | grep origin/release/')
.toString()
.trim()
.split('\n')
.map((b) => b.trim().replace('origin/release/', ''));
return branches;
};
const release = (tag, branch) => {
const steps = [
`git checkout ${branch}`,
'git pull',
`git reset --hard ${tag}`,
'git push --force',
];
try {
for (const cmd of steps) {
const result = execSync(cmd).toString();
}
} catch (err) {
console.error('Could not make a release');
}
};
inquirer
.prompt([
{
type: 'list',
name: 'tag',
message: 'What version would you like to release?',
choices: getTags(),
},
{
type: 'checkbox',
name: 'envs',
message: 'To what environment you wish to release?',
choices: ['mainnet', ...getReleaseBranches()],
validate(answer) {
return answer.length > 0;
},
},
])
.then((answers) => {
inquirer
.prompt({
type: 'confirm',
name: 'sure',
message: `Are you sure? This will release ${
answers.tag
} to ${answers.envs.join(', ')}`,
})
.then(() => {
for (const env of answers.envs) {
const branch = env === 'mainnet' ? 'main' : `release/${env}`;
release(answers.tag, branch);
}
execSync('git checkout develop');
})
.catch((err) => {
console.log('Something went wrong', err.toString());
});
})
.catch((err) => {
console.log('Something went wrong', err.toString());
});