2022-11-04 10:47:53 +00:00
|
|
|
import { enabledAssetsProvider } from '@vegaprotocol/assets';
|
|
|
|
import { DepositManager } from '@vegaprotocol/deposits';
|
|
|
|
import { useEnvironment } from '@vegaprotocol/environment';
|
|
|
|
import { t, titlefy, useDataProvider } from '@vegaprotocol/react-helpers';
|
|
|
|
import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit';
|
2022-08-31 15:33:08 +00:00
|
|
|
import { Web3Container } from '@vegaprotocol/web3';
|
2022-09-23 14:29:35 +00:00
|
|
|
import { useEffect } from 'react';
|
2022-11-08 07:23:38 +00:00
|
|
|
import { usePageTitleStore } from '../../stores';
|
2022-03-25 07:44:10 +00:00
|
|
|
|
2022-11-08 07:23:38 +00:00
|
|
|
export const Deposit = () => {
|
2022-10-14 15:42:53 +00:00
|
|
|
const { updateTitle } = usePageTitleStore((store) => ({
|
|
|
|
updateTitle: store.updateTitle,
|
2022-09-23 14:29:35 +00:00
|
|
|
}));
|
2022-10-14 15:42:53 +00:00
|
|
|
|
2022-09-23 14:29:35 +00:00
|
|
|
useEffect(() => {
|
2022-10-14 15:42:53 +00:00
|
|
|
updateTitle(titlefy([t('Deposits')]));
|
|
|
|
}, [updateTitle]);
|
2022-09-23 14:29:35 +00:00
|
|
|
|
2022-11-04 10:47:53 +00:00
|
|
|
const { VEGA_ENV } = useEnvironment();
|
|
|
|
const { data, error, loading } = useDataProvider({
|
|
|
|
dataProvider: enabledAssetsProvider,
|
|
|
|
});
|
|
|
|
|
2022-03-25 07:44:10 +00:00
|
|
|
return (
|
2022-06-07 22:08:40 +00:00
|
|
|
<Web3Container>
|
2022-08-31 04:35:46 +00:00
|
|
|
<div className="max-w-[420px] p-8 mx-auto">
|
|
|
|
<h1 className="text-2xl mb-4">{t('Deposit')}</h1>
|
2022-11-04 10:47:53 +00:00
|
|
|
<AsyncRenderer
|
|
|
|
data={data}
|
|
|
|
error={error}
|
|
|
|
loading={loading}
|
|
|
|
render={(assets) => {
|
|
|
|
if (!assets || !assets.length) {
|
|
|
|
return (
|
|
|
|
<Splash>
|
|
|
|
<p>{t('No assets on this network')}</p>
|
|
|
|
</Splash>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<DepositManager
|
|
|
|
assets={assets}
|
|
|
|
isFaucetable={VEGA_ENV !== 'MAINNET'}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
/>
|
2022-06-07 22:08:40 +00:00
|
|
|
</div>
|
|
|
|
</Web3Container>
|
2022-03-25 07:44:10 +00:00
|
|
|
);
|
|
|
|
};
|