diff --git a/src/containers/DepositModal.tsx b/src/containers/DepositModal.tsx index 41cefdd..5c3aeee 100644 --- a/src/containers/DepositModal.tsx +++ b/src/containers/DepositModal.tsx @@ -1,12 +1,13 @@ +import { BigNumber } from 'bignumber.js' import { ReactElement, useContext } from 'react' import Download from 'remixicon-react/DownloadLineIcon' -import { Context as SettingsContext } from '../providers/Settings' - import WithdrawDepositModal from '../components/WithdrawDepositModal' -import { BigNumber } from 'bignumber.js' +import { Context as BeeContext } from '../providers/Bee' +import { Context as SettingsContext } from '../providers/Settings' export default function DepositModal(): ReactElement { const { beeDebugApi } = useContext(SettingsContext) + const { refresh } = useContext(BeeContext) return ( } min={new BigNumber(0)} - action={(amount: bigint) => { + action={async (amount: bigint) => { if (!beeDebugApi) throw new Error('Bee Debug URL is not valid') - return beeDebugApi.depositTokens(amount.toString()) + const transactionHash = await beeDebugApi.depositTokens(amount.toString()) + refresh() + + return transactionHash }} /> ) diff --git a/src/containers/WithdrawModal.tsx b/src/containers/WithdrawModal.tsx index 351e578..97162c9 100644 --- a/src/containers/WithdrawModal.tsx +++ b/src/containers/WithdrawModal.tsx @@ -2,10 +2,12 @@ import { BigNumber } from 'bignumber.js' import { ReactElement, useContext } from 'react' import Upload from 'remixicon-react/UploadLineIcon' import WithdrawDepositModal from '../components/WithdrawDepositModal' +import { Context as BeeContext } from '../providers/Bee' import { Context as SettingsContext } from '../providers/Settings' export default function WithdrawModal(): ReactElement { const { beeDebugApi } = useContext(SettingsContext) + const { refresh } = useContext(BeeContext) return ( } min={new BigNumber(0)} - action={(amount: bigint) => { + action={async (amount: bigint) => { if (!beeDebugApi) throw new Error('Bee Debug URL is not valid') - return beeDebugApi.withdrawTokens(amount.toString()) + const transactionHash = await beeDebugApi.withdrawTokens(amount.toString()) + refresh() + + return transactionHash }} /> )