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

Release/1.12.0 #1061

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Casper Wallet",
"description": "Securely manage your CSPR tokens and interact with dapps with the self-custody wallet for the Casper blockchain.",
"version": "1.11.1",
"version": "1.12.0",
"author": "MAKE LLC",
"scripts": {
"devtools:redux": "redux-devtools --hostname=localhost",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_all.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HASH=$(git rev-parse --short HEAD)

npm run build:chrome && npm run build:firefox && cd ./build && zip -r casper-wallet-1.11.1#$HASH.zip ./* && npm run build:src
npm run build:chrome && npm run build:firefox && cd ./build && zip -r casper-wallet-1.12.0#$HASH.zip ./* && npm run build:src
4 changes: 3 additions & 1 deletion src/apps/onboarding/pages/unlock-wallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Trans, useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import styled from 'styled-components';

import { PasswordDoesNotExistError } from '@src/errors';

import { UnlockWalletPageContent } from '@onboarding/pages/unlock-wallet/content';
import { RouterPath, useTypedNavigate } from '@onboarding/router';

Expand Down Expand Up @@ -39,7 +41,7 @@ export function UnlockWalletPage({ saveIsLoggedIn }: UnlockWalletPageProps) {
const passwordSaltHash = useSelector(selectPasswordSaltHash);

if (passwordHash == null || passwordSaltHash == null) {
throw Error("Password doesn't exist");
throw new PasswordDoesNotExistError();
}

const {
Expand Down
22 changes: 11 additions & 11 deletions src/apps/popup/pages/navigation-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,17 @@ export function NavigationMenuPageContent() {
}
}
]
: []),
{
id: 6,
title: t('Add watch account'),
iconPath: 'assets/icons/plus.svg',
disabled: false,
handleOnClick: () => {
closeNavigationMenu();
navigate(RouterPath.AddWatchAccount);
}
}
: [])
// {
// id: 6,
// title: t('Add watch account'),
// iconPath: 'assets/icons/plus.svg',
// disabled: false,
// handleOnClick: () => {
// closeNavigationMenu();
// navigate(RouterPath.AddWatchAccount);
// }
// }
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/apps/popup/pages/password-protection-page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ERROR_DISPLAYED_BEFORE_ATTEMPT_IS_DECREMENTED,
LOGIN_RETRY_ATTEMPTS_LIMIT
} from '@src/constants';
import { PasswordDoesNotExistError } from '@src/errors';
import { getErrorMessageForIncorrectPassword } from '@src/utils';

