Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bridge-ui): filtering out BLL token failure when bridging #13969

Merged
merged 3 commits into from
Jun 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions packages/bridge-ui/src/components/BridgeForm/BridgeForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -237,24 +237,20 @@
// title (header), note (footer), icon, etc.

const headerError = '<strong>Failed to approve</strong><br />';
const noteError =
_token.symbol.toLocaleLowerCase() === 'bll'
? '<div class="mt-2 text-xs"><strong>Note</strong>: BLL token intentionally will fail 50% of the time</div>'
: '';

if (error.cause?.status === 0) {
const explorerUrl = `${$srcChain.explorerUrl}/tx/${error.cause.transactionHash}`;
const htmlLink = `<a href="${explorerUrl}" target="_blank"><b><u>here</u></b></a>`;
errorToast(
`${headerError}Click ${htmlLink} to see more details on the explorer.${noteError}`,
`${headerError}Click ${htmlLink} to see more details on the explorer.`,
true, // dismissible
);
} else if (
[error.code, error.cause?.code].includes(ethers.errors.ACTION_REJECTED)
) {
warningToast(`Transaction has been rejected.`);
} else {
errorToast(`${headerError}Try again later.${noteError}`);
errorToast(`${headerError}Try again later.`);
}
}
}
Expand Down Expand Up @@ -425,15 +421,19 @@
);
} catch (error) {
console.error(error);
Sentry.captureException(error);

const isBll = _token.symbol.toLocaleLowerCase() === 'bll';

const headerError = '<strong>Failed to bridge funds</strong><br />';
const noteError =
_token.symbol.toLocaleLowerCase() === 'bll'
? '<div class="mt-2 text-xs"><strong>Note</strong>: BLL token intentionally will fail 50% of the time</div>'
: '';
const noteError = isBll
? '<div class="mt-2 text-xs"><strong>Note</strong>: BLL token intentionally will fail 50% of the time</div>'
: '';

if (error.cause?.status === 0) {
// No need to capture this error if BLL is the one failing,
// otherwise we're gonna spam Sentry with expected errors
!isBll && Sentry.captureException(error);

const explorerUrl = `${$srcChain.explorerUrl}/tx/${error.cause.transactionHash}`;
const htmlLink = `<a href="${explorerUrl}" target="_blank"><b><u>here</u></b></a>`;
errorToast(
Expand All @@ -445,6 +445,9 @@
) {
warningToast(`Transaction has been rejected.`);
} else {
// Do not capture if it's BLL. It's expected.
!isBll && Sentry.captureException(error);

errorToast(`${headerError}Try again later.${noteError}`);
}
}
Expand Down