Skip to content

Commit

Permalink
Merge branch 'sentry'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlilley committed Oct 1, 2024
2 parents 78f46a8 + bf5c36a commit c64f281
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
3 changes: 3 additions & 0 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,7 @@ export default withSentryConfig(nextConfig, {
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,

// Disables Sentry's telemetry features
telemetry: false,
})
3 changes: 2 additions & 1 deletion apps/web/src/lib/hooks/useSimulateTrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ export function useSimulateTrade({
trade &&
typeof trade.tokenTax === 'undefined' &&
isMinOutError(error)
)
) {
return false
}
return i < 3
},
enabled:
Expand Down
25 changes: 4 additions & 21 deletions apps/web/src/ui/swap/simple/simple-swap-trade-review-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const SimpleSwapTradeReviewDialog: FC<{
trade?.tokenTax instanceof Percent
? trade.tokenTax.toPercentageString()
: trade?.tokenTax,
tx: trade.tx,
})
}, [trade, chainId])

Expand Down Expand Up @@ -151,9 +152,8 @@ export const SimpleSwapTradeReviewDialog: FC<{

try {
const ts = new Date().getTime()
const receiptPromise = client.waitForTransactionReceipt({
const promise = client.waitForTransactionReceipt({
hash,
retryCount: 30,
})

sendAnalyticsEvent(SwapEventName.SWAP_SIGNED, {
Expand All @@ -167,7 +167,7 @@ export const SimpleSwapTradeReviewDialog: FC<{
type: 'swap',
chainId: chainId,
txHash: hash,
promise: receiptPromise,
promise,
summary: {
pending: `${
isWrap ? 'Wrapping' : isUnwrap ? 'Unwrapping' : 'Swapping'
Expand Down Expand Up @@ -197,7 +197,7 @@ export const SimpleSwapTradeReviewDialog: FC<{
groupTimestamp: ts,
})

const receipt = await receiptPromise
const receipt = await promise
{
const trade = tradeRef.current
if (receipt.status === 'success') {
Expand Down Expand Up @@ -274,25 +274,9 @@ export const SimpleSwapTradeReviewDialog: FC<{

return async (confirm: () => void) => {
try {
Sentry.addBreadcrumb({
category: 'swap',
message: 'Swap execution in progress',
level: 'info',
})
await sendTransactionAsync(simulation)
// Add breadcrumb for successful swap
Sentry.addBreadcrumb({
category: 'swap',
message: 'Swap completed successfully',
level: 'info',
})
confirm()
} catch (e) {
Sentry.addBreadcrumb({
category: 'swap',
message: 'Swap failed',
level: 'error',
})
Sentry.captureException(e)
throw e
}
Expand All @@ -302,7 +286,6 @@ export const SimpleSwapTradeReviewDialog: FC<{
const { status } = useWaitForTransactionReceipt({
chainId: chainId,
hash: data,
retryCount: 30,
})

return (
Expand Down

0 comments on commit c64f281

Please sign in to comment.