From dbe752fccc4c838ebd775dfefbed828ee3bca473 Mon Sep 17 00:00:00 2001 From: Pete Watters <2938440+pete-watters@users.noreply.github.com> Date: Wed, 15 May 2024 15:37:43 +0100 Subject: [PATCH] chore: add better analytics for broadcast errors --- .../broadcast-error-dialog.tsx | 30 ------------------- .../ledger-sign-stacks-tx-container.tsx | 11 ++++++- .../send-inscription-review.tsx | 1 + .../brc20/brc20-send-form-confirmation.tsx | 4 +++ .../form/btc/btc-send-form-confirmation.tsx | 5 +++- 5 files changed, 19 insertions(+), 32 deletions(-) diff --git a/src/app/components/broadcast-error-dialog/broadcast-error-dialog.tsx b/src/app/components/broadcast-error-dialog/broadcast-error-dialog.tsx index b5f5aea193f..574a2a99a5a 100644 --- a/src/app/components/broadcast-error-dialog/broadcast-error-dialog.tsx +++ b/src/app/components/broadcast-error-dialog/broadcast-error-dialog.tsx @@ -48,33 +48,3 @@ export function BroadcastErrorDialog() { ); } -// thjis is where it fails so take a look here - -/** - * - * I tried - * - send with low fee, custom fee, high fee - * - oull out ledger while confirming - * - try medium fee? look at sentry, l;ook at this error-dialog and what sends us here and when - * - * - * Rolled back to v6.31.0 and can’t find any .address - - Barely even have any results for get(state, 'a - - Nevermind .address - - - > Pete - * - */ - -// FIRST fix routing tests https://github.com/leather-wallet/extension/actions/runs/9090696560/job/24983972564?pr=5353 - -// > try a few more things here then wrap up an investigation. I can't really see anythig happening here - -// Then after that try and clean house with some short UI stuff - -// - can I do network modal ? -// - can I do increase fee background location? -// - settings menu animations? diff --git a/src/app/features/ledger/flows/stacks-tx-signing/ledger-sign-stacks-tx-container.tsx b/src/app/features/ledger/flows/stacks-tx-signing/ledger-sign-stacks-tx-container.tsx index f0b1d9cb664..101426eb52b 100644 --- a/src/app/features/ledger/flows/stacks-tx-signing/ledger-sign-stacks-tx-container.tsx +++ b/src/app/features/ledger/flows/stacks-tx-signing/ledger-sign-stacks-tx-container.tsx @@ -7,6 +7,7 @@ import get from 'lodash.get'; import { RouteUrls } from '@shared/route-urls'; import { delay, isError } from '@shared/utils'; +import { analytics } from '@shared/utils/analytics'; import { useScrollLock } from '@app/common/hooks/use-scroll-lock'; import { appEvents } from '@app/common/publish-subscribe'; @@ -129,7 +130,15 @@ function LedgerSignStacksTxContainer() { signedTx, }); } catch (e) { - ledgerNavigate.toBroadcastErrorStep(isError(e) ? e.message : 'Unknown error'); + const error = isError(e) ? e.message : 'Unknown error'; + void analytics.track('ledger_transaction_publish_error', { + error: { + message: error, + error: e, + }, + }); + + ledgerNavigate.toBroadcastErrorStep(error); return; } }, diff --git a/src/app/pages/send/ordinal-inscription/send-inscription-review.tsx b/src/app/pages/send/ordinal-inscription/send-inscription-review.tsx index 2ecddb2c72c..69a32c50256 100644 --- a/src/app/pages/send/ordinal-inscription/send-inscription-review.tsx +++ b/src/app/pages/send/ordinal-inscription/send-inscription-review.tsx @@ -64,6 +64,7 @@ export function SendInscriptionReview() { }); }, onError(e) { + void analytics.track('broadcast_ordinal_transaction_error', { error: e }); navigate(`/${RouteUrls.SendOrdinalInscription}/${RouteUrls.SendOrdinalInscriptionError}`, { state: { error: e, diff --git a/src/app/pages/send/send-crypto-asset-form/form/brc20/brc20-send-form-confirmation.tsx b/src/app/pages/send/send-crypto-asset-form/form/brc20/brc20-send-form-confirmation.tsx index d6d176f3e5b..1298b7e1e9e 100644 --- a/src/app/pages/send/send-crypto-asset-form/form/brc20/brc20-send-form-confirmation.tsx +++ b/src/app/pages/send/send-crypto-asset-form/form/brc20/brc20-send-form-confirmation.tsx @@ -98,6 +98,10 @@ export function Brc20SendFormConfirmation() { }); }, onError(e) { + void analytics.track('broadcast_brc20_transaction_error', { + error: e, + }); + nav.toErrorPage(e); }, }); diff --git a/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form-confirmation.tsx b/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form-confirmation.tsx index 00b9fb55e04..e3b9596a687 100644 --- a/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form-confirmation.tsx +++ b/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form-confirmation.tsx @@ -138,6 +138,9 @@ export function BtcSendFormConfirmation() { ); }, onError(e) { + void analytics.track('btc_transaction_broadcast_error', { + error: e, + }); nav.toErrorPage(e); }, }); @@ -194,7 +197,7 @@ export function BtcSendFormConfirmation() { } + value={} // maybe here pete? could this crash if no address???? probablynot data-testid={SendCryptoAssetSelectors.ConfirmationDetailsRecipient} />