chore: migrate withdrawals lib (#2009)
* chore: cleanup lib types * chore: migrate withdrawals * fix: withdrawals query and types * fix: types * fix: orders build * fix: withdraws build * fix: format * fix: more build stuff in withdrawal lib * fix: format * fix: more withdrawal builds * fix: format * fix: orders build again * fix: remaining build errors * fix: format * fix: withdrawal tests * fix: trick git to pick up file rename? * fix: rename back to orders * fix: rename generated file
This commit is contained in:
parent
045454b484
commit
df8a22a19e
@ -1,10 +1,12 @@
|
|||||||
import { AssetStatus, WithdrawalStatus } from '@vegaprotocol/types';
|
import { Schema } from '@vegaprotocol/types';
|
||||||
import type { Withdrawals } from '@vegaprotocol/withdraws';
|
import type { WithdrawalsQuery } from '@vegaprotocol/withdraws';
|
||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import type { PartialDeep } from 'type-fest';
|
import type { PartialDeep } from 'type-fest';
|
||||||
|
|
||||||
export const generateWithdrawals = (override?: PartialDeep<Withdrawals>) => {
|
export const generateWithdrawals = (
|
||||||
const defaultResult: Withdrawals = {
|
override?: PartialDeep<WithdrawalsQuery>
|
||||||
|
) => {
|
||||||
|
const defaultResult: WithdrawalsQuery = {
|
||||||
party: {
|
party: {
|
||||||
id: 'party-0',
|
id: 'party-0',
|
||||||
withdrawalsConnection: {
|
withdrawalsConnection: {
|
||||||
@ -14,7 +16,7 @@ export const generateWithdrawals = (override?: PartialDeep<Withdrawals>) => {
|
|||||||
__typename: 'WithdrawalEdge',
|
__typename: 'WithdrawalEdge',
|
||||||
node: {
|
node: {
|
||||||
id: 'withdrawal-0',
|
id: 'withdrawal-0',
|
||||||
status: WithdrawalStatus.STATUS_FINALIZED,
|
status: Schema.WithdrawalStatus.STATUS_FINALIZED,
|
||||||
amount: '100',
|
amount: '100',
|
||||||
txHash: null,
|
txHash: null,
|
||||||
createdTimestamp: new Date('2022-02-02').toISOString(),
|
createdTimestamp: new Date('2022-02-02').toISOString(),
|
||||||
@ -30,7 +32,7 @@ export const generateWithdrawals = (override?: PartialDeep<Withdrawals>) => {
|
|||||||
name: 'asset-0 name',
|
name: 'asset-0 name',
|
||||||
symbol: 'AST0',
|
symbol: 'AST0',
|
||||||
decimals: 5,
|
decimals: 5,
|
||||||
status: AssetStatus.STATUS_ENABLED,
|
status: Schema.AssetStatus.STATUS_ENABLED,
|
||||||
source: {
|
source: {
|
||||||
__typename: 'ERC20',
|
__typename: 'ERC20',
|
||||||
contractAddress: '0x123',
|
contractAddress: '0x123',
|
||||||
@ -43,7 +45,7 @@ export const generateWithdrawals = (override?: PartialDeep<Withdrawals>) => {
|
|||||||
__typename: 'WithdrawalEdge',
|
__typename: 'WithdrawalEdge',
|
||||||
node: {
|
node: {
|
||||||
id: 'withdrawal-1',
|
id: 'withdrawal-1',
|
||||||
status: WithdrawalStatus.STATUS_FINALIZED,
|
status: Schema.WithdrawalStatus.STATUS_FINALIZED,
|
||||||
amount: '100',
|
amount: '100',
|
||||||
txHash:
|
txHash:
|
||||||
'0x5d7b1a35ba6bd23be17bb7a159c13cdbb3121fceb94e9c6c510f5503dce48d03',
|
'0x5d7b1a35ba6bd23be17bb7a159c13cdbb3121fceb94e9c6c510f5503dce48d03',
|
||||||
@ -60,7 +62,7 @@ export const generateWithdrawals = (override?: PartialDeep<Withdrawals>) => {
|
|||||||
name: 'asset-0 name',
|
name: 'asset-0 name',
|
||||||
symbol: 'AST0',
|
symbol: 'AST0',
|
||||||
decimals: 5,
|
decimals: 5,
|
||||||
status: AssetStatus.STATUS_ENABLED,
|
status: Schema.AssetStatus.STATUS_ENABLED,
|
||||||
source: {
|
source: {
|
||||||
__typename: 'ERC20',
|
__typename: 'ERC20',
|
||||||
contractAddress: '0x123',
|
contractAddress: '0x123',
|
||||||
|
@ -10,14 +10,14 @@ import produce from 'immer';
|
|||||||
import {
|
import {
|
||||||
AccountEventsDocument,
|
AccountEventsDocument,
|
||||||
AccountsDocument,
|
AccountsDocument,
|
||||||
} from './__generated___/Accounts';
|
} from './__generated__/Accounts';
|
||||||
|
|
||||||
import type { IterableElement } from 'type-fest';
|
import type { IterableElement } from 'type-fest';
|
||||||
import type {
|
import type {
|
||||||
AccountFieldsFragment,
|
AccountFieldsFragment,
|
||||||
AccountsQuery,
|
AccountsQuery,
|
||||||
AccountEventsSubscription,
|
AccountEventsSubscription,
|
||||||
} from './__generated___/Accounts';
|
} from './__generated__/Accounts';
|
||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
import type { Asset } from '@vegaprotocol/assets';
|
import type { Asset } from '@vegaprotocol/assets';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from './__generated___/Accounts';
|
export * from './__generated__/Accounts';
|
||||||
export * from './accounts-data-provider';
|
export * from './accounts-data-provider';
|
||||||
export * from './accounts-table';
|
export * from './accounts-table';
|
||||||
export * from './asset-balance';
|
export * from './asset-balance';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { makeDataProvider, useDataProvider } from '@vegaprotocol/react-helpers';
|
import { makeDataProvider, useDataProvider } from '@vegaprotocol/react-helpers';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
import type { AssetQuery, AssetFieldsFragment } from './__generated___/Asset';
|
import type { AssetQuery, AssetFieldsFragment } from './__generated__/Asset';
|
||||||
import { AssetDocument } from './__generated___/Asset';
|
import { AssetDocument } from './__generated__/Asset';
|
||||||
|
|
||||||
export type Asset = AssetFieldsFragment;
|
export type Asset = AssetFieldsFragment;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';
|
|||||||
import { AssetStatus } from '@vegaprotocol/types';
|
import { AssetStatus } from '@vegaprotocol/types';
|
||||||
import { AssetDetailsDialog } from './asset-details-dialog';
|
import { AssetDetailsDialog } from './asset-details-dialog';
|
||||||
import { AssetDetail, testId } from './asset-details-table';
|
import { AssetDetail, testId } from './asset-details-table';
|
||||||
import { AssetsDocument } from './__generated___/Assets';
|
import { AssetsDocument } from './__generated__/Assets';
|
||||||
import { generateBuiltinAsset, generateERC20Asset } from './test-helpers';
|
import { generateBuiltinAsset, generateERC20Asset } from './test-helpers';
|
||||||
|
|
||||||
const mockedData = {
|
const mockedData = {
|
||||||
|
@ -3,9 +3,9 @@ import {
|
|||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
useDataProvider,
|
useDataProvider,
|
||||||
} from '@vegaprotocol/react-helpers';
|
} from '@vegaprotocol/react-helpers';
|
||||||
import { AssetsDocument } from './__generated___/Assets';
|
import { AssetsDocument } from './__generated__/Assets';
|
||||||
import { AssetStatus } from '@vegaprotocol/types';
|
import { AssetStatus } from '@vegaprotocol/types';
|
||||||
import type { AssetsQuery } from './__generated___/Assets';
|
import type { AssetsQuery } from './__generated__/Assets';
|
||||||
import type { Asset } from './asset-data-provider';
|
import type { Asset } from './asset-data-provider';
|
||||||
|
|
||||||
export interface ERC20AssetSource {
|
export interface ERC20AssetSource {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export * from './__generated___/Asset';
|
export * from './__generated__/Asset';
|
||||||
export * from './__generated___/Assets';
|
export * from './__generated__/Assets';
|
||||||
export * from './asset-data-provider';
|
export * from './asset-data-provider';
|
||||||
export * from './assets-data-provider';
|
export * from './assets-data-provider';
|
||||||
export * from './asset-details-dialog';
|
export * from './asset-details-dialog';
|
||||||
|
@ -3,19 +3,19 @@ import type { Candle, DataSource } from 'pennant';
|
|||||||
import { Interval as PennantInterval } from 'pennant';
|
import { Interval as PennantInterval } from 'pennant';
|
||||||
|
|
||||||
import { addDecimal } from '@vegaprotocol/react-helpers';
|
import { addDecimal } from '@vegaprotocol/react-helpers';
|
||||||
import { ChartDocument } from './__generated___/Chart';
|
import { ChartDocument } from './__generated__/Chart';
|
||||||
import type { ChartQuery, ChartQueryVariables } from './__generated___/Chart';
|
import type { ChartQuery, ChartQueryVariables } from './__generated__/Chart';
|
||||||
import {
|
import {
|
||||||
CandlesDocument,
|
CandlesDocument,
|
||||||
CandlesEventsDocument,
|
CandlesEventsDocument,
|
||||||
} from './__generated___/Candles';
|
} from './__generated__/Candles';
|
||||||
import type {
|
import type {
|
||||||
CandlesQuery,
|
CandlesQuery,
|
||||||
CandlesQueryVariables,
|
CandlesQueryVariables,
|
||||||
CandleFieldsFragment,
|
CandleFieldsFragment,
|
||||||
CandlesEventsSubscription,
|
CandlesEventsSubscription,
|
||||||
CandlesEventsSubscriptionVariables,
|
CandlesEventsSubscriptionVariables,
|
||||||
} from './__generated___/Candles';
|
} from './__generated__/Candles';
|
||||||
import type { Subscription } from 'zen-observable-ts';
|
import type { Subscription } from 'zen-observable-ts';
|
||||||
import { Interval } from '@vegaprotocol/types';
|
import { Interval } from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from './__generated___/Candles';
|
export * from './__generated__/Candles';
|
||||||
export * from './__generated___/Chart';
|
export * from './__generated__/Chart';
|
||||||
export * from './candles-chart';
|
export * from './candles-chart';
|
||||||
export * from './data-source';
|
export * from './data-source';
|
||||||
|
@ -2,7 +2,7 @@ import { useMemo } from 'react';
|
|||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { AccountType } from '@vegaprotocol/types';
|
import { AccountType } from '@vegaprotocol/types';
|
||||||
import { toBigNum } from '@vegaprotocol/react-helpers';
|
import { toBigNum } from '@vegaprotocol/react-helpers';
|
||||||
import type { DealTicketMarketFragment } from '../deal-ticket/__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from '../deal-ticket/__generated__/DealTicket';
|
||||||
import type { OrderMargin } from '../../hooks/use-order-margin';
|
import type { OrderMargin } from '../../hooks/use-order-margin';
|
||||||
import { usePartyBalanceQuery, useSettlementAccount } from '../../hooks';
|
import { usePartyBalanceQuery, useSettlementAccount } from '../../hooks';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
} from '@vegaprotocol/types';
|
} from '@vegaprotocol/types';
|
||||||
import type { ValidationProps } from './use-order-validation';
|
import type { ValidationProps } from './use-order-validation';
|
||||||
import { marketTranslations, useOrderValidation } from './use-order-validation';
|
import { marketTranslations, useOrderValidation } from './use-order-validation';
|
||||||
import type { DealTicketMarketFragment } from '../deal-ticket/__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from '../deal-ticket/__generated__/DealTicket';
|
||||||
import * as OrderMarginValidation from './use-order-margin-validation';
|
import * as OrderMarginValidation from './use-order-margin-validation';
|
||||||
import { ValidateMargin } from './validate-margin';
|
import { ValidateMargin } from './validate-margin';
|
||||||
import { ERROR_SIZE_DECIMAL } from '../constants';
|
import { ERROR_SIZE_DECIMAL } from '../constants';
|
||||||
|
@ -14,7 +14,7 @@ import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
|||||||
import { Tooltip } from '@vegaprotocol/ui-toolkit';
|
import { Tooltip } from '@vegaprotocol/ui-toolkit';
|
||||||
import { MarketDataGrid } from '../trading-mode-tooltip';
|
import { MarketDataGrid } from '../trading-mode-tooltip';
|
||||||
import { compileGridData } from '../trading-mode-tooltip/compile-grid-data';
|
import { compileGridData } from '../trading-mode-tooltip/compile-grid-data';
|
||||||
import type { DealTicketMarketFragment } from '../deal-ticket/__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from '../deal-ticket/__generated__/DealTicket';
|
||||||
import { ValidateMargin } from './validate-margin';
|
import { ValidateMargin } from './validate-margin';
|
||||||
import type { OrderMargin } from '../../hooks/use-order-margin';
|
import type { OrderMargin } from '../../hooks/use-order-margin';
|
||||||
import { useOrderMarginValidation } from './use-order-margin-validation';
|
import { useOrderMarginValidation } from './use-order-margin-validation';
|
||||||
|
@ -2,7 +2,7 @@ import type { UseFormRegister } from 'react-hook-form';
|
|||||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||||
import { DealTicketMarketAmount } from './deal-ticket-market-amount';
|
import { DealTicketMarketAmount } from './deal-ticket-market-amount';
|
||||||
import { DealTicketLimitAmount } from './deal-ticket-limit-amount';
|
import { DealTicketLimitAmount } from './deal-ticket-limit-amount';
|
||||||
import type { DealTicketMarketFragment } from './__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from './__generated__/DealTicket';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import { Schema } from '@vegaprotocol/types';
|
||||||
import type { DealTicketErrorMessage } from './deal-ticket-error';
|
import type { DealTicketErrorMessage } from './deal-ticket-error';
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit';
|
import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import { DealTicketManager } from './deal-ticket-manager';
|
import { DealTicketManager } from './deal-ticket-manager';
|
||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { useDealTicketQuery } from './__generated___/DealTicket';
|
import { useDealTicketQuery } from './__generated__/DealTicket';
|
||||||
import type { DealTicketQuery } from './__generated___/DealTicket';
|
import type { DealTicketQuery } from './__generated__/DealTicket';
|
||||||
|
|
||||||
export interface DealTicketContainerProps {
|
export interface DealTicketContainerProps {
|
||||||
marketId: string;
|
marketId: string;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { VegaTxStatus } from '@vegaprotocol/wallet';
|
import { VegaTxStatus } from '@vegaprotocol/wallet';
|
||||||
import { DealTicket } from './deal-ticket';
|
import { DealTicket } from './deal-ticket';
|
||||||
import type { DealTicketMarketFragment } from './__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from './__generated__/DealTicket';
|
||||||
import { useOrderSubmit, OrderFeedback } from '@vegaprotocol/orders';
|
import { useOrderSubmit, OrderFeedback } from '@vegaprotocol/orders';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import { Schema } from '@vegaprotocol/types';
|
||||||
import { Icon, Intent } from '@vegaprotocol/ui-toolkit';
|
import { Icon, Intent } from '@vegaprotocol/ui-toolkit';
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { VegaWalletContext } from '@vegaprotocol/wallet';
|
import { VegaWalletContext } from '@vegaprotocol/wallet';
|
||||||
import { fireEvent, render, screen, act } from '@testing-library/react';
|
import { fireEvent, render, screen, act } from '@testing-library/react';
|
||||||
import { DealTicket } from './deal-ticket';
|
import { DealTicket } from './deal-ticket';
|
||||||
import type { DealTicketMarketFragment } from './__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from './__generated__/DealTicket';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import { Schema } from '@vegaprotocol/types';
|
||||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||||
import type { MockedResponse } from '@apollo/client/testing';
|
import type { MockedResponse } from '@apollo/client/testing';
|
||||||
|
@ -20,7 +20,7 @@ import { SideSelector } from './side-selector';
|
|||||||
import { TimeInForceSelector } from './time-in-force-selector';
|
import { TimeInForceSelector } from './time-in-force-selector';
|
||||||
import { TypeSelector } from './type-selector';
|
import { TypeSelector } from './type-selector';
|
||||||
|
|
||||||
import type { DealTicketMarketFragment } from './__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from './__generated__/DealTicket';
|
||||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||||
import type { DealTicketErrorMessage } from './deal-ticket-error';
|
import type { DealTicketErrorMessage } from './deal-ticket-error';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from './__generated___/DealTicket';
|
export * from './__generated__/DealTicket';
|
||||||
export * from './deal-ticket-amount';
|
export * from './deal-ticket-amount';
|
||||||
export * from './deal-ticket-container';
|
export * from './deal-ticket-container';
|
||||||
export * from './deal-ticket-limit-amount';
|
export * from './deal-ticket-limit-amount';
|
||||||
|
@ -7,7 +7,7 @@ import { MarketTradingMode, AuctionTrigger } from '@vegaprotocol/types';
|
|||||||
import { Link as UILink } from '@vegaprotocol/ui-toolkit';
|
import { Link as UILink } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import type { MarketDataGridProps } from './market-data-grid';
|
import type { MarketDataGridProps } from './market-data-grid';
|
||||||
import type { DealTicketMarketFragment } from '../deal-ticket/__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from '../deal-ticket/__generated__/DealTicket';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
export const compileGridData = (
|
export const compileGridData = (
|
||||||
|
@ -4,7 +4,7 @@ import { MockedProvider } from '@apollo/client/testing';
|
|||||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||||
import type { PartyBalanceQuery } from './__generated__/PartyBalance';
|
import type { PartyBalanceQuery } from './__generated__/PartyBalance';
|
||||||
import { useOrderCloseOut } from './use-order-closeout';
|
import { useOrderCloseOut } from './use-order-closeout';
|
||||||
import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated__/DealTicket';
|
||||||
|
|
||||||
jest.mock('@vegaprotocol/wallet', () => ({
|
jest.mock('@vegaprotocol/wallet', () => ({
|
||||||
...jest.requireActual('@vegaprotocol/wallet'),
|
...jest.requireActual('@vegaprotocol/wallet'),
|
||||||
|
@ -6,7 +6,7 @@ import { useMarketPositions } from './use-market-positions';
|
|||||||
import { useMarketDataMarkPrice } from './use-market-data-mark-price';
|
import { useMarketDataMarkPrice } from './use-market-data-mark-price';
|
||||||
import { usePartyMarketDataQuery } from './__generated__/PartyMarketData';
|
import { usePartyMarketDataQuery } from './__generated__/PartyMarketData';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import { Schema } from '@vegaprotocol/types';
|
||||||
import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated__/DealTicket';
|
||||||
import type { PartyBalanceQuery } from './__generated__/PartyBalance';
|
import type { PartyBalanceQuery } from './__generated__/PartyBalance';
|
||||||
import { useSettlementAccount } from './use-settlement-account';
|
import { useSettlementAccount } from './use-settlement-account';
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { BigNumber } from 'bignumber.js';
|
|||||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||||
import type { PositionMargin } from './use-market-positions';
|
import type { PositionMargin } from './use-market-positions';
|
||||||
import { useOrderMargin } from './use-order-margin';
|
import { useOrderMargin } from './use-order-margin';
|
||||||
import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated__/DealTicket';
|
||||||
|
|
||||||
let mockEstimateData = {
|
let mockEstimateData = {
|
||||||
estimateOrder: {
|
estimateOrder: {
|
||||||
|
@ -6,7 +6,7 @@ import { useMarketPositions } from './use-market-positions';
|
|||||||
import { useMarketDataMarkPrice } from './use-market-data-mark-price';
|
import { useMarketDataMarkPrice } from './use-market-data-mark-price';
|
||||||
import type { EstimateOrderQuery } from './__generated__/EstimateOrder';
|
import type { EstimateOrderQuery } from './__generated__/EstimateOrder';
|
||||||
import { useEstimateOrderQuery } from './__generated__/EstimateOrder';
|
import { useEstimateOrderQuery } from './__generated__/EstimateOrder';
|
||||||
import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated___/DealTicket';
|
import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated__/DealTicket';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
order: OrderSubmissionBody['orderSubmission'];
|
order: OrderSubmissionBody['orderSubmission'];
|
||||||
|
@ -11,7 +11,7 @@ import type {
|
|||||||
VegaValueFormatterParams,
|
VegaValueFormatterParams,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import { AgGridDynamic as AgGrid, Link } from '@vegaprotocol/ui-toolkit';
|
import { AgGridDynamic as AgGrid, Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { DepositFieldsFragment } from './__generated___/Deposit';
|
import type { DepositFieldsFragment } from './__generated__/Deposit';
|
||||||
import { useEnvironment } from '@vegaprotocol/environment';
|
import { useEnvironment } from '@vegaprotocol/environment';
|
||||||
import { DepositStatusMapping } from '@vegaprotocol/types';
|
import { DepositStatusMapping } from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from './__generated___/Deposit';
|
export * from './__generated__/Deposit';
|
||||||
export * from './deposit-container';
|
export * from './deposit-container';
|
||||||
export * from './deposit-form';
|
export * from './deposit-form';
|
||||||
export * from './deposit-limits';
|
export * from './deposit-limits';
|
||||||
|
@ -8,13 +8,13 @@ import { Schema } from '@vegaprotocol/types';
|
|||||||
import {
|
import {
|
||||||
useDepositsQuery,
|
useDepositsQuery,
|
||||||
DepositEventDocument,
|
DepositEventDocument,
|
||||||
} from './__generated___/Deposit';
|
} from './__generated__/Deposit';
|
||||||
import type {
|
import type {
|
||||||
DepositFieldsFragment,
|
DepositFieldsFragment,
|
||||||
DepositsQuery,
|
DepositsQuery,
|
||||||
DepositEventSubscription,
|
DepositEventSubscription,
|
||||||
DepositEventSubscriptionVariables,
|
DepositEventSubscriptionVariables,
|
||||||
} from './__generated___/Deposit';
|
} from './__generated__/Deposit';
|
||||||
|
|
||||||
export const useDeposits = () => {
|
export const useDeposits = () => {
|
||||||
const { pubKey } = useVegaWallet();
|
const { pubKey } = useVegaWallet();
|
||||||
|
@ -3,8 +3,8 @@ import * as Sentry from '@sentry/react';
|
|||||||
import type {
|
import type {
|
||||||
DepositEventSubscription,
|
DepositEventSubscription,
|
||||||
DepositEventSubscriptionVariables,
|
DepositEventSubscriptionVariables,
|
||||||
} from './__generated___/Deposit';
|
} from './__generated__/Deposit';
|
||||||
import { DepositEventDocument } from './__generated___/Deposit';
|
import { DepositEventDocument } from './__generated__/Deposit';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import { Schema } from '@vegaprotocol/types';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { remove0x, removeDecimal } from '@vegaprotocol/react-helpers';
|
import { remove0x, removeDecimal } from '@vegaprotocol/react-helpers';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from './lib/fills-container';
|
export * from './lib/fills-container';
|
||||||
export * from './lib/use-fills-list';
|
export * from './lib/use-fills-list';
|
||||||
export * from './lib/fills-data-provider';
|
export * from './lib/fills-data-provider';
|
||||||
export * from './lib/__generated___/Fills';
|
export * from './lib/__generated__/Fills';
|
||||||
|
@ -10,13 +10,13 @@ import {
|
|||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
import { marketsProvider } from '@vegaprotocol/market-list';
|
import { marketsProvider } from '@vegaprotocol/market-list';
|
||||||
import type { PageInfo, Edge } from '@vegaprotocol/react-helpers';
|
import type { PageInfo, Edge } from '@vegaprotocol/react-helpers';
|
||||||
import { FillsDocument, FillsEventDocument } from './__generated___/Fills';
|
import { FillsDocument, FillsEventDocument } from './__generated__/Fills';
|
||||||
import type {
|
import type {
|
||||||
FillsQuery,
|
FillsQuery,
|
||||||
FillFieldsFragment,
|
FillFieldsFragment,
|
||||||
FillEdgeFragment,
|
FillEdgeFragment,
|
||||||
FillsEventSubscription,
|
FillsEventSubscription,
|
||||||
} from './__generated___/Fills';
|
} from './__generated__/Fills';
|
||||||
|
|
||||||
const update = (
|
const update = (
|
||||||
data: FillEdgeFragment[] | null,
|
data: FillEdgeFragment[] | null,
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import { VoteEventDocument } from './__generated___/VoteSubsciption';
|
import { VoteEventDocument } from './__generated__/VoteSubsciption';
|
||||||
import type { Subscription } from 'zen-observable-ts';
|
import type { Subscription } from 'zen-observable-ts';
|
||||||
import type { VegaTxState } from '@vegaprotocol/wallet';
|
import type { VegaTxState } from '@vegaprotocol/wallet';
|
||||||
import type {
|
import type {
|
||||||
VoteEventFieldsFragment,
|
VoteEventFieldsFragment,
|
||||||
VoteEventSubscription,
|
VoteEventSubscription,
|
||||||
VoteEventSubscriptionVariables,
|
VoteEventSubscriptionVariables,
|
||||||
} from './__generated___/VoteSubsciption';
|
} from './__generated__/VoteSubsciption';
|
||||||
|
|
||||||
export const useVoteEvent = (transaction: VegaTxState) => {
|
export const useVoteEvent = (transaction: VegaTxState) => {
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
|
@ -3,7 +3,7 @@ import * as Sentry from '@sentry/react';
|
|||||||
import { useVegaTransaction, useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaTransaction, useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { useVoteEvent } from './use-vote-event';
|
import { useVoteEvent } from './use-vote-event';
|
||||||
import type { VoteValue } from '@vegaprotocol/types';
|
import type { VoteValue } from '@vegaprotocol/types';
|
||||||
import type { VoteEventFieldsFragment } from './__generated___/VoteSubsciption';
|
import type { VoteEventFieldsFragment } from './__generated__/VoteSubsciption';
|
||||||
|
|
||||||
export const useVoteSubmit = () => {
|
export const useVoteSubmit = () => {
|
||||||
const { pubKey } = useVegaWallet();
|
const { pubKey } = useVegaWallet();
|
||||||
|
@ -11,8 +11,8 @@ import { useMemo } from 'react';
|
|||||||
import type {
|
import type {
|
||||||
LedgerEntriesQuery,
|
LedgerEntriesQuery,
|
||||||
LedgerEntryFragment,
|
LedgerEntryFragment,
|
||||||
} from './__generated___/LedgerEntries';
|
} from './__generated__/LedgerEntries';
|
||||||
import { LedgerEntriesDocument } from './__generated___/LedgerEntries';
|
import { LedgerEntriesDocument } from './__generated__/LedgerEntries';
|
||||||
|
|
||||||
export type LedgerEntry = LedgerEntryFragment & {
|
export type LedgerEntry = LedgerEntryFragment & {
|
||||||
id: number;
|
id: number;
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
export * from './__generated___/orders';
|
export * from './__generated__/Orders';
|
||||||
export * from './order-data-provider';
|
export * from './order-data-provider';
|
||||||
|
@ -15,8 +15,8 @@ import type {
|
|||||||
OrderFieldsFragment,
|
OrderFieldsFragment,
|
||||||
OrdersQuery,
|
OrdersQuery,
|
||||||
OrdersUpdateSubscription,
|
OrdersUpdateSubscription,
|
||||||
} from './__generated___/orders';
|
} from './__generated__/Orders';
|
||||||
import { OrdersDocument, OrdersUpdateDocument } from './__generated___/orders';
|
import { OrdersDocument, OrdersUpdateDocument } from './__generated__/Orders';
|
||||||
|
|
||||||
export type Order = Omit<OrderFieldsFragment, 'market'> & {
|
export type Order = Omit<OrderFieldsFragment, 'market'> & {
|
||||||
market?: Market;
|
market?: Market;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useEnvironment } from '@vegaprotocol/environment';
|
import { useEnvironment } from '@vegaprotocol/environment';
|
||||||
import type { OrderEventFieldsFragment } from '../../order-hooks/__generated___/OrderEvent';
|
import type { OrderEventFieldsFragment } from '../../order-hooks/__generated__/OrderEvent';
|
||||||
import { addDecimalsFormatNumber, Size, t } from '@vegaprotocol/react-helpers';
|
import { addDecimalsFormatNumber, Size, t } from '@vegaprotocol/react-helpers';
|
||||||
import {
|
import {
|
||||||
OrderRejectionReasonMapping,
|
OrderRejectionReasonMapping,
|
||||||
|
@ -3,7 +3,7 @@ import { MockedProvider } from '@apollo/client/testing';
|
|||||||
import { renderHook, waitFor } from '@testing-library/react';
|
import { renderHook, waitFor } from '@testing-library/react';
|
||||||
import { useOrderListData } from './use-order-list-data';
|
import { useOrderListData } from './use-order-list-data';
|
||||||
import type { Edge } from '@vegaprotocol/react-helpers';
|
import type { Edge } from '@vegaprotocol/react-helpers';
|
||||||
import type { OrderFieldsFragment } from '../order-data-provider/__generated___/orders';
|
import type { OrderFieldsFragment } from '../order-data-provider/__generated__/Orders';
|
||||||
import type { IGetRowsParams } from 'ag-grid-community';
|
import type { IGetRowsParams } from 'ag-grid-community';
|
||||||
|
|
||||||
const loadMock = jest.fn();
|
const loadMock = jest.fn();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from './__generated___/OrderEvent';
|
export * from './__generated__/OrderEvent';
|
||||||
export * from './use-order-cancel';
|
export * from './use-order-cancel';
|
||||||
export * from './use-order-submit';
|
export * from './use-order-submit';
|
||||||
export * from './use-order-edit';
|
export * from './use-order-edit';
|
||||||
|
@ -3,8 +3,8 @@ import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
|||||||
import { VegaTxStatus, VegaWalletContext } from '@vegaprotocol/wallet';
|
import { VegaTxStatus, VegaWalletContext } from '@vegaprotocol/wallet';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { useOrderEdit } from './use-order-edit';
|
import { useOrderEdit } from './use-order-edit';
|
||||||
import type { OrderEventSubscription } from './__generated___/OrderEvent';
|
import type { OrderEventSubscription } from './__generated__/OrderEvent';
|
||||||
import { OrderEventDocument } from './__generated___/OrderEvent';
|
import { OrderEventDocument } from './__generated__/OrderEvent';
|
||||||
import type { MockedResponse } from '@apollo/client/testing';
|
import type { MockedResponse } from '@apollo/client/testing';
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import type { Order } from '../components';
|
import type { Order } from '../components';
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import { OrderEventDocument } from './__generated___/OrderEvent';
|
import { OrderEventDocument } from './__generated__/OrderEvent';
|
||||||
import type {
|
import type {
|
||||||
OrderEventSubscription,
|
OrderEventSubscription,
|
||||||
OrderEventSubscriptionVariables,
|
OrderEventSubscriptionVariables,
|
||||||
OrderEventFieldsFragment,
|
OrderEventFieldsFragment,
|
||||||
} from './__generated___/OrderEvent';
|
} from './__generated__/OrderEvent';
|
||||||
import type { Subscription } from 'zen-observable-ts';
|
import type { Subscription } from 'zen-observable-ts';
|
||||||
import type { VegaTxState } from '@vegaprotocol/wallet';
|
import type { VegaTxState } from '@vegaprotocol/wallet';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import { Schema } from '@vegaprotocol/types';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import type { OrderEventFieldsFragment } from './__generated___/OrderEvent';
|
import type { OrderEventFieldsFragment } from './__generated__/OrderEvent';
|
||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { toNanoSeconds } from '@vegaprotocol/react-helpers';
|
import { toNanoSeconds } from '@vegaprotocol/react-helpers';
|
||||||
import { useVegaTransaction, determineId } from '@vegaprotocol/wallet';
|
import { useVegaTransaction, determineId } from '@vegaprotocol/wallet';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from './lib/__generated___/Positions';
|
export * from './lib/__generated__/Positions';
|
||||||
export * from './lib/positions-container';
|
export * from './lib/positions-container';
|
||||||
export * from './lib/positions-data-providers';
|
export * from './lib/positions-data-providers';
|
||||||
export * from './lib/positions-table';
|
export * from './lib/positions-table';
|
||||||
|
@ -3,11 +3,11 @@ import { makeDataProvider } from '@vegaprotocol/react-helpers';
|
|||||||
import {
|
import {
|
||||||
MarginsSubscriptionDocument,
|
MarginsSubscriptionDocument,
|
||||||
MarginsDocument,
|
MarginsDocument,
|
||||||
} from './__generated___/Positions';
|
} from './__generated__/Positions';
|
||||||
import type {
|
import type {
|
||||||
MarginsQuery,
|
MarginsQuery,
|
||||||
MarginsSubscriptionSubscription,
|
MarginsSubscriptionSubscription,
|
||||||
} from './__generated___/Positions';
|
} from './__generated__/Positions';
|
||||||
|
|
||||||
const update = (
|
const update = (
|
||||||
data: MarginsQuery['party'],
|
data: MarginsQuery['party'],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { AccountType, MarketTradingMode } from '@vegaprotocol/types';
|
import { AccountType, MarketTradingMode } from '@vegaprotocol/types';
|
||||||
import type { Account } from '@vegaprotocol/accounts';
|
import type { Account } from '@vegaprotocol/accounts';
|
||||||
import type { MarketWithData } from '@vegaprotocol/market-list';
|
import type { MarketWithData } from '@vegaprotocol/market-list';
|
||||||
import type { PositionsQuery, MarginsQuery } from './__generated___/Positions';
|
import type { PositionsQuery, MarginsQuery } from './__generated__/Positions';
|
||||||
import { getMetrics, rejoinPositionData } from './positions-data-providers';
|
import { getMetrics, rejoinPositionData } from './positions-data-providers';
|
||||||
|
|
||||||
const accounts = [
|
const accounts = [
|
||||||
|
@ -18,11 +18,11 @@ import type {
|
|||||||
PositionsSubscriptionSubscription,
|
PositionsSubscriptionSubscription,
|
||||||
MarginsQuery,
|
MarginsQuery,
|
||||||
MarginFieldsFragment,
|
MarginFieldsFragment,
|
||||||
} from './__generated___/Positions';
|
} from './__generated__/Positions';
|
||||||
import {
|
import {
|
||||||
PositionsDocument,
|
PositionsDocument,
|
||||||
PositionsSubscriptionDocument,
|
PositionsSubscriptionDocument,
|
||||||
} from './__generated___/Positions';
|
} from './__generated__/Positions';
|
||||||
import { marginsDataProvider } from './margin-data-provider';
|
import { marginsDataProvider } from './margin-data-provider';
|
||||||
|
|
||||||
type PositionMarginLevel = Pick<
|
type PositionMarginLevel = Pick<
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from './__generated___/NetworkParams';
|
export * from './__generated__/NetworkParams';
|
||||||
export * from './use-apply-grid-transaction';
|
export * from './use-apply-grid-transaction';
|
||||||
export * from './use-data-provider';
|
export * from './use-data-provider';
|
||||||
export * from './use-fetch';
|
export * from './use-fetch';
|
||||||
|
@ -8,9 +8,9 @@ import {
|
|||||||
useNetworkParams,
|
useNetworkParams,
|
||||||
} from './use-network-params';
|
} from './use-network-params';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import type { NetworkParamsQuery } from './__generated___/NetworkParams';
|
import type { NetworkParamsQuery } from './__generated__/NetworkParams';
|
||||||
import { NetworkParamDocument } from './__generated___/NetworkParams';
|
import { NetworkParamDocument } from './__generated__/NetworkParams';
|
||||||
import { NetworkParamsDocument } from './__generated___/NetworkParams';
|
import { NetworkParamsDocument } from './__generated__/NetworkParams';
|
||||||
|
|
||||||
describe('useNetworkParam', () => {
|
describe('useNetworkParam', () => {
|
||||||
const setup = (arg: NetworkParamsKey) => {
|
const setup = (arg: NetworkParamsKey) => {
|
||||||
|
@ -3,7 +3,7 @@ import { useMemo } from 'react';
|
|||||||
import {
|
import {
|
||||||
useNetworkParamQuery,
|
useNetworkParamQuery,
|
||||||
useNetworkParamsQuery,
|
useNetworkParamsQuery,
|
||||||
} from './__generated___/NetworkParams';
|
} from './__generated__/NetworkParams';
|
||||||
|
|
||||||
export const NetworkParams = {
|
export const NetworkParams = {
|
||||||
blockchains_ethereumConfig: 'blockchains_ethereumConfig',
|
blockchains_ethereumConfig: 'blockchains_ethereumConfig',
|
||||||
|
@ -11,4 +11,4 @@ export * from './lib/remove-0x';
|
|||||||
export * from './lib/storage';
|
export * from './lib/storage';
|
||||||
export * from './lib/time';
|
export * from './lib/time';
|
||||||
export * from './lib/validate';
|
export * from './lib/validate';
|
||||||
export * from './lib/__generated___/ChainId';
|
export * from './lib/__generated__/ChainId';
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
export * from './lib/trades-container';
|
export * from './lib/trades-container';
|
||||||
export * from './lib/__generated___/Trades';
|
export * from './lib/__generated__/Trades';
|
||||||
|
@ -9,7 +9,7 @@ import type { BodyScrollEvent, BodyScrollEndEvent } from 'ag-grid-community';
|
|||||||
import { MAX_TRADES, tradesWithMarketProvider } from './trades-data-provider';
|
import { MAX_TRADES, tradesWithMarketProvider } from './trades-data-provider';
|
||||||
import { TradesTable } from './trades-table';
|
import { TradesTable } from './trades-table';
|
||||||
import type { Trade, TradeEdge } from './trades-data-provider';
|
import type { Trade, TradeEdge } from './trades-data-provider';
|
||||||
import type { TradesQueryVariables } from './__generated___/Trades';
|
import type { TradesQueryVariables } from './__generated__/Trades';
|
||||||
|
|
||||||
interface TradesContainerProps {
|
interface TradesContainerProps {
|
||||||
marketId: string;
|
marketId: string;
|
||||||
|
@ -12,8 +12,8 @@ import type {
|
|||||||
TradesQuery,
|
TradesQuery,
|
||||||
TradeFieldsFragment,
|
TradeFieldsFragment,
|
||||||
TradesUpdateSubscription,
|
TradesUpdateSubscription,
|
||||||
} from './__generated___/Trades';
|
} from './__generated__/Trades';
|
||||||
import { TradesDocument, TradesUpdateDocument } from './__generated___/Trades';
|
import { TradesDocument, TradesUpdateDocument } from './__generated__/Trades';
|
||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import produce from 'immer';
|
import produce from 'immer';
|
||||||
|
|
||||||
|
@ -13,17 +13,34 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
excludes: [
|
excludes: [
|
||||||
'**/generic-data-provider.ts',
|
'**/generic-data-provider.ts',
|
||||||
'**/__generated___/*',
|
'**/__generated__/*',
|
||||||
'../../libs/accounts/**',
|
'../../libs/accounts/**',
|
||||||
'../../libs/assets/**',
|
'../../libs/assets/**',
|
||||||
'../../libs/candles-chart/**',
|
'../../libs/candles-chart/**',
|
||||||
|
'../../libs/cypress/**',
|
||||||
'../../libs/deal-ticket/**',
|
'../../libs/deal-ticket/**',
|
||||||
'../../libs/deposits/**',
|
'../../libs/deposits/**',
|
||||||
'../../libs/environment/**',
|
'../../libs/environment/**',
|
||||||
'../../libs/fills/**',
|
'../../libs/fills/**',
|
||||||
'../../libs/governance/**',
|
'../../libs/governance/**',
|
||||||
|
'../../libs/ledger/**',
|
||||||
'../../libs/liquidity/**',
|
'../../libs/liquidity/**',
|
||||||
|
// @TODO: uncomment these when migrated
|
||||||
|
// '../../libs/maket-depth/**',
|
||||||
|
// '../../libs/market-list/**',
|
||||||
|
// '../../libs/market-info/**',
|
||||||
|
'../../libs/network-info/**',
|
||||||
'../../libs/network-stats/**',
|
'../../libs/network-stats/**',
|
||||||
|
'../../libs/orders/**',
|
||||||
|
'../../libs/positions/**',
|
||||||
|
'../../libs/react-helpers/**',
|
||||||
|
'../../libs/smart-contracts/**',
|
||||||
|
'../../libs/tailwind-config/**',
|
||||||
|
'../../libs/trades/**',
|
||||||
|
'../../libs/ui-toolkit/**',
|
||||||
|
'../../libs/wallet/**',
|
||||||
|
'../../libs/web3/**',
|
||||||
|
'../../libs/withdraws/**',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
27
libs/types/src/__generated__/globalTypes.ts
generated
27
libs/types/src/__generated__/globalTypes.ts
generated
@ -63,6 +63,18 @@ export enum DataSourceSpecStatus {
|
|||||||
STATUS_DEACTIVATED = "STATUS_DEACTIVATED",
|
STATUS_DEACTIVATED = "STATUS_DEACTIVATED",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interval for trade candles when subscribing via Vega GraphQL, default is I15M
|
||||||
|
*/
|
||||||
|
export enum Interval {
|
||||||
|
INTERVAL_I15M = "INTERVAL_I15M",
|
||||||
|
INTERVAL_I1D = "INTERVAL_I1D",
|
||||||
|
INTERVAL_I1H = "INTERVAL_I1H",
|
||||||
|
INTERVAL_I1M = "INTERVAL_I1M",
|
||||||
|
INTERVAL_I5M = "INTERVAL_I5M",
|
||||||
|
INTERVAL_I6H = "INTERVAL_I6H",
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current state of a market
|
* The current state of a market
|
||||||
*/
|
*/
|
||||||
@ -181,20 +193,17 @@ export enum StakeLinkingStatus {
|
|||||||
STATUS_REJECTED = "STATUS_REJECTED",
|
STATUS_REJECTED = "STATUS_REJECTED",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ValidatorStatus {
|
||||||
|
VALIDATOR_NODE_STATUS_ERSATZ = "VALIDATOR_NODE_STATUS_ERSATZ",
|
||||||
|
VALIDATOR_NODE_STATUS_PENDING = "VALIDATOR_NODE_STATUS_PENDING",
|
||||||
|
VALIDATOR_NODE_STATUS_TENDERMINT = "VALIDATOR_NODE_STATUS_TENDERMINT",
|
||||||
|
}
|
||||||
|
|
||||||
export enum VoteValue {
|
export enum VoteValue {
|
||||||
VALUE_NO = "VALUE_NO",
|
VALUE_NO = "VALUE_NO",
|
||||||
VALUE_YES = "VALUE_YES",
|
VALUE_YES = "VALUE_YES",
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The status of a withdrawal
|
|
||||||
*/
|
|
||||||
export enum WithdrawalStatus {
|
|
||||||
STATUS_FINALIZED = "STATUS_FINALIZED",
|
|
||||||
STATUS_OPEN = "STATUS_OPEN",
|
|
||||||
STATUS_REJECTED = "STATUS_REJECTED",
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================
|
//==============================================================
|
||||||
// END Enums and Input Objects
|
// END Enums and Input Objects
|
||||||
//==============================================================
|
//==============================================================
|
||||||
|
@ -278,18 +278,6 @@ export enum WithdrawalStatusMapping {
|
|||||||
STATUS_REJECTED = 'Rejected',
|
STATUS_REJECTED = 'Rejected',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The interval for trade candles when subscribing via Vega GraphQL, default is I15M
|
|
||||||
*/
|
|
||||||
export enum Interval {
|
|
||||||
INTERVAL_I15M = 'INTERVAL_I15M',
|
|
||||||
INTERVAL_I1D = 'INTERVAL_I1D',
|
|
||||||
INTERVAL_I1H = 'INTERVAL_I1H',
|
|
||||||
INTERVAL_I1M = 'INTERVAL_I1M',
|
|
||||||
INTERVAL_I5M = 'INTERVAL_I5M',
|
|
||||||
INTERVAL_I6H = 'INTERVAL_I6H',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum ProposalUserAction {
|
export enum ProposalUserAction {
|
||||||
CREATE = 'CREATE',
|
CREATE = 'CREATE',
|
||||||
VOTE = 'VOTE',
|
VOTE = 'VOTE',
|
||||||
|
@ -10,4 +10,4 @@ export * from './provider';
|
|||||||
export * from './connect-dialog';
|
export * from './connect-dialog';
|
||||||
export * from './utils';
|
export * from './utils';
|
||||||
export * from './constants';
|
export * from './constants';
|
||||||
export * from './__generated___/TransactionResult';
|
export * from './__generated__/TransactionResult';
|
||||||
|
@ -3,8 +3,8 @@ import type { MockedResponse } from '@apollo/client/testing';
|
|||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import { renderHook } from '@testing-library/react';
|
import { renderHook } from '@testing-library/react';
|
||||||
import { Schema as Types } from '@vegaprotocol/types';
|
import { Schema as Types } from '@vegaprotocol/types';
|
||||||
import type { TransactionEventSubscription } from './__generated___/TransactionResult';
|
import type { TransactionEventSubscription } from './__generated__/TransactionResult';
|
||||||
import { TransactionEventDocument } from './__generated___/TransactionResult';
|
import { TransactionEventDocument } from './__generated__/TransactionResult';
|
||||||
import { useTransactionResult } from './use-transaction-result';
|
import { useTransactionResult } from './use-transaction-result';
|
||||||
|
|
||||||
const pubKey = 'test-pubkey';
|
const pubKey = 'test-pubkey';
|
||||||
|
@ -5,8 +5,8 @@ import type { Subscription } from 'zen-observable-ts';
|
|||||||
import type {
|
import type {
|
||||||
TransactionEventSubscription,
|
TransactionEventSubscription,
|
||||||
TransactionEventSubscriptionVariables,
|
TransactionEventSubscriptionVariables,
|
||||||
} from './__generated___/TransactionResult';
|
} from './__generated__/TransactionResult';
|
||||||
import { TransactionEventDocument } from './__generated___/TransactionResult';
|
import { TransactionEventDocument } from './__generated__/TransactionResult';
|
||||||
|
|
||||||
export interface TransactionResult {
|
export interface TransactionResult {
|
||||||
partyId: string;
|
partyId: string;
|
||||||
|
@ -9,5 +9,5 @@ export * from './lib/use-complete-withdraw';
|
|||||||
export * from './lib/use-create-withdraw';
|
export * from './lib/use-create-withdraw';
|
||||||
export * from './lib/use-verify-withdrawal';
|
export * from './lib/use-verify-withdrawal';
|
||||||
export * from './lib/use-withdrawals';
|
export * from './lib/use-withdrawals';
|
||||||
export * from './lib/__generated__/Withdrawals';
|
export * from './lib/__generated__/Withdrawal';
|
||||||
export * from './lib/__generated__/WithdrawalFields';
|
export * from './lib/__generated__/Erc20Approval';
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
query WithdrawPageQuery($partyId: ID!) {
|
|
||||||
party(id: $partyId) {
|
|
||||||
id
|
|
||||||
withdrawals {
|
|
||||||
id
|
|
||||||
txHash
|
|
||||||
}
|
|
||||||
accounts {
|
|
||||||
type
|
|
||||||
balance
|
|
||||||
asset {
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assetsConnection {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
name
|
|
||||||
decimals
|
|
||||||
source {
|
|
||||||
... on ERC20 {
|
|
||||||
contractAddress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,23 @@
|
|||||||
|
fragment PendingWithdrawal on Withdrawal {
|
||||||
|
pendingOnForeignChain @client
|
||||||
|
txHash
|
||||||
|
}
|
||||||
|
|
||||||
fragment WithdrawalFields on Withdrawal {
|
fragment WithdrawalFields on Withdrawal {
|
||||||
id
|
id
|
||||||
status
|
status
|
||||||
amount
|
amount
|
||||||
asset {
|
asset {
|
||||||
id
|
id
|
||||||
|
name
|
||||||
symbol
|
symbol
|
||||||
decimals
|
decimals
|
||||||
|
status
|
||||||
|
source {
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
createdTimestamp
|
createdTimestamp
|
||||||
withdrawnTimestamp
|
withdrawnTimestamp
|
||||||
@ -21,8 +33,12 @@ fragment WithdrawalFields on Withdrawal {
|
|||||||
query Withdrawals($partyId: ID!) {
|
query Withdrawals($partyId: ID!) {
|
||||||
party(id: $partyId) {
|
party(id: $partyId) {
|
||||||
id
|
id
|
||||||
withdrawals {
|
withdrawalsConnection {
|
||||||
...WithdrawalFields
|
edges {
|
||||||
|
node {
|
||||||
|
...WithdrawalFields
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
52
libs/withdraws/src/lib/__generated__/AssetFields.ts
generated
52
libs/withdraws/src/lib/__generated__/AssetFields.ts
generated
@ -1,52 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
import { AssetStatus } from "@vegaprotocol/types";
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL fragment: AssetFields
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface AssetFields_source_BuiltinAsset {
|
|
||||||
__typename: "BuiltinAsset";
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AssetFields_source_ERC20 {
|
|
||||||
__typename: "ERC20";
|
|
||||||
/**
|
|
||||||
* The address of the ERC20 contract
|
|
||||||
*/
|
|
||||||
contractAddress: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AssetFields_source = AssetFields_source_BuiltinAsset | AssetFields_source_ERC20;
|
|
||||||
|
|
||||||
export interface AssetFields {
|
|
||||||
__typename: "Asset";
|
|
||||||
/**
|
|
||||||
* The ID of the asset
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The symbol of the asset (e.g: GBP)
|
|
||||||
*/
|
|
||||||
symbol: string;
|
|
||||||
/**
|
|
||||||
* The full name of the asset (e.g: Great British Pound)
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
|
||||||
*/
|
|
||||||
decimals: number;
|
|
||||||
/**
|
|
||||||
* The status of the asset in the Vega network
|
|
||||||
*/
|
|
||||||
status: AssetStatus;
|
|
||||||
/**
|
|
||||||
* The origin source of the asset (e.g: an ERC20 asset)
|
|
||||||
*/
|
|
||||||
source: AssetFields_source;
|
|
||||||
}
|
|
@ -1,52 +1,54 @@
|
|||||||
/* tslint:disable */
|
import { Schema as Types } from '@vegaprotocol/types';
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
// ====================================================
|
import { gql } from '@apollo/client';
|
||||||
// GraphQL query operation: Erc20Approval
|
import * as Apollo from '@apollo/client';
|
||||||
// ====================================================
|
const defaultOptions = {} as const;
|
||||||
|
export type Erc20ApprovalQueryVariables = Types.Exact<{
|
||||||
|
withdrawalId: Types.Scalars['ID'];
|
||||||
|
}>;
|
||||||
|
|
||||||
export interface Erc20Approval_erc20WithdrawalApproval {
|
|
||||||
__typename: "Erc20WithdrawalApproval";
|
export type Erc20ApprovalQuery = { __typename?: 'Query', erc20WithdrawalApproval?: { __typename?: 'Erc20WithdrawalApproval', assetSource: string, amount: string, nonce: string, signatures: string, targetAddress: string, expiry: string, creation: string } | null };
|
||||||
/**
|
|
||||||
* The source asset in the ethereum network
|
|
||||||
*/
|
export const Erc20ApprovalDocument = gql`
|
||||||
assetSource: string;
|
query Erc20Approval($withdrawalId: ID!) {
|
||||||
/**
|
erc20WithdrawalApproval(withdrawalId: $withdrawalId) {
|
||||||
* The amount to be withdrawn
|
assetSource
|
||||||
*/
|
amount
|
||||||
amount: string;
|
nonce
|
||||||
/**
|
signatures
|
||||||
* The nonce to be used in the request
|
targetAddress
|
||||||
*/
|
expiry
|
||||||
nonce: string;
|
creation
|
||||||
/**
|
}
|
||||||
* Signature aggregate from the nodes, in the following format:
|
|
||||||
* 0x + sig1 + sig2 + ... + sigN
|
|
||||||
*/
|
|
||||||
signatures: string;
|
|
||||||
/**
|
|
||||||
* The target address which will receive the funds
|
|
||||||
*/
|
|
||||||
targetAddress: string;
|
|
||||||
/**
|
|
||||||
* Timestamp in seconds for expiry of the approval
|
|
||||||
*/
|
|
||||||
expiry: string;
|
|
||||||
/**
|
|
||||||
* Timestamp at which the withdrawal was created
|
|
||||||
*/
|
|
||||||
creation: string;
|
|
||||||
}
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export interface Erc20Approval {
|
/**
|
||||||
/**
|
* __useErc20ApprovalQuery__
|
||||||
* Find an erc20 withdrawal approval using its withdrawal ID
|
*
|
||||||
*/
|
* To run a query within a React component, call `useErc20ApprovalQuery` and pass it any options that fit your needs.
|
||||||
erc20WithdrawalApproval: Erc20Approval_erc20WithdrawalApproval | null;
|
* When your component renders, `useErc20ApprovalQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||||
}
|
* you can use to render your UI.
|
||||||
|
*
|
||||||
export interface Erc20ApprovalVariables {
|
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||||
withdrawalId: string;
|
*
|
||||||
}
|
* @example
|
||||||
|
* const { data, loading, error } = useErc20ApprovalQuery({
|
||||||
|
* variables: {
|
||||||
|
* withdrawalId: // value for 'withdrawalId'
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useErc20ApprovalQuery(baseOptions: Apollo.QueryHookOptions<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>(Erc20ApprovalDocument, options);
|
||||||
|
}
|
||||||
|
export function useErc20ApprovalLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>(Erc20ApprovalDocument, options);
|
||||||
|
}
|
||||||
|
export type Erc20ApprovalQueryHookResult = ReturnType<typeof useErc20ApprovalQuery>;
|
||||||
|
export type Erc20ApprovalLazyQueryHookResult = ReturnType<typeof useErc20ApprovalLazyQuery>;
|
||||||
|
export type Erc20ApprovalQueryResult = Apollo.QueryResult<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>;
|
@ -1,20 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL fragment: PendingWithdrawal
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface PendingWithdrawal {
|
|
||||||
__typename: "Withdrawal";
|
|
||||||
/**
|
|
||||||
* Whether or the not the withdrawal is being processed on Ethereum
|
|
||||||
*/
|
|
||||||
pendingOnForeignChain: boolean;
|
|
||||||
/**
|
|
||||||
* Hash of the transaction on the foreign chain
|
|
||||||
*/
|
|
||||||
txHash: string | null;
|
|
||||||
}
|
|
@ -3,22 +3,30 @@ import { Schema as Types } from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type WithdrawalFieldsFragment = { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null };
|
export type PendingWithdrawalFragment = { __typename?: 'Withdrawal', pendingOnForeignChain: boolean, txHash?: string | null };
|
||||||
|
|
||||||
|
export type WithdrawalFieldsFragment = { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null };
|
||||||
|
|
||||||
export type WithdrawalsQueryVariables = Types.Exact<{
|
export type WithdrawalsQueryVariables = Types.Exact<{
|
||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type WithdrawalsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, withdrawals?: Array<{ __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null }> | null } | null };
|
export type WithdrawalsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, withdrawalsConnection?: { __typename?: 'WithdrawalsConnection', edges?: Array<{ __typename?: 'WithdrawalEdge', node: { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null } } | null> | null } | null } | null };
|
||||||
|
|
||||||
export type WithdrawalEventSubscriptionVariables = Types.Exact<{
|
export type WithdrawalEventSubscriptionVariables = Types.Exact<{
|
||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type WithdrawalEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'AccountEvent' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit' } | { __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', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null } }> | null };
|
export type WithdrawalEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'AccountEvent' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit' } | { __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', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null } }> | null };
|
||||||
|
|
||||||
|
export const PendingWithdrawalFragmentDoc = gql`
|
||||||
|
fragment PendingWithdrawal on Withdrawal {
|
||||||
|
pendingOnForeignChain @client
|
||||||
|
txHash
|
||||||
|
}
|
||||||
|
`;
|
||||||
export const WithdrawalFieldsFragmentDoc = gql`
|
export const WithdrawalFieldsFragmentDoc = gql`
|
||||||
fragment WithdrawalFields on Withdrawal {
|
fragment WithdrawalFields on Withdrawal {
|
||||||
id
|
id
|
||||||
@ -26,8 +34,15 @@ export const WithdrawalFieldsFragmentDoc = gql`
|
|||||||
amount
|
amount
|
||||||
asset {
|
asset {
|
||||||
id
|
id
|
||||||
|
name
|
||||||
symbol
|
symbol
|
||||||
decimals
|
decimals
|
||||||
|
status
|
||||||
|
source {
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
createdTimestamp
|
createdTimestamp
|
||||||
withdrawnTimestamp
|
withdrawnTimestamp
|
||||||
@ -44,8 +59,12 @@ export const WithdrawalsDocument = gql`
|
|||||||
query Withdrawals($partyId: ID!) {
|
query Withdrawals($partyId: ID!) {
|
||||||
party(id: $partyId) {
|
party(id: $partyId) {
|
||||||
id
|
id
|
||||||
withdrawals {
|
withdrawalsConnection {
|
||||||
...WithdrawalFields
|
edges {
|
||||||
|
node {
|
||||||
|
...WithdrawalFields
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
125
libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts
generated
125
libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts
generated
@ -1,125 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
import { WithdrawalStatus, AssetStatus } from "@vegaprotocol/types";
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL subscription operation: WithdrawalEvent
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface WithdrawalEvent_busEvents_event_TimeUpdate {
|
|
||||||
__typename: "TimeUpdate" | "MarketEvent" | "TransferResponses" | "PositionResolution" | "Order" | "Trade" | "AccountEvent" | "Party" | "MarginLevels" | "Proposal" | "Vote" | "MarketData" | "NodeSignature" | "LossSocialization" | "SettlePosition" | "Market" | "Asset" | "MarketTick" | "SettleDistressed" | "AuctionEvent" | "RiskFactor" | "Deposit" | "OracleSpec" | "LiquidityProvision" | "TransactionResult";
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalEvent_busEvents_event_Withdrawal_asset_source_BuiltinAsset {
|
|
||||||
__typename: "BuiltinAsset";
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalEvent_busEvents_event_Withdrawal_asset_source_ERC20 {
|
|
||||||
__typename: "ERC20";
|
|
||||||
/**
|
|
||||||
* The address of the ERC20 contract
|
|
||||||
*/
|
|
||||||
contractAddress: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type WithdrawalEvent_busEvents_event_Withdrawal_asset_source = WithdrawalEvent_busEvents_event_Withdrawal_asset_source_BuiltinAsset | WithdrawalEvent_busEvents_event_Withdrawal_asset_source_ERC20;
|
|
||||||
|
|
||||||
export interface WithdrawalEvent_busEvents_event_Withdrawal_asset {
|
|
||||||
__typename: "Asset";
|
|
||||||
/**
|
|
||||||
* The ID of the asset
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The full name of the asset (e.g: Great British Pound)
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* The symbol of the asset (e.g: GBP)
|
|
||||||
*/
|
|
||||||
symbol: string;
|
|
||||||
/**
|
|
||||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
|
||||||
*/
|
|
||||||
decimals: number;
|
|
||||||
/**
|
|
||||||
* The status of the asset in the Vega network
|
|
||||||
*/
|
|
||||||
status: AssetStatus;
|
|
||||||
/**
|
|
||||||
* The origin source of the asset (e.g: an ERC20 asset)
|
|
||||||
*/
|
|
||||||
source: WithdrawalEvent_busEvents_event_Withdrawal_asset_source;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalEvent_busEvents_event_Withdrawal_details {
|
|
||||||
__typename: "Erc20WithdrawalDetails";
|
|
||||||
/**
|
|
||||||
* The ethereum address of the receiver of the asset funds
|
|
||||||
*/
|
|
||||||
receiverAddress: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalEvent_busEvents_event_Withdrawal {
|
|
||||||
__typename: "Withdrawal";
|
|
||||||
/**
|
|
||||||
* The Vega internal ID of the withdrawal
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The current status of the withdrawal
|
|
||||||
*/
|
|
||||||
status: WithdrawalStatus;
|
|
||||||
/**
|
|
||||||
* The amount to be withdrawn
|
|
||||||
*/
|
|
||||||
amount: string;
|
|
||||||
/**
|
|
||||||
* The asset to be withdrawn
|
|
||||||
*/
|
|
||||||
asset: WithdrawalEvent_busEvents_event_Withdrawal_asset;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time at which the withdrawal was created
|
|
||||||
*/
|
|
||||||
createdTimestamp: string;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time at which the withdrawal was finalised
|
|
||||||
*/
|
|
||||||
withdrawnTimestamp: string | null;
|
|
||||||
/**
|
|
||||||
* Hash of the transaction on the foreign chain
|
|
||||||
*/
|
|
||||||
txHash: string | null;
|
|
||||||
/**
|
|
||||||
* Foreign chain specific details about the withdrawal
|
|
||||||
*/
|
|
||||||
details: WithdrawalEvent_busEvents_event_Withdrawal_details | null;
|
|
||||||
/**
|
|
||||||
* Whether or the not the withdrawal is being processed on Ethereum
|
|
||||||
*/
|
|
||||||
pendingOnForeignChain: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type WithdrawalEvent_busEvents_event = WithdrawalEvent_busEvents_event_TimeUpdate | WithdrawalEvent_busEvents_event_Withdrawal;
|
|
||||||
|
|
||||||
export interface WithdrawalEvent_busEvents {
|
|
||||||
__typename: "BusEvent";
|
|
||||||
/**
|
|
||||||
* The payload - the wrapped event
|
|
||||||
*/
|
|
||||||
event: WithdrawalEvent_busEvents_event;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalEvent {
|
|
||||||
/**
|
|
||||||
* Subscribe to event data from the event bus
|
|
||||||
*/
|
|
||||||
busEvents: WithdrawalEvent_busEvents[] | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalEventVariables {
|
|
||||||
partyId: string;
|
|
||||||
}
|
|
100
libs/withdraws/src/lib/__generated__/WithdrawalFields.ts
generated
100
libs/withdraws/src/lib/__generated__/WithdrawalFields.ts
generated
@ -1,100 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
import { WithdrawalStatus, AssetStatus } from "@vegaprotocol/types";
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL fragment: WithdrawalFields
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface WithdrawalFields_asset_source_BuiltinAsset {
|
|
||||||
__typename: "BuiltinAsset";
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalFields_asset_source_ERC20 {
|
|
||||||
__typename: "ERC20";
|
|
||||||
/**
|
|
||||||
* The address of the ERC20 contract
|
|
||||||
*/
|
|
||||||
contractAddress: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type WithdrawalFields_asset_source = WithdrawalFields_asset_source_BuiltinAsset | WithdrawalFields_asset_source_ERC20;
|
|
||||||
|
|
||||||
export interface WithdrawalFields_asset {
|
|
||||||
__typename: "Asset";
|
|
||||||
/**
|
|
||||||
* The ID of the asset
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The full name of the asset (e.g: Great British Pound)
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* The symbol of the asset (e.g: GBP)
|
|
||||||
*/
|
|
||||||
symbol: string;
|
|
||||||
/**
|
|
||||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
|
||||||
*/
|
|
||||||
decimals: number;
|
|
||||||
/**
|
|
||||||
* The status of the asset in the Vega network
|
|
||||||
*/
|
|
||||||
status: AssetStatus;
|
|
||||||
/**
|
|
||||||
* The origin source of the asset (e.g: an ERC20 asset)
|
|
||||||
*/
|
|
||||||
source: WithdrawalFields_asset_source;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalFields_details {
|
|
||||||
__typename: "Erc20WithdrawalDetails";
|
|
||||||
/**
|
|
||||||
* The ethereum address of the receiver of the asset funds
|
|
||||||
*/
|
|
||||||
receiverAddress: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalFields {
|
|
||||||
__typename: "Withdrawal";
|
|
||||||
/**
|
|
||||||
* The Vega internal ID of the withdrawal
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The current status of the withdrawal
|
|
||||||
*/
|
|
||||||
status: WithdrawalStatus;
|
|
||||||
/**
|
|
||||||
* The amount to be withdrawn
|
|
||||||
*/
|
|
||||||
amount: string;
|
|
||||||
/**
|
|
||||||
* The asset to be withdrawn
|
|
||||||
*/
|
|
||||||
asset: WithdrawalFields_asset;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time at which the withdrawal was created
|
|
||||||
*/
|
|
||||||
createdTimestamp: string;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time at which the withdrawal was finalised
|
|
||||||
*/
|
|
||||||
withdrawnTimestamp: string | null;
|
|
||||||
/**
|
|
||||||
* Hash of the transaction on the foreign chain
|
|
||||||
*/
|
|
||||||
txHash: string | null;
|
|
||||||
/**
|
|
||||||
* Foreign chain specific details about the withdrawal
|
|
||||||
*/
|
|
||||||
details: WithdrawalFields_details | null;
|
|
||||||
/**
|
|
||||||
* Whether or the not the withdrawal is being processed on Ethereum
|
|
||||||
*/
|
|
||||||
pendingOnForeignChain: boolean;
|
|
||||||
}
|
|
139
libs/withdraws/src/lib/__generated__/Withdrawals.ts
generated
139
libs/withdraws/src/lib/__generated__/Withdrawals.ts
generated
@ -1,139 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
import { WithdrawalStatus, AssetStatus } from "@vegaprotocol/types";
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL query operation: Withdrawals
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface Withdrawals_party_withdrawalsConnection_edges_node_asset_source_BuiltinAsset {
|
|
||||||
__typename: "BuiltinAsset";
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Withdrawals_party_withdrawalsConnection_edges_node_asset_source_ERC20 {
|
|
||||||
__typename: "ERC20";
|
|
||||||
/**
|
|
||||||
* The address of the ERC20 contract
|
|
||||||
*/
|
|
||||||
contractAddress: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Withdrawals_party_withdrawalsConnection_edges_node_asset_source = Withdrawals_party_withdrawalsConnection_edges_node_asset_source_BuiltinAsset | Withdrawals_party_withdrawalsConnection_edges_node_asset_source_ERC20;
|
|
||||||
|
|
||||||
export interface Withdrawals_party_withdrawalsConnection_edges_node_asset {
|
|
||||||
__typename: "Asset";
|
|
||||||
/**
|
|
||||||
* The ID of the asset
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The full name of the asset (e.g: Great British Pound)
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* The symbol of the asset (e.g: GBP)
|
|
||||||
*/
|
|
||||||
symbol: string;
|
|
||||||
/**
|
|
||||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
|
||||||
*/
|
|
||||||
decimals: number;
|
|
||||||
/**
|
|
||||||
* The status of the asset in the Vega network
|
|
||||||
*/
|
|
||||||
status: AssetStatus;
|
|
||||||
/**
|
|
||||||
* The origin source of the asset (e.g: an ERC20 asset)
|
|
||||||
*/
|
|
||||||
source: Withdrawals_party_withdrawalsConnection_edges_node_asset_source;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Withdrawals_party_withdrawalsConnection_edges_node_details {
|
|
||||||
__typename: "Erc20WithdrawalDetails";
|
|
||||||
/**
|
|
||||||
* The ethereum address of the receiver of the asset funds
|
|
||||||
*/
|
|
||||||
receiverAddress: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Withdrawals_party_withdrawalsConnection_edges_node {
|
|
||||||
__typename: "Withdrawal";
|
|
||||||
/**
|
|
||||||
* The Vega internal ID of the withdrawal
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The current status of the withdrawal
|
|
||||||
*/
|
|
||||||
status: WithdrawalStatus;
|
|
||||||
/**
|
|
||||||
* The amount to be withdrawn
|
|
||||||
*/
|
|
||||||
amount: string;
|
|
||||||
/**
|
|
||||||
* The asset to be withdrawn
|
|
||||||
*/
|
|
||||||
asset: Withdrawals_party_withdrawalsConnection_edges_node_asset;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time at which the withdrawal was created
|
|
||||||
*/
|
|
||||||
createdTimestamp: string;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time at which the withdrawal was finalised
|
|
||||||
*/
|
|
||||||
withdrawnTimestamp: string | null;
|
|
||||||
/**
|
|
||||||
* Hash of the transaction on the foreign chain
|
|
||||||
*/
|
|
||||||
txHash: string | null;
|
|
||||||
/**
|
|
||||||
* Foreign chain specific details about the withdrawal
|
|
||||||
*/
|
|
||||||
details: Withdrawals_party_withdrawalsConnection_edges_node_details | null;
|
|
||||||
/**
|
|
||||||
* Whether or the not the withdrawal is being processed on Ethereum
|
|
||||||
*/
|
|
||||||
pendingOnForeignChain: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Withdrawals_party_withdrawalsConnection_edges {
|
|
||||||
__typename: "WithdrawalEdge";
|
|
||||||
/**
|
|
||||||
* The withdrawal
|
|
||||||
*/
|
|
||||||
node: Withdrawals_party_withdrawalsConnection_edges_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Withdrawals_party_withdrawalsConnection {
|
|
||||||
__typename: "WithdrawalsConnection";
|
|
||||||
/**
|
|
||||||
* The withdrawals
|
|
||||||
*/
|
|
||||||
edges: (Withdrawals_party_withdrawalsConnection_edges | null)[] | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Withdrawals_party {
|
|
||||||
__typename: "Party";
|
|
||||||
/**
|
|
||||||
* Party identifier
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The list of all withdrawals initiated by the party
|
|
||||||
*/
|
|
||||||
withdrawalsConnection: Withdrawals_party_withdrawalsConnection | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Withdrawals {
|
|
||||||
/**
|
|
||||||
* An entity that is trading on the Vega network
|
|
||||||
*/
|
|
||||||
party: Withdrawals_party | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WithdrawalsVariables {
|
|
||||||
partyId: string;
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
|
||||||
|
|
||||||
import { gql } from '@apollo/client';
|
|
||||||
import * as Apollo from '@apollo/client';
|
|
||||||
const defaultOptions = {} as const;
|
|
||||||
export type Erc20ApprovalQueryVariables = Types.Exact<{
|
|
||||||
withdrawalId: Types.Scalars['ID'];
|
|
||||||
}>;
|
|
||||||
|
|
||||||
|
|
||||||
export type Erc20ApprovalQuery = { __typename?: 'Query', erc20WithdrawalApproval?: { __typename?: 'Erc20WithdrawalApproval', assetSource: string, amount: string, nonce: string, signatures: string, targetAddress: string, expiry: string, creation: string } | null };
|
|
||||||
|
|
||||||
|
|
||||||
export const Erc20ApprovalDocument = gql`
|
|
||||||
query Erc20Approval($withdrawalId: ID!) {
|
|
||||||
erc20WithdrawalApproval(withdrawalId: $withdrawalId) {
|
|
||||||
assetSource
|
|
||||||
amount
|
|
||||||
nonce
|
|
||||||
signatures
|
|
||||||
targetAddress
|
|
||||||
expiry
|
|
||||||
creation
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* __useErc20ApprovalQuery__
|
|
||||||
*
|
|
||||||
* To run a query within a React component, call `useErc20ApprovalQuery` and pass it any options that fit your needs.
|
|
||||||
* When your component renders, `useErc20ApprovalQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
||||||
* you can use to render your UI.
|
|
||||||
*
|
|
||||||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const { data, loading, error } = useErc20ApprovalQuery({
|
|
||||||
* variables: {
|
|
||||||
* withdrawalId: // value for 'withdrawalId'
|
|
||||||
* },
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
export function useErc20ApprovalQuery(baseOptions: Apollo.QueryHookOptions<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useQuery<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>(Erc20ApprovalDocument, options);
|
|
||||||
}
|
|
||||||
export function useErc20ApprovalLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useLazyQuery<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>(Erc20ApprovalDocument, options);
|
|
||||||
}
|
|
||||||
export type Erc20ApprovalQueryHookResult = ReturnType<typeof useErc20ApprovalQuery>;
|
|
||||||
export type Erc20ApprovalLazyQueryHookResult = ReturnType<typeof useErc20ApprovalLazyQuery>;
|
|
||||||
export type Erc20ApprovalQueryResult = Apollo.QueryResult<Erc20ApprovalQuery, Erc20ApprovalQueryVariables>;
|
|
@ -1,75 +0,0 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
|
||||||
|
|
||||||
import { gql } from '@apollo/client';
|
|
||||||
import * as Apollo from '@apollo/client';
|
|
||||||
const defaultOptions = {} as const;
|
|
||||||
export type WithdrawPageQueryQueryVariables = Types.Exact<{
|
|
||||||
partyId: Types.Scalars['ID'];
|
|
||||||
}>;
|
|
||||||
|
|
||||||
|
|
||||||
export type WithdrawPageQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, withdrawals?: Array<{ __typename?: 'Withdrawal', id: string, txHash?: string | null }> | null, accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string } }> | null } | null, assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } | null };
|
|
||||||
|
|
||||||
|
|
||||||
export const WithdrawPageQueryDocument = gql`
|
|
||||||
query WithdrawPageQuery($partyId: ID!) {
|
|
||||||
party(id: $partyId) {
|
|
||||||
id
|
|
||||||
withdrawals {
|
|
||||||
id
|
|
||||||
txHash
|
|
||||||
}
|
|
||||||
accounts {
|
|
||||||
type
|
|
||||||
balance
|
|
||||||
asset {
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assetsConnection {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
name
|
|
||||||
decimals
|
|
||||||
source {
|
|
||||||
... on ERC20 {
|
|
||||||
contractAddress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* __useWithdrawPageQueryQuery__
|
|
||||||
*
|
|
||||||
* To run a query within a React component, call `useWithdrawPageQueryQuery` and pass it any options that fit your needs.
|
|
||||||
* When your component renders, `useWithdrawPageQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
||||||
* you can use to render your UI.
|
|
||||||
*
|
|
||||||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const { data, loading, error } = useWithdrawPageQueryQuery({
|
|
||||||
* variables: {
|
|
||||||
* partyId: // value for 'partyId'
|
|
||||||
* },
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
export function useWithdrawPageQueryQuery(baseOptions: Apollo.QueryHookOptions<WithdrawPageQueryQuery, WithdrawPageQueryQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useQuery<WithdrawPageQueryQuery, WithdrawPageQueryQueryVariables>(WithdrawPageQueryDocument, options);
|
|
||||||
}
|
|
||||||
export function useWithdrawPageQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<WithdrawPageQueryQuery, WithdrawPageQueryQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useLazyQuery<WithdrawPageQueryQuery, WithdrawPageQueryQueryVariables>(WithdrawPageQueryDocument, options);
|
|
||||||
}
|
|
||||||
export type WithdrawPageQueryQueryHookResult = ReturnType<typeof useWithdrawPageQueryQuery>;
|
|
||||||
export type WithdrawPageQueryLazyQueryHookResult = ReturnType<typeof useWithdrawPageQueryLazyQuery>;
|
|
||||||
export type WithdrawPageQueryQueryResult = Apollo.QueryResult<WithdrawPageQueryQuery, WithdrawPageQueryQueryVariables>;
|
|
@ -5,13 +5,13 @@ import { CompleteCell } from './pending-withdrawals-table';
|
|||||||
import { PendingWithdrawalsTable } from './pending-withdrawals-table';
|
import { PendingWithdrawalsTable } from './pending-withdrawals-table';
|
||||||
import { getTimeFormat } from '@vegaprotocol/react-helpers';
|
import { getTimeFormat } from '@vegaprotocol/react-helpers';
|
||||||
import type { TypedDataAgGrid } from '@vegaprotocol/ui-toolkit';
|
import type { TypedDataAgGrid } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { WithdrawalFields } from './__generated__/WithdrawalFields';
|
import type { WithdrawalFieldsFragment } from './__generated__/Withdrawal';
|
||||||
|
|
||||||
jest.mock('@web3-react/core', () => ({
|
jest.mock('@web3-react/core', () => ({
|
||||||
useWeb3React: () => ({ provider: undefined }),
|
useWeb3React: () => ({ provider: undefined }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const generateTable = (props: TypedDataAgGrid<WithdrawalFields>) => (
|
const generateTable = (props: TypedDataAgGrid<WithdrawalFieldsFragment>) => (
|
||||||
<MockedProvider>
|
<MockedProvider>
|
||||||
<PendingWithdrawalsTable {...props} />
|
<PendingWithdrawalsTable {...props} />
|
||||||
</MockedProvider>
|
</MockedProvider>
|
||||||
|
@ -22,12 +22,12 @@ import {
|
|||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/environment';
|
import { useEnvironment } from '@vegaprotocol/environment';
|
||||||
import { useCompleteWithdraw } from './use-complete-withdraw';
|
import { useCompleteWithdraw } from './use-complete-withdraw';
|
||||||
import type { WithdrawalFields } from './__generated__/WithdrawalFields';
|
import type { WithdrawalFieldsFragment } from './__generated__/Withdrawal';
|
||||||
import type { VerifyState } from './use-verify-withdrawal';
|
import type { VerifyState } from './use-verify-withdrawal';
|
||||||
import { ApprovalStatus, useVerifyWithdrawal } from './use-verify-withdrawal';
|
import { ApprovalStatus, useVerifyWithdrawal } from './use-verify-withdrawal';
|
||||||
|
|
||||||
export const PendingWithdrawalsTable = (
|
export const PendingWithdrawalsTable = (
|
||||||
props: TypedDataAgGrid<WithdrawalFields>
|
props: TypedDataAgGrid<WithdrawalFieldsFragment>
|
||||||
) => {
|
) => {
|
||||||
const { ETHERSCAN_URL } = useEnvironment();
|
const { ETHERSCAN_URL } = useEnvironment();
|
||||||
const {
|
const {
|
||||||
@ -60,7 +60,7 @@ export const PendingWithdrawalsTable = (
|
|||||||
valueFormatter={({
|
valueFormatter={({
|
||||||
value,
|
value,
|
||||||
data,
|
data,
|
||||||
}: VegaValueFormatterParams<WithdrawalFields, 'amount'>) => {
|
}: VegaValueFormatterParams<WithdrawalFieldsFragment, 'amount'>) => {
|
||||||
return isNumeric(value) && data?.asset
|
return isNumeric(value) && data?.asset
|
||||||
? addDecimalsFormatNumber(value, data.asset.decimals)
|
? addDecimalsFormatNumber(value, data.asset.decimals)
|
||||||
: null;
|
: null;
|
||||||
@ -74,7 +74,7 @@ export const PendingWithdrawalsTable = (
|
|||||||
value,
|
value,
|
||||||
valueFormatted,
|
valueFormatted,
|
||||||
}: VegaICellRendererParams<
|
}: VegaICellRendererParams<
|
||||||
WithdrawalFields,
|
WithdrawalFieldsFragment,
|
||||||
'details.receiverAddress'
|
'details.receiverAddress'
|
||||||
> & {
|
> & {
|
||||||
ethUrl: string;
|
ethUrl: string;
|
||||||
@ -92,7 +92,7 @@ export const PendingWithdrawalsTable = (
|
|||||||
valueFormatter={({
|
valueFormatter={({
|
||||||
value,
|
value,
|
||||||
}: VegaValueFormatterParams<
|
}: VegaValueFormatterParams<
|
||||||
WithdrawalFields,
|
WithdrawalFieldsFragment,
|
||||||
'details.receiverAddress'
|
'details.receiverAddress'
|
||||||
>) => {
|
>) => {
|
||||||
if (!value) return '-';
|
if (!value) return '-';
|
||||||
@ -105,7 +105,7 @@ export const PendingWithdrawalsTable = (
|
|||||||
valueFormatter={({
|
valueFormatter={({
|
||||||
value,
|
value,
|
||||||
}: VegaValueFormatterParams<
|
}: VegaValueFormatterParams<
|
||||||
WithdrawalFields,
|
WithdrawalFieldsFragment,
|
||||||
'createdTimestamp'
|
'createdTimestamp'
|
||||||
>) => {
|
>) => {
|
||||||
return value ? getDateTimeFormat().format(new Date(value)) : '';
|
return value ? getDateTimeFormat().format(new Date(value)) : '';
|
||||||
@ -116,7 +116,7 @@ export const PendingWithdrawalsTable = (
|
|||||||
field="status"
|
field="status"
|
||||||
flex={2}
|
flex={2}
|
||||||
cellRendererParams={{
|
cellRendererParams={{
|
||||||
complete: async (withdrawal: WithdrawalFields) => {
|
complete: async (withdrawal: WithdrawalFieldsFragment) => {
|
||||||
const verified = await verify(withdrawal);
|
const verified = await verify(withdrawal);
|
||||||
|
|
||||||
if (!verified) {
|
if (!verified) {
|
||||||
@ -149,8 +149,8 @@ export const PendingWithdrawalsTable = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type CompleteCellProps = {
|
export type CompleteCellProps = {
|
||||||
data: WithdrawalFields;
|
data: WithdrawalFieldsFragment;
|
||||||
complete: (withdrawal: WithdrawalFields) => void;
|
complete: (withdrawal: WithdrawalFieldsFragment) => void;
|
||||||
};
|
};
|
||||||
export const CompleteCell = ({ data, complete }: CompleteCellProps) => (
|
export const CompleteCell = ({ data, complete }: CompleteCellProps) => (
|
||||||
<Button
|
<Button
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
|
|
||||||
export const ERC20_APPROVAL_QUERY = gql`
|
|
||||||
query Erc20Approval($withdrawalId: ID!) {
|
|
||||||
erc20WithdrawalApproval(withdrawalId: $withdrawalId) {
|
|
||||||
assetSource
|
|
||||||
amount
|
|
||||||
nonce
|
|
||||||
signatures
|
|
||||||
targetAddress
|
|
||||||
expiry
|
|
||||||
creation
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
@ -1,13 +1,9 @@
|
|||||||
import type { Asset } from '@vegaprotocol/assets';
|
import type { Asset } from '@vegaprotocol/assets';
|
||||||
import {
|
import { Schema } from '@vegaprotocol/types';
|
||||||
AccountType,
|
|
||||||
AssetStatus,
|
|
||||||
WithdrawalStatus,
|
|
||||||
} from '@vegaprotocol/types';
|
|
||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import type { PartialDeep } from 'type-fest';
|
import type { PartialDeep } from 'type-fest';
|
||||||
import type { AccountFieldsFragment } from '@vegaprotocol/accounts';
|
import type { AccountFieldsFragment } from '@vegaprotocol/accounts';
|
||||||
import type { Withdrawals_party_withdrawalsConnection_edges_node } from './__generated__/Withdrawals';
|
import type { WithdrawalFieldsFragment } from './__generated__/Withdrawal';
|
||||||
|
|
||||||
export const generateAsset = (override?: PartialDeep<Asset>) => {
|
export const generateAsset = (override?: PartialDeep<Asset>) => {
|
||||||
const defaultAsset: Asset = {
|
const defaultAsset: Asset = {
|
||||||
@ -16,7 +12,7 @@ export const generateAsset = (override?: PartialDeep<Asset>) => {
|
|||||||
name: 'asset-name',
|
name: 'asset-name',
|
||||||
quantum: '',
|
quantum: '',
|
||||||
decimals: 5,
|
decimals: 5,
|
||||||
status: AssetStatus.STATUS_ENABLED,
|
status: Schema.AssetStatus.STATUS_ENABLED,
|
||||||
source: {
|
source: {
|
||||||
contractAddress: 'contract-address',
|
contractAddress: 'contract-address',
|
||||||
lifetimeLimit: '123000000',
|
lifetimeLimit: '123000000',
|
||||||
@ -56,7 +52,7 @@ export const generateAccount = (
|
|||||||
override?: PartialDeep<AccountFieldsFragment>
|
override?: PartialDeep<AccountFieldsFragment>
|
||||||
) => {
|
) => {
|
||||||
const defaultAccount: AccountFieldsFragment = {
|
const defaultAccount: AccountFieldsFragment = {
|
||||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
type: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
|
||||||
balance: '100000',
|
balance: '100000',
|
||||||
asset: {
|
asset: {
|
||||||
id: 'asset-id',
|
id: 'asset-id',
|
||||||
@ -66,13 +62,13 @@ export const generateAccount = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const generateWithdrawal = (
|
export const generateWithdrawal = (
|
||||||
override?: PartialDeep<Withdrawals_party_withdrawalsConnection_edges_node>
|
override?: PartialDeep<WithdrawalFieldsFragment>
|
||||||
): Withdrawals_party_withdrawalsConnection_edges_node => {
|
): WithdrawalFieldsFragment => {
|
||||||
return merge(
|
return merge(
|
||||||
{
|
{
|
||||||
__typename: 'Withdrawal',
|
__typename: 'Withdrawal',
|
||||||
id: 'withdrawal-id',
|
id: 'withdrawal-id',
|
||||||
status: WithdrawalStatus.STATUS_OPEN,
|
status: Schema.WithdrawalStatus.STATUS_OPEN,
|
||||||
amount: '100',
|
amount: '100',
|
||||||
asset: {
|
asset: {
|
||||||
__typename: 'Asset',
|
__typename: 'Asset',
|
||||||
@ -80,7 +76,7 @@ export const generateWithdrawal = (
|
|||||||
id: 'asset-id',
|
id: 'asset-id',
|
||||||
symbol: 'asset-symbol',
|
symbol: 'asset-symbol',
|
||||||
decimals: 2,
|
decimals: 2,
|
||||||
status: AssetStatus.STATUS_ENABLED,
|
status: Schema.AssetStatus.STATUS_ENABLED,
|
||||||
source: {
|
source: {
|
||||||
__typename: 'ERC20',
|
__typename: 'ERC20',
|
||||||
contractAddress: '0x123',
|
contractAddress: '0x123',
|
||||||
|
@ -4,11 +4,10 @@ import type { MockedResponse } from '@apollo/client/testing';
|
|||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { useCompleteWithdraw } from './use-complete-withdraw';
|
import { useCompleteWithdraw } from './use-complete-withdraw';
|
||||||
import type { Erc20Approval } from './__generated__/Erc20Approval';
|
import type { Erc20ApprovalQuery } from './__generated__/Erc20Approval';
|
||||||
import { ERC20_APPROVAL_QUERY } from './queries';
|
import { Erc20ApprovalDocument } from './__generated__/Erc20Approval';
|
||||||
import * as web3 from '@vegaprotocol/web3';
|
import * as web3 from '@vegaprotocol/web3';
|
||||||
import * as sentry from '@sentry/react';
|
import * as sentry from '@sentry/react';
|
||||||
import type { Erc20Approval_erc20WithdrawalApproval } from './__generated__/Erc20Approval';
|
|
||||||
|
|
||||||
jest.mock('@vegaprotocol/web3', () => {
|
jest.mock('@vegaprotocol/web3', () => {
|
||||||
const orig = jest.requireActual('@vegaprotocol/web3');
|
const orig = jest.requireActual('@vegaprotocol/web3');
|
||||||
@ -31,8 +30,7 @@ function setup(mocks?: MockedResponse[]) {
|
|||||||
|
|
||||||
it('Should perform the Ethereum transaction with the fetched approval', async () => {
|
it('Should perform the Ethereum transaction with the fetched approval', async () => {
|
||||||
const withdrawalId = 'withdrawal-id';
|
const withdrawalId = 'withdrawal-id';
|
||||||
const erc20WithdrawalApproval: Erc20Approval_erc20WithdrawalApproval = {
|
const erc20WithdrawalApproval = {
|
||||||
__typename: 'Erc20WithdrawalApproval',
|
|
||||||
assetSource: 'asset-source',
|
assetSource: 'asset-source',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
nonce: '1',
|
nonce: '1',
|
||||||
@ -41,9 +39,9 @@ it('Should perform the Ethereum transaction with the fetched approval', async ()
|
|||||||
targetAddress: 'target-address',
|
targetAddress: 'target-address',
|
||||||
expiry: 'expiry',
|
expiry: 'expiry',
|
||||||
};
|
};
|
||||||
const mockERC20Approval: MockedResponse<Erc20Approval> = {
|
const mockERC20Approval: MockedResponse<Erc20ApprovalQuery> = {
|
||||||
request: {
|
request: {
|
||||||
query: ERC20_APPROVAL_QUERY,
|
query: Erc20ApprovalDocument,
|
||||||
variables: { withdrawalId },
|
variables: { withdrawalId },
|
||||||
},
|
},
|
||||||
result: {
|
result: {
|
||||||
@ -77,9 +75,9 @@ it('Should perform the Ethereum transaction with the fetched approval', async ()
|
|||||||
|
|
||||||
it('Captures an error if the erc20Withdrawal is not found', async () => {
|
it('Captures an error if the erc20Withdrawal is not found', async () => {
|
||||||
const withdrawalId = 'withdrawal-id';
|
const withdrawalId = 'withdrawal-id';
|
||||||
const mockERC20Approval: MockedResponse<Erc20Approval> = {
|
const mockERC20Approval: MockedResponse<Erc20ApprovalQuery> = {
|
||||||
request: {
|
request: {
|
||||||
query: ERC20_APPROVAL_QUERY,
|
query: Erc20ApprovalDocument,
|
||||||
variables: { withdrawalId },
|
variables: { withdrawalId },
|
||||||
},
|
},
|
||||||
result: {
|
result: {
|
||||||
@ -108,9 +106,9 @@ it('Captures an error if the erc20Withdrawal is not found', async () => {
|
|||||||
|
|
||||||
it('Captures an error if erc20 approval query fails', async () => {
|
it('Captures an error if erc20 approval query fails', async () => {
|
||||||
const withdrawalId = 'withdrawal-id';
|
const withdrawalId = 'withdrawal-id';
|
||||||
const mockERC20Approval: MockedResponse<Erc20Approval> = {
|
const mockERC20Approval: MockedResponse<Erc20ApprovalQuery> = {
|
||||||
request: {
|
request: {
|
||||||
query: ERC20_APPROVAL_QUERY,
|
query: Erc20ApprovalDocument,
|
||||||
variables: { withdrawalId },
|
variables: { withdrawalId },
|
||||||
},
|
},
|
||||||
error: new Error('query failed'),
|
error: new Error('query failed'),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { gql, useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import { captureException } from '@sentry/react';
|
import { captureException } from '@sentry/react';
|
||||||
import type { CollateralBridge } from '@vegaprotocol/smart-contracts';
|
import type { CollateralBridge } from '@vegaprotocol/smart-contracts';
|
||||||
import {
|
import {
|
||||||
@ -7,19 +7,13 @@ import {
|
|||||||
useEthereumTransaction,
|
useEthereumTransaction,
|
||||||
} from '@vegaprotocol/web3';
|
} from '@vegaprotocol/web3';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { ERC20_APPROVAL_QUERY } from './queries';
|
import { Erc20ApprovalDocument } from './__generated__/Erc20Approval';
|
||||||
import type {
|
import type {
|
||||||
Erc20Approval,
|
Erc20ApprovalQuery,
|
||||||
Erc20ApprovalVariables,
|
Erc20ApprovalQueryVariables,
|
||||||
} from './__generated__/Erc20Approval';
|
} from './__generated__/Erc20Approval';
|
||||||
import type { PendingWithdrawal } from './__generated__/PendingWithdrawal';
|
import { PendingWithdrawalFragmentDoc } from './__generated__/Withdrawal';
|
||||||
|
import type { PendingWithdrawalFragment } from './__generated__/Withdrawal';
|
||||||
export const PENDING_WITHDRAWAL_FRAGMMENT = gql`
|
|
||||||
fragment PendingWithdrawal on Withdrawal {
|
|
||||||
pendingOnForeignChain @client
|
|
||||||
txHash
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const useCompleteWithdraw = () => {
|
export const useCompleteWithdraw = () => {
|
||||||
const { query, cache } = useApolloClient();
|
const { query, cache } = useApolloClient();
|
||||||
@ -38,8 +32,11 @@ export const useCompleteWithdraw = () => {
|
|||||||
if (!contract) {
|
if (!contract) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const res = await query<Erc20Approval, Erc20ApprovalVariables>({
|
const res = await query<
|
||||||
query: ERC20_APPROVAL_QUERY,
|
Erc20ApprovalQuery,
|
||||||
|
Erc20ApprovalQueryVariables
|
||||||
|
>({
|
||||||
|
query: Erc20ApprovalDocument,
|
||||||
variables: { withdrawalId },
|
variables: { withdrawalId },
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -66,9 +63,9 @@ export const useCompleteWithdraw = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (id && transaction.txHash) {
|
if (id && transaction.txHash) {
|
||||||
cache.writeFragment<PendingWithdrawal>({
|
cache.writeFragment<PendingWithdrawalFragment>({
|
||||||
id: `Withdrawal:${id}`,
|
id: `Withdrawal:${id}`,
|
||||||
fragment: PENDING_WITHDRAWAL_FRAGMMENT,
|
fragment: PendingWithdrawalFragmentDoc,
|
||||||
data: {
|
data: {
|
||||||
__typename: 'Withdrawal',
|
__typename: 'Withdrawal',
|
||||||
pendingOnForeignChain:
|
pendingOnForeignChain:
|
||||||
|
@ -2,10 +2,10 @@ import { act, renderHook } from '@testing-library/react';
|
|||||||
import type { MockedResponse } from '@apollo/client/testing';
|
import type { MockedResponse } from '@apollo/client/testing';
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { ERC20_APPROVAL_QUERY } from './queries';
|
|
||||||
import type { WithdrawalArgs } from './use-create-withdraw';
|
import type { WithdrawalArgs } from './use-create-withdraw';
|
||||||
import { useCreateWithdraw } from './use-create-withdraw';
|
import { useCreateWithdraw } from './use-create-withdraw';
|
||||||
import type { Erc20Approval } from './__generated__/Erc20Approval';
|
import { Erc20ApprovalDocument } from './__generated__/Erc20Approval';
|
||||||
|
import type { Erc20ApprovalQuery } from './__generated__/Erc20Approval';
|
||||||
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
||||||
import {
|
import {
|
||||||
initialState,
|
initialState,
|
||||||
@ -15,11 +15,10 @@ import {
|
|||||||
} from '@vegaprotocol/wallet';
|
} from '@vegaprotocol/wallet';
|
||||||
import { waitFor } from '@testing-library/react';
|
import { waitFor } from '@testing-library/react';
|
||||||
import type {
|
import type {
|
||||||
WithdrawalEvent,
|
WithdrawalEventSubscription,
|
||||||
WithdrawalEvent_busEvents_event_Withdrawal,
|
WithdrawalFieldsFragment,
|
||||||
} from './__generated__/WithdrawalEvent';
|
} from './__generated__/Withdrawal';
|
||||||
import { WITHDRAWAL_BUS_EVENT_SUB } from './use-withdrawals';
|
import { WithdrawalsDocument } from './__generated__/Withdrawal';
|
||||||
import { WithdrawalStatus } from '@vegaprotocol/types';
|
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import { Schema } from '@vegaprotocol/types';
|
||||||
|
|
||||||
function setup(
|
function setup(
|
||||||
@ -54,9 +53,9 @@ afterAll(() => {
|
|||||||
const pubKey = '0x123';
|
const pubKey = '0x123';
|
||||||
let mockSend: jest.Mock;
|
let mockSend: jest.Mock;
|
||||||
let withdrawalInput: WithdrawalArgs;
|
let withdrawalInput: WithdrawalArgs;
|
||||||
let withdrawalEvent: WithdrawalEvent_busEvents_event_Withdrawal;
|
let withdrawalEvent: WithdrawalFieldsFragment;
|
||||||
let mockERC20Approval: MockedResponse<Erc20Approval>;
|
let mockERC20Approval: MockedResponse<Erc20ApprovalQuery>;
|
||||||
let mockWithdrawalEvent: MockedResponse<WithdrawalEvent>;
|
let mockWithdrawalEvent: MockedResponse<WithdrawalEventSubscription>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockSend = jest
|
mockSend = jest
|
||||||
@ -64,7 +63,7 @@ beforeEach(() => {
|
|||||||
.mockReturnValue(Promise.resolve({ transactionHash: txHash, signature }));
|
.mockReturnValue(Promise.resolve({ transactionHash: txHash, signature }));
|
||||||
withdrawalEvent = {
|
withdrawalEvent = {
|
||||||
id: '2fca514cebf9f465ae31ecb4c5721e3a6f5f260425ded887ca50ba15b81a5d50',
|
id: '2fca514cebf9f465ae31ecb4c5721e3a6f5f260425ded887ca50ba15b81a5d50',
|
||||||
status: WithdrawalStatus.STATUS_OPEN,
|
status: Schema.WithdrawalStatus.STATUS_OPEN,
|
||||||
amount: '100',
|
amount: '100',
|
||||||
asset: {
|
asset: {
|
||||||
__typename: 'Asset',
|
__typename: 'Asset',
|
||||||
@ -96,7 +95,7 @@ beforeEach(() => {
|
|||||||
};
|
};
|
||||||
mockERC20Approval = {
|
mockERC20Approval = {
|
||||||
request: {
|
request: {
|
||||||
query: ERC20_APPROVAL_QUERY,
|
query: Erc20ApprovalDocument,
|
||||||
variables: { withdrawalId: derivedWithdrawalId },
|
variables: { withdrawalId: derivedWithdrawalId },
|
||||||
},
|
},
|
||||||
result: {
|
result: {
|
||||||
@ -117,7 +116,7 @@ beforeEach(() => {
|
|||||||
};
|
};
|
||||||
mockWithdrawalEvent = {
|
mockWithdrawalEvent = {
|
||||||
request: {
|
request: {
|
||||||
query: WITHDRAWAL_BUS_EVENT_SUB,
|
query: WithdrawalsDocument,
|
||||||
variables: { partyId: pubKey },
|
variables: { partyId: pubKey },
|
||||||
},
|
},
|
||||||
result: {
|
result: {
|
||||||
|
@ -6,8 +6,8 @@ import {
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useWithdrawalApproval } from './use-withdrawal-approval';
|
import { useWithdrawalApproval } from './use-withdrawal-approval';
|
||||||
import { useWithdrawalEvent } from './use-withdrawal-event';
|
import { useWithdrawalEvent } from './use-withdrawal-event';
|
||||||
import type { Erc20Approval_erc20WithdrawalApproval } from './__generated__/Erc20Approval';
|
import type { Erc20ApprovalQuery } from './__generated__/Erc20Approval';
|
||||||
import type { WithdrawalFields } from './__generated__/WithdrawalFields';
|
import type { WithdrawalFieldsFragment } from './__generated__/Withdrawal';
|
||||||
|
|
||||||
export interface WithdrawalArgs {
|
export interface WithdrawalArgs {
|
||||||
amount: string;
|
amount: string;
|
||||||
@ -18,9 +18,12 @@ export interface WithdrawalArgs {
|
|||||||
|
|
||||||
export const useCreateWithdraw = () => {
|
export const useCreateWithdraw = () => {
|
||||||
const waitForWithdrawalApproval = useWithdrawalApproval();
|
const waitForWithdrawalApproval = useWithdrawalApproval();
|
||||||
const [approval, setApproval] =
|
const [approval, setApproval] = useState<
|
||||||
useState<Erc20Approval_erc20WithdrawalApproval | null>(null);
|
Erc20ApprovalQuery['erc20WithdrawalApproval'] | null
|
||||||
const [withdrawal, setWithdrawal] = useState<WithdrawalFields | null>(null);
|
>(null);
|
||||||
|
const [withdrawal, setWithdrawal] = useState<WithdrawalFieldsFragment | null>(
|
||||||
|
null
|
||||||
|
);
|
||||||
const [availableTimestamp, setAvailableTimestamp] = useState<number | null>(
|
const [availableTimestamp, setAvailableTimestamp] = useState<number | null>(
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { useBridgeContract } from '@vegaprotocol/web3';
|
import { useBridgeContract } from '@vegaprotocol/web3';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import type { Asset } from '@vegaprotocol/assets';
|
|
||||||
import { addDecimal } from '@vegaprotocol/react-helpers';
|
import { addDecimal } from '@vegaprotocol/react-helpers';
|
||||||
|
import type { WithdrawalFieldsFragment } from './__generated__/Withdrawal';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a function to get the threshold amount for a withdrawal. If a withdrawal amount
|
* Returns a function to get the threshold amount for a withdrawal. If a withdrawal amount
|
||||||
@ -12,7 +12,11 @@ import { addDecimal } from '@vegaprotocol/react-helpers';
|
|||||||
export const useGetWithdrawThreshold = () => {
|
export const useGetWithdrawThreshold = () => {
|
||||||
const contract = useBridgeContract();
|
const contract = useBridgeContract();
|
||||||
const getThreshold = useCallback(
|
const getThreshold = useCallback(
|
||||||
async (asset: Pick<Asset, 'source' | 'decimals'> | undefined) => {
|
async (
|
||||||
|
asset:
|
||||||
|
| Pick<WithdrawalFieldsFragment['asset'], 'source' | 'decimals'>
|
||||||
|
| undefined
|
||||||
|
) => {
|
||||||
if (!contract || asset?.source.__typename !== 'ERC20') {
|
if (!contract || asset?.source.__typename !== 'ERC20') {
|
||||||
return new BigNumber(Infinity);
|
return new BigNumber(Infinity);
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { captureException } from '@sentry/react';
|
import { captureException } from '@sentry/react';
|
||||||
import type { WithdrawalFields } from './__generated__/WithdrawalFields';
|
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { addDecimal, t } from '@vegaprotocol/react-helpers';
|
import { addDecimal, t } from '@vegaprotocol/react-helpers';
|
||||||
import { useGetWithdrawThreshold } from './use-get-withdraw-threshold';
|
import { useGetWithdrawThreshold } from './use-get-withdraw-threshold';
|
||||||
import { useGetWithdrawDelay } from './use-get-withdraw-delay';
|
import { useGetWithdrawDelay } from './use-get-withdraw-delay';
|
||||||
import { ERC20_APPROVAL_QUERY } from './queries';
|
import type { WithdrawalFieldsFragment } from './__generated__/Withdrawal';
|
||||||
|
import { Erc20ApprovalDocument } from './__generated__/Erc20Approval';
|
||||||
import type {
|
import type {
|
||||||
Erc20Approval,
|
Erc20ApprovalQuery,
|
||||||
Erc20ApprovalVariables,
|
Erc20ApprovalQueryVariables,
|
||||||
} from './__generated__/Erc20Approval';
|
} from './__generated__/Erc20Approval';
|
||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import type { ERC20Asset } from '@vegaprotocol/assets';
|
|
||||||
|
|
||||||
export enum ApprovalStatus {
|
export enum ApprovalStatus {
|
||||||
Idle = 'Idle',
|
Idle = 'Idle',
|
||||||
@ -58,7 +57,7 @@ export const useVerifyWithdrawal = () => {
|
|||||||
}, [setState]);
|
}, [setState]);
|
||||||
|
|
||||||
const verify = useCallback(
|
const verify = useCallback(
|
||||||
async (withdrawal: WithdrawalFields) => {
|
async (withdrawal: WithdrawalFieldsFragment) => {
|
||||||
try {
|
try {
|
||||||
setState({ dialogOpen: true });
|
setState({ dialogOpen: true });
|
||||||
|
|
||||||
@ -81,7 +80,7 @@ export const useVerifyWithdrawal = () => {
|
|||||||
addDecimal(withdrawal.amount, withdrawal.asset.decimals)
|
addDecimal(withdrawal.amount, withdrawal.asset.decimals)
|
||||||
);
|
);
|
||||||
|
|
||||||
const threshold = await getThreshold(withdrawal.asset as ERC20Asset);
|
const threshold = await getThreshold(withdrawal.asset);
|
||||||
|
|
||||||
if (threshold && amount.isGreaterThan(threshold)) {
|
if (threshold && amount.isGreaterThan(threshold)) {
|
||||||
const delaySecs = await getDelay();
|
const delaySecs = await getDelay();
|
||||||
@ -98,8 +97,11 @@ export const useVerifyWithdrawal = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await client.query<Erc20Approval, Erc20ApprovalVariables>({
|
const res = await client.query<
|
||||||
query: ERC20_APPROVAL_QUERY,
|
Erc20ApprovalQuery,
|
||||||
|
Erc20ApprovalQueryVariables
|
||||||
|
>({
|
||||||
|
query: Erc20ApprovalDocument,
|
||||||
variables: { withdrawalId: withdrawal.id },
|
variables: { withdrawalId: withdrawal.id },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import { ERC20_APPROVAL_QUERY } from './queries';
|
import { Erc20ApprovalDocument } from './__generated__/Erc20Approval';
|
||||||
import type {
|
import type {
|
||||||
Erc20Approval,
|
Erc20ApprovalQuery,
|
||||||
Erc20ApprovalVariables,
|
Erc20ApprovalQueryVariables,
|
||||||
Erc20Approval_erc20WithdrawalApproval,
|
|
||||||
} from './__generated__/Erc20Approval';
|
} from './__generated__/Erc20Approval';
|
||||||
|
|
||||||
type WaitForApproval = (
|
type WaitForApproval = (
|
||||||
id: string
|
id: string
|
||||||
) => Promise<Erc20Approval_erc20WithdrawalApproval>;
|
) => Promise<Erc20ApprovalQuery['erc20WithdrawalApproval']>;
|
||||||
|
|
||||||
export const useWithdrawalApproval = () => {
|
export const useWithdrawalApproval = () => {
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
@ -22,10 +21,10 @@ export const useWithdrawalApproval = () => {
|
|||||||
intervalRef.current = setInterval(async () => {
|
intervalRef.current = setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
const res = await client.query<
|
const res = await client.query<
|
||||||
Erc20Approval,
|
Erc20ApprovalQuery,
|
||||||
Erc20ApprovalVariables
|
Erc20ApprovalQueryVariables
|
||||||
>({
|
>({
|
||||||
query: ERC20_APPROVAL_QUERY,
|
query: Erc20ApprovalDocument,
|
||||||
variables: { withdrawalId: id },
|
variables: { withdrawalId: id },
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
});
|
});
|
||||||
|
@ -2,17 +2,17 @@ import { useApolloClient } from '@apollo/client';
|
|||||||
import type { VegaTxState } from '@vegaprotocol/wallet';
|
import type { VegaTxState } from '@vegaprotocol/wallet';
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import type { Subscription } from 'zen-observable-ts';
|
import type { Subscription } from 'zen-observable-ts';
|
||||||
import { WITHDRAWAL_BUS_EVENT_SUB } from './use-withdrawals';
|
import { WithdrawalsDocument } from './__generated__/Withdrawal';
|
||||||
import type {
|
import type {
|
||||||
WithdrawalEvent,
|
WithdrawalEventSubscription,
|
||||||
WithdrawalEventVariables,
|
WithdrawalEventSubscriptionVariables,
|
||||||
WithdrawalEvent_busEvents_event_Withdrawal,
|
WithdrawalFieldsFragment,
|
||||||
} from './__generated__/WithdrawalEvent';
|
} from './__generated__/Withdrawal';
|
||||||
|
|
||||||
type WaitForWithdrawalEvent = (
|
type WaitForWithdrawalEvent = (
|
||||||
id: string,
|
id: string,
|
||||||
partyId: string
|
partyId: string
|
||||||
) => Promise<WithdrawalEvent_busEvents_event_Withdrawal>;
|
) => Promise<WithdrawalFieldsFragment>;
|
||||||
|
|
||||||
export const useWithdrawalEvent = (transaction: VegaTxState) => {
|
export const useWithdrawalEvent = (transaction: VegaTxState) => {
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
@ -22,8 +22,11 @@ export const useWithdrawalEvent = (transaction: VegaTxState) => {
|
|||||||
(id, partyId) => {
|
(id, partyId) => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
subRef.current = client
|
subRef.current = client
|
||||||
.subscribe<WithdrawalEvent, WithdrawalEventVariables>({
|
.subscribe<
|
||||||
query: WITHDRAWAL_BUS_EVENT_SUB,
|
WithdrawalEventSubscription,
|
||||||
|
WithdrawalEventSubscriptionVariables
|
||||||
|
>({
|
||||||
|
query: WithdrawalsDocument,
|
||||||
variables: { partyId },
|
variables: { partyId },
|
||||||
})
|
})
|
||||||
.subscribe(({ data }) => {
|
.subscribe(({ data }) => {
|
||||||
|
@ -1,24 +1,21 @@
|
|||||||
import { WithdrawalStatus } from '@vegaprotocol/types';
|
import { Schema } from '@vegaprotocol/types';
|
||||||
import { generateWithdrawal } from './test-helpers';
|
import { generateWithdrawal } from './test-helpers';
|
||||||
import { updateQuery } from './use-withdrawals';
|
import { updateQuery } from './use-withdrawals';
|
||||||
import type {
|
import type {
|
||||||
WithdrawalEvent,
|
WithdrawalsQuery,
|
||||||
WithdrawalEvent_busEvents_event_Withdrawal,
|
WithdrawalEventSubscription,
|
||||||
} from './__generated__/WithdrawalEvent';
|
WithdrawalFieldsFragment,
|
||||||
import type {
|
} from './__generated__/Withdrawal';
|
||||||
Withdrawals,
|
|
||||||
Withdrawals_party_withdrawalsConnection_edges_node,
|
|
||||||
} from './__generated__/Withdrawals';
|
|
||||||
|
|
||||||
describe('updateQuery', () => {
|
describe('updateQuery', () => {
|
||||||
it('updates existing withdrawals', () => {
|
it('updates existing withdrawals', () => {
|
||||||
const withdrawal = generateWithdrawal({
|
const withdrawal = generateWithdrawal({
|
||||||
id: '1',
|
id: '1',
|
||||||
status: WithdrawalStatus.STATUS_OPEN,
|
status: Schema.WithdrawalStatus.STATUS_OPEN,
|
||||||
});
|
});
|
||||||
const withdrawalUpdate = generateWithdrawal({
|
const withdrawalUpdate = generateWithdrawal({
|
||||||
id: '1',
|
id: '1',
|
||||||
status: WithdrawalStatus.STATUS_FINALIZED,
|
status: Schema.WithdrawalStatus.STATUS_FINALIZED,
|
||||||
});
|
});
|
||||||
const prev = mockQuery([withdrawal]);
|
const prev = mockQuery([withdrawal]);
|
||||||
const incoming = mockSub([withdrawalUpdate]);
|
const incoming = mockSub([withdrawalUpdate]);
|
||||||
@ -31,7 +28,6 @@ describe('updateQuery', () => {
|
|||||||
__typename: 'WithdrawalsConnection',
|
__typename: 'WithdrawalsConnection',
|
||||||
edges: [
|
edges: [
|
||||||
{
|
{
|
||||||
__typename: 'WithdrawalEdge',
|
|
||||||
node: withdrawalUpdate,
|
node: withdrawalUpdate,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -60,11 +56,9 @@ describe('updateQuery', () => {
|
|||||||
__typename: 'WithdrawalsConnection',
|
__typename: 'WithdrawalsConnection',
|
||||||
edges: [
|
edges: [
|
||||||
{
|
{
|
||||||
__typename: 'WithdrawalEdge',
|
|
||||||
node: withdrawalUpdate,
|
node: withdrawalUpdate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: 'WithdrawalEdge',
|
|
||||||
node: withdrawal,
|
node: withdrawal,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -90,7 +84,6 @@ describe('updateQuery', () => {
|
|||||||
__typename: 'WithdrawalsConnection',
|
__typename: 'WithdrawalsConnection',
|
||||||
edges: [
|
edges: [
|
||||||
{
|
{
|
||||||
__typename: 'WithdrawalEdge',
|
|
||||||
node: withdrawalUpdate,
|
node: withdrawalUpdate,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -102,14 +95,14 @@ describe('updateQuery', () => {
|
|||||||
it('Handles updates and inserts simultaneously', () => {
|
it('Handles updates and inserts simultaneously', () => {
|
||||||
const withdrawal1 = generateWithdrawal({
|
const withdrawal1 = generateWithdrawal({
|
||||||
id: '1',
|
id: '1',
|
||||||
status: WithdrawalStatus.STATUS_OPEN,
|
status: Schema.WithdrawalStatus.STATUS_OPEN,
|
||||||
});
|
});
|
||||||
const withdrawal2 = generateWithdrawal({
|
const withdrawal2 = generateWithdrawal({
|
||||||
id: '2',
|
id: '2',
|
||||||
});
|
});
|
||||||
const withdrawalUpdate = generateWithdrawal({
|
const withdrawalUpdate = generateWithdrawal({
|
||||||
id: '1',
|
id: '1',
|
||||||
status: WithdrawalStatus.STATUS_FINALIZED,
|
status: Schema.WithdrawalStatus.STATUS_FINALIZED,
|
||||||
});
|
});
|
||||||
const withdrawalNew = generateWithdrawal({
|
const withdrawalNew = generateWithdrawal({
|
||||||
id: '3',
|
id: '3',
|
||||||
@ -125,15 +118,12 @@ describe('updateQuery', () => {
|
|||||||
__typename: 'WithdrawalsConnection',
|
__typename: 'WithdrawalsConnection',
|
||||||
edges: [
|
edges: [
|
||||||
{
|
{
|
||||||
__typename: 'WithdrawalEdge',
|
|
||||||
node: withdrawalUpdate,
|
node: withdrawalUpdate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: 'WithdrawalEdge',
|
|
||||||
node: withdrawalNew,
|
node: withdrawalNew,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: 'WithdrawalEdge',
|
|
||||||
node: withdrawal2,
|
node: withdrawal2,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -144,8 +134,8 @@ describe('updateQuery', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mockQuery = (
|
const mockQuery = (
|
||||||
withdrawals: Withdrawals_party_withdrawalsConnection_edges_node[]
|
withdrawals: WithdrawalFieldsFragment[]
|
||||||
): Withdrawals => {
|
): WithdrawalsQuery => {
|
||||||
return {
|
return {
|
||||||
party: {
|
party: {
|
||||||
__typename: 'Party',
|
__typename: 'Party',
|
||||||
@ -153,7 +143,6 @@ const mockQuery = (
|
|||||||
withdrawalsConnection: {
|
withdrawalsConnection: {
|
||||||
__typename: 'WithdrawalsConnection',
|
__typename: 'WithdrawalsConnection',
|
||||||
edges: withdrawals.map((w) => ({
|
edges: withdrawals.map((w) => ({
|
||||||
__typename: 'WithdrawalEdge',
|
|
||||||
node: w,
|
node: w,
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
@ -162,10 +151,10 @@ const mockQuery = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockSub = (
|
const mockSub = (
|
||||||
withdrawals: WithdrawalEvent_busEvents_event_Withdrawal[]
|
withdrawals: WithdrawalFieldsFragment[]
|
||||||
): {
|
): {
|
||||||
subscriptionData: {
|
subscriptionData: {
|
||||||
data: WithdrawalEvent;
|
data: WithdrawalEventSubscription;
|
||||||
};
|
};
|
||||||
} => {
|
} => {
|
||||||
return {
|
return {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user