address comments

This commit is contained in:
Bill He
2023-08-28 11:15:47 -07:00
parent de08098409
commit b1a3fb6dc1
5 changed files with 15 additions and 22 deletions
-16
View File
@@ -1,7 +1,6 @@
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
import { useSelector } from 'react-redux';
import { Squid } from '@0xsquid/sdk';
import { USDC_DENOM } from '@dydxprotocol/v4-client';
import { DydxV4Network, isDydxV4Network } from '@/constants/networks';
@@ -14,21 +13,6 @@ const SQUID_BASE_URL: Record<DydxV4Network, string | undefined> = {
[DydxV4Network.V4Mainnet]: 'https://api.0xsquid.com',
};
/**
* @description Deposit route defaults for IBC Testnet
* */
export const SQUID_DEPOSIT_ROUTE_DEFAULTS = {
toChain: 'dydx-testnet-2',
toToken: USDC_DENOM,
enableForecall: false, // instant execution service, defaults to true
};
export const SQUID_WITHDRAW_ROUTE_DEFAULTS = {
fromChain: 'dydx-testnet-2',
fromToken: USDC_DENOM,
enableForecall: false, // instant execution service, defaults to true
};
const useSquidContext = () => {
const selectedNetwork = useSelector(getSelectedNetwork);
const [_, setInitialized] = useState(false);
@@ -284,7 +284,7 @@ Styled.Header = styled.header`
`;
Styled.TransferButtons = styled.div`
${layoutMixins.row}
${layoutMixins.inlineRow}
gap: 1rem;
`;
@@ -19,6 +19,7 @@ import { useAccounts, useDebounce, useStringGetter } from '@/hooks';
import { useAccountBalance } from '@/hooks/useAccountBalance';
import { layoutMixins } from '@/styles/layoutMixins';
import { formMixins } from '@/styles/formMixins';
import { AlertMessage } from '@/components/AlertMessage';
import { Button } from '@/components/Button';
@@ -279,9 +280,9 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
label={stringGetter({ key: STRING_KEYS.AMOUNT })}
value={fromAmount}
slotRight={
<Button size={ButtonSize.XSmall} onClick={onClickMax}>
<Styled.FormInputButton size={ButtonSize.XSmall} onClick={onClickMax}>
{stringGetter({ key: STRING_KEYS.MAX })}
</Button>
</Styled.FormInputButton>
}
/>
</Styled.WithDetailsReceipt>
@@ -311,6 +312,8 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
const Styled: Record<string, AnyStyledComponent> = {};
Styled.Form = styled.form`
--form-input-height: 3.5rem;
${layoutMixins.flexColumn}
gap: 1.5rem;
@@ -333,3 +336,7 @@ Styled.Link = styled(Link)`
Styled.TransactionInfo = styled.span`
${layoutMixins.row}
`;
Styled.FormInputButton = styled(Button)`
${formMixins.inputInnerButton}
`;
@@ -80,11 +80,11 @@ export const WithdrawForm = () => {
});
return () => {
abacusStateManager.clearTransferInputValues();
abacusStateManager.setTransferValue({
field: TransferInputField.type,
value: null,
});
abacusStateManager.clearTransferInputValues();
};
}, []);
@@ -272,7 +272,7 @@ export const WithdrawForm = () => {
placeholder={stringGetter({ key: STRING_KEYS.ADDRESS })}
onChange={onChangeAddress}
value={toAddress || ''}
label={stringGetter({ key: STRING_KEYS.ADDRESS })}
label={stringGetter({ key: STRING_KEYS.DESTINATION })}
/>
<ChainSelectMenu
label={stringGetter({ key: STRING_KEYS.NETWORK })}
@@ -329,6 +329,8 @@ Styled.DiffOutput = styled(DiffOutput)`
`;
Styled.Form = styled.form`
--form-input-height: 3.5rem;
min-height: calc(100% - var(--stickyArea0-bottomHeight));
${layoutMixins.flexColumn}
@@ -114,7 +114,7 @@ export const WithdrawButtonAndReceipt = ({
{
key: 'exchange-rate',
label: <span>{stringGetter({ key: STRING_KEYS.EXCHANGE_RATE })}</span>,
value: withdrawToken && (
value: withdrawToken && typeof summary?.exchangeRate === 'number' && (
<Styled.ExchangeRate>
<Output type={OutputType.Asset} value={1} fractionDigits={0} tag="USDC" />
=