11be7aaa8a
* refactor: deposit manager with a zustand store and refetching balances after contracts complete * refactor: remove assetId query string functionality * chore: remove unused import * chore: add a comment with a link to code explanation * refactor: capture errors from deposit value get functions * refactor: add error handling for async perform funcs * feat: add assets to react helpers for types and erc20 check
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { gql } from '@apollo/client';
|
|
import { PageQueryContainer } from '../../../components/page-query-container';
|
|
import type { DepositPage } from './__generated__/DepositPage';
|
|
import { DepositManager } from '@vegaprotocol/deposits';
|
|
import { t } from '@vegaprotocol/react-helpers';
|
|
import { useEnvironment } from '@vegaprotocol/environment';
|
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
|
import { ASSET_FRAGMENT } from '../../../lib/query-fragments';
|
|
|
|
const DEPOSIT_PAGE_QUERY = gql`
|
|
${ASSET_FRAGMENT}
|
|
query DepositPage {
|
|
assets {
|
|
...AssetFields
|
|
}
|
|
}
|
|
`;
|
|
|
|
/**
|
|
* Fetches data required for the Deposit page
|
|
*/
|
|
export const DepositContainer = () => {
|
|
const { VEGA_ENV } = useEnvironment();
|
|
|
|
return (
|
|
<PageQueryContainer<DepositPage>
|
|
query={DEPOSIT_PAGE_QUERY}
|
|
render={(data) => {
|
|
if (!data.assets?.length) {
|
|
return (
|
|
<Splash>
|
|
<p>{t('No assets on this network')}</p>
|
|
</Splash>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<DepositManager
|
|
assets={data.assets}
|
|
isFaucetable={VEGA_ENV !== 'MAINNET'}
|
|
/>
|
|
);
|
|
}}
|
|
/>
|
|
);
|
|
};
|