@@ -35,23 +35,26 @@ const TokenAndAmount: React.FC<ITokenAndAmount> = ({ quantity, setQuantity }) =>
35
35
const { address } = useAccount ( ) ;
36
36
const { sendingToken, setHasSufficientNativeBalance } = useNewTransactionContext ( ) ;
37
37
38
- const isNativeTransaction = sendingToken ?. address === ' native' ;
38
+ const isNativeTransaction = sendingToken ?. address === " native" ;
39
39
40
40
const { data : nativeBalance } = useBalance ( {
41
- address : isNativeTransaction ? address as `0x${string } ` : undefined ,
41
+ query : { enabled : isNativeTransaction } ,
42
+ address : isNativeTransaction ? ( address as `0x${string } `) : undefined ,
42
43
} ) ;
43
44
44
45
const { data : tokenBalance } = useReadContract ( {
45
- address : ! isNativeTransaction ? sendingToken ?. address as `0x${string } ` : undefined ,
46
+ query : { enabled : ! isNativeTransaction } ,
47
+ address : ! isNativeTransaction ? ( sendingToken ?. address as `0x${string } `) : undefined ,
46
48
abi : erc20Abi ,
47
- functionName : ' balanceOf' ,
49
+ functionName : " balanceOf" ,
48
50
args : [ address as `0x${string } `] ,
49
51
} ) ;
50
52
51
53
const { data : tokenDecimal } = useReadContract ( {
52
- address : ! isNativeTransaction ? sendingToken ?. address as `0x${string } ` : undefined ,
54
+ query : { enabled : ! isNativeTransaction } ,
55
+ address : ! isNativeTransaction ? ( sendingToken ?. address as `0x${string } `) : undefined ,
53
56
abi : erc20Abi ,
54
- functionName : ' decimals' ,
57
+ functionName : " decimals" ,
55
58
} ) ;
56
59
57
60
const [ error , setError ] = useState ( "" ) ;
@@ -89,11 +92,7 @@ const TokenAndAmount: React.FC<ITokenAndAmount> = ({ quantity, setQuantity }) =>
89
92
< AmountField quantity = { quantity } setQuantity = { setQuantity } error = { error } />
90
93
< TokenSelectorAndMaxBalance >
91
94
< TokenSelector />
92
- < MaxBalance
93
- formattedBalance = { formattedBalance }
94
- rawBalance = { balanceAmount }
95
- setQuantity = { setQuantity }
96
- />
95
+ < MaxBalance rawBalance = { balanceAmount } { ...{ setQuantity, formattedBalance } } />
97
96
</ TokenSelectorAndMaxBalance >
98
97
</ Container >
99
98
) ;
0 commit comments