Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c1105ce7b | ||
|
|
68e5cb8680 | ||
|
|
dea36da7bf |
@@ -37,10 +37,10 @@ type UseAccountBalanceProps = {
|
||||
* 0xSquid uses this 0x address as the chain's default token.
|
||||
* @todo We will need to add additional logic here if we 'useAccountBalance' on non-Squid related forms.
|
||||
*/
|
||||
const CHAIN_DEFAULT_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
||||
export const CHAIN_DEFAULT_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
||||
|
||||
export const useAccountBalance = ({
|
||||
addressOrDenom = CHAIN_DEFAULT_TOKEN_ADDRESS,
|
||||
addressOrDenom,
|
||||
assetSymbol,
|
||||
bech32AddrPrefix,
|
||||
chainId,
|
||||
|
||||
@@ -14,7 +14,7 @@ import { NumberSign } from '@/constants/numbers';
|
||||
import type { EvmAddress } from '@/constants/wallets';
|
||||
|
||||
import { useAccounts, useDebounce, useStringGetter } from '@/hooks';
|
||||
import { useAccountBalance } from '@/hooks/useAccountBalance';
|
||||
import { useAccountBalance, CHAIN_DEFAULT_TOKEN_ADDRESS } from '@/hooks/useAccountBalance';
|
||||
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
||||
import { NATIVE_TOKEN_ADDRESS, useSquid } from '@/hooks/useSquid';
|
||||
import { useWalletConnection } from '@/hooks/useWalletConnection';
|
||||
@@ -86,7 +86,7 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
||||
|
||||
// Async Data
|
||||
const { balance, queryStatus, isQueryFetching } = useAccountBalance({
|
||||
addressOrDenom: sourceToken?.address || undefined,
|
||||
addressOrDenom: sourceToken?.address || CHAIN_DEFAULT_TOKEN_ADDRESS,
|
||||
assetSymbol: sourceToken?.symbol || undefined,
|
||||
chainId: chainId,
|
||||
decimals: sourceToken?.decimals || undefined,
|
||||
|
||||
@@ -49,15 +49,15 @@ export const WithdrawButtonAndReceipt = ({
|
||||
const [isEditingSlippage, setIsEditingSlipapge] = useState(false);
|
||||
const stringGetter = useStringGetter();
|
||||
|
||||
const { balance, queryStatus } = useAccountBalance({
|
||||
addressOrDenom: withdrawToken?.address || undefined,
|
||||
assetSymbol: withdrawToken?.symbol || undefined,
|
||||
chainId: withdrawChain ? parseInt(withdrawChain) : undefined,
|
||||
decimals: withdrawToken?.decimals || undefined,
|
||||
isCosmosChain: false,
|
||||
});
|
||||
|
||||
// TODO: uncomment when we have a way to get token amount estimate from abacus
|
||||
// const { balance, queryStatus } = useAccountBalance({
|
||||
// addressOrDenom: withdrawToken?.address || undefined,
|
||||
// assetSymbol: withdrawToken?.symbol || undefined,
|
||||
// chainId: withdrawChain ? parseInt(withdrawChain) : undefined,
|
||||
// decimals: withdrawToken?.decimals || undefined,
|
||||
// isCosmosChain: false,
|
||||
// });
|
||||
|
||||
// const balanceBN = MustBigNumber(balance);
|
||||
// const newBalance =
|
||||
// // toAmountMin && withdrawToken && parseUnits(toAmountMin, withdrawToken.decimals).toString();
|
||||
@@ -158,7 +158,7 @@ export const WithdrawButtonAndReceipt = ({
|
||||
// },
|
||||
];
|
||||
|
||||
const isFormValid = !isDisabled && !isEditingSlippage && queryStatus !== 'error';
|
||||
const isFormValid = !isDisabled && !isEditingSlippage;
|
||||
|
||||
return (
|
||||
<Styled.WithReceipt
|
||||
|
||||
Reference in New Issue
Block a user