Compare commits

..
Author SHA1 Message Date
sam-keen 3fd8205587 ci-make-deploy-preview 2023-03-31 11:57:34 +01:00
Matthew Russell 2b77421600 fix: add gas estimates with a buffer for all token app tx 2023-03-30 14:27:17 -07:00
6 changed files with 15 additions and 44 deletions
-15
View File
@@ -1,17 +1,2 @@
import { utcToZonedTime, format as tzFormat } from 'date-fns-tz';
export const DATE_FORMAT_DETAILED = 'dd MMMM yyyy HH:mm';
export const DATE_FORMAT_LONG = 'dd MMM yyyy';
/** Format a user's local date and time with the time zone abbreviation */
export const formatDateWithLocalTimezone = (
date: Date,
formatStr = 'dd MMMM yyyy HH:mm (z)'
) => {
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
const localDatetime = utcToZonedTime(date, userTimeZone);
return tzFormat(localDatetime, formatStr, {
timeZone: userTimeZone,
});
};
@@ -1,10 +1,8 @@
import { isFuture } from 'date-fns';
import { format, isFuture } from 'date-fns';
import { useTranslation } from 'react-i18next';
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
import {
formatDateWithLocalTimezone,
} from '../../../../lib/date-formats';
import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats';
import type { Proposals_proposals } from '../../proposals/__generated__/Proposals';
import { CurrentProposalState } from '../current-proposal-state';
@@ -31,13 +29,13 @@ export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => {
{isFuture(new Date(terms.closingDatetime))
? t('closesOn')
: t('closedOn')}
{formatDateWithLocalTimezone(new Date(terms.closingDatetime))}
{format(new Date(terms.closingDatetime), DATE_FORMAT_DETAILED)}
</KeyValueTableRow>
<KeyValueTableRow>
{isFuture(new Date(terms.enactmentDatetime || 0))
? t('proposedEnactment')
: t('enactedOn')}
{formatDateWithLocalTimezone(new Date(terms.enactmentDatetime || 0))}
{format(new Date(terms.enactmentDatetime || 0), DATE_FORMAT_DETAILED)}
</KeyValueTableRow>
<KeyValueTableRow>
{t('proposedBy')}
@@ -45,7 +43,7 @@ export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => {
</KeyValueTableRow>
<KeyValueTableRow>
{t('proposedOn')}
{formatDateWithLocalTimezone(new Date(proposal.datetime))}
{format(new Date(proposal.datetime), DATE_FORMAT_DETAILED)}
</KeyValueTableRow>
{proposal.rejectionReason ? (
<KeyValueTableRow>
@@ -95,17 +95,12 @@ export function useUserVote(
setVoteState(VoteState.Requested);
const voteMapping = {
[VoteValue.Yes]: 'VALUE_YES',
[VoteValue.No]: 'VALUE_NO',
} as const;
try {
const variables = {
pubKey: keypair.pub,
propagate: true,
voteSubmission: {
value: voteMapping[value],
value: value,
proposalId,
},
};
+9 -10
View File
@@ -1,6 +1,12 @@
import type { z } from 'zod';
import type { GetKeysSchema, TransactionResponseSchema } from './connectors';
import type { IterableElement } from 'type-fest';
import type {
OrderTimeInForce,
OrderType,
Side,
VoteValue,
} from '@vegaprotocol/types';
interface BaseTransaction {
pubKey: string;
@@ -22,19 +28,12 @@ export interface UndelegateSubmissionBody extends BaseTransaction {
};
}
type OrderTimeInForce =
| 'TIME_IN_FORCE_FOK'
| 'TIME_IN_FORCE_GFA'
| 'TIME_IN_FORCE_GFN'
| 'TIME_IN_FORCE_GTC'
| 'TIME_IN_FORCE_GTT'
| 'TIME_IN_FORCE_IOC';
export interface OrderSubmissionBody extends BaseTransaction {
orderSubmission: {
marketId: string;
reference?: string;
type: 'TYPE_MARKET' | 'TYPE_LIMIT';
side: 'SIDE_BUY' | 'SIDE_SELL';
type: OrderType;
side: Side;
timeInForce: OrderTimeInForce;
size: string;
price?: string;
@@ -63,7 +62,7 @@ export interface OrderAmendmentBody extends BaseTransaction {
export interface VoteSubmissionBody extends BaseTransaction {
voteSubmission: {
value: 'VALUE_YES' | 'VALUE_NO';
value: VoteValue;
proposalId: string;
};
}
-1
View File
@@ -47,7 +47,6 @@
"classnames": "^2.3.1",
"core-js": "^3.6.5",
"date-fns": "^2.28.0",
"date-fns-tz": "^2.0.0",
"duration-js": "^4.0.0",
"env-cmd": "^10.1.0",
"ethers": "^5.6.0",
-5
View File
@@ -10909,11 +10909,6 @@ dataloader@2.1.0:
resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-2.1.0.tgz#c69c538235e85e7ac6c6c444bae8ecabf5de9df7"
integrity sha512-qTcEYLen3r7ojZNgVUaRggOI+KM7jrKxXeSHhogh/TWxYMeONEMqY+hmkobiYQozsGIyg9OYVzO4ZIfoB4I0pQ==
date-fns-tz@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/date-fns-tz/-/date-fns-tz-2.0.0.tgz#1b14c386cb8bc16fc56fe333d4fc34ae1d1099d5"
integrity sha512-OAtcLdB9vxSXTWHdT8b398ARImVwQMyjfYGkKD2zaGpHseG2UPHbHjXELReErZFxWdSLph3c2zOaaTyHfOhERQ==
date-fns@^1.27.2:
version "1.30.1"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"