* chore: assets to assetsconnection Changed queries in explorer app * chore: assets to assetsConnection (961) * chore: assets to assetsConnection (961) * chore: assets to assetsConnection (961) * fix: after merge issues fixed
This commit is contained in:
parent
47c087ad88
commit
aea2a85519
@ -9,7 +9,7 @@ import { AccountType } from "@vegaprotocol/types";
|
|||||||
// GraphQL query operation: AssetsQuery
|
// GraphQL query operation: AssetsQuery
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface AssetsQuery_assets_source_ERC20 {
|
export interface AssetsQuery_assetsConnection_edges_node_source_ERC20 {
|
||||||
__typename: "ERC20";
|
__typename: "ERC20";
|
||||||
/**
|
/**
|
||||||
* The address of the ERC20 contract
|
* The address of the ERC20 contract
|
||||||
@ -17,7 +17,7 @@ export interface AssetsQuery_assets_source_ERC20 {
|
|||||||
contractAddress: string;
|
contractAddress: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AssetsQuery_assets_source_BuiltinAsset {
|
export interface AssetsQuery_assetsConnection_edges_node_source_BuiltinAsset {
|
||||||
__typename: "BuiltinAsset";
|
__typename: "BuiltinAsset";
|
||||||
/**
|
/**
|
||||||
* Maximum amount that can be requested by a party through the built-in asset faucet at a time
|
* Maximum amount that can be requested by a party through the built-in asset faucet at a time
|
||||||
@ -25,9 +25,9 @@ export interface AssetsQuery_assets_source_BuiltinAsset {
|
|||||||
maxFaucetAmountMint: string;
|
maxFaucetAmountMint: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetsQuery_assets_source = AssetsQuery_assets_source_ERC20 | AssetsQuery_assets_source_BuiltinAsset;
|
export type AssetsQuery_assetsConnection_edges_node_source = AssetsQuery_assetsConnection_edges_node_source_ERC20 | AssetsQuery_assetsConnection_edges_node_source_BuiltinAsset;
|
||||||
|
|
||||||
export interface AssetsQuery_assets_infrastructureFeeAccount_market {
|
export interface AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount_market {
|
||||||
__typename: "Market";
|
__typename: "Market";
|
||||||
/**
|
/**
|
||||||
* Market ID
|
* Market ID
|
||||||
@ -35,7 +35,7 @@ export interface AssetsQuery_assets_infrastructureFeeAccount_market {
|
|||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AssetsQuery_assets_infrastructureFeeAccount {
|
export interface AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount {
|
||||||
__typename: "Account";
|
__typename: "Account";
|
||||||
/**
|
/**
|
||||||
* Account type (General, Margin, etc)
|
* Account type (General, Margin, etc)
|
||||||
@ -48,10 +48,10 @@ export interface AssetsQuery_assets_infrastructureFeeAccount {
|
|||||||
/**
|
/**
|
||||||
* Market (only relevant to margin accounts)
|
* Market (only relevant to margin accounts)
|
||||||
*/
|
*/
|
||||||
market: AssetsQuery_assets_infrastructureFeeAccount_market | null;
|
market: AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount_market | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AssetsQuery_assets {
|
export interface AssetsQuery_assetsConnection_edges_node {
|
||||||
__typename: "Asset";
|
__typename: "Asset";
|
||||||
/**
|
/**
|
||||||
* The ID of the asset
|
* The ID of the asset
|
||||||
@ -72,16 +72,29 @@ export interface AssetsQuery_assets {
|
|||||||
/**
|
/**
|
||||||
* The origin source of the asset (e.g: an ERC20 asset)
|
* The origin source of the asset (e.g: an ERC20 asset)
|
||||||
*/
|
*/
|
||||||
source: AssetsQuery_assets_source;
|
source: AssetsQuery_assetsConnection_edges_node_source;
|
||||||
/**
|
/**
|
||||||
* The infrastructure fee account for this asset
|
* The infrastructure fee account for this asset
|
||||||
*/
|
*/
|
||||||
infrastructureFeeAccount: AssetsQuery_assets_infrastructureFeeAccount;
|
infrastructureFeeAccount: AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AssetsQuery_assetsConnection_edges {
|
||||||
|
__typename: "AssetEdge";
|
||||||
|
node: AssetsQuery_assetsConnection_edges_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AssetsQuery_assetsConnection {
|
||||||
|
__typename: "AssetsConnection";
|
||||||
|
/**
|
||||||
|
* The assets
|
||||||
|
*/
|
||||||
|
edges: (AssetsQuery_assetsConnection_edges | null)[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AssetsQuery {
|
export interface AssetsQuery {
|
||||||
/**
|
/**
|
||||||
* The list of all assets in use in the Vega network
|
* The list of all assets in use in the vega network or the specified asset if id is provided
|
||||||
*/
|
*/
|
||||||
assets: AssetsQuery_assets[] | null;
|
assetsConnection: AssetsQuery_assetsConnection;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { gql, useQuery } from '@apollo/client';
|
import { gql, useQuery } from '@apollo/client';
|
||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { assetsConnectionToAssets, t } from '@vegaprotocol/react-helpers';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { RouteTitle } from '../../components/route-title';
|
import { RouteTitle } from '../../components/route-title';
|
||||||
import { SubHeading } from '../../components/sub-heading';
|
import { SubHeading } from '../../components/sub-heading';
|
||||||
@ -8,24 +8,28 @@ import type { AssetsQuery } from './__generated__/AssetsQuery';
|
|||||||
|
|
||||||
export const ASSETS_QUERY = gql`
|
export const ASSETS_QUERY = gql`
|
||||||
query AssetsQuery {
|
query AssetsQuery {
|
||||||
assets {
|
assetsConnection {
|
||||||
id
|
edges {
|
||||||
name
|
node {
|
||||||
symbol
|
|
||||||
decimals
|
|
||||||
source {
|
|
||||||
... on ERC20 {
|
|
||||||
contractAddress
|
|
||||||
}
|
|
||||||
... on BuiltinAsset {
|
|
||||||
maxFaucetAmountMint
|
|
||||||
}
|
|
||||||
}
|
|
||||||
infrastructureFeeAccount {
|
|
||||||
type
|
|
||||||
balance
|
|
||||||
market {
|
|
||||||
id
|
id
|
||||||
|
name
|
||||||
|
symbol
|
||||||
|
decimals
|
||||||
|
source {
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
... on BuiltinAsset {
|
||||||
|
maxFaucetAmountMint
|
||||||
|
}
|
||||||
|
}
|
||||||
|
infrastructureFeeAccount {
|
||||||
|
type
|
||||||
|
balance
|
||||||
|
market {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,11 +38,13 @@ export const ASSETS_QUERY = gql`
|
|||||||
|
|
||||||
const Assets = () => {
|
const Assets = () => {
|
||||||
const { data } = useQuery<AssetsQuery>(ASSETS_QUERY);
|
const { data } = useQuery<AssetsQuery>(ASSETS_QUERY);
|
||||||
if (!data || !data.assets) return null;
|
|
||||||
|
const assets = assetsConnectionToAssets(data?.assetsConnection);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
<RouteTitle data-testid="assets-header">{t('Assets')}</RouteTitle>
|
<RouteTitle data-testid="assets-header">{t('Assets')}</RouteTitle>
|
||||||
{data?.assets.map((a) => (
|
{assets.map((a) => (
|
||||||
<React.Fragment key={a.id}>
|
<React.Fragment key={a.id}>
|
||||||
<SubHeading data-testid="asset-header">
|
<SubHeading data-testid="asset-header">
|
||||||
{a.name} ({a.symbol})
|
{a.name} ({a.symbol})
|
||||||
|
@ -140,11 +140,11 @@ export interface WithdrawPage_party {
|
|||||||
withdrawals: WithdrawPage_party_withdrawals[] | null;
|
withdrawals: WithdrawPage_party_withdrawals[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WithdrawPage_assets_source_BuiltinAsset {
|
export interface WithdrawPage_assetsConnection_edges_node_source_BuiltinAsset {
|
||||||
__typename: "BuiltinAsset";
|
__typename: "BuiltinAsset";
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WithdrawPage_assets_source_ERC20 {
|
export interface WithdrawPage_assetsConnection_edges_node_source_ERC20 {
|
||||||
__typename: "ERC20";
|
__typename: "ERC20";
|
||||||
/**
|
/**
|
||||||
* The address of the ERC20 contract
|
* The address of the ERC20 contract
|
||||||
@ -152,9 +152,9 @@ export interface WithdrawPage_assets_source_ERC20 {
|
|||||||
contractAddress: string;
|
contractAddress: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type WithdrawPage_assets_source = WithdrawPage_assets_source_BuiltinAsset | WithdrawPage_assets_source_ERC20;
|
export type WithdrawPage_assetsConnection_edges_node_source = WithdrawPage_assetsConnection_edges_node_source_BuiltinAsset | WithdrawPage_assetsConnection_edges_node_source_ERC20;
|
||||||
|
|
||||||
export interface WithdrawPage_assets {
|
export interface WithdrawPage_assetsConnection_edges_node {
|
||||||
__typename: "Asset";
|
__typename: "Asset";
|
||||||
/**
|
/**
|
||||||
* The ID of the asset
|
* The ID of the asset
|
||||||
@ -175,7 +175,20 @@ export interface WithdrawPage_assets {
|
|||||||
/**
|
/**
|
||||||
* The origin source of the asset (e.g: an ERC20 asset)
|
* The origin source of the asset (e.g: an ERC20 asset)
|
||||||
*/
|
*/
|
||||||
source: WithdrawPage_assets_source;
|
source: WithdrawPage_assetsConnection_edges_node_source;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WithdrawPage_assetsConnection_edges {
|
||||||
|
__typename: "AssetEdge";
|
||||||
|
node: WithdrawPage_assetsConnection_edges_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WithdrawPage_assetsConnection {
|
||||||
|
__typename: "AssetsConnection";
|
||||||
|
/**
|
||||||
|
* The assets
|
||||||
|
*/
|
||||||
|
edges: (WithdrawPage_assetsConnection_edges | null)[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WithdrawPage {
|
export interface WithdrawPage {
|
||||||
@ -184,9 +197,9 @@ export interface WithdrawPage {
|
|||||||
*/
|
*/
|
||||||
party: WithdrawPage_party | null;
|
party: WithdrawPage_party | null;
|
||||||
/**
|
/**
|
||||||
* The list of all assets in use in the Vega network
|
* The list of all assets in use in the vega network or the specified asset if id is provided
|
||||||
*/
|
*/
|
||||||
assets: WithdrawPage_assets[] | null;
|
assetsConnection: WithdrawPage_assetsConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WithdrawPageVariables {
|
export interface WithdrawPageVariables {
|
||||||
|
@ -15,6 +15,7 @@ import type {
|
|||||||
} from './__generated__/WithdrawPage';
|
} from './__generated__/WithdrawPage';
|
||||||
import { WithdrawManager } from '@vegaprotocol/withdraws';
|
import { WithdrawManager } from '@vegaprotocol/withdraws';
|
||||||
import { AccountType } from '@vegaprotocol/types';
|
import { AccountType } from '@vegaprotocol/types';
|
||||||
|
import { assetsConnectionToAssets } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
const Withdraw = () => {
|
const Withdraw = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -75,14 +76,18 @@ const WITHDRAW_PAGE_QUERY = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assets {
|
assetsConnection {
|
||||||
id
|
edges {
|
||||||
symbol
|
node {
|
||||||
name
|
id
|
||||||
decimals
|
symbol
|
||||||
source {
|
name
|
||||||
... on ERC20 {
|
decimals
|
||||||
contractAddress
|
source {
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,6 +139,8 @@ export const WithdrawContainer = ({ currVegaKey }: WithdrawContainerProps) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const assets = assetsConnectionToAssets(data.assetsConnection);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{hasPendingWithdrawals && (
|
{hasPendingWithdrawals && (
|
||||||
@ -151,7 +158,7 @@ export const WithdrawContainer = ({ currVegaKey }: WithdrawContainerProps) => {
|
|||||||
</Callout>
|
</Callout>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<WithdrawManager assets={data.assets || []} accounts={accounts} />
|
<WithdrawManager assets={assets || []} accounts={accounts} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
// GraphQL query operation: DepositPage
|
// GraphQL query operation: DepositPage
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface DepositPage_assets_source_BuiltinAsset {
|
export interface DepositPage_assetsConnection_edges_node_source_BuiltinAsset {
|
||||||
__typename: "BuiltinAsset";
|
__typename: "BuiltinAsset";
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DepositPage_assets_source_ERC20 {
|
export interface DepositPage_assetsConnection_edges_node_source_ERC20 {
|
||||||
__typename: "ERC20";
|
__typename: "ERC20";
|
||||||
/**
|
/**
|
||||||
* The address of the ERC20 contract
|
* The address of the ERC20 contract
|
||||||
@ -19,9 +19,9 @@ export interface DepositPage_assets_source_ERC20 {
|
|||||||
contractAddress: string;
|
contractAddress: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DepositPage_assets_source = DepositPage_assets_source_BuiltinAsset | DepositPage_assets_source_ERC20;
|
export type DepositPage_assetsConnection_edges_node_source = DepositPage_assetsConnection_edges_node_source_BuiltinAsset | DepositPage_assetsConnection_edges_node_source_ERC20;
|
||||||
|
|
||||||
export interface DepositPage_assets {
|
export interface DepositPage_assetsConnection_edges_node {
|
||||||
__typename: "Asset";
|
__typename: "Asset";
|
||||||
/**
|
/**
|
||||||
* The ID of the asset
|
* The ID of the asset
|
||||||
@ -42,12 +42,25 @@ export interface DepositPage_assets {
|
|||||||
/**
|
/**
|
||||||
* The origin source of the asset (e.g: an ERC20 asset)
|
* The origin source of the asset (e.g: an ERC20 asset)
|
||||||
*/
|
*/
|
||||||
source: DepositPage_assets_source;
|
source: DepositPage_assetsConnection_edges_node_source;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DepositPage_assetsConnection_edges {
|
||||||
|
__typename: "AssetEdge";
|
||||||
|
node: DepositPage_assetsConnection_edges_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DepositPage_assetsConnection {
|
||||||
|
__typename: "AssetsConnection";
|
||||||
|
/**
|
||||||
|
* The assets
|
||||||
|
*/
|
||||||
|
edges: (DepositPage_assetsConnection_edges | null)[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DepositPage {
|
export interface DepositPage {
|
||||||
/**
|
/**
|
||||||
* The list of all assets in use in the Vega network
|
* The list of all assets in use in the vega network or the specified asset if id is provided
|
||||||
*/
|
*/
|
||||||
assets: DepositPage_assets[] | null;
|
assetsConnection: DepositPage_assetsConnection;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import { gql } from '@apollo/client';
|
|||||||
import { PageQueryContainer } from '../../../components/page-query-container';
|
import { PageQueryContainer } from '../../../components/page-query-container';
|
||||||
import type { DepositPage } from './__generated__/DepositPage';
|
import type { DepositPage } from './__generated__/DepositPage';
|
||||||
import { DepositManager } from '@vegaprotocol/deposits';
|
import { DepositManager } from '@vegaprotocol/deposits';
|
||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { assetsConnectionToAssets, t } from '@vegaprotocol/react-helpers';
|
||||||
import { useEnvironment } from '@vegaprotocol/environment';
|
import { useEnvironment } from '@vegaprotocol/environment';
|
||||||
import { Splash } from '@vegaprotocol/ui-toolkit';
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import { ASSET_FRAGMENT } from '../../../lib/query-fragments';
|
import { ASSET_FRAGMENT } from '../../../lib/query-fragments';
|
||||||
@ -10,8 +10,12 @@ import { ASSET_FRAGMENT } from '../../../lib/query-fragments';
|
|||||||
const DEPOSIT_PAGE_QUERY = gql`
|
const DEPOSIT_PAGE_QUERY = gql`
|
||||||
${ASSET_FRAGMENT}
|
${ASSET_FRAGMENT}
|
||||||
query DepositPage {
|
query DepositPage {
|
||||||
assets {
|
assetsConnection {
|
||||||
...AssetFields
|
edges {
|
||||||
|
node {
|
||||||
|
...AssetFields
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -26,7 +30,8 @@ export const DepositContainer = () => {
|
|||||||
<PageQueryContainer<DepositPage>
|
<PageQueryContainer<DepositPage>
|
||||||
query={DEPOSIT_PAGE_QUERY}
|
query={DEPOSIT_PAGE_QUERY}
|
||||||
render={(data) => {
|
render={(data) => {
|
||||||
if (!data.assets?.length) {
|
const assets = assetsConnectionToAssets(data.assetsConnection);
|
||||||
|
if (!assets.length) {
|
||||||
return (
|
return (
|
||||||
<Splash>
|
<Splash>
|
||||||
<p>{t('No assets on this network')}</p>
|
<p>{t('No assets on this network')}</p>
|
||||||
@ -36,7 +41,7 @@ export const DepositContainer = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DepositManager
|
<DepositManager
|
||||||
assets={data.assets}
|
assets={assets}
|
||||||
isFaucetable={VEGA_ENV !== 'MAINNET'}
|
isFaucetable={VEGA_ENV !== 'MAINNET'}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -65,11 +65,11 @@ export interface WithdrawPageQuery_party {
|
|||||||
accounts: WithdrawPageQuery_party_accounts[] | null;
|
accounts: WithdrawPageQuery_party_accounts[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WithdrawPageQuery_assets_source_BuiltinAsset {
|
export interface WithdrawPageQuery_assetsConnection_edges_node_source_BuiltinAsset {
|
||||||
__typename: "BuiltinAsset";
|
__typename: "BuiltinAsset";
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WithdrawPageQuery_assets_source_ERC20 {
|
export interface WithdrawPageQuery_assetsConnection_edges_node_source_ERC20 {
|
||||||
__typename: "ERC20";
|
__typename: "ERC20";
|
||||||
/**
|
/**
|
||||||
* The address of the ERC20 contract
|
* The address of the ERC20 contract
|
||||||
@ -77,9 +77,9 @@ export interface WithdrawPageQuery_assets_source_ERC20 {
|
|||||||
contractAddress: string;
|
contractAddress: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type WithdrawPageQuery_assets_source = WithdrawPageQuery_assets_source_BuiltinAsset | WithdrawPageQuery_assets_source_ERC20;
|
export type WithdrawPageQuery_assetsConnection_edges_node_source = WithdrawPageQuery_assetsConnection_edges_node_source_BuiltinAsset | WithdrawPageQuery_assetsConnection_edges_node_source_ERC20;
|
||||||
|
|
||||||
export interface WithdrawPageQuery_assets {
|
export interface WithdrawPageQuery_assetsConnection_edges_node {
|
||||||
__typename: "Asset";
|
__typename: "Asset";
|
||||||
/**
|
/**
|
||||||
* The ID of the asset
|
* The ID of the asset
|
||||||
@ -100,7 +100,20 @@ export interface WithdrawPageQuery_assets {
|
|||||||
/**
|
/**
|
||||||
* The origin source of the asset (e.g: an ERC20 asset)
|
* The origin source of the asset (e.g: an ERC20 asset)
|
||||||
*/
|
*/
|
||||||
source: WithdrawPageQuery_assets_source;
|
source: WithdrawPageQuery_assetsConnection_edges_node_source;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WithdrawPageQuery_assetsConnection_edges {
|
||||||
|
__typename: "AssetEdge";
|
||||||
|
node: WithdrawPageQuery_assetsConnection_edges_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WithdrawPageQuery_assetsConnection {
|
||||||
|
__typename: "AssetsConnection";
|
||||||
|
/**
|
||||||
|
* The assets
|
||||||
|
*/
|
||||||
|
edges: (WithdrawPageQuery_assetsConnection_edges | null)[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WithdrawPageQuery {
|
export interface WithdrawPageQuery {
|
||||||
@ -109,9 +122,9 @@ export interface WithdrawPageQuery {
|
|||||||
*/
|
*/
|
||||||
party: WithdrawPageQuery_party | null;
|
party: WithdrawPageQuery_party | null;
|
||||||
/**
|
/**
|
||||||
* The list of all assets in use in the Vega network
|
* The list of all assets in use in the vega network or the specified asset if id is provided
|
||||||
*/
|
*/
|
||||||
assets: WithdrawPageQuery_assets[] | null;
|
assetsConnection: WithdrawPageQuery_assetsConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WithdrawPageQueryVariables {
|
export interface WithdrawPageQueryVariables {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { assetsConnectionToAssets, t } from '@vegaprotocol/react-helpers';
|
||||||
import { Splash } from '@vegaprotocol/ui-toolkit';
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { WithdrawManager } from '@vegaprotocol/withdraws';
|
import { WithdrawManager } from '@vegaprotocol/withdraws';
|
||||||
@ -29,8 +29,12 @@ const WITHDRAW_PAGE_QUERY = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assets {
|
assetsConnection {
|
||||||
...AssetFields
|
edges {
|
||||||
|
node {
|
||||||
|
...AssetFields
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -55,7 +59,8 @@ export const WithdrawPageContainer = ({
|
|||||||
skip: !keypair?.pub,
|
skip: !keypair?.pub,
|
||||||
}}
|
}}
|
||||||
render={(data) => {
|
render={(data) => {
|
||||||
if (!data.assets?.length) {
|
const assets = assetsConnectionToAssets(data.assetsConnection);
|
||||||
|
if (!assets.length) {
|
||||||
return (
|
return (
|
||||||
<Splash>
|
<Splash>
|
||||||
<p>{t('No assets on this network')}</p>
|
<p>{t('No assets on this network')}</p>
|
||||||
@ -84,7 +89,7 @@ export const WithdrawPageContainer = ({
|
|||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
<WithdrawManager
|
<WithdrawManager
|
||||||
assets={data.assets}
|
assets={assets}
|
||||||
accounts={data.party?.accounts || []}
|
accounts={data.party?.accounts || []}
|
||||||
initialAssetId={assetId}
|
initialAssetId={assetId}
|
||||||
/>
|
/>
|
||||||
|
@ -16,6 +16,16 @@ export interface Asset {
|
|||||||
source: ERC20AssetSource | BuiltinAssetSource;
|
source: ERC20AssetSource | BuiltinAssetSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface AssetEdge {
|
||||||
|
__typename: 'AssetEdge';
|
||||||
|
node: Asset;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AssetsConnection {
|
||||||
|
__typename: 'AssetsConnection';
|
||||||
|
edges: (AssetEdge | null)[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
export type ERC20Asset = Omit<Asset, 'source'> & {
|
export type ERC20Asset = Omit<Asset, 'source'> & {
|
||||||
source: ERC20AssetSource;
|
source: ERC20AssetSource;
|
||||||
};
|
};
|
||||||
@ -28,3 +38,12 @@ export const isAssetTypeERC20 = (asset?: Asset): asset is ERC20Asset => {
|
|||||||
if (!asset?.source) return false;
|
if (!asset?.source) return false;
|
||||||
return asset.source.__typename === 'ERC20';
|
return asset.source.__typename === 'ERC20';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const assetsConnectionToAssets = (
|
||||||
|
assetsConnection: AssetsConnection | undefined | null
|
||||||
|
): Asset[] => {
|
||||||
|
const edges = assetsConnection?.edges?.filter((e) => e && e?.node);
|
||||||
|
if (!edges) return [];
|
||||||
|
|
||||||
|
return (edges as AssetEdge[]).map((e) => e.node);
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user