Skip to content

Commit

Permalink
chore: handle null price impact in useZap
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMasayoshi committed Jan 21, 2025
1 parent d2b6682 commit 0c2e6c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/web/src/lib/hooks/useZap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ export const useZap = ({ query, ...params }: UseZapParams) => {
throw new Error(`Error: ${response.statusText}`)
}

return zapResponseSchema.parse(await response.json())
const parsed = zapResponseSchema.parse(await response.json())

if (parsed.priceImpact === null) throw new Error('priceImpact is NULL')

return parsed
},
staleTime: query?.staleTime ?? 1000 * 60 * 1, // 1 minutes
enabled:
Expand Down

0 comments on commit 0c2e6c7

Please sign in to comment.