TransferType prop
This commit is contained in:
parent
daf862aa40
commit
88fa4e26e4
@ -20,7 +20,11 @@ import { useTokenConfigs } from './useTokenConfigs';
|
||||
|
||||
const BLOCK_TIME = isMainnet ? 1_000 : 1_500;
|
||||
|
||||
export const useWithdrawalInfo = ({ isTransfer }: { isTransfer?: boolean }) => {
|
||||
export const useWithdrawalInfo = ({
|
||||
transferType,
|
||||
}: {
|
||||
transferType: 'withdrawal' | 'transfer';
|
||||
}) => {
|
||||
const { getWithdrawalAndTransferGatingStatus, getWithdrawalCapacityByDenom } = useDydxClient();
|
||||
const { usdcDenom, usdcDecimals } = useTokenConfigs();
|
||||
const apiState = useSelector(getApiState, shallowEqual);
|
||||
@ -95,7 +99,7 @@ export const useWithdrawalInfo = ({ isTransfer }: { isTransfer?: boolean }) => {
|
||||
openDialog({
|
||||
type: DialogTypes.WithdrawalGated,
|
||||
dialogProps: {
|
||||
isTransfer,
|
||||
transferType,
|
||||
estimatedUnblockTime: withdrawalAndTransferGatingStatusValue.estimatedUnblockTime,
|
||||
},
|
||||
})
|
||||
|
||||
@ -12,14 +12,14 @@ import { Icon, IconName } from '@/components/Icon';
|
||||
|
||||
type ElementProps = {
|
||||
setIsOpen: (open: boolean) => void;
|
||||
isTransfer?: boolean;
|
||||
transferType: 'withdrawal' | 'transfer';
|
||||
estimatedUnblockTime?: string | null;
|
||||
};
|
||||
|
||||
export const WithdrawalGateDialog = ({
|
||||
setIsOpen,
|
||||
isTransfer,
|
||||
estimatedUnblockTime,
|
||||
transferType,
|
||||
}: ElementProps) => {
|
||||
const stringGetter = useStringGetter();
|
||||
const { withdrawalGateLearnMore } = useURLConfigs();
|
||||
@ -30,9 +30,10 @@ export const WithdrawalGateDialog = ({
|
||||
stacked
|
||||
setIsOpen={setIsOpen}
|
||||
title={
|
||||
isTransfer
|
||||
? stringGetter({ key: STRING_KEYS.TRANSFERS_PAUSED })
|
||||
: stringGetter({ key: STRING_KEYS.WITHDRAWALS_PAUSED })
|
||||
{
|
||||
withdrawal: stringGetter({ key: STRING_KEYS.WITHDRAWALS_PAUSED }),
|
||||
transfer: stringGetter({ key: STRING_KEYS.TRANSFERS_PAUSED }),
|
||||
}[transferType]
|
||||
}
|
||||
slotIcon={
|
||||
<Styled.IconContainer>
|
||||
|
||||
@ -89,7 +89,7 @@ export const WithdrawForm = () => {
|
||||
const [slippage, setSlippage] = useState(isCctp ? 0 : 0.01); // 0.1% slippage
|
||||
const debouncedAmount = useDebounce<string>(withdrawAmount, 500);
|
||||
const { usdcLabel } = useTokenConfigs();
|
||||
const { usdcWithdawalCapacity } = useWithdrawalInfo({ isTransfer: false });
|
||||
const { usdcWithdawalCapacity } = useWithdrawalInfo({ transferType: 'withdrawal' });
|
||||
|
||||
const isValidAddress = toAddress && isAddress(toAddress);
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ export const TransferForm = ({
|
||||
const { nativeTokenBalance, usdcBalance } = useAccountBalance();
|
||||
const selectedDydxChainId = useSelector(getSelectedDydxChainId);
|
||||
const { tokensConfigs, usdcLabel, chainTokenLabel } = useTokenConfigs();
|
||||
useWithdrawalInfo({ isTransfer: true });
|
||||
useWithdrawalInfo({ transferType: 'transfer' });
|
||||
|
||||
const {
|
||||
address: recipientAddress,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user