Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into develop
This commit is contained in:
@@ -42,3 +42,5 @@ jobs:
|
||||
run: yarn nx affected:test
|
||||
- name: Build affected
|
||||
run: yarn nx affected:build
|
||||
- name: Build affected spec
|
||||
run: yarn nx affected --target=build-spec
|
||||
|
||||
@@ -12,7 +12,7 @@ export const generateAccounts = (
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
accounts: [
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '100000000',
|
||||
market: null,
|
||||
@@ -22,7 +22,7 @@ export const generateAccounts = (
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '100000000',
|
||||
market: {
|
||||
@@ -35,7 +35,7 @@ export const generateAccounts = (
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '1000',
|
||||
market: {
|
||||
@@ -48,7 +48,7 @@ export const generateAccounts = (
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '1000',
|
||||
market: {
|
||||
@@ -61,7 +61,7 @@ export const generateAccounts = (
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '100000000',
|
||||
market: null,
|
||||
|
||||
@@ -23,27 +23,27 @@ export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
__typename: 'Asset',
|
||||
},
|
||||
@@ -64,27 +64,27 @@ export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
__typename: 'Asset',
|
||||
},
|
||||
@@ -103,7 +103,7 @@ export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '0',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: null,
|
||||
takerFeeRewardAccount: null,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { FillsQuery, FillFieldsFragment } from '@vegaprotocol/fills';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import merge from 'lodash/merge';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
|
||||
@@ -17,7 +17,7 @@ export const generateFills = (
|
||||
seller: {
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
},
|
||||
aggressor: Side.SIDE_SELL,
|
||||
aggressor: Schema.Side.SIDE_SELL,
|
||||
buyerFee: {
|
||||
infrastructureFee: '5000',
|
||||
},
|
||||
@@ -30,11 +30,11 @@ export const generateFills = (
|
||||
seller: {
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
},
|
||||
aggressor: Side.SIDE_BUY,
|
||||
aggressor: Schema.Side.SIDE_BUY,
|
||||
}),
|
||||
generateFill({
|
||||
id: '3',
|
||||
aggressor: Side.SIDE_SELL,
|
||||
aggressor: Schema.Side.SIDE_SELL,
|
||||
market: {
|
||||
id: 'market-2',
|
||||
},
|
||||
@@ -80,7 +80,7 @@ export const generateFill = (override?: PartialDeep<FillFieldsFragment>) => {
|
||||
size: '50000',
|
||||
buyOrder: 'buy-order',
|
||||
sellOrder: 'sell-order',
|
||||
aggressor: Side.SIDE_BUY,
|
||||
aggressor: Schema.Side.SIDE_BUY,
|
||||
buyer: {
|
||||
__typename: 'Party',
|
||||
id: 'buyer-id',
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
import merge from 'lodash/merge';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type {
|
||||
Orders,
|
||||
Orders_party_ordersConnection_edges_node,
|
||||
} from '@vegaprotocol/orders';
|
||||
import {
|
||||
OrderStatus,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
Side,
|
||||
} from '@vegaprotocol/types';
|
||||
import type { OrdersQuery, OrderFieldsFragment } from '@vegaprotocol/orders';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
|
||||
export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
const orders: Orders_party_ordersConnection_edges_node[] = [
|
||||
export const generateOrders = (
|
||||
override?: PartialDeep<OrdersQuery>
|
||||
): OrdersQuery => {
|
||||
const orders: OrderFieldsFragment[] = [
|
||||
{
|
||||
__typename: 'Order',
|
||||
id: '066468C06549101DAF7BC51099E1412A0067DC08C246B7D8013C9D0CBF1E8EE7',
|
||||
@@ -21,12 +15,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-0',
|
||||
},
|
||||
size: '10',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_FILLED,
|
||||
side: Side.SIDE_BUY,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_FILLED,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
remaining: '0',
|
||||
price: '20000000',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 30).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -42,12 +36,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-1',
|
||||
},
|
||||
size: '1',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_FILLED,
|
||||
side: Side.SIDE_BUY,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_FILLED,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
remaining: '0',
|
||||
price: '100',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 29).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -63,12 +57,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-2',
|
||||
},
|
||||
size: '1',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_FILLED,
|
||||
side: Side.SIDE_BUY,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_FILLED,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
remaining: '0',
|
||||
price: '20000',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 28).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -84,12 +78,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-3',
|
||||
},
|
||||
size: '1',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_ACTIVE,
|
||||
side: Side.SIDE_BUY,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_ACTIVE,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
remaining: '0',
|
||||
price: '100000',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 27).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -105,12 +99,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-3',
|
||||
},
|
||||
size: '10',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_PARTIALLY_FILLED,
|
||||
side: Side.SIDE_SELL,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_PARTIALLY_FILLED,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
remaining: '3',
|
||||
price: '100000',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 27).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -120,7 +114,7 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
},
|
||||
];
|
||||
|
||||
const defaultResult: Orders = {
|
||||
const defaultResult: OrdersQuery = {
|
||||
party: {
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
ordersConnection: {
|
||||
|
||||
@@ -19,7 +19,7 @@ export const generatePartyBalance = (
|
||||
decimals: 5,
|
||||
__typename: 'Asset',
|
||||
},
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
{
|
||||
balance: '100000000',
|
||||
@@ -31,7 +31,7 @@ export const generatePartyBalance = (
|
||||
decimals: 5,
|
||||
__typename: 'Asset',
|
||||
},
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
{
|
||||
balance: '3412867',
|
||||
@@ -43,7 +43,7 @@ export const generatePartyBalance = (
|
||||
decimals: 5,
|
||||
__typename: 'Asset',
|
||||
},
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
{
|
||||
balance: '70007',
|
||||
@@ -55,7 +55,7 @@ export const generatePartyBalance = (
|
||||
decimals: 5,
|
||||
__typename: 'Asset',
|
||||
},
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
],
|
||||
__typename: 'Party',
|
||||
|
||||
@@ -8,7 +8,7 @@ export const generatePartyMarketData = () => {
|
||||
balance: '1200000',
|
||||
asset: { id: 'fBTC', decimals: 5, __typename: 'Asset' },
|
||||
market: null,
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
],
|
||||
marginsConnection: { edges: null, __typename: 'MarginConnection' },
|
||||
|
||||
@@ -77,6 +77,13 @@
|
||||
"nx build console-lite"
|
||||
]
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./apps/console-lite/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
|
||||
@@ -8,7 +8,7 @@ export type PartyBalanceQueryQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type PartyBalanceQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } }> | null } | null };
|
||||
export type PartyBalanceQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } }> | null } | null };
|
||||
|
||||
|
||||
export const PartyBalanceQueryDocument = gql`
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import type {
|
||||
PartyBalanceQuery_party_accounts,
|
||||
PartyBalanceQuery_party_accounts_asset,
|
||||
} from './__generated__/PartyBalanceQuery';
|
||||
AccountFragment,
|
||||
DealTicketMarketFragment,
|
||||
} from '@vegaprotocol/deal-ticket';
|
||||
import { DealTicketBalance } from './deal-ticket-balance';
|
||||
import { AccountType } from '@vegaprotocol/types';
|
||||
|
||||
const tDAI: PartyBalanceQuery_party_accounts_asset = {
|
||||
__typename: 'Asset',
|
||||
id: '1',
|
||||
symbol: 'tDAI',
|
||||
name: 'TDAI',
|
||||
decimals: 2,
|
||||
};
|
||||
|
||||
const accounts: PartyBalanceQuery_party_accounts[] = [
|
||||
const tDAI: DealTicketMarketFragment['tradableInstrument']['instrument']['product']['settlementAsset'] =
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'Asset',
|
||||
id: '1',
|
||||
symbol: 'tDAI',
|
||||
name: 'TDAI',
|
||||
decimals: 2,
|
||||
};
|
||||
|
||||
const accounts: AccountFragment[] = [
|
||||
{
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '1000000',
|
||||
asset: tDAI,
|
||||
|
||||
@@ -38,7 +38,7 @@ import { DealTicketSize } from './deal-ticket-size';
|
||||
import MarketNameRenderer from '../simple-market-list/simple-market-renderer';
|
||||
import SideSelector, { SIDE_NAMES } from './side-selector';
|
||||
import ReviewTrade from './review-trade';
|
||||
import { Side, OrderType } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import { DealTicketSlippage } from './deal-ticket-slippage';
|
||||
|
||||
interface DealTicketMarketProps {
|
||||
@@ -118,7 +118,7 @@ export const DealTicketSteps = ({ market }: DealTicketMarketProps) => {
|
||||
|
||||
const price = useMemo(() => {
|
||||
if (slippage && market?.depth?.lastTrade?.price) {
|
||||
const isLong = order.side === Side.SIDE_BUY;
|
||||
const isLong = order.side === Schema.Side.SIDE_BUY;
|
||||
const multiplier = new BigNumber(1)[isLong ? 'plus' : 'minus'](
|
||||
parseFloat(slippage) / 100
|
||||
);
|
||||
@@ -182,7 +182,7 @@ export const DealTicketSteps = ({ market }: DealTicketMarketProps) => {
|
||||
(value: number) => {
|
||||
if (market?.depth?.lastTrade?.price) {
|
||||
if (value) {
|
||||
const isLong = order.side === Side.SIDE_BUY;
|
||||
const isLong = order.side === Schema.Side.SIDE_BUY;
|
||||
const multiplier = new BigNumber(1)[isLong ? 'plus' : 'minus'](
|
||||
value / 100
|
||||
);
|
||||
@@ -193,11 +193,11 @@ export const DealTicketSteps = ({ market }: DealTicketMarketProps) => {
|
||||
|
||||
setValue('price', bestAskPrice);
|
||||
|
||||
if (order.type === OrderType.TYPE_MARKET) {
|
||||
setValue('type', OrderType.TYPE_LIMIT);
|
||||
if (order.type === Schema.OrderType.TYPE_MARKET) {
|
||||
setValue('type', Schema.OrderType.TYPE_LIMIT);
|
||||
}
|
||||
} else {
|
||||
setValue('type', OrderType.TYPE_MARKET);
|
||||
setValue('type', Schema.OrderType.TYPE_MARKET);
|
||||
setValue('price', market?.depth?.lastTrade?.price);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {
|
||||
MarketTags,
|
||||
MarketTagsVariables,
|
||||
} from './__generated__/MarketTags';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import { MarketExpires } from '@vegaprotocol/market-info';
|
||||
|
||||
export const MARKET_TAGS_QUERY = gql`
|
||||
@@ -72,9 +72,10 @@ export default ({
|
||||
<div
|
||||
className={classNames(
|
||||
{
|
||||
'buyButton dark:buyButtonDark': order.side === Side.SIDE_BUY,
|
||||
'buyButton dark:buyButtonDark':
|
||||
order.side === Schema.Side.SIDE_BUY,
|
||||
'sellButton dark:sellButtonDark':
|
||||
order.side === Side.SIDE_SELL,
|
||||
order.side === Schema.Side.SIDE_SELL,
|
||||
},
|
||||
'px-2 py-1 inline text-ui-small'
|
||||
)}
|
||||
|
||||
@@ -2,16 +2,16 @@ import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { FormGroup } from '@vegaprotocol/ui-toolkit';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
|
||||
interface SideSelectorProps {
|
||||
value: Side;
|
||||
onSelect: (side: Side) => void;
|
||||
value: Schema.Side;
|
||||
onSelect: (side: Schema.Side) => void;
|
||||
}
|
||||
|
||||
export const SIDE_NAMES: Record<Side, string> = {
|
||||
[Side.SIDE_BUY]: t('Long'),
|
||||
[Side.SIDE_SELL]: t('Short'),
|
||||
export const SIDE_NAMES: Record<Schema.Side, string> = {
|
||||
[Schema.Side.SIDE_BUY]: t('Long'),
|
||||
[Schema.Side.SIDE_SELL]: t('Short'),
|
||||
};
|
||||
|
||||
export default ({ value, onSelect }: SideSelectorProps) => {
|
||||
@@ -31,9 +31,9 @@ export default ({ value, onSelect }: SideSelectorProps) => {
|
||||
className={classNames(
|
||||
'px-8 py-2',
|
||||
'buyButton hover:buyButton dark:buyButtonDark dark:hover:buyButtonDark',
|
||||
{ selected: value === Side.SIDE_BUY }
|
||||
{ selected: value === Schema.Side.SIDE_BUY }
|
||||
)}
|
||||
onClick={() => onSelect(Side.SIDE_BUY)}
|
||||
onClick={() => onSelect(Schema.Side.SIDE_BUY)}
|
||||
>
|
||||
{t('Long')}
|
||||
</button>
|
||||
@@ -43,9 +43,9 @@ export default ({ value, onSelect }: SideSelectorProps) => {
|
||||
className={classNames(
|
||||
'px-8 py-2',
|
||||
'sellButton hover:sellButton dark:sellButtonDark dark:hover:sellButtonDark',
|
||||
{ selected: value === Side.SIDE_SELL }
|
||||
{ selected: value === Schema.Side.SIDE_SELL }
|
||||
)}
|
||||
onClick={() => onSelect(Side.SIDE_SELL)}
|
||||
onClick={() => onSelect(Schema.Side.SIDE_SELL)}
|
||||
>
|
||||
{t('Short')}
|
||||
</button>
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
t,
|
||||
} from '@vegaprotocol/react-helpers';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
|
||||
interface Props {
|
||||
partyId: string;
|
||||
@@ -118,13 +118,13 @@ const useColumnDefinitions = ({ partyId }: Props) => {
|
||||
const taker = t('Taker');
|
||||
const maker = t('Maker');
|
||||
if (data?.buyer.id === partyId) {
|
||||
if (value === Side.SIDE_BUY) {
|
||||
if (value === Schema.Side.SIDE_BUY) {
|
||||
return taker;
|
||||
} else {
|
||||
return maker;
|
||||
}
|
||||
} else if (data?.seller.id === partyId) {
|
||||
if (value === Side.SIDE_SELL) {
|
||||
if (value === Schema.Side.SIDE_SELL) {
|
||||
return taker;
|
||||
} else {
|
||||
return maker;
|
||||
|
||||
@@ -12,19 +12,16 @@ import {
|
||||
t,
|
||||
} from '@vegaprotocol/react-helpers';
|
||||
import type {
|
||||
Orders_party_ordersConnection_edges_node,
|
||||
OrderFieldsFragment,
|
||||
Order,
|
||||
CancelOrderArgs,
|
||||
} from '@vegaprotocol/orders';
|
||||
import { isOrderActive } from '@vegaprotocol/orders';
|
||||
import {
|
||||
OrderRejectionReasonMapping,
|
||||
OrderStatus,
|
||||
OrderType,
|
||||
OrderStatusMapping,
|
||||
OrderTypeMapping,
|
||||
Side,
|
||||
OrderTimeInForce,
|
||||
Schema,
|
||||
OrderTimeInForceMapping,
|
||||
} from '@vegaprotocol/types';
|
||||
|
||||
@@ -60,21 +57,15 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
||||
cellClass: 'font-mono !flex h-full items-center',
|
||||
width: 80,
|
||||
cellClassRules: {
|
||||
[positiveClassNames]: ({
|
||||
data,
|
||||
}: {
|
||||
data: Orders_party_ordersConnection_edges_node;
|
||||
}) => data?.side === Side.SIDE_BUY,
|
||||
[negativeClassNames]: ({
|
||||
data,
|
||||
}: {
|
||||
data: Orders_party_ordersConnection_edges_node;
|
||||
}) => data?.side === Side.SIDE_SELL,
|
||||
[positiveClassNames]: ({ data }: { data: OrderFieldsFragment }) =>
|
||||
data?.side === Schema.Side.SIDE_BUY,
|
||||
[negativeClassNames]: ({ data }: { data: OrderFieldsFragment }) =>
|
||||
data?.side === Schema.Side.SIDE_SELL,
|
||||
},
|
||||
valueFormatter: ({ value, data }: ValueFormatterParams) => {
|
||||
if (value && data && data.market) {
|
||||
const prefix = data
|
||||
? data.side === Side.SIDE_BUY
|
||||
? data.side === Schema.Side.SIDE_BUY
|
||||
? '+'
|
||||
: '-'
|
||||
: '';
|
||||
@@ -92,8 +83,8 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
||||
valueFormatter: ({
|
||||
value,
|
||||
}: ValueFormatterParams & {
|
||||
value?: Orders_party_ordersConnection_edges_node['type'];
|
||||
}) => OrderTypeMapping[value as OrderType],
|
||||
value?: OrderFieldsFragment['type'];
|
||||
}) => OrderTypeMapping[value as Schema.OrderType],
|
||||
},
|
||||
{
|
||||
colId: 'status',
|
||||
@@ -106,7 +97,7 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
||||
value?: StatusKey;
|
||||
}) => {
|
||||
if (value && data && data.market) {
|
||||
if (value === OrderStatus.STATUS_REJECTED) {
|
||||
if (value === Schema.OrderStatus.STATUS_REJECTED) {
|
||||
return `${OrderStatusMapping[value as StatusKey]}: ${
|
||||
data.rejectionReason &&
|
||||
OrderRejectionReasonMapping[
|
||||
@@ -130,7 +121,7 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
||||
data,
|
||||
value,
|
||||
}: ValueFormatterParams & {
|
||||
value?: Orders_party_ordersConnection_edges_node['remaining'];
|
||||
value?: OrderFieldsFragment['remaining'];
|
||||
}) => {
|
||||
if (value && data && data.market) {
|
||||
const dps = data.market.positionDecimalPlaces;
|
||||
@@ -156,13 +147,13 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
||||
value,
|
||||
data,
|
||||
}: ValueFormatterParams & {
|
||||
value?: Orders_party_ordersConnection_edges_node['price'];
|
||||
value?: OrderFieldsFragment['price'];
|
||||
}) => {
|
||||
if (
|
||||
value === undefined ||
|
||||
!data ||
|
||||
!data.market ||
|
||||
data.type === OrderType.TYPE_MARKET
|
||||
data.type === Schema.OrderType.TYPE_MARKET
|
||||
) {
|
||||
return '-';
|
||||
}
|
||||
@@ -181,7 +172,7 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
||||
}) => {
|
||||
if (value && data?.market) {
|
||||
if (
|
||||
value === OrderTimeInForce.TIME_IN_FORCE_GTT &&
|
||||
value === Schema.OrderTimeInForce.TIME_IN_FORCE_GTT &&
|
||||
data.expiresAt
|
||||
) {
|
||||
const expiry = getDateTimeFormat().format(
|
||||
@@ -203,7 +194,7 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
||||
valueFormatter: ({
|
||||
value,
|
||||
}: ValueFormatterParams & {
|
||||
value?: Orders_party_ordersConnection_edges_node['createdAt'];
|
||||
value?: OrderFieldsFragment['createdAt'];
|
||||
}) => {
|
||||
return value ? getDateTimeFormat().format(new Date(value)) : value;
|
||||
},
|
||||
@@ -215,7 +206,7 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
||||
valueFormatter: ({
|
||||
value,
|
||||
}: ValueFormatterParams & {
|
||||
value?: Orders_party_ordersConnection_edges_node['updatedAt'];
|
||||
value?: OrderFieldsFragment['updatedAt'];
|
||||
}) => {
|
||||
return value ? getDateTimeFormat().format(new Date(value)) : '-';
|
||||
},
|
||||
|
||||
+9
-23
@@ -15,8 +15,8 @@ import {
|
||||
} from '@testing-library/react';
|
||||
import { MockedProvider } from '@apollo/react-testing';
|
||||
import { MarketState } from '@vegaprotocol/types';
|
||||
import type { Market } from '@vegaprotocol/market-list';
|
||||
import SimpleMarketToolbar from './simple-market-toolbar';
|
||||
import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets';
|
||||
import { markets as filterData } from './mocks/market-filters.json';
|
||||
|
||||
const mockedNavigate = jest.fn();
|
||||
@@ -35,35 +35,23 @@ describe('SimpleMarketToolbar', () => {
|
||||
const routes = useRoutes([
|
||||
{
|
||||
path: '/',
|
||||
element: (
|
||||
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
|
||||
),
|
||||
element: <SimpleMarketToolbar data={filterData as Market[]} />,
|
||||
},
|
||||
{
|
||||
path: 'markets',
|
||||
children: [
|
||||
{
|
||||
path: `:state`,
|
||||
element: (
|
||||
<SimpleMarketToolbar
|
||||
data={filterData as SimpleMarkets_markets[]}
|
||||
/>
|
||||
),
|
||||
element: <SimpleMarketToolbar data={filterData as Market[]} />,
|
||||
children: [
|
||||
{
|
||||
path: `:product`,
|
||||
element: (
|
||||
<SimpleMarketToolbar
|
||||
data={filterData as SimpleMarkets_markets[]}
|
||||
/>
|
||||
),
|
||||
element: <SimpleMarketToolbar data={filterData as Market[]} />,
|
||||
children: [
|
||||
{
|
||||
path: `:asset`,
|
||||
element: (
|
||||
<SimpleMarketToolbar
|
||||
data={filterData as SimpleMarkets_markets[]}
|
||||
/>
|
||||
<SimpleMarketToolbar data={filterData as Market[]} />
|
||||
),
|
||||
},
|
||||
],
|
||||
@@ -71,9 +59,7 @@ describe('SimpleMarketToolbar', () => {
|
||||
],
|
||||
},
|
||||
],
|
||||
element: (
|
||||
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
|
||||
),
|
||||
element: <SimpleMarketToolbar data={filterData as Market[]} />,
|
||||
},
|
||||
]);
|
||||
const location = useLocation();
|
||||
@@ -166,7 +152,7 @@ describe('SimpleMarketToolbar', () => {
|
||||
}));
|
||||
render(
|
||||
<MockedProvider mocks={[]} addTypename={false}>
|
||||
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
|
||||
<SimpleMarketToolbar data={filterData as Market[]} />
|
||||
</MockedProvider>,
|
||||
{ wrapper: BrowserRouter }
|
||||
);
|
||||
@@ -187,7 +173,7 @@ describe('SimpleMarketToolbar', () => {
|
||||
(useParams as jest.Mock).mockImplementation(() => ({}));
|
||||
render(
|
||||
<MockedProvider mocks={[]} addTypename={false}>
|
||||
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
|
||||
<SimpleMarketToolbar data={filterData as Market[]} />
|
||||
</MockedProvider>,
|
||||
{ wrapper: BrowserRouter }
|
||||
);
|
||||
@@ -211,7 +197,7 @@ describe('SimpleMarketToolbar', () => {
|
||||
}));
|
||||
render(
|
||||
<MockedProvider mocks={[]} addTypename={false}>
|
||||
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
|
||||
<SimpleMarketToolbar data={filterData as Market[]} />
|
||||
</MockedProvider>,
|
||||
{ wrapper: BrowserRouter }
|
||||
);
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"module": "commonjs",
|
||||
"types": ["jest", "node", "@testing-library/jest-dom"],
|
||||
"jsx": "react",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true
|
||||
"types": ["jest", "node", "@testing-library/jest-dom"]
|
||||
},
|
||||
"files": ["../../node_modules/@nrwl/react/typings/cssmodule.d.ts"],
|
||||
"include": [
|
||||
"**/*.test.ts",
|
||||
"**/*.spec.ts",
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-exp
|
||||
NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
|
||||
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||
NX_VEGA_ENV=STAGNET3
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||
|
||||
@@ -3,7 +3,7 @@ NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-exp
|
||||
NX_TENDERMINT_URL=http://localhost:26617
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
|
||||
NX_VEGA_URL=http://localhost:3028/query
|
||||
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||
NX_VEGA_ENV=CUSTOM
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ NX_TENDERMINT_URL=https://n04.d.vega.xyz/tm
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://n04.d.vega.xyz/tm/websocket
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
|
||||
NX_VEGA_URL=https://api.n04.d.vega.xyz/graphql
|
||||
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||
NX_VEGA_ENV=DEVNET
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
NX_BLOCK_EXPLORER=
|
||||
|
||||
@@ -4,7 +4,7 @@ NX_TENDERMINT_URL=https://mainnet-observer-proxy01.ops.vega.xyz/
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://mainnet-observer-proxy01.ops.vega.xyz/websocket
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
|
||||
NX_VEGA_URL=https://api.vega.xyz/query
|
||||
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||
NX_VEGA_ENV=MAINNET
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
NX_BLOCK_EXPLORER=
|
||||
|
||||
@@ -4,7 +4,9 @@ NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json
|
||||
NX_VEGA_ENV=STAGNET1
|
||||
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
|
||||
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
|
||||
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
|
||||
NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql
|
||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket
|
||||
|
||||
@@ -4,7 +4,7 @@ NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
|
||||
NX_VEGA_URL=https://api.n01.stagnet3.vega.xyz/graphql
|
||||
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||
NX_VEGA_ENV=STAGNET3
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
NX_BLOCK_EXPLORER=
|
||||
|
||||
@@ -4,7 +4,7 @@ NX_TENDERMINT_URL=https://tm.n07.testnet.vega.xyz
|
||||
NX_BLOCK_EXPLORER=https://n13.testnet.vega.xyz/rest
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n07.testnet.vega.xyz/websocket
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
|
||||
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||
NX_VEGA_ENV=TESTNET
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
NX_VEGA_URL=https://api.n09.testnet.vega.xyz/graphql
|
||||
|
||||
@@ -74,6 +74,13 @@
|
||||
"nx build explorer"
|
||||
]
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./apps/explorer/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
|
||||
@@ -36,7 +36,7 @@ export interface AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccoun
|
||||
}
|
||||
|
||||
export interface AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount {
|
||||
__typename: "Account";
|
||||
__typename: "AccountBalance";
|
||||
/**
|
||||
* Account type (General, Margin, etc)
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ export interface AssetsQuery_assetsConnection_edges_node {
|
||||
/**
|
||||
* The infrastructure fee account for this asset
|
||||
*/
|
||||
infrastructureFeeAccount: AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount;
|
||||
infrastructureFeeAccount: AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount | null;
|
||||
}
|
||||
|
||||
export interface AssetsQuery_assetsConnection_edges {
|
||||
|
||||
@@ -6,7 +6,7 @@ const defaultOptions = {} as const;
|
||||
export type AssetsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type AssetsQueryQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string }, infrastructureFeeAccount: { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null } } } | null> | null } | null };
|
||||
export type AssetsQueryQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string }, infrastructureFeeAccount?: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null } | null } } | null> | null } | null };
|
||||
|
||||
|
||||
export const AssetsQueryDocument = gql`
|
||||
|
||||
@@ -42,7 +42,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_metadata {
|
||||
}
|
||||
|
||||
export interface MarketsQuery_markets_tradableInstrument_instrument_product_settlementAsset_globalRewardPoolAccount {
|
||||
__typename: "Account";
|
||||
__typename: "AccountBalance";
|
||||
/**
|
||||
* Balance as string - current account balance (approx. as balances can be updated several times per second)
|
||||
*/
|
||||
@@ -286,7 +286,7 @@ export interface MarketsQuery_markets_accounts_asset {
|
||||
}
|
||||
|
||||
export interface MarketsQuery_markets_accounts {
|
||||
__typename: "Account";
|
||||
__typename: "AccountBalance";
|
||||
/**
|
||||
* Asset, the 'currency'
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@ const defaultOptions = {} as const;
|
||||
export type MarketsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type MarketsQueryQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, decimalPlaces: number, tradingMode: Types.MarketTradingMode, state: Types.MarketState, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, id: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, name: string, decimals: number, globalRewardPoolAccount?: { __typename?: 'Account', balance: string } | null } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, proposal?: { __typename?: 'Proposal', id?: string | null } | null, accounts?: Array<{ __typename?: 'Account', balance: string, type: Types.AccountType, asset: { __typename?: 'Asset', id: string, name: string } }> | null, data?: { __typename?: 'MarketData', markPrice: string, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, midPrice: string, staticMidPrice: string, timestamp: string, openInterest: string, auctionEnd?: string | null, auctionStart?: string | null, indicativePrice: string, indicativeVolume: string, trigger: Types.AuctionTrigger, extensionTrigger: Types.AuctionTrigger, targetStake?: string | null, suppliedStake?: string | null, marketValueProxy: string, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', auctionExtensionSecs: number, probability: number } }> | null, liquidityProviderFeeShare?: Array<{ __typename?: 'LiquidityProviderFeeShare', equityLikeShare: string, averageEntryValuation: string, party: { __typename?: 'Party', id: string } }> | null } | null }> | null };
|
||||
export type MarketsQueryQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, decimalPlaces: number, tradingMode: Types.MarketTradingMode, state: Types.MarketState, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, id: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, name: string, decimals: number, globalRewardPoolAccount?: { __typename?: 'AccountBalance', balance: string } | null } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, proposal?: { __typename?: 'Proposal', id?: string | null } | null, accounts?: Array<{ __typename?: 'AccountBalance', balance: string, type: Types.AccountType, asset: { __typename?: 'Asset', id: string, name: string } }> | null, data?: { __typename?: 'MarketData', markPrice: string, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, midPrice: string, staticMidPrice: string, timestamp: string, openInterest: string, auctionEnd?: string | null, auctionStart?: string | null, indicativePrice: string, indicativeVolume: string, trigger: Types.AuctionTrigger, extensionTrigger: Types.AuctionTrigger, targetStake?: string | null, suppliedStake?: string | null, marketValueProxy: string, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', auctionExtensionSecs: number, probability: number } }> | null, liquidityProviderFeeShare?: Array<{ __typename?: 'LiquidityProviderFeeShare', equityLikeShare: string, averageEntryValuation: string, party: { __typename?: 'Party', id: string } }> | null } | null }> | null };
|
||||
|
||||
|
||||
export const MarketsQueryDocument = gql`
|
||||
|
||||
@@ -8,7 +8,7 @@ export type PartyAssetsQueryQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type PartyAssetsQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, delegations?: Array<{ __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } }> | null, stake: { __typename?: 'PartyStake', currentStakeAvailable: string }, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } } }> | null } | null };
|
||||
export type PartyAssetsQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, delegations?: Array<{ __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } }> | null, stake: { __typename?: 'PartyStake', currentStakeAvailable: string }, accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } } }> | null } | null };
|
||||
|
||||
|
||||
export const PartyAssetsQueryDocument = gql`
|
||||
|
||||
@@ -81,7 +81,7 @@ export interface PartyAssetsQuery_party_accounts_asset {
|
||||
}
|
||||
|
||||
export interface PartyAssetsQuery_party_accounts {
|
||||
__typename: "Account";
|
||||
__typename: "AccountBalance";
|
||||
/**
|
||||
* Asset, the 'currency'
|
||||
*/
|
||||
|
||||
@@ -88,6 +88,13 @@
|
||||
"nx build liquidity-provision-dashboard"
|
||||
]
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./apps/liquidity-provision-dashboard/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
|
||||
@@ -74,6 +74,13 @@
|
||||
"nx build multisig-signer"
|
||||
]
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./apps/multisig-signer/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
|
||||
@@ -274,7 +274,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "129999.45",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "96249.65741714187627252",
|
||||
"locked_amount": "96016.17448193874966366",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129999.45",
|
||||
@@ -340,7 +340,7 @@
|
||||
"tranche_end": "2023-09-03T00:00:00.000Z",
|
||||
"total_added": "52600",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "45067.54189497717188",
|
||||
"locked_amount": "44925.70570142060104",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "2600",
|
||||
@@ -513,7 +513,7 @@
|
||||
"tranche_end": "2023-09-17T00:00:00.000Z",
|
||||
"total_added": "5000",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "4475.767694063927",
|
||||
"locked_amount": "4462.28516615931",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "5000",
|
||||
@@ -724,7 +724,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "97499.58",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "37634.1494879773269697494",
|
||||
"locked_amount": "37405.12447846227415707",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "97499.58",
|
||||
@@ -757,7 +757,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "135173.4239508",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "51439.385085206660947364406288",
|
||||
"locked_amount": "51126.347436717991246186291608",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "135173.4239508",
|
||||
@@ -790,7 +790,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "32499.86",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "15832.0367825928700854478",
|
||||
"locked_amount": "15735.689916140255189314",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "32499.86",
|
||||
@@ -823,7 +823,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "10833.29",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "5153.1743422855387802305",
|
||||
"locked_amount": "5121.814372183075076614",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10833.29",
|
||||
@@ -856,7 +856,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "22749.93",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "19263.716632166230787346",
|
||||
"locked_amount": "19146.486059800393774347",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "6500",
|
||||
@@ -931,7 +931,7 @@
|
||||
"tranche_end": "2022-11-01T00:00:00.000Z",
|
||||
"total_added": "30000",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "1097.4524456521728",
|
||||
"locked_amount": "936.98105374396269",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -1048,7 +1048,7 @@
|
||||
"tranche_end": "2023-06-02T00:00:00.000Z",
|
||||
"total_added": "1939928.38",
|
||||
"total_removed": "626880.6921411330574",
|
||||
"locked_amount": "1167842.42108528531283383",
|
||||
"locked_amount": "1162611.393382023622567738",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1852091.69",
|
||||
@@ -1345,7 +1345,7 @@
|
||||
"tranche_end": "2023-02-01T00:00:00.000Z",
|
||||
"total_added": "42500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "22804.72429800725075",
|
||||
"locked_amount": "22577.38982613727525",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "12500",
|
||||
@@ -3808,10 +3808,15 @@
|
||||
"tranche_id": 10,
|
||||
"tranche_start": "2021-07-15T23:37:11.000Z",
|
||||
"tranche_end": "2021-07-15T23:37:11.000Z",
|
||||
"total_added": "5115969.150000000000000001",
|
||||
"total_removed": "5113483.280000000000000001",
|
||||
"total_added": "5565969.150000000000000001",
|
||||
"total_removed": "5563483.280000000000000001",
|
||||
"locked_amount": "0",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "450000",
|
||||
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
|
||||
"tx": "0xfd3f5320618d015f10fd774838c6be49fd80f0e5afb678684ac7c7361b97da2e"
|
||||
},
|
||||
{
|
||||
"amount": "100000",
|
||||
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
|
||||
@@ -4294,6 +4299,11 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "450000",
|
||||
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
|
||||
"tx": "0x71a6411439723e3edc24a7acb552c4ff2b6980872798ef8512ecd6a03e397b71"
|
||||
},
|
||||
{
|
||||
"amount": "100000",
|
||||
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
|
||||
@@ -4724,6 +4734,12 @@
|
||||
{
|
||||
"address": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "450000",
|
||||
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
|
||||
"tranche_id": 10,
|
||||
"tx": "0xfd3f5320618d015f10fd774838c6be49fd80f0e5afb678684ac7c7361b97da2e"
|
||||
},
|
||||
{
|
||||
"amount": "100000",
|
||||
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
|
||||
@@ -4864,6 +4880,12 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "450000",
|
||||
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
|
||||
"tranche_id": 10,
|
||||
"tx": "0x71a6411439723e3edc24a7acb552c4ff2b6980872798ef8512ecd6a03e397b71"
|
||||
},
|
||||
{
|
||||
"amount": "100000",
|
||||
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
|
||||
@@ -4997,8 +5019,8 @@
|
||||
"tx": "0xac16a4ce688d40a482a59914d68c3a676592f8804ee8f0781b66a4ba5ccfbdfc"
|
||||
}
|
||||
],
|
||||
"total_tokens": "1956651",
|
||||
"withdrawn_tokens": "1956651",
|
||||
"total_tokens": "2406651",
|
||||
"withdrawn_tokens": "2406651",
|
||||
"remaining_tokens": "0"
|
||||
},
|
||||
{
|
||||
@@ -6047,10 +6069,30 @@
|
||||
"tranche_id": 11,
|
||||
"tranche_start": "2021-09-03T00:00:00.000Z",
|
||||
"tranche_end": "2022-09-03T00:00:00.000Z",
|
||||
"total_added": "40655.000000000000000003",
|
||||
"total_added": "40684.000000000000000003",
|
||||
"total_removed": "25366.75324099301",
|
||||
"locked_amount": "0",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10",
|
||||
"user": "0xABD95f7D67e76280df18220AA6F5A7358956C58b",
|
||||
"tx": "0x37d6f89baf838aabecdc5b9a73d1e77e756a3f5c481110b58a10411e92ad0cba"
|
||||
},
|
||||
{
|
||||
"amount": "12",
|
||||
"user": "0xABD95f7D67e76280df18220AA6F5A7358956C58b",
|
||||
"tx": "0x60df930da53b884d43f81a103c7637e3edf27d2a4b52d8692e69d9c089fd98ee"
|
||||
},
|
||||
{
|
||||
"amount": "2",
|
||||
"user": "0xABD95f7D67e76280df18220AA6F5A7358956C58b",
|
||||
"tx": "0xb709a7c454621197a14942e134f78cc03c06dfb16a51a2c9be8319bf934ed812"
|
||||
},
|
||||
{
|
||||
"amount": "5",
|
||||
"user": "0xABD95f7D67e76280df18220AA6F5A7358956C58b",
|
||||
"tx": "0x1ced95c8b8f51848273bf2a048e6ebe9e200e59f959664620e207ce54fdadc00"
|
||||
},
|
||||
{
|
||||
"amount": "125",
|
||||
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
|
||||
@@ -13575,6 +13617,39 @@
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"address": "0xABD95f7D67e76280df18220AA6F5A7358956C58b",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10",
|
||||
"user": "0xABD95f7D67e76280df18220AA6F5A7358956C58b",
|
||||
"tranche_id": 11,
|
||||
"tx": "0x37d6f89baf838aabecdc5b9a73d1e77e756a3f5c481110b58a10411e92ad0cba"
|
||||
},
|
||||
{
|
||||
"amount": "12",
|
||||
"user": "0xABD95f7D67e76280df18220AA6F5A7358956C58b",
|
||||
"tranche_id": 11,
|
||||
"tx": "0x60df930da53b884d43f81a103c7637e3edf27d2a4b52d8692e69d9c089fd98ee"
|
||||
},
|
||||
{
|
||||
"amount": "2",
|
||||
"user": "0xABD95f7D67e76280df18220AA6F5A7358956C58b",
|
||||
"tranche_id": 11,
|
||||
"tx": "0xb709a7c454621197a14942e134f78cc03c06dfb16a51a2c9be8319bf934ed812"
|
||||
},
|
||||
{
|
||||
"amount": "5",
|
||||
"user": "0xABD95f7D67e76280df18220AA6F5A7358956C58b",
|
||||
"tranche_id": 11,
|
||||
"tx": "0x1ced95c8b8f51848273bf2a048e6ebe9e200e59f959664620e207ce54fdadc00"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"total_tokens": "29",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "29"
|
||||
},
|
||||
{
|
||||
"address": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
|
||||
"deposits": [
|
||||
@@ -24780,8 +24855,8 @@
|
||||
"tranche_start": "2022-03-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "3732368.4671",
|
||||
"total_removed": "223275.6398802360697",
|
||||
"locked_amount": "1819068.43186497551785693485",
|
||||
"total_removed": "223655.6603333956257",
|
||||
"locked_amount": "1811030.258062187675158904076",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1998.95815",
|
||||
@@ -24955,6 +25030,11 @@
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tx": "0xf6708cf8b4b71e4705a99ccfc967456280544ccb064518c4ae06e08b6df3efa7"
|
||||
},
|
||||
{
|
||||
"amount": "380.020453159556",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tx": "0xdc11263bc339be651ab14af63174f2cdb29eaf3300a6a809b2f9a610df94f469"
|
||||
},
|
||||
{
|
||||
"amount": "4439.863808001919",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
@@ -25160,6 +25240,12 @@
|
||||
"tranche_id": 1,
|
||||
"tx": "0xf6708cf8b4b71e4705a99ccfc967456280544ccb064518c4ae06e08b6df3efa7"
|
||||
},
|
||||
{
|
||||
"amount": "380.020453159556",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tranche_id": 1,
|
||||
"tx": "0xdc11263bc339be651ab14af63174f2cdb29eaf3300a6a809b2f9a610df94f469"
|
||||
},
|
||||
{
|
||||
"amount": "4439.863808001919",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
@@ -25270,8 +25356,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "187637.95",
|
||||
"withdrawn_tokens": "96033.171050169656",
|
||||
"remaining_tokens": "91604.778949830344"
|
||||
"withdrawn_tokens": "96413.191503329212",
|
||||
"remaining_tokens": "91224.758496670788"
|
||||
},
|
||||
{
|
||||
"address": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e",
|
||||
@@ -25752,8 +25838,8 @@
|
||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "15870102.715470999700000001",
|
||||
"total_removed": "238273.7820930462773544",
|
||||
"locked_amount": "11749987.4496775524656951941458329714098404",
|
||||
"total_removed": "238759.9961824283322294",
|
||||
"locked_amount": "11721484.6014729559154065406073874423533388",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "16249.93",
|
||||
@@ -26282,6 +26368,16 @@
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tx": "0xccc015d37acd80014d0cd747ec9b6f8fc55ae6c14ceb3c6bc5611382fb2200f5"
|
||||
},
|
||||
{
|
||||
"amount": "465.356889800941875",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0xfbc0ac40eb0b82233ff74c0b44e1f933e855c71c84060db7345e32d32fef1d2a"
|
||||
},
|
||||
{
|
||||
"amount": "20.857199581113",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tx": "0x57be6b70763a67c21c44ec5b16bb2bdcd0201dd456d3be062ad639a500f615de"
|
||||
},
|
||||
{
|
||||
"amount": "243.932422174205",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
@@ -27128,6 +27224,12 @@
|
||||
"tranche_id": 2,
|
||||
"tx": "0xc1036c5ebdc4423f7e2241869acd2b218855eb087b7a7301b34c5f30d0c53468"
|
||||
},
|
||||
{
|
||||
"amount": "465.356889800941875",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0xfbc0ac40eb0b82233ff74c0b44e1f933e855c71c84060db7345e32d32fef1d2a"
|
||||
},
|
||||
{
|
||||
"amount": "981.32183505687375",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -27838,8 +27940,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "259998.8875",
|
||||
"withdrawn_tokens": "67163.2107753242295",
|
||||
"remaining_tokens": "192835.6767246757705"
|
||||
"withdrawn_tokens": "67628.567665125171375",
|
||||
"remaining_tokens": "192370.319834874828625"
|
||||
},
|
||||
{
|
||||
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
|
||||
@@ -28757,6 +28859,12 @@
|
||||
"tranche_id": 2,
|
||||
"tx": "0xccc015d37acd80014d0cd747ec9b6f8fc55ae6c14ceb3c6bc5611382fb2200f5"
|
||||
},
|
||||
{
|
||||
"amount": "20.857199581113",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tranche_id": 2,
|
||||
"tx": "0x57be6b70763a67c21c44ec5b16bb2bdcd0201dd456d3be062ad639a500f615de"
|
||||
},
|
||||
{
|
||||
"amount": "243.932422174205",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
@@ -28849,8 +28957,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "12362.05",
|
||||
"withdrawn_tokens": "3200.923492408422",
|
||||
"remaining_tokens": "9161.126507591578"
|
||||
"withdrawn_tokens": "3221.780691989535",
|
||||
"remaining_tokens": "9140.269308010465"
|
||||
},
|
||||
{
|
||||
"address": "0xb091D456d0dFCB94dcba6f355379056C5bb995fC",
|
||||
@@ -29474,8 +29582,8 @@
|
||||
"tranche_start": "2021-11-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-05T00:00:00.000Z",
|
||||
"total_added": "14597706.0446472999",
|
||||
"total_removed": "3140755.062704674199099637",
|
||||
"locked_amount": "5126068.16287379526746716073449839",
|
||||
"total_removed": "3141399.277884802232022137",
|
||||
"locked_amount": "5099754.51540371360721163558107384",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129284.449",
|
||||
@@ -29699,6 +29807,11 @@
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0x14c4b4cf77c54981577d361682f156d5fa12b867b286df96746eac2fbcbc1699"
|
||||
},
|
||||
{
|
||||
"amount": "644.2151801280329225",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0xc88cbd4f724b63b359afeec4284dc430a581e94c94df08f775476bb6e7641d7f"
|
||||
},
|
||||
{
|
||||
"amount": "1360.2331260920135955",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
@@ -32023,6 +32136,12 @@
|
||||
"tranche_id": 3,
|
||||
"tx": "0x14c4b4cf77c54981577d361682f156d5fa12b867b286df96746eac2fbcbc1699"
|
||||
},
|
||||
{
|
||||
"amount": "644.2151801280329225",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0xc88cbd4f724b63b359afeec4284dc430a581e94c94df08f775476bb6e7641d7f"
|
||||
},
|
||||
{
|
||||
"amount": "1360.2331260920135955",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
@@ -34011,8 +34130,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "359123.469575",
|
||||
"withdrawn_tokens": "232548.516908492756543",
|
||||
"remaining_tokens": "126574.952666507243457"
|
||||
"withdrawn_tokens": "233192.7320886207894655",
|
||||
"remaining_tokens": "125930.7374863792105345"
|
||||
},
|
||||
{
|
||||
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
|
||||
@@ -35129,8 +35248,8 @@
|
||||
"tranche_start": "2021-10-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "5778205.3912159303",
|
||||
"total_removed": "1946099.134996047321029132",
|
||||
"locked_amount": "1708437.129813389772078403182360171",
|
||||
"total_removed": "2110079.858212660363479132",
|
||||
"locked_amount": "1698040.44855434566635123479204978",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "552496.6455",
|
||||
@@ -35279,6 +35398,11 @@
|
||||
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
|
||||
"tx": "0x5e6e6f25a5e54eaaaec1b558ebbe5ef03a6a5e5ace1d2ebdbe0b785fe7893827"
|
||||
},
|
||||
{
|
||||
"amount": "163980.72321661304245",
|
||||
"user": "0x83b1a48376E045D26420200345414e6b93066396",
|
||||
"tx": "0xb2e3a1c7547cc573d47d8902010f5b6f837f1b4580570f0fa34b6041a6ca70a6"
|
||||
},
|
||||
{
|
||||
"amount": "14848.19419062596735675",
|
||||
"user": "0x9058e12e2F32cB1cD4D3123359963D77786477FC",
|
||||
@@ -36349,6 +36473,12 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "163980.72321661304245",
|
||||
"user": "0x83b1a48376E045D26420200345414e6b93066396",
|
||||
"tranche_id": 4,
|
||||
"tx": "0xb2e3a1c7547cc573d47d8902010f5b6f837f1b4580570f0fa34b6041a6ca70a6"
|
||||
},
|
||||
{
|
||||
"amount": "60299.73667925783",
|
||||
"user": "0x83b1a48376E045D26420200345414e6b93066396",
|
||||
@@ -36387,8 +36517,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "1104995.291",
|
||||
"withdrawn_tokens": "615457.29883212240315",
|
||||
"remaining_tokens": "489537.99216787759685"
|
||||
"withdrawn_tokens": "779438.0220487354456",
|
||||
"remaining_tokens": "325557.2689512645544"
|
||||
},
|
||||
{
|
||||
"address": "0x5565d64f29Ea17355106DF3bA5903Eb793B3e139",
|
||||
@@ -36738,7 +36868,7 @@
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "472355.6199999996",
|
||||
"total_removed": "6182.082957838296",
|
||||
"locked_amount": "288241.79126746612658824589852868",
|
||||
"locked_amount": "286968.0966802541023539294469812",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "3000",
|
||||
@@ -63705,7 +63835,7 @@
|
||||
"tranche_start": "2021-12-05T00:00:00.000Z",
|
||||
"tranche_end": "2022-06-05T00:00:00.000Z",
|
||||
"total_added": "171288.42",
|
||||
"total_removed": "56194.7088304822989",
|
||||
"total_removed": "56244.8822826097989",
|
||||
"locked_amount": "0",
|
||||
"deposits": [
|
||||
{
|
||||
@@ -67940,6 +68070,11 @@
|
||||
"user": "0x4e2b2C4F091f0167770822a706f05C6c51B46E85",
|
||||
"tx": "0x7bc2cab61bc39fd7d196ae964e72332b9917e26168a180474162aeab5d331897"
|
||||
},
|
||||
{
|
||||
"amount": "50.1734521275",
|
||||
"user": "0x21d4109baaB9aAB379CaCf2D121357ada958570D",
|
||||
"tx": "0x257f56185f835db9af657e45218e8aa6e29e0fa84fa1e0139ca1564b1ce11520"
|
||||
},
|
||||
{
|
||||
"amount": "40",
|
||||
"user": "0x7cE6eB9eCcbe0E2d35Cd4515d58b813d943BF2Ec",
|
||||
@@ -76455,6 +76590,12 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "50.1734521275",
|
||||
"user": "0x21d4109baaB9aAB379CaCf2D121357ada958570D",
|
||||
"tranche_id": 6,
|
||||
"tx": "0x257f56185f835db9af657e45218e8aa6e29e0fa84fa1e0139ca1564b1ce11520"
|
||||
},
|
||||
{
|
||||
"amount": "199.8265478725",
|
||||
"user": "0x21d4109baaB9aAB379CaCf2D121357ada958570D",
|
||||
@@ -76463,8 +76604,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "250",
|
||||
"withdrawn_tokens": "199.8265478725",
|
||||
"remaining_tokens": "50.1734521275"
|
||||
"withdrawn_tokens": "250",
|
||||
"remaining_tokens": "0"
|
||||
},
|
||||
{
|
||||
"address": "0x667B436A05523B8D80483b030f559f034753DD74",
|
||||
|
||||
@@ -64,6 +64,13 @@
|
||||
"jestConfig": "apps/stats/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./apps/stats/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
|
||||
@@ -37,7 +37,7 @@ extend type RewardPerAssetDetail {
|
||||
totalAmountFormatted: String!
|
||||
}
|
||||
|
||||
extend type Account {
|
||||
extend type AccountBalance {
|
||||
"The balance field formatted by the client"
|
||||
balanceFormatted: String!
|
||||
}
|
||||
|
||||
@@ -74,6 +74,13 @@
|
||||
"nx build token"
|
||||
]
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./apps/token/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
|
||||
@@ -97,7 +97,7 @@ export interface Delegations_party_accounts_asset {
|
||||
}
|
||||
|
||||
export interface Delegations_party_accounts {
|
||||
__typename: "Account";
|
||||
__typename: "AccountBalance";
|
||||
/**
|
||||
* Asset, the 'currency'
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@ export type DelegationsQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type DelegationsQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string }, party?: { __typename?: 'Party', id: string, delegations?: Array<{ __typename?: 'Delegation', amountFormatted: string, amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } }> | null, stake: { __typename?: 'PartyStake', currentStakeAvailable: string, currentStakeAvailableFormatted: string }, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } } }> | null } | null };
|
||||
export type DelegationsQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string }, party?: { __typename?: 'Party', id: string, delegations?: Array<{ __typename?: 'Delegation', amountFormatted: string, amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } }> | null, stake: { __typename?: 'PartyStake', currentStakeAvailable: string, currentStakeAvailableFormatted: string }, accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } } }> | null } | null };
|
||||
|
||||
|
||||
export const DelegationsDocument = gql`
|
||||
|
||||
@@ -32,6 +32,6 @@ extend type RewardPerAssetDetail {
|
||||
totalAmountFormatted: String!
|
||||
}
|
||||
|
||||
extend type Account {
|
||||
extend type AccountBalance {
|
||||
balanceFormatted: String!
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { generateProposal } from '../../test-helpers/generate-proposals';
|
||||
import { Proposal } from './proposal';
|
||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
||||
|
||||
jest.mock('../proposal-detail-header/proposal-header', () => ({
|
||||
ProposalHeader: () => <div data-testid="proposal-header"></div>,
|
||||
@@ -20,13 +21,13 @@ jest.mock('../vote-details', () => ({
|
||||
|
||||
it('Renders with data-testid', () => {
|
||||
const proposal = generateProposal();
|
||||
render(<Proposal proposal={proposal} />);
|
||||
render(<Proposal proposal={proposal as Proposal_proposal} />);
|
||||
expect(screen.getByTestId('proposal')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders each section', () => {
|
||||
const proposal = generateProposal();
|
||||
render(<Proposal proposal={proposal} />);
|
||||
render(<Proposal proposal={proposal as Proposal_proposal} />);
|
||||
expect(screen.getByTestId('proposal-header')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('proposal-change-table')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('proposal-terms-json')).toBeInTheDocument();
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
lastMonth,
|
||||
nextMonth,
|
||||
} from '../../test-helpers/mocks';
|
||||
import type { ProposalsConnection_proposalsConnection_edges_node as ProposalNode } from '@vegaprotocol/governance';
|
||||
import type { ProposalFields } from '../../__generated__/ProposalFields';
|
||||
|
||||
const openProposalClosesNextMonth = generateProposal({
|
||||
id: 'proposal1',
|
||||
@@ -58,7 +58,7 @@ const failedProposalClosedLastMonth = generateProposal({
|
||||
},
|
||||
});
|
||||
|
||||
const renderComponent = (proposals: ProposalNode[]) => (
|
||||
const renderComponent = (proposals: ProposalFields[]) => (
|
||||
<Router>
|
||||
<MockedProvider mocks={[networkParamsQueryMock]}>
|
||||
<AppStateProvider>
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import {
|
||||
nextWeek,
|
||||
lastMonth,
|
||||
} from '../../test-helpers/mocks';
|
||||
import type { ProposalsConnection_proposalsConnection_edges_node as ProposalNode } from '@vegaprotocol/governance';
|
||||
import type { ProposalFields } from '../../__generated__/ProposalFields';
|
||||
|
||||
const rejectedProposalClosesNextWeek = generateProposal({
|
||||
id: 'rejected1',
|
||||
@@ -35,7 +35,7 @@ const rejectedProposalClosedLastMonth = generateProposal({
|
||||
},
|
||||
});
|
||||
|
||||
const renderComponent = (proposals: ProposalNode[]) => (
|
||||
const renderComponent = (proposals: ProposalFields[]) => (
|
||||
<Router>
|
||||
<MockedProvider mocks={[networkParamsQueryMock]}>
|
||||
<AppStateProvider>
|
||||
|
||||
+17
-11
@@ -1,6 +1,13 @@
|
||||
import { render, screen, fireEvent, act } from '@testing-library/react';
|
||||
import { ProposalFormVoteAndEnactmentDeadline } from './proposal-form-vote-and-enactment-deadline';
|
||||
|
||||
jest.mock('@vegaprotocol/react-helpers', () => ({
|
||||
...jest.requireActual('@vegaprotocol/react-helpers'),
|
||||
getDateTimeFormat: jest.fn(() => ({
|
||||
format: (date: Date) => date.toISOString(),
|
||||
})),
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
jest.setSystemTime(new Date('2022-01-01T00:00:00.000Z'));
|
||||
@@ -19,7 +26,6 @@ const maxEnactDeadline = '4h0m0s';
|
||||
* Formats date according to locale.
|
||||
* @param expected Use format: YYYY-MM-DDThh:mm:ss.000Z
|
||||
*/
|
||||
const expectedDate = (expected: string) => new Date(expected).toLocaleString();
|
||||
|
||||
const renderComponent = () => {
|
||||
const register = jest.fn();
|
||||
@@ -142,13 +148,13 @@ describe('Proposal form vote, validation and enactment deadline', () => {
|
||||
// Should be adding 2 mins to the vote deadline as the minimum is set by
|
||||
// default, and we add 2 mins for wallet confirmation
|
||||
expect(screen.getByTestId('voting-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T01:02:00.000Z')
|
||||
'2022-01-01T01:02:00.000Z'
|
||||
);
|
||||
expect(screen.getByTestId('validation-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T00:02:00.000Z')
|
||||
'2022-01-01T00:02:00.000Z'
|
||||
);
|
||||
expect(screen.getByTestId('enactment-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T02:00:00.000Z')
|
||||
'2022-01-01T02:00:00.000Z'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -159,13 +165,13 @@ describe('Proposal form vote, validation and enactment deadline', () => {
|
||||
});
|
||||
|
||||
expect(screen.getByTestId('voting-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T01:02:30.000Z')
|
||||
'2022-01-01T01:02:30.000Z'
|
||||
);
|
||||
expect(screen.getByTestId('validation-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T00:02:30.000Z')
|
||||
'2022-01-01T00:02:30.000Z'
|
||||
);
|
||||
expect(screen.getByTestId('enactment-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T02:00:30.000Z')
|
||||
'2022-01-01T02:00:30.000Z'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -174,10 +180,10 @@ describe('Proposal form vote, validation and enactment deadline', () => {
|
||||
const voteDeadlineInput = screen.getByTestId('proposal-vote-deadline');
|
||||
fireEvent.change(voteDeadlineInput, { target: { value: 2 } });
|
||||
expect(screen.getByTestId('voting-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T02:00:00.000Z')
|
||||
'2022-01-01T02:00:00.000Z'
|
||||
);
|
||||
expect(screen.getByTestId('enactment-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T03:00:00.000Z')
|
||||
'2022-01-01T03:00:00.000Z'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -192,12 +198,12 @@ describe('Proposal form vote, validation and enactment deadline', () => {
|
||||
fireEvent.click(voteDeadlineMaxButton);
|
||||
fireEvent.click(validationDeadlineMaxButton);
|
||||
expect(screen.getByTestId('validation-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T05:00:00.000Z')
|
||||
'2022-01-01T05:00:00.000Z'
|
||||
);
|
||||
expect(validationDeadlineInput).toHaveValue(5);
|
||||
fireEvent.click(voteDeadlineMinButton);
|
||||
expect(screen.getByTestId('validation-date')).toHaveTextContent(
|
||||
expectedDate('2022-01-01T01:00:00.000Z')
|
||||
'2022-01-01T01:00:00.000Z'
|
||||
);
|
||||
expect(validationDeadlineInput).toHaveValue(1);
|
||||
});
|
||||
|
||||
+4
-3
@@ -6,6 +6,7 @@ import {
|
||||
Input,
|
||||
InputError,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { getDateTimeFormat } from '@vegaprotocol/react-helpers';
|
||||
import { addHours, addMinutes } from 'date-fns';
|
||||
import {
|
||||
deadlineToSeconds,
|
||||
@@ -109,7 +110,7 @@ const ValidationForm = ({
|
||||
{t('ThisWillSetValidationDeadlineTo')}
|
||||
</span>
|
||||
<span data-testid="validation-date" className="pl-2">
|
||||
{deadlineDates.validation.toLocaleString()}
|
||||
{getDateTimeFormat().format(deadlineDates.validation)}
|
||||
</span>
|
||||
{deadlines.validation === 0 && (
|
||||
<span
|
||||
@@ -215,7 +216,7 @@ const EnactmentForm = ({
|
||||
{t('ThisWillSetEnactmentDeadlineTo')}
|
||||
</span>
|
||||
<span data-testid="enactment-date" className="pl-2">
|
||||
{deadlineDates.enactment.toLocaleString()}
|
||||
{getDateTimeFormat().format(deadlineDates.enactment)}
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
@@ -454,7 +455,7 @@ export function ProposalFormVoteAndEnactmentDeadline({
|
||||
{t('ThisWillSetVotingDeadlineTo')}
|
||||
</span>
|
||||
<span data-testid="voting-date" className="pl-2">
|
||||
{deadlineDates.vote.toLocaleString()}
|
||||
{getDateTimeFormat().format(deadlineDates.vote)}
|
||||
</span>
|
||||
{deadlines.vote === minVoteHours && (
|
||||
<span
|
||||
|
||||
@@ -493,12 +493,13 @@ export interface Proposal_proposal_terms_change_NewAsset_source_ERC20 {
|
||||
contractAddress: string;
|
||||
/**
|
||||
* The lifetime limits deposit per address
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
* Note: this is a temporary measure that can be changed by governance
|
||||
*/
|
||||
lifetimeLimit: string;
|
||||
/**
|
||||
* The maximum allowed per withdrawal
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
* The maximum you can withdraw instantly. All withdrawals over the threshold will be delayed by the withdrawal delay.
|
||||
* There’s no limit on the size of a withdrawal
|
||||
* Note: this is a temporary measure that can be changed by governance
|
||||
*/
|
||||
withdrawThreshold: string;
|
||||
}
|
||||
@@ -550,12 +551,13 @@ export interface Proposal_proposal_terms_change_UpdateAsset_source {
|
||||
__typename: "UpdateERC20";
|
||||
/**
|
||||
* The lifetime limits deposit per address
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
* Note: this is a temporary measure that can be changed by governance
|
||||
*/
|
||||
lifetimeLimit: string;
|
||||
/**
|
||||
* The maximum allowed per withdrawal
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
* The maximum you can withdraw instantly. All withdrawals over the threshold will be delayed by the withdrawal delay.
|
||||
* There’s no limit on the size of a withdrawal
|
||||
* Note: this is a temporary measure that can be changed by governance
|
||||
*/
|
||||
withdrawThreshold: string;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ describe('Proposal container', () => {
|
||||
|
||||
it('Renders proposal details if proposal is found', async () => {
|
||||
const proposal = generateProposal({ id: 'foo' });
|
||||
render(renderComponent(proposal, 'foo'));
|
||||
render(renderComponent(proposal as Proposal_proposal, 'foo'));
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('proposal')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
+4
-3
@@ -137,12 +137,13 @@ export interface ProposalFields_terms_change_UpdateAsset_source {
|
||||
__typename: "UpdateERC20";
|
||||
/**
|
||||
* The lifetime limits deposit per address
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
* Note: this is a temporary measure that can be changed by governance
|
||||
*/
|
||||
lifetimeLimit: string;
|
||||
/**
|
||||
* The maximum allowed per withdrawal
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
* The maximum you can withdraw instantly. All withdrawals over the threshold will be delayed by the withdrawal delay.
|
||||
* There’s no limit on the size of a withdrawal
|
||||
* Note: this is a temporary measure that can be changed by governance
|
||||
*/
|
||||
withdrawThreshold: string;
|
||||
}
|
||||
|
||||
@@ -137,12 +137,13 @@ export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateAss
|
||||
__typename: "UpdateERC20";
|
||||
/**
|
||||
* The lifetime limits deposit per address
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
* Note: this is a temporary measure that can be changed by governance
|
||||
*/
|
||||
lifetimeLimit: string;
|
||||
/**
|
||||
* The maximum allowed per withdrawal
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
* The maximum you can withdraw instantly. All withdrawals over the threshold will be delayed by the withdrawal delay.
|
||||
* There’s no limit on the size of a withdrawal
|
||||
* Note: this is a temporary measure that can be changed by governance
|
||||
*/
|
||||
withdrawThreshold: string;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MockedProvider } from '@apollo/client/testing';
|
||||
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
||||
import { VegaWalletContext } from '@vegaprotocol/wallet';
|
||||
import {
|
||||
BusEventType,
|
||||
Schema,
|
||||
ProposalRejectionReason,
|
||||
ProposalState,
|
||||
} from '@vegaprotocol/types';
|
||||
@@ -28,7 +28,7 @@ describe('Raw proposal form', () => {
|
||||
busEvents: [
|
||||
{
|
||||
__typename: 'BusEvent',
|
||||
type: BusEventType.Proposal,
|
||||
type: Schema.BusEventType.Proposal,
|
||||
event: {
|
||||
__typename: 'Proposal',
|
||||
id: '2fca514cebf9f465ae31ecb4c5721e3a6f5f260425ded887ca50ba15b81a5d50',
|
||||
|
||||
@@ -118,11 +118,11 @@ describe('Market trading page', () => {
|
||||
const toolTipValue = 'tooltip-value';
|
||||
const auctionToolTipLabels = [
|
||||
'Auction start',
|
||||
'Est auction end',
|
||||
'Est. auction end',
|
||||
'Target liquidity',
|
||||
'Current liquidity',
|
||||
'Est uncrossing price',
|
||||
'Est uncrossing vol',
|
||||
'Est. uncrossing price',
|
||||
'Est. uncrossing vol',
|
||||
];
|
||||
|
||||
cy.getByTestId(marketSummaryBlock).within(() => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OrderRejectionReason, OrderStatus } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
import {
|
||||
updateOrder,
|
||||
@@ -19,7 +19,7 @@ const editOrderBtn = 'edit';
|
||||
describe('orders list', { tags: '@smoke' }, () => {
|
||||
before(() => {
|
||||
const subscriptionMocks = getSubscriptionMocks();
|
||||
cy.spy(subscriptionMocks, 'OrderSub');
|
||||
cy.spy(subscriptionMocks, 'OrdersUpdate');
|
||||
cy.mockTradingPage();
|
||||
cy.mockGQLSubscription(subscriptionMocks);
|
||||
cy.visit('/markets/market-0');
|
||||
@@ -27,7 +27,7 @@ describe('orders list', { tags: '@smoke' }, () => {
|
||||
cy.getByTestId('tab-orders').contains('Please connect Vega wallet');
|
||||
connectVegaWallet();
|
||||
cy.wait('@Orders').then(() => {
|
||||
expect(subscriptionMocks.OrderSub).to.be.calledOnce;
|
||||
expect(subscriptionMocks.OrdersUpdate).to.be.calledOnce;
|
||||
});
|
||||
});
|
||||
it('renders orders', () => {
|
||||
@@ -124,7 +124,7 @@ describe('orders list', { tags: '@smoke' }, () => {
|
||||
describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
before(() => {
|
||||
const subscriptionMocks = getSubscriptionMocks();
|
||||
cy.spy(subscriptionMocks, 'OrderSub');
|
||||
cy.spy(subscriptionMocks, 'OrdersUpdate');
|
||||
cy.mockTradingPage();
|
||||
cy.mockGQLSubscription(subscriptionMocks);
|
||||
cy.visit('/markets/market-0');
|
||||
@@ -132,7 +132,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
cy.getByTestId('tab-orders').contains('Please connect Vega wallet');
|
||||
connectVegaWallet();
|
||||
cy.wait('@Orders').then(() => {
|
||||
expect(subscriptionMocks.OrderSub).to.be.calledOnce;
|
||||
expect(subscriptionMocks.OrdersUpdate).to.be.calledOnce;
|
||||
});
|
||||
});
|
||||
const orderId = '1234567890';
|
||||
@@ -142,7 +142,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
// 7002-SORD-041
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: OrderStatus.STATUS_ACTIVE,
|
||||
status: Schema.OrderStatus.STATUS_ACTIVE,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
'have.text',
|
||||
@@ -154,7 +154,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
// 7002-SORD-042
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: OrderStatus.STATUS_EXPIRED,
|
||||
status: Schema.OrderStatus.STATUS_EXPIRED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
'have.text',
|
||||
@@ -167,7 +167,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
// NOT COVERED: see the txn that cancelled it and a link to the block explorer, if cancelled by a user transaction.
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: OrderStatus.STATUS_CANCELLED,
|
||||
status: Schema.OrderStatus.STATUS_CANCELLED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
'have.text',
|
||||
@@ -180,7 +180,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
// NOT COVERED: see an explanation of why stopped
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: OrderStatus.STATUS_STOPPED,
|
||||
status: Schema.OrderStatus.STATUS_STOPPED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
'have.text',
|
||||
@@ -192,7 +192,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
// 7002-SORD-045
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: OrderStatus.STATUS_PARTIALLY_FILLED,
|
||||
status: Schema.OrderStatus.STATUS_PARTIALLY_FILLED,
|
||||
size: '5',
|
||||
remaining: '1',
|
||||
});
|
||||
@@ -211,7 +211,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
// NOT COVERED: Must be able to see/link to all trades that were created from this order
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: OrderStatus.STATUS_FILLED,
|
||||
status: Schema.OrderStatus.STATUS_FILLED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
'have.text',
|
||||
@@ -223,8 +223,8 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
// 7002-SORD-047
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: OrderStatus.STATUS_REJECTED,
|
||||
rejectionReason: OrderRejectionReason.ORDER_ERROR_INTERNAL_ERROR,
|
||||
status: Schema.OrderStatus.STATUS_REJECTED,
|
||||
rejectionReason: Schema.OrderRejectionReason.ORDER_ERROR_INTERNAL_ERROR,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
'have.text',
|
||||
@@ -237,7 +237,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
// NOT COVERED: must see an explanation of why parked orders happen
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: OrderStatus.STATUS_PARKED,
|
||||
status: Schema.OrderStatus.STATUS_PARKED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
'have.text',
|
||||
|
||||
@@ -12,7 +12,7 @@ export const generateAccounts = (
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
accounts: [
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '100000000',
|
||||
market: null,
|
||||
@@ -22,7 +22,7 @@ export const generateAccounts = (
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '100000000',
|
||||
market: {
|
||||
@@ -35,7 +35,7 @@ export const generateAccounts = (
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '1000',
|
||||
market: {
|
||||
@@ -48,7 +48,7 @@ export const generateAccounts = (
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '1000',
|
||||
market: {
|
||||
@@ -61,7 +61,7 @@ export const generateAccounts = (
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '100000000',
|
||||
market: null,
|
||||
@@ -72,7 +72,7 @@ export const generateAccounts = (
|
||||
},
|
||||
// account to withdraw Sepolia tBTC
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '100000000',
|
||||
market: null,
|
||||
|
||||
@@ -23,27 +23,27 @@ export const generateAsset = (override?: PartialDeep<AssetQuery>) => {
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
__typename: 'Asset',
|
||||
},
|
||||
@@ -74,27 +74,27 @@ export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
__typename: 'Asset',
|
||||
},
|
||||
@@ -115,27 +115,27 @@ export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
__typename: 'Asset',
|
||||
},
|
||||
@@ -154,7 +154,7 @@ export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '0',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: null,
|
||||
takerFeeRewardAccount: null,
|
||||
@@ -183,27 +183,27 @@ export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
||||
quantum: '1',
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
__typename: 'Asset',
|
||||
},
|
||||
@@ -225,27 +225,27 @@ export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
||||
quantum: '1',
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
__typename: 'Asset',
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { FillsQuery, FillFieldsFragment } from '@vegaprotocol/fills';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import merge from 'lodash/merge';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
|
||||
@@ -17,7 +17,7 @@ export const generateFills = (
|
||||
seller: {
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
},
|
||||
aggressor: Side.SIDE_SELL,
|
||||
aggressor: Schema.Side.SIDE_SELL,
|
||||
buyerFee: {
|
||||
infrastructureFee: '5000',
|
||||
},
|
||||
@@ -30,11 +30,11 @@ export const generateFills = (
|
||||
seller: {
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
},
|
||||
aggressor: Side.SIDE_BUY,
|
||||
aggressor: Schema.Side.SIDE_BUY,
|
||||
}),
|
||||
generateFill({
|
||||
id: '3',
|
||||
aggressor: Side.SIDE_SELL,
|
||||
aggressor: Schema.Side.SIDE_SELL,
|
||||
market: {
|
||||
id: 'market-2',
|
||||
},
|
||||
@@ -80,7 +80,7 @@ export const generateFill = (override?: PartialDeep<FillFieldsFragment>) => {
|
||||
size: '50000',
|
||||
buyOrder: 'buy-order',
|
||||
sellOrder: 'sell-order',
|
||||
aggressor: Side.SIDE_BUY,
|
||||
aggressor: Schema.Side.SIDE_BUY,
|
||||
buyer: {
|
||||
__typename: 'Party',
|
||||
id: 'buyer-id',
|
||||
|
||||
@@ -36,7 +36,7 @@ export const generateMarketInfoQuery = (
|
||||
__typename: 'Asset',
|
||||
},
|
||||
balance: '0',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
{
|
||||
type: AccountType.ACCOUNT_TYPE_FEES_LIQUIDITY,
|
||||
@@ -45,7 +45,7 @@ export const generateMarketInfoQuery = (
|
||||
__typename: 'Asset',
|
||||
},
|
||||
balance: '0',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
],
|
||||
fees: {
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
import merge from 'lodash/merge';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type {
|
||||
Orders,
|
||||
Orders_party_ordersConnection_edges_node,
|
||||
} from '@vegaprotocol/orders';
|
||||
import {
|
||||
OrderStatus,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
Side,
|
||||
} from '@vegaprotocol/types';
|
||||
import type { OrdersQuery, OrderFieldsFragment } from '@vegaprotocol/orders';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
|
||||
export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
const orders: Orders_party_ordersConnection_edges_node[] = [
|
||||
export const generateOrders = (
|
||||
override?: PartialDeep<OrdersQuery>
|
||||
): OrdersQuery => {
|
||||
const orders: OrderFieldsFragment[] = [
|
||||
{
|
||||
__typename: 'Order',
|
||||
id: '066468C06549101DAF7BC51099E1412A0067DC08C246B7D8013C9D0CBF1E8EE7',
|
||||
@@ -21,12 +15,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-0',
|
||||
},
|
||||
size: '10',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_FILLED,
|
||||
side: Side.SIDE_BUY,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_FILLED,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
remaining: '0',
|
||||
price: '20000000',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 30).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -42,12 +36,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-1',
|
||||
},
|
||||
size: '1',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_FILLED,
|
||||
side: Side.SIDE_BUY,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_FILLED,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
remaining: '0',
|
||||
price: '100',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 29).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -63,12 +57,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-2',
|
||||
},
|
||||
size: '1',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_FILLED,
|
||||
side: Side.SIDE_BUY,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_FILLED,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
remaining: '0',
|
||||
price: '20000',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 28).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -84,12 +78,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-3',
|
||||
},
|
||||
size: '1',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_ACTIVE,
|
||||
side: Side.SIDE_BUY,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_ACTIVE,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
remaining: '0',
|
||||
price: '100000',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 27).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -105,12 +99,12 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
id: 'market-3',
|
||||
},
|
||||
size: '10',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_PARTIALLY_FILLED,
|
||||
side: Side.SIDE_SELL,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_PARTIALLY_FILLED,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
remaining: '3',
|
||||
price: '100000',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 27).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
@@ -120,7 +114,7 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
|
||||
},
|
||||
];
|
||||
|
||||
const defaultResult: Orders = {
|
||||
const defaultResult: OrdersQuery = {
|
||||
party: {
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
ordersConnection: {
|
||||
|
||||
@@ -1,48 +1,50 @@
|
||||
import merge from 'lodash/merge';
|
||||
import type {
|
||||
OrderSub as OrderSubData,
|
||||
OrderSubVariables,
|
||||
OrderSub_orders,
|
||||
OrdersUpdateSubscription,
|
||||
OrdersUpdateSubscriptionVariables,
|
||||
OrderUpdateFieldsFragment,
|
||||
} from '@vegaprotocol/orders';
|
||||
|
||||
import type { onMessage } from '@vegaprotocol/cypress';
|
||||
import {
|
||||
OrderStatus,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
Side,
|
||||
} from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
let sendOrderUpdate: (data: OrderSubData) => void;
|
||||
const getOnOrderSub = () => {
|
||||
const onOrderSub: onMessage<OrderSubData, OrderSubVariables> = (send) => {
|
||||
let sendOrderUpdate: (data: OrdersUpdateSubscription) => void;
|
||||
const getOnOrderUpdate = () => {
|
||||
const onOrderUpdate: onMessage<
|
||||
OrdersUpdateSubscription,
|
||||
OrdersUpdateSubscriptionVariables
|
||||
> = (send) => {
|
||||
sendOrderUpdate = send;
|
||||
};
|
||||
return onOrderSub;
|
||||
return onOrderUpdate;
|
||||
};
|
||||
|
||||
export const getSubscriptionMocks = () => ({ OrderSub: getOnOrderSub() });
|
||||
export const getSubscriptionMocks = () => ({
|
||||
OrdersUpdate: getOnOrderUpdate(),
|
||||
});
|
||||
|
||||
export function updateOrder(override?: PartialDeep<OrderSub_orders>): void {
|
||||
const order: OrderSub_orders = {
|
||||
export function updateOrder(
|
||||
override?: PartialDeep<OrderUpdateFieldsFragment>
|
||||
): void {
|
||||
const order: OrderUpdateFieldsFragment = {
|
||||
__typename: 'OrderUpdate',
|
||||
id: '1234567890',
|
||||
marketId: 'market-0',
|
||||
size: '10',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
status: OrderStatus.STATUS_FILLED,
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
status: Schema.OrderStatus.STATUS_FILLED,
|
||||
rejectionReason: null,
|
||||
side: Side.SIDE_BUY,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
remaining: '0',
|
||||
price: '20000000',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
createdAt: new Date(2020, 1, 30).toISOString(),
|
||||
updatedAt: null,
|
||||
expiresAt: null,
|
||||
liquidityProvisionId: null,
|
||||
peggedOrder: null,
|
||||
};
|
||||
const update: OrderSubData = {
|
||||
const update: OrdersUpdateSubscription = {
|
||||
orders: [merge(order, override)],
|
||||
};
|
||||
if (!sendOrderUpdate) {
|
||||
|
||||
@@ -30,12 +30,7 @@ const Portfolio = () => {
|
||||
<Tabs>
|
||||
<Tab id="positions" name={t('Positions')}>
|
||||
<VegaWalletContainer>
|
||||
<div className={tabContentClassName}>
|
||||
<h4 className="text-xl p-4">{t('Positions')}</h4>
|
||||
<div>
|
||||
<PositionsContainer />
|
||||
</div>
|
||||
</div>
|
||||
<PositionsContainer />
|
||||
</VegaWalletContainer>
|
||||
</Tab>
|
||||
<Tab id="orders" name={t('Orders')}>
|
||||
|
||||
@@ -60,6 +60,13 @@
|
||||
"nx build trading"
|
||||
]
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./apps/trading/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"module": "commonjs",
|
||||
"types": ["jest", "node", "@testing-library/jest-dom"],
|
||||
"jsx": "react"
|
||||
"types": ["jest", "node", "@testing-library/jest-dom"]
|
||||
},
|
||||
"include": [
|
||||
"**/*.test.ts",
|
||||
|
||||
@@ -69,6 +69,13 @@
|
||||
"quiet": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./libs/accounts/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fragment AccountFields on Account {
|
||||
fragment AccountFields on AccountBalance {
|
||||
type
|
||||
balance
|
||||
market {
|
||||
|
||||
@@ -3,14 +3,14 @@ import { Schema as Types } from '@vegaprotocol/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type AccountFieldsFragment = { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null, asset: { __typename?: 'Asset', id: string } };
|
||||
export type AccountFieldsFragment = { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null, asset: { __typename?: 'Asset', id: string } };
|
||||
|
||||
export type AccountsQueryVariables = Types.Exact<{
|
||||
partyId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type AccountsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null, asset: { __typename?: 'Asset', id: string } }> | null } | null };
|
||||
export type AccountsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null, asset: { __typename?: 'Asset', id: string } }> | null } | null };
|
||||
|
||||
export type AccountEventsSubscriptionVariables = Types.Exact<{
|
||||
partyId: Types.Scalars['ID'];
|
||||
@@ -20,7 +20,7 @@ export type AccountEventsSubscriptionVariables = Types.Exact<{
|
||||
export type AccountEventsSubscription = { __typename?: 'Subscription', accounts: Array<{ __typename?: 'AccountUpdate', type: Types.AccountType, balance: string, assetId: string, marketId?: string | null }> };
|
||||
|
||||
export const AccountFieldsFragmentDoc = gql`
|
||||
fragment AccountFields on Account {
|
||||
fragment AccountFields on AccountBalance {
|
||||
type
|
||||
balance
|
||||
market {
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('getId', () => {
|
||||
|
||||
const accounts = [
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '2781397',
|
||||
market: {
|
||||
@@ -68,7 +68,7 @@ const accounts = [
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '406922',
|
||||
market: {
|
||||
@@ -90,7 +90,7 @@ const accounts = [
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '10001000000',
|
||||
market: null,
|
||||
@@ -102,7 +102,7 @@ const accounts = [
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '1990351587',
|
||||
market: null,
|
||||
@@ -114,7 +114,7 @@ const accounts = [
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '2996218603',
|
||||
market: null,
|
||||
@@ -126,7 +126,7 @@ const accounts = [
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '5000593078',
|
||||
market: null,
|
||||
@@ -138,7 +138,7 @@ const accounts = [
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '4000000000000001006031',
|
||||
market: null,
|
||||
@@ -177,7 +177,7 @@ const accountResult = [
|
||||
balance: '5000593078',
|
||||
breakdown: [
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
asset: {
|
||||
__typename: 'Asset',
|
||||
decimals: 5,
|
||||
@@ -217,7 +217,7 @@ const accountResult = [
|
||||
balance: '2996218603',
|
||||
breakdown: [
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
asset: {
|
||||
__typename: 'Asset',
|
||||
decimals: 5,
|
||||
|
||||
@@ -27,7 +27,7 @@ function isAccount(
|
||||
| IterableElement<AccountEventsSubscription['accounts']>
|
||||
): account is AccountFieldsFragment {
|
||||
return (
|
||||
(account as AccountFieldsFragment).__typename === 'Account' ||
|
||||
(account as AccountFieldsFragment).__typename === 'AccountBalance' ||
|
||||
Boolean((account as AccountFieldsFragment).asset?.id)
|
||||
);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ const update = (
|
||||
draft[index].balance = delta.balance;
|
||||
} else {
|
||||
draft.unshift({
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: delta.type,
|
||||
balance: delta.balance,
|
||||
market: delta.marketId ? { id: delta.marketId } : null,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { getAccountData } from './accounts-data-provider';
|
||||
import { AccountTable } from './accounts-table';
|
||||
|
||||
const singleRow = {
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: Types.AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '125600000',
|
||||
market: {
|
||||
@@ -80,7 +80,7 @@ it('should get correct account data', () => {
|
||||
balance: '0',
|
||||
breakdown: [
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
asset: {
|
||||
__typename: 'Asset',
|
||||
decimals: 5,
|
||||
|
||||
@@ -16,7 +16,7 @@ export const Primary = Template.bind({});
|
||||
Primary.args = {
|
||||
data: getAccountData([
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '2781397',
|
||||
market: {
|
||||
@@ -38,7 +38,7 @@ Primary.args = {
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '406922',
|
||||
market: {
|
||||
@@ -60,7 +60,7 @@ Primary.args = {
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '10001000000',
|
||||
market: null,
|
||||
@@ -72,7 +72,7 @@ Primary.args = {
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '1990351587',
|
||||
market: null,
|
||||
@@ -84,7 +84,7 @@ Primary.args = {
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '2996218603',
|
||||
market: null,
|
||||
@@ -96,7 +96,7 @@ Primary.args = {
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '5000593078',
|
||||
market: null,
|
||||
@@ -108,7 +108,7 @@ Primary.args = {
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '4000000000000001006031',
|
||||
market: null,
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { AccountFields } from './accounts-data-provider';
|
||||
import { getAccountData } from './accounts-data-provider';
|
||||
|
||||
const singleRow = {
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: Types.AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '125600000',
|
||||
market: {
|
||||
@@ -74,7 +74,7 @@ describe('BreakdownTable', () => {
|
||||
balance: '0',
|
||||
breakdown: [
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
asset: {
|
||||
__typename: 'Asset',
|
||||
decimals: 5,
|
||||
|
||||
@@ -38,6 +38,13 @@
|
||||
"jestConfig": "libs/assets/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./libs/assets/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ import { Schema as Types } from '@vegaprotocol/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type AssetFieldsFragment = { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string }, infrastructureFeeAccount: { __typename?: 'Account', balance: string }, globalRewardPoolAccount?: { __typename?: 'Account', balance: string } | null, takerFeeRewardAccount?: { __typename?: 'Account', balance: string } | null, makerFeeRewardAccount?: { __typename?: 'Account', balance: string } | null, lpFeeRewardAccount?: { __typename?: 'Account', balance: string } | null, marketProposerRewardAccount?: { __typename?: 'Account', balance: string } | null };
|
||||
export type AssetFieldsFragment = { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string }, infrastructureFeeAccount?: { __typename?: 'AccountBalance', balance: string } | null, globalRewardPoolAccount?: { __typename?: 'AccountBalance', balance: string } | null, takerFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, makerFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, lpFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, marketProposerRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null };
|
||||
|
||||
export type AssetQueryVariables = Types.Exact<{
|
||||
assetId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type AssetQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string }, infrastructureFeeAccount: { __typename?: 'Account', balance: string }, globalRewardPoolAccount?: { __typename?: 'Account', balance: string } | null, takerFeeRewardAccount?: { __typename?: 'Account', balance: string } | null, makerFeeRewardAccount?: { __typename?: 'Account', balance: string } | null, lpFeeRewardAccount?: { __typename?: 'Account', balance: string } | null, marketProposerRewardAccount?: { __typename?: 'Account', balance: string } | null } } | null> | null } | null };
|
||||
export type AssetQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string }, infrastructureFeeAccount?: { __typename?: 'AccountBalance', balance: string } | null, globalRewardPoolAccount?: { __typename?: 'AccountBalance', balance: string } | null, takerFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, makerFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, lpFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, marketProposerRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null } } | null> | null } | null };
|
||||
|
||||
export const AssetFieldsFragmentDoc = gql`
|
||||
fragment AssetFields on Asset {
|
||||
|
||||
@@ -7,7 +7,7 @@ const defaultOptions = {} as const;
|
||||
export type AssetsQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type AssetsQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string }, infrastructureFeeAccount: { __typename?: 'Account', balance: string }, globalRewardPoolAccount?: { __typename?: 'Account', balance: string } | null, takerFeeRewardAccount?: { __typename?: 'Account', balance: string } | null, makerFeeRewardAccount?: { __typename?: 'Account', balance: string } | null, lpFeeRewardAccount?: { __typename?: 'Account', balance: string } | null, marketProposerRewardAccount?: { __typename?: 'Account', balance: string } | null } } | null> | null } | null };
|
||||
export type AssetsQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string }, infrastructureFeeAccount?: { __typename?: 'AccountBalance', balance: string } | null, globalRewardPoolAccount?: { __typename?: 'AccountBalance', balance: string } | null, takerFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, makerFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, lpFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, marketProposerRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null } } | null> | null } | null };
|
||||
|
||||
|
||||
export const AssetsDocument = gql`
|
||||
|
||||
@@ -129,7 +129,7 @@ export const rows: Rows = [
|
||||
key: AssetDetail.INFRASTRUCTURE_FEE_ACCOUNT_BALANCE,
|
||||
label: t('Infrastructure fee account balance'),
|
||||
tooltip: t('The infrastructure fee account in this asset'),
|
||||
value: (asset) => num(asset, asset.infrastructureFeeAccount.balance),
|
||||
value: (asset) => num(asset, asset.infrastructureFeeAccount?.balance),
|
||||
},
|
||||
{
|
||||
key: AssetDetail.GLOBAL_REWARD_POOL_ACCOUNT_BALANCE,
|
||||
|
||||
@@ -16,27 +16,27 @@ export const generateERC20Asset = (i: number, status: AssetStatus): Asset => ({
|
||||
status: status,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
__typename: 'Asset',
|
||||
});
|
||||
@@ -57,7 +57,7 @@ export const generateBuiltinAsset = (
|
||||
status: status,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '0',
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: null,
|
||||
takerFeeRewardAccount: null,
|
||||
|
||||
@@ -38,6 +38,13 @@
|
||||
"jestConfig": "libs/candles-chart/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./libs/candles-chart/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,13 @@
|
||||
"jestConfig": "libs/cypress/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./libs/cypress/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
|
||||
@@ -38,6 +38,13 @@
|
||||
"jestConfig": "libs/deal-ticket/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./libs/deal-ticket/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import { toDecimal } from '@vegaprotocol/react-helpers';
|
||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||
import { OrderTimeInForce, OrderType, Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
|
||||
export const getDefaultOrder = (market: {
|
||||
id: string;
|
||||
positionDecimalPlaces: number;
|
||||
}): OrderSubmissionBody['orderSubmission'] => ({
|
||||
marketId: market.id,
|
||||
type: OrderType.TYPE_MARKET,
|
||||
side: Side.SIDE_BUY,
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_IOC,
|
||||
type: Schema.OrderType.TYPE_MARKET,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_IOC,
|
||||
size: String(toDecimal(market.positionDecimalPlaces)),
|
||||
});
|
||||
|
||||
export interface Order {
|
||||
marketId: string;
|
||||
type: OrderType;
|
||||
type: Schema.OrderType;
|
||||
size: string;
|
||||
side: Side;
|
||||
timeInForce: OrderTimeInForce;
|
||||
side: Schema.Side;
|
||||
timeInForce: Schema.OrderTimeInForce;
|
||||
price?: string;
|
||||
expiresAt?: Date;
|
||||
}
|
||||
|
||||
+25
-17
@@ -5,8 +5,7 @@ import {
|
||||
MarketState,
|
||||
MarketStateMapping,
|
||||
MarketTradingMode,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
Schema,
|
||||
} from '@vegaprotocol/types';
|
||||
import type { ValidationProps } from './use-order-validation';
|
||||
import { marketTranslations } from './use-order-validation';
|
||||
@@ -48,6 +47,15 @@ const market: DealTicketMarketFragment = {
|
||||
price: '100',
|
||||
},
|
||||
},
|
||||
fees: {
|
||||
__typename: 'Fees',
|
||||
factors: {
|
||||
__typename: 'FeeFactors',
|
||||
makerFee: '1',
|
||||
infrastructureFee: '2',
|
||||
liquidityFee: '3',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const defaultWalletContext = {
|
||||
@@ -63,8 +71,8 @@ const defaultWalletContext = {
|
||||
const defaultOrder = {
|
||||
market,
|
||||
step: 0.1,
|
||||
orderType: OrderType.TYPE_MARKET,
|
||||
orderTimeInForce: OrderTimeInForce.TIME_IN_FORCE_FOK,
|
||||
orderType: Schema.OrderType.TYPE_MARKET,
|
||||
orderTimeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_FOK,
|
||||
};
|
||||
|
||||
const ERROR = {
|
||||
@@ -158,7 +166,7 @@ describe('useOrderValidation', () => {
|
||||
({ tradingMode, errorMessage }) => {
|
||||
const { result } = setup({
|
||||
market: { ...defaultOrder.market, tradingMode },
|
||||
orderType: OrderType.TYPE_MARKET,
|
||||
orderType: Schema.OrderType.TYPE_MARKET,
|
||||
});
|
||||
expect(result.current.isDisabled).toBeTruthy();
|
||||
expect(result.current.message).toBe(errorMessage);
|
||||
@@ -166,22 +174,22 @@ describe('useOrderValidation', () => {
|
||||
);
|
||||
|
||||
it.each`
|
||||
tradingMode | orderTimeInForce | errorMessage
|
||||
${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_FOK} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_FOK} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_FOK} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_IOC} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_IOC} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_IOC} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_GFN} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_GFN} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_GFN} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
tradingMode | orderTimeInForce | errorMessage
|
||||
${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${Schema.OrderTimeInForce.TIME_IN_FORCE_FOK} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${Schema.OrderTimeInForce.TIME_IN_FORCE_FOK} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${Schema.OrderTimeInForce.TIME_IN_FORCE_FOK} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${Schema.OrderTimeInForce.TIME_IN_FORCE_IOC} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${Schema.OrderTimeInForce.TIME_IN_FORCE_IOC} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${Schema.OrderTimeInForce.TIME_IN_FORCE_IOC} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${Schema.OrderTimeInForce.TIME_IN_FORCE_GFN} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${Schema.OrderTimeInForce.TIME_IN_FORCE_GFN} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${Schema.OrderTimeInForce.TIME_IN_FORCE_GFN} | ${ERROR.MARKET_CONTINUOUS_TIF}
|
||||
`(
|
||||
`Returns an error message when submitting a limit order with a "$orderTimeInForce" value to a "$tradingMode" market`,
|
||||
({ tradingMode, orderTimeInForce, errorMessage }) => {
|
||||
const { result } = setup({
|
||||
market: { ...defaultOrder.market, tradingMode },
|
||||
orderType: OrderType.TYPE_LIMIT,
|
||||
orderType: Schema.OrderType.TYPE_LIMIT,
|
||||
orderTimeInForce,
|
||||
});
|
||||
expect(result.current).toStrictEqual({
|
||||
@@ -202,7 +210,7 @@ describe('useOrderValidation', () => {
|
||||
({ fieldName, errorType, errorMessage }) => {
|
||||
const { result } = setup({
|
||||
fieldErrors: { [fieldName]: { type: errorType } },
|
||||
orderType: OrderType.TYPE_LIMIT,
|
||||
orderType: Schema.OrderType.TYPE_LIMIT,
|
||||
});
|
||||
expect(result.current).toStrictEqual({
|
||||
isDisabled: true,
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
MarketState,
|
||||
MarketStateMapping,
|
||||
MarketTradingMode,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
Schema,
|
||||
} from '@vegaprotocol/types';
|
||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||
import { Tooltip } from '@vegaprotocol/ui-toolkit';
|
||||
@@ -28,8 +27,8 @@ export const isMarketInAuction = (market: DealTicketMarketFragment) => {
|
||||
export type ValidationProps = {
|
||||
step?: number;
|
||||
market: DealTicketMarketFragment;
|
||||
orderType: OrderType;
|
||||
orderTimeInForce: OrderTimeInForce;
|
||||
orderType: Schema.OrderType;
|
||||
orderTimeInForce: Schema.OrderTimeInForce;
|
||||
fieldErrors?: FieldErrors<OrderSubmissionBody['orderSubmission']>;
|
||||
};
|
||||
|
||||
@@ -94,7 +93,7 @@ export const useOrderValidation = ({
|
||||
}
|
||||
|
||||
if (isMarketInAuction(market)) {
|
||||
if (orderType === OrderType.TYPE_MARKET) {
|
||||
if (orderType === Schema.OrderType.TYPE_MARKET) {
|
||||
if (
|
||||
market.tradingMode ===
|
||||
MarketTradingMode.TRADING_MODE_MONITORING_AUCTION &&
|
||||
@@ -149,11 +148,11 @@ export const useOrderValidation = ({
|
||||
};
|
||||
}
|
||||
if (
|
||||
orderType === OrderType.TYPE_LIMIT &&
|
||||
orderType === Schema.OrderType.TYPE_LIMIT &&
|
||||
[
|
||||
OrderTimeInForce.TIME_IN_FORCE_FOK,
|
||||
OrderTimeInForce.TIME_IN_FORCE_IOC,
|
||||
OrderTimeInForce.TIME_IN_FORCE_GFN,
|
||||
Schema.OrderTimeInForce.TIME_IN_FORCE_FOK,
|
||||
Schema.OrderTimeInForce.TIME_IN_FORCE_IOC,
|
||||
Schema.OrderTimeInForce.TIME_IN_FORCE_GFN,
|
||||
].includes(orderTimeInForce)
|
||||
) {
|
||||
if (
|
||||
@@ -231,7 +230,7 @@ export const useOrderValidation = ({
|
||||
|
||||
if (
|
||||
fieldErrors?.price?.type === 'required' &&
|
||||
orderType !== OrderType.TYPE_MARKET
|
||||
orderType !== Schema.OrderType.TYPE_MARKET
|
||||
) {
|
||||
return {
|
||||
isDisabled: true,
|
||||
@@ -241,7 +240,7 @@ export const useOrderValidation = ({
|
||||
|
||||
if (
|
||||
fieldErrors?.price?.type === 'min' &&
|
||||
orderType !== OrderType.TYPE_MARKET
|
||||
orderType !== Schema.OrderType.TYPE_MARKET
|
||||
) {
|
||||
return {
|
||||
isDisabled: true,
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { DealTicketMarketFragment } from './__generated___/DealTicket';
|
||||
import { ExpirySelector } from './expiry-selector';
|
||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||
import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet';
|
||||
import { OrderTimeInForce, OrderType } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import { getDefaultOrder } from '../deal-ticket-validation';
|
||||
import {
|
||||
isMarketInAuction,
|
||||
@@ -69,7 +69,7 @@ export const DealTicket = ({
|
||||
order.price && removeDecimal(order.price, market.decimalPlaces),
|
||||
size: removeDecimal(order.size, market.positionDecimalPlaces),
|
||||
expiresAt:
|
||||
order.timeInForce === OrderTimeInForce.TIME_IN_FORCE_GTT
|
||||
order.timeInForce === Schema.OrderTimeInForce.TIME_IN_FORCE_GTT
|
||||
? order.expiresAt
|
||||
: undefined,
|
||||
});
|
||||
@@ -96,7 +96,7 @@ export const DealTicket = ({
|
||||
const marketPriceFormatted =
|
||||
marketPrice && addDecimal(marketPrice, market.decimalPlaces);
|
||||
useEffect(() => {
|
||||
if (marketPriceFormatted && order.type === OrderType.TYPE_MARKET) {
|
||||
if (marketPriceFormatted && order.type === Schema.OrderType.TYPE_MARKET) {
|
||||
setValue('price', marketPriceFormatted);
|
||||
}
|
||||
}, [marketPriceFormatted, order.type, setValue]);
|
||||
@@ -138,8 +138,8 @@ export const DealTicket = ({
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{order.type === OrderType.TYPE_LIMIT &&
|
||||
order.timeInForce === OrderTimeInForce.TIME_IN_FORCE_GTT && (
|
||||
{order.type === Schema.OrderType.TYPE_LIMIT &&
|
||||
order.timeInForce === Schema.OrderTimeInForce.TIME_IN_FORCE_GTT && (
|
||||
<Controller
|
||||
name="expiresAt"
|
||||
control={control}
|
||||
|
||||
@@ -6,7 +6,7 @@ query PartyBalance($partyId: ID!) {
|
||||
}
|
||||
}
|
||||
|
||||
fragment Account on Account {
|
||||
fragment Account on AccountBalance {
|
||||
type
|
||||
balance
|
||||
asset {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ export type MarketPositionsQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type MarketPositionsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, positionsConnection?: { __typename?: 'PositionConnection', edges?: Array<{ __typename?: 'PositionEdge', node: { __typename?: 'Position', openVolume: string, market: { __typename?: 'Market', id: string } } }> | null } | null } | null };
|
||||
export type MarketPositionsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, positionsConnection?: { __typename?: 'PositionConnection', edges?: Array<{ __typename?: 'PositionEdge', node: { __typename?: 'Position', openVolume: string, market: { __typename?: 'Market', id: string } } }> | null } | null } | null };
|
||||
|
||||
|
||||
export const MarketPositionsDocument = gql`
|
||||
|
||||
+3
-3
@@ -8,12 +8,12 @@ export type PartyBalanceQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type PartyBalanceQuery = { __typename?: 'Query', party?: { __typename?: 'Party', accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } }> | null } | null };
|
||||
export type PartyBalanceQuery = { __typename?: 'Query', party?: { __typename?: 'Party', accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } }> | null } | null };
|
||||
|
||||
export type AccountFragment = { __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } };
|
||||
export type AccountFragment = { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } };
|
||||
|
||||
export const AccountFragmentDoc = gql`
|
||||
fragment Account on Account {
|
||||
fragment Account on AccountBalance {
|
||||
type
|
||||
balance
|
||||
asset {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ export type PartyMarketDataQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type PartyMarketDataQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, marginsConnection?: { __typename?: 'MarginConnection', edges?: Array<{ __typename?: 'MarginEdge', node: { __typename?: 'MarginLevels', initialLevel: string, maintenanceLevel: string, searchLevel: string, market: { __typename?: 'Market', id: string } } }> | null } | null } | null };
|
||||
export type PartyMarketDataQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, marginsConnection?: { __typename?: 'MarginConnection', edges?: Array<{ __typename?: 'MarginEdge', node: { __typename?: 'MarginLevels', initialLevel: string, maintenanceLevel: string, searchLevel: string, market: { __typename?: 'Market', id: string } } }> | null } | null } | null };
|
||||
|
||||
|
||||
export const PartyMarketDataDocument = gql`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MockedProvider } from '@apollo/client/testing';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||
import { useCalculateSlippage } from './use-calculate-slippage';
|
||||
|
||||
@@ -82,7 +82,7 @@ describe('useCalculateSlippage Hook', () => {
|
||||
marketId: 'marketId',
|
||||
order: {
|
||||
size: '10',
|
||||
side: Side.SIDE_BUY,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
} as OrderSubmissionBody['orderSubmission'],
|
||||
}),
|
||||
{
|
||||
@@ -99,7 +99,7 @@ describe('useCalculateSlippage Hook', () => {
|
||||
marketId: 'marketId',
|
||||
order: {
|
||||
size: '10',
|
||||
side: Side.SIDE_SELL,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
} as OrderSubmissionBody['orderSubmission'],
|
||||
}),
|
||||
{
|
||||
@@ -125,7 +125,7 @@ describe('useCalculateSlippage Hook', () => {
|
||||
marketId: 'marketId',
|
||||
order: {
|
||||
size: '10',
|
||||
side: Side.SIDE_SELL,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
} as OrderSubmissionBody['orderSubmission'],
|
||||
}),
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { marketDepthProvider } from '@vegaprotocol/market-depth';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import { marketProvider } from '@vegaprotocol/market-list';
|
||||
import type { SingleMarketFieldsFragment } from '@vegaprotocol/market-list';
|
||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||
@@ -32,7 +32,7 @@ export const useCalculateSlippage = ({ marketId, order }: Props) => {
|
||||
variables,
|
||||
});
|
||||
const volPriceArr =
|
||||
data?.depth[order.side === Side.SIDE_BUY ? 'sell' : 'buy'] || [];
|
||||
data?.depth[order.side === Schema.Side.SIDE_BUY ? 'sell' : 'buy'] || [];
|
||||
if (volPriceArr.length && market) {
|
||||
const decimals = market.decimalPlaces ?? 0;
|
||||
const positionDecimals = market.positionDecimalPlaces ?? 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { FeesBreakdown } from '@vegaprotocol/market-info';
|
||||
import { formatNumber, t } from '@vegaprotocol/react-helpers';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||
import BigNumber from 'bignumber.js';
|
||||
@@ -29,7 +29,7 @@ export const useFeeDealTicketDetails = (
|
||||
const estPrice = order.price || market.depth.lastTrade?.price;
|
||||
if (estPrice) {
|
||||
if (slippage && parseFloat(slippage) !== 0) {
|
||||
const isLong = order.side === Side.SIDE_BUY;
|
||||
const isLong = order.side === Schema.Side.SIDE_BUY;
|
||||
const multiplier = new BigNumber(1)[isLong ? 'plus' : 'minus'](
|
||||
parseFloat(slippage) / 100
|
||||
);
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import {
|
||||
AccountType,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
Side,
|
||||
} from '@vegaprotocol/types';
|
||||
import { AccountType, Schema } from '@vegaprotocol/types';
|
||||
import type { PositionMargin } from './use-market-positions';
|
||||
import { BigNumber } from 'bignumber.js';
|
||||
import { useMaximumPositionSize } from './use-maximum-position-size';
|
||||
@@ -19,7 +14,7 @@ const defaultMockMarketPositions = {
|
||||
let mockMarketPositions: PositionMargin | null = defaultMockMarketPositions;
|
||||
|
||||
const mockAccount: Account = {
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '200000',
|
||||
asset: {
|
||||
@@ -32,10 +27,10 @@ const mockAccount: Account = {
|
||||
};
|
||||
|
||||
const mockOrder: OrderSubmissionBody['orderSubmission'] = {
|
||||
type: OrderType.TYPE_MARKET,
|
||||
type: Schema.OrderType.TYPE_MARKET,
|
||||
size: '1',
|
||||
side: Side.SIDE_BUY,
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_IOC,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_IOC,
|
||||
marketId: 'market-id',
|
||||
};
|
||||
|
||||
@@ -92,7 +87,7 @@ describe('useMaximumPositionSize', () => {
|
||||
|
||||
it('should return correct size when open positions and opposite side', () => {
|
||||
const price = '50';
|
||||
mockOrder.side = Side.SIDE_SELL;
|
||||
mockOrder.side = Schema.Side.SIDE_SELL;
|
||||
mockMarketPositions = defaultMockMarketPositions;
|
||||
const expected = 4001;
|
||||
const { result } = renderHook(() =>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useMarketPositions } from './use-market-positions';
|
||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||
import { useSettlementAccount } from './use-settlement-account';
|
||||
import { AccountType, Side } from '@vegaprotocol/types';
|
||||
import { AccountType, Schema } from '@vegaprotocol/types';
|
||||
import { BigNumber } from 'bignumber.js';
|
||||
import type { AccountFragment as Account } from './__generated__/PartyBalance';
|
||||
|
||||
@@ -47,8 +47,10 @@ export const useMaximumPositionSize = ({
|
||||
}
|
||||
|
||||
const isSameSide =
|
||||
(marketPositions.openVolume.isPositive() && order.side === Side.SIDE_BUY) ||
|
||||
(marketPositions.openVolume.isNegative() && order.side === Side.SIDE_SELL);
|
||||
(marketPositions.openVolume.isPositive() &&
|
||||
order.side === Schema.Side.SIDE_BUY) ||
|
||||
(marketPositions.openVolume.isNegative() &&
|
||||
order.side === Schema.Side.SIDE_SELL);
|
||||
|
||||
const adjustedForVolume = new BigNumber(size)[isSameSide ? 'minus' : 'plus'](
|
||||
marketPositions.openVolume
|
||||
|
||||
@@ -5,7 +5,7 @@ import { addDecimal, formatNumber } from '@vegaprotocol/react-helpers';
|
||||
import { useMarketPositions } from './use-market-positions';
|
||||
import { useMarketDataMarkPrice } from './use-market-data-mark-price';
|
||||
import { usePartyMarketDataQuery } from './__generated__/PartyMarketData';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated___/DealTicket';
|
||||
import type { PartyBalanceQuery } from './__generated__/PartyBalance';
|
||||
import { useSettlementAccount } from './use-settlement-account';
|
||||
@@ -63,7 +63,7 @@ export const useOrderCloseOut = ({
|
||||
marketPositions?.openVolume.toString() || '0',
|
||||
market.positionDecimalPlaces
|
||||
)
|
||||
)[order.side === Side.SIDE_BUY ? 'plus' : 'minus'](order.size);
|
||||
)[order.side === Schema.Side.SIDE_BUY ? 'plus' : 'minus'](order.size);
|
||||
const markPrice = new BigNumber(
|
||||
addDecimal(
|
||||
markPriceData?.market?.data?.markPrice || 0,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BigNumber } from 'bignumber.js';
|
||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import { addDecimal, removeDecimal } from '@vegaprotocol/react-helpers';
|
||||
import { useMarketPositions } from './use-market-positions';
|
||||
import { useMarketDataMarkPrice } from './use-market-data-mark-price';
|
||||
@@ -48,12 +48,15 @@ export const useOrderMargin = ({
|
||||
BigNumber.maximum(
|
||||
0,
|
||||
new BigNumber(marketPositions?.openVolume || 0)
|
||||
[order.side === Side.SIDE_BUY ? 'plus' : 'minus'](order.size)
|
||||
[order.side === Schema.Side.SIDE_BUY ? 'plus' : 'minus'](order.size)
|
||||
.absoluteValue()
|
||||
).toString(),
|
||||
market.positionDecimalPlaces
|
||||
),
|
||||
side: order.side === Side.SIDE_BUY ? Side.SIDE_BUY : Side.SIDE_SELL,
|
||||
side:
|
||||
order.side === Schema.Side.SIDE_BUY
|
||||
? Schema.Side.SIDE_BUY
|
||||
: Schema.Side.SIDE_SELL,
|
||||
timeInForce: order.timeInForce,
|
||||
type: order.type,
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ describe('useSettlementAccount Hook', () => {
|
||||
it('should filter accounts by settlementAssetId', () => {
|
||||
const accounts: Account[] = [
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '2000000000000000000000',
|
||||
asset: {
|
||||
@@ -19,7 +19,7 @@ describe('useSettlementAccount Hook', () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '1000000000',
|
||||
asset: {
|
||||
@@ -31,7 +31,7 @@ describe('useSettlementAccount Hook', () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '5000000000000000000',
|
||||
asset: {
|
||||
@@ -43,7 +43,7 @@ describe('useSettlementAccount Hook', () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Account',
|
||||
__typename: 'AccountBalance',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '5000000000000000000',
|
||||
asset: {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"module": "commonjs",
|
||||
"types": ["jest", "node", "@testing-library/jest-dom"]
|
||||
},
|
||||
"files": ["../../node_modules/@nrwl/react/typings/cssmodule.d.ts"],
|
||||
"include": [
|
||||
"**/*.test.ts",
|
||||
"**/*.spec.ts",
|
||||
|
||||
@@ -38,6 +38,13 @@
|
||||
"jestConfig": "libs/deposits/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./libs/deposits/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export type DepositEventSubscriptionVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type DepositEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'Account' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit', id: string, status: Types.DepositStatus, amount: string, createdTimestamp: string, creditedTimestamp?: string | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order' } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal' } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransactionResult' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal' } }> | null };
|
||||
export type DepositEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'AccountEvent' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit', id: string, status: Types.DepositStatus, amount: string, createdTimestamp: string, creditedTimestamp?: string | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order' } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal' } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransactionResult' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal' } }> | null };
|
||||
|
||||
export const DepositFieldsFragmentDoc = gql`
|
||||
fragment DepositFields on Deposit {
|
||||
|
||||
@@ -2,28 +2,37 @@ import { waitFor, fireEvent, render, screen } from '@testing-library/react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import type { DepositFormProps } from './deposit-form';
|
||||
import { DepositForm } from './deposit-form';
|
||||
import { AssetStatus } from '@vegaprotocol/types';
|
||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||
import { useWeb3React } from '@web3-react/core';
|
||||
import type { Asset } from '@vegaprotocol/react-helpers';
|
||||
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
|
||||
|
||||
jest.mock('@vegaprotocol/wallet');
|
||||
jest.mock('@web3-react/core');
|
||||
|
||||
function generateAsset(): Asset {
|
||||
function generateAsset(): AssetFieldsFragment {
|
||||
return {
|
||||
__typename: 'Asset',
|
||||
id: 'asset-id',
|
||||
symbol: 'asset-symbol',
|
||||
name: 'asset-name',
|
||||
decimals: 2,
|
||||
quantum: '',
|
||||
status: AssetStatus.STATUS_ENABLED,
|
||||
source: {
|
||||
__typename: 'ERC20',
|
||||
contractAddress: 'contract-address',
|
||||
lifetimeLimit: '',
|
||||
withdrawThreshold: '',
|
||||
},
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
let asset: Asset;
|
||||
let asset: AssetFieldsFragment;
|
||||
let props: DepositFormProps;
|
||||
const MOCK_ETH_ADDRESS = '0x72c22822A19D20DE7e426fB84aa047399Ddd8853';
|
||||
|
||||
|
||||
@@ -38,6 +38,13 @@
|
||||
"jestConfig": "libs/environment/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./libs/environment/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +138,8 @@ describe('Network switcher', () => {
|
||||
[Networks.TESTNET]: 'https://test.net',
|
||||
[Networks.STAGNET3]: 'https://stag3.net',
|
||||
[Networks.DEVNET]: 'https://dev.net',
|
||||
[Networks.STAGNET1]: 'https://stag1.net',
|
||||
[Networks.SANDBOX]: 'https://sandbox.net',
|
||||
};
|
||||
// @ts-ignore Typescript doesn't know about this module being mocked
|
||||
useEnvironment.mockImplementation(() => ({
|
||||
@@ -175,6 +177,8 @@ describe('Network switcher', () => {
|
||||
[Networks.TESTNET]: 'https://test.net',
|
||||
[Networks.STAGNET3]: 'https://stag3.net',
|
||||
[Networks.DEVNET]: 'https://dev.net',
|
||||
[Networks.STAGNET1]: 'https://stag1.net',
|
||||
[Networks.SANDBOX]: 'https://sandbox.net',
|
||||
};
|
||||
// @ts-ignore Typescript doesn't know about this module being mocked
|
||||
useEnvironment.mockImplementation(() => ({
|
||||
@@ -205,6 +209,8 @@ describe('Network switcher', () => {
|
||||
[Networks.TESTNET]: 'https://test.net',
|
||||
[Networks.STAGNET3]: 'https://stag3.net',
|
||||
[Networks.DEVNET]: 'https://dev.net',
|
||||
[Networks.STAGNET1]: 'https://stag1.net',
|
||||
[Networks.SANDBOX]: 'https://sandbox.net',
|
||||
};
|
||||
// @ts-ignore Typescript doesn't know about this module being mocked
|
||||
useEnvironment.mockImplementation(() => ({
|
||||
|
||||
@@ -69,6 +69,13 @@
|
||||
"quiet": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"build-spec": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"outputs": [],
|
||||
"options": {
|
||||
"command": "yarn tsc --project ./libs/fills/tsconfig.spec.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user