11import { useAtom , useAtomValue , useSetAtom } from 'jotai'
22import { useCallback , useEffect } from 'react'
3- import { Address , erc20Abi } from 'viem'
3+ import { Address , erc20Abi , Hex } from 'viem'
4+ import { mainnet } from 'viem/chains'
45import { useSendTransaction , useWaitForTransactionReceipt } from 'wagmi'
56import useContractWrite from '../../hooks/useContractWrite'
67import useWatchTransaction from '../../hooks/useWatchTransaction'
@@ -9,6 +10,7 @@ import { formatCurrency } from '../../utils/format'
910import {
1011 useTrackIndexDTFZap ,
1112 useTrackIndexDTFZapClick ,
13+ useTrackIndexDTFZapError ,
1214} from '../../utils/tracking'
1315import FusionTokenLogo from '../fusion-token-logo'
1416import TransactionButton , {
@@ -27,7 +29,6 @@ import {
2729import ZapDustWarningCheckbox from './zap-dust-warning-checkbox'
2830import ZapErrorMsg , { ZapTxErrorMsg } from './zap-error-msg'
2931import ZapPriceImpactWarningCheckbox from './zap-warning-checkbox'
30- import { mainnet } from 'viem/chains'
3132
3233const LoadingButton = ( {
3334 fetchingZapper,
@@ -169,7 +170,7 @@ const SubmitZapButton = ({
169170
170171 setInputAmountCached ( inputAmount )
171172 sendTransaction ( {
172- data : tx . data as Address ,
173+ data : tx . data as Hex ,
173174 gas : BigInt ( gas ?? 0 ) * multiplier || undefined ,
174175 to : tx . to as Address ,
175176 value : BigInt ( tx . value ) ,
@@ -180,8 +181,6 @@ const SubmitZapButton = ({
180181 readyToSubmit ,
181182 inputAmount ,
182183 gas ,
183- tx ?. to ,
184- tx ?. value ,
185184 chainId ,
186185 setInputAmountCached ,
187186 sendTransaction ,
@@ -222,6 +221,13 @@ const SubmitZapButton = ({
222221 setOngoingTx ,
223222 ] )
224223
224+ useTrackIndexDTFZapError ( {
225+ tokenIn : tokenIn ,
226+ tokenOut : tokenOut ,
227+ zapError : error ?. message ?. split ( '\n' ) [ 0 ] || error ?. name || '' ,
228+ source,
229+ } )
230+
225231 return (
226232 < div className = "flex flex-col gap-1" >
227233 < ZapPriceImpactWarningCheckbox priceImpact = { truePriceImpact } />
0 commit comments