import {
Expand Down Expand Up @@ -66,7 +67,7 @@ export const PasswordProtectionPage = ({
ERROR_DISPLAYED_BEFORE_ATTEMPT_IS_DECREMENTED;

if (passwordHash == null || passwordSaltHash == null) {
throw Error("Password doesn't exist");
throw new PasswordDoesNotExistError();
}

const {
Expand Down
5 changes: 5 additions & 0 deletions src/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export class PasswordDoesNotExistError extends Error {
constructor() {
super("Password doesn't exist");
}
}
8 changes: 7 additions & 1 deletion src/libs/layout/error/error-boundary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { Component, ReactNode } from 'react';

import { PasswordDoesNotExistError } from '@src/errors';

import { WindowErrorPage, createErrorLocationState } from '@libs/layout';

Check warning on line 5 in src/libs/layout/error/error-boundary.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

Dependency cycle via ./error:6

interface Props {
children: ReactNode;
Expand Down Expand Up @@ -32,12 +34,16 @@
// TODO: Add localizations below
return (
<WindowErrorPage
error={this.state.error}
overrideState={createErrorLocationState({
errorHeaderText: 'Something went wrong',
errorContentText:
this.state.error?.message ||
'Please check browser console for error details, this will be a valuable for our team to fix the issue.',
errorPrimaryButtonLabel: 'Close',
errorPrimaryButtonLabel:
this.state.error instanceof PasswordDoesNotExistError
? 'Reset Wallet'
: 'Close',
errorRedirectPath: null
})}
/>
Expand Down
26 changes: 21 additions & 5 deletions src/libs/layout/error/window-page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import React from 'react';
import { NavigateFunction } from 'react-router';

import { PasswordDoesNotExistError } from '@src/errors';

import { closeCurrentWindow } from '@background/close-current-window';
import { openOnboardingUi } from '@background/open-onboarding-flow';
import { resetVault } from '@background/redux/sagas/actions';
import { dispatchToMainStore } from '@background/redux/utils';

import {
FooterButtonsContainer,
Expand All @@ -17,12 +22,14 @@ interface ErrorPageProps {
overrideState?: { state: Required<ErrorLocationState> };
createTypedNavigate?: () => NavigateFunction;
createTypedLocation?: () => Location & any;
error?: Error | null;
}

export function WindowErrorPage({
overrideState,
createTypedNavigate,
createTypedLocation
createTypedLocation,
error
}: ErrorPageProps) {
const navigate = createTypedNavigate
? createTypedNavigate()
Expand Down Expand Up @@ -50,11 +57,20 @@ export function WindowErrorPage({
<FooterButtonsContainer>
<Button
color="primaryBlue"
onClick={() =>
location?.state?.errorRedirectPath != null
onClick={async () => {
if (error instanceof PasswordDoesNotExistError) {
try {
dispatchToMainStore(resetVault());
closeCurrentWindow();
openOnboardingUi();
return;
} catch (e) {}
}

return location?.state?.errorRedirectPath != null
? navigate(location.state.errorRedirectPath)
: closeCurrentWindow()
}
: closeCurrentWindow();
}}
>
{state.errorPrimaryButtonLabel}
</Button>
Expand Down
3 changes: 2 additions & 1 deletion src/libs/layout/unlock-vault/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ERROR_DISPLAYED_BEFORE_ATTEMPT_IS_DECREMENTED,
LOGIN_RETRY_ATTEMPTS_LIMIT
} from '@src/constants';
import { PasswordDoesNotExistError } from '@src/errors';
import { getErrorMessageForIncorrectPassword } from '@src/utils';

import {
Expand Down Expand Up @@ -79,7 +80,7 @@ export const UnlockVaultPage = ({ popupLayout }: UnlockVaultPageProps) => {
ERROR_DISPLAYED_BEFORE_ATTEMPT_IS_DECREMENTED;

if (passwordHash == null || passwordSaltHash == null) {
throw Error("Password doesn't exist");
throw new PasswordDoesNotExistError();
}

const {
Expand Down
64 changes: 32 additions & 32 deletions xcode-project/Casper Wallet/Casper Wallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
2439D7D429F0757C00F07C90 /* onboarding.html in Resources */ = {isa = PBXBuildFile; fileRef = 2439D7BE29F0757C00F07C90 /* onboarding.html */; };
2439D7D529F0757C00F07C90 /* signature-request.html in Resources */ = {isa = PBXBuildFile; fileRef = 2439D7BF29F0757C00F07C90 /* signature-request.html */; };
B3867CAE2A7B038000BD01B7 /* declarative_net_request_rules.json in Resources */ = {isa = PBXBuildFile; fileRef = B3867CAC2A7B038000BD01B7 /* declarative_net_request_rules.json */; };
B3C8A9332C21AF6D006B8DA3 /* 314.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B3C8A92C2C21AF6C006B8DA3 /* 314.bundle.js */; };
B3C8A9342C21AF6D006B8DA3 /* 355.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B3C8A92D2C21AF6C006B8DA3 /* 355.bundle.js */; };
B3C8A9352C21AF6D006B8DA3 /* 83.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B3C8A92E2C21AF6C006B8DA3 /* 83.bundle.js */; };
B3C8A9362C21AF6D006B8DA3 /* 176.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B3C8A92F2C21AF6C006B8DA3 /* 176.bundle.js */; };
B3C8A9372C21AF6D006B8DA3 /* 878.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B3C8A9302C21AF6C006B8DA3 /* 878.bundle.js */; };
B3C8A9382C21AF6D006B8DA3 /* 564.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B3C8A9312C21AF6C006B8DA3 /* 564.bundle.js */; };
B3C8A9392C21AF6D006B8DA3 /* 467.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B3C8A9322C21AF6C006B8DA3 /* 467.bundle.js */; };
B39F2C712C885940002CF2B9 /* 646.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B39F2C6A2C885940002CF2B9 /* 646.bundle.js */; };
B39F2C722C885940002CF2B9 /* 652.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B39F2C6B2C885940002CF2B9 /* 652.bundle.js */; };
B39F2C732C885940002CF2B9 /* 271.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B39F2C6C2C885940002CF2B9 /* 271.bundle.js */; };
B39F2C742C885940002CF2B9 /* 812.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B39F2C6D2C885940002CF2B9 /* 812.bundle.js */; };
B39F2C752C885940002CF2B9 /* 209.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B39F2C6E2C885940002CF2B9 /* 209.bundle.js */; };
B39F2C762C885940002CF2B9 /* 63.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B39F2C6F2C885940002CF2B9 /* 63.bundle.js */; };
B39F2C772C885940002CF2B9 /* 36.bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = B39F2C702C885940002CF2B9 /* 36.bundle.js */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -109,13 +109,13 @@
2439D7BE29F0757C00F07C90 /* onboarding.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = onboarding.html; path = ../../../build/firefox/onboarding.html; sourceTree = "<group>"; };
2439D7BF29F0757C00F07C90 /* signature-request.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = "signature-request.html"; path = "../../../build/firefox/signature-request.html"; sourceTree = "<group>"; };
B3867CAC2A7B038000BD01B7 /* declarative_net_request_rules.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = declarative_net_request_rules.json; path = ../../../src/declarative_net_request_rules.json; sourceTree = "<group>"; };
B3C8A92C2C21AF6C006B8DA3 /* 314.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 314.bundle.js; path = ../../../build/firefox/314.bundle.js; sourceTree = "<group>"; };
B3C8A92D2C21AF6C006B8DA3 /* 355.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 355.bundle.js; path = ../../../build/firefox/355.bundle.js; sourceTree = "<group>"; };
B3C8A92E2C21AF6C006B8DA3 /* 83.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 83.bundle.js; path = ../../../build/firefox/83.bundle.js; sourceTree = "<group>"; };
B3C8A92F2C21AF6C006B8DA3 /* 176.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 176.bundle.js; path = ../../../build/firefox/176.bundle.js; sourceTree = "<group>"; };
B3C8A9302C21AF6C006B8DA3 /* 878.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 878.bundle.js; path = ../../../build/firefox/878.bundle.js; sourceTree = "<group>"; };
B3C8A9312C21AF6C006B8DA3 /* 564.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 564.bundle.js; path = ../../../build/firefox/564.bundle.js; sourceTree = "<group>"; };
B3C8A9322C21AF6C006B8DA3 /* 467.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 467.bundle.js; path = ../../../build/firefox/467.bundle.js; sourceTree = "<group>"; };
B39F2C6A2C885940002CF2B9 /* 646.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 646.bundle.js; path = ../../../build/firefox/646.bundle.js; sourceTree = "<group>"; };
B39F2C6B2C885940002CF2B9 /* 652.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 652.bundle.js; path = ../../../build/firefox/652.bundle.js; sourceTree = "<group>"; };
B39F2C6C2C885940002CF2B9 /* 271.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 271.bundle.js; path = ../../../build/firefox/271.bundle.js; sourceTree = "<group>"; };
B39F2C6D2C885940002CF2B9 /* 812.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 812.bundle.js; path = ../../../build/firefox/812.bundle.js; sourceTree = "<group>"; };
B39F2C6E2C885940002CF2B9 /* 209.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 209.bundle.js; path = ../../../build/firefox/209.bundle.js; sourceTree = "<group>"; };
B39F2C6F2C885940002CF2B9 /* 63.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 63.bundle.js; path = ../../../build/firefox/63.bundle.js; sourceTree = "<group>"; };
B39F2C702C885940002CF2B9 /* 36.bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = 36.bundle.js; path = ../../../build/firefox/36.bundle.js; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -194,13 +194,13 @@
2439D7A929F0757C00F07C90 /* Resources */ = {
isa = PBXGroup;
children = (
B3C8A92E2C21AF6C006B8DA3 /* 83.bundle.js */,
B3C8A92F2C21AF6C006B8DA3 /* 176.bundle.js */,
B3C8A92C2C21AF6C006B8DA3 /* 314.bundle.js */,
B3C8A92D2C21AF6C006B8DA3 /* 355.bundle.js */,
B3C8A9322C21AF6C006B8DA3 /* 467.bundle.js */,
B3C8A9312C21AF6C006B8DA3 /* 564.bundle.js */,
B3C8A9302C21AF6C006B8DA3 /* 878.bundle.js */,
B39F2C702C885940002CF2B9 /* 36.bundle.js */,
B39F2C6F2C885940002CF2B9 /* 63.bundle.js */,
B39F2C6E2C885940002CF2B9 /* 209.bundle.js */,
B39F2C6C2C885940002CF2B9 /* 271.bundle.js */,
B39F2C6A2C885940002CF2B9 /* 646.bundle.js */,
B39F2C6B2C885940002CF2B9 /* 652.bundle.js */,
B39F2C6D2C885940002CF2B9 /* 812.bundle.js */,
B3867CAC2A7B038000BD01B7 /* declarative_net_request_rules.json */,
2439D7AA29F0757C00F07C90 /* connectToApp.bundle.js */,
2439D7AB29F0757C00F07C90 /* logo16.png */,
Expand Down Expand Up @@ -321,34 +321,34 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B39F2C772C885940002CF2B9 /* 36.bundle.js in Resources */,
2439D7D429F0757C00F07C90 /* onboarding.html in Resources */,
B39F2C752C885940002CF2B9 /* 209.bundle.js in Resources */,
2439D7CB29F0757C00F07C90 /* logo64.png in Resources */,
B39F2C732C885940002CF2B9 /* 271.bundle.js in Resources */,
2439D7D229F0757C00F07C90 /* popup.bundle.js in Resources */,
B39F2C742C885940002CF2B9 /* 812.bundle.js in Resources */,
2439D7C029F0757C00F07C90 /* connectToApp.bundle.js in Resources */,
B39F2C762C885940002CF2B9 /* 63.bundle.js in Resources */,
2439D7D129F0757C00F07C90 /* assets in Resources */,
2439D7C129F0757C00F07C90 /* logo16.png in Resources */,
2439D7C729F0757C00F07C90 /* contentScript.bundle.js in Resources */,
2439D7D329F0757C00F07C90 /* logo192.png in Resources */,
2439D7C429F0757C00F07C90 /* locales in Resources */,
2439D7D029F0757C00F07C90 /* onboarding.bundle.js in Resources */,
B3C8A9352C21AF6D006B8DA3 /* 83.bundle.js in Resources */,
B3C8A9342C21AF6D006B8DA3 /* 355.bundle.js in Resources */,
2439D7C829F0757C00F07C90 /* popup.html in Resources */,
2439D7C929F0757C00F07C90 /* background.bundle.js in Resources */,
B39F2C722C885940002CF2B9 /* 652.bundle.js in Resources */,
B39F2C712C885940002CF2B9 /* 646.bundle.js in Resources */,
2439D7C529F0757C00F07C90 /* import-account-with-file.html in Resources */,
2439D7C629F0757C00F07C90 /* sdk.bundle.js in Resources */,
2439D7CD29F0757C00F07C90 /* importAccountWithFile.bundle.js in Resources */,
B3C8A9392C21AF6D006B8DA3 /* 467.bundle.js in Resources */,
B3C8A9362C21AF6D006B8DA3 /* 176.bundle.js in Resources */,
2439D7CF29F0757C00F07C90 /* manifest.json in Resources */,
B3C8A9332C21AF6D006B8DA3 /* 314.bundle.js in Resources */,
2439D7CC29F0757C00F07C90 /* signatureRequest.bundle.js in Resources */,
B3867CAE2A7B038000BD01B7 /* declarative_net_request_rules.json in Resources */,
B3C8A9382C21AF6D006B8DA3 /* 564.bundle.js in Resources */,
2439D7CA29F0757C00F07C90 /* logo128.png in Resources */,
2439D7C229F0757C00F07C90 /* connect-to-app.html in Resources */,
2439D7D529F0757C00F07C90 /* signature-request.html in Resources */,
B3C8A9372C21AF6D006B8DA3 /* 878.bundle.js in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -584,7 +584,7 @@
CODE_SIGN_ENTITLEMENTS = "Casper Wallet/Casper Wallet.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 70;
CURRENT_PROJECT_VERSION = 79;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Casper Wallet/Info.plist";
Expand All @@ -598,7 +598,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.11.1;
MARKETING_VERSION = 1.12.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand All @@ -621,7 +621,7 @@
CODE_SIGN_ENTITLEMENTS = "Casper Wallet/Casper Wallet.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 70;
CURRENT_PROJECT_VERSION = 79;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Casper Wallet/Info.plist";
Expand All @@ -635,7 +635,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.11.1;
MARKETING_VERSION = 1.12.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand Down
Loading