Skip to content

Commit

Permalink
hotfix - improve err msg for unsupported legacy address (#342)
Browse files Browse the repository at this point in the history
* improve error message

* add mainnet error message

* use regex for error message checking

* version bump
  • Loading branch information
jeremy-babylonlabs authored Jul 12, 2024
1 parent 29b7995 commit 761a4a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-staking",
"version": "0.2.10",
"version": "0.2.11",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
14 changes: 13 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,21 @@ const Home: React.FC<HomeProps> = () => {
// User cancelled the connection, hence do nothing
return;
}
let errorMessage;
switch (true) {
case /Incorrect address prefix for (Testnet \/ Signet|Mainnet)/.test(
error.message,
):
errorMessage =
"Unsupported address type detected. Please use a Native SegWit or Taproot address.";
break;
default:
errorMessage = error.message;
break;
}
showError({
error: {
message: error.message,
message: errorMessage,
errorState: ErrorState.WALLET,
errorTime: new Date(),
},
Expand Down

0 comments on commit 761a4a2

Please sign in to comment.