Skip to content

Commit

Permalink
Merge pull request #480 from HathorNetwork/dev
Browse files Browse the repository at this point in the history
Release v0.23.1-rc3
  • Loading branch information
r4mmer authored Jan 9, 2024
2 parents 3d2824f + 43a879d commit c50b515
Show file tree
Hide file tree
Showing 34 changed files with 1,134 additions and 878 deletions.
1,091 changes: 689 additions & 402 deletions locale/texts.pot

Large diffs are not rendered by default.

233 changes: 124 additions & 109 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"productName": "Hathor Wallet",
"description": "Light wallet for Hathor Network",
"author": "Hathor Labs <[email protected]> (https://hathor.network/)",
"version": "0.27.1-rc2",
"version": "0.27.1-rc3",
"private": true,
"dependencies": {
"@hathor/wallet-lib": "1.0.2",
"@ledgerhq/hw-transport-node-hid": "6.27.1",
"@hathor/wallet-lib": "1.0.4",
"@ledgerhq/hw-transport-node-hid": "6.28.1",
"@sentry/electron": "3.0.7",
"babel-polyfill": "6.26.0",
"bootstrap": "4.6.1",
Expand Down Expand Up @@ -108,7 +108,9 @@
},
"mac": {
"provisioningProfile": "keys/mac_production.provisionprofile",
"notarize": { "teamId": "TEAM-ID-HERE" },
"notarize": {
"teamId": "TEAM-ID-HERE"
},
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "build/entitlements.mac.plist",
Expand Down
2 changes: 1 addition & 1 deletion public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (process.platform === 'darwin') {
}

const appName = 'Hathor Wallet';
const walletVersion = '0.27.1-rc2';
const walletVersion = '0.27.1-rc3';

const debugMode = (
process.argv.indexOf('--unsafe-mode') >= 0 &&
Expand Down
31 changes: 24 additions & 7 deletions public/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ class Ledger {
this.subscriptor = Transport.listen({
next: e => {
if (e.type === 'add') {
console.log(`Device detected: ${e.deviceModel?.id}`);
// We get this event when any app is opened on Ledger (Bitcoin, Ethereum, Hathor, etc). We have
// the getVersion call next to make sure we're on the Hathor app.
this.getVersion();
} else if (e.type === 'remove') {
console.log(`Device removed: ${e.deviceModel?.id}`);
// This is called in some situations
// - Usb disconnected
// - When user quits an app
Expand All @@ -134,7 +136,10 @@ class Ledger {
}
}
},
error: error => {},
error: error => {
console.log('Error communicating with device');
console.log(error);
},
complete: () => {}
})

Expand Down Expand Up @@ -175,12 +180,22 @@ class Ledger {

const { command, p1, p2, data, resolve, reject } = this.sendQueue.shift();
this.getTransport()
.then(transport => transport.send(ledgerCLA, command, p1, p2, data))
.then((response) => { resolve(response) }, (error) => { reject(error) })
.then(transport => {
console.log(`Sending to ledger ${command} ${p1} ${p2}`);
return transport.send(ledgerCLA, command, p1, p2, data);
})
.then((response) => {
console.log(`Got response ${response.toString('hex')}`);
resolve(response);
}, (error) => {
console.log(error);
reject(error);
})
.finally(() => {
// When done, check the queue again
this.checkSendQueue();
});
console.log('Finished sending command, will retry queue');
// When done, check the queue again
this.checkSendQueue();
});
}

/**
Expand All @@ -190,7 +205,7 @@ class Ledger {
* @return {Promise} Promise resolved when there's a response from Ledger
*/
sendToQueue = (command, p1, p2, data) => {
console.log('sending to Ledger:', command, p1, p2);
console.log('sending to queue:', command, p1, p2);
const promise = new Promise((resolve, reject) => {
const element = {
command,
Expand Down Expand Up @@ -240,6 +255,8 @@ class Ledger {
this.transport.decorateAppAPIMethods(this, this.methods, "HTR");
resolve(transport);
}, (e) => {
console.log('Error creating transport');
console.log(e);
reject(Ledger.parseLedgerError(e));
});
});
Expand Down
11 changes: 11 additions & 0 deletions public/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ process.once('loaded', () => {
// Set closed in localStorage, so user does not open in the wallet page
localStorage.setItem('localstorage:closed', 'true');

const accessDataRaw = localStorage.getItem('localstorage:accessdata');
if (accessDataRaw) {
// check if the access data is from a hardware wallet, if so we need to remove it
// This ensures that a previously closed hardware wallet will not be loaded again
// unless the device is connected
const accessData = JSON.parse(accessDataRaw);
if ((accessData?.walletFlags & 0x02) > 0) {
localStorage.removeItem('localstorage:accessdata');
}
}

// Sending to main process the information about systray message
const systrayMessageChecked = JSON.parse(localStorage.getItem('wallet:systray_message_checked')) === true;
ipcRenderer.send('systray_message:check', systrayMessageChecked);
Expand Down
14 changes: 7 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ class Root extends React.Component {
<StartedRoute exact path="/signin" component={Signin} loaded={false} />
<StartedRoute exact path="/hardware_wallet" component={StartHardwareWallet} loaded={false} />
<NavigationRoute exact path="/locked" component={LockedWallet} />
<Route exact path="/welcome" component={Welcome} />
<Route exact path="/loading_addresses" component={LoadingAddresses} />
<Route exact path="/permission" component={SentryPermission} />
<Route exact path="/welcome" children={<Welcome />} />
<Route exact path="/loading_addresses" children={<LoadingAddresses />} />
<Route exact path="/permission" children={<SentryPermission />} />
<StartedRoute exact path="" component={Wallet} loaded={true} />
<Route path="" component={Page404} />
<Route path="" children={<Page404 />} />
</Switch>
)
}
Expand All @@ -173,7 +173,7 @@ const returnLoadedWalletComponent = (Component, props) => {
const isServerScreen = props.match.path === '/server';

// If was closed and is loaded we need to redirect to locked screen
if ((!isServerScreen) && (LOCAL_STORE.wasClosed() || LOCAL_STORE.isLocked())) {
if ((!isServerScreen) && (LOCAL_STORE.wasClosed() || LOCAL_STORE.isLocked()) && (!LOCAL_STORE.isHardwareWallet())) {
return <Redirect to={{ pathname: '/locked/' }} />;
}

Expand Down Expand Up @@ -250,7 +250,7 @@ const returnStartedRoute = (Component, props, rest) => {
// the locked screen since the wallet would not be able to be started otherwise
const isServerScreen = props.match.path === '/server';
// Wallet is locked, go to locked screen
if (LOCAL_STORE.isLocked() && !isServerScreen) {
if (LOCAL_STORE.isLocked() && !isServerScreen && !LOCAL_STORE.isHardwareWallet()) {
return <Redirect to={{pathname: '/locked/'}}/>;
}

Expand Down Expand Up @@ -319,7 +319,7 @@ const returnDefaultComponent = (Component, props) => {
<div className='component-div h-100'>
<Navigation {...props}/>
<Component {...props} />
<RequestErrorModal {...props} />
<RequestErrorModal />
</div>
);
}
Expand Down
22 changes: 11 additions & 11 deletions src/components/BackButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@

import React from 'react';
import { t } from 'ttag';
import { useHistory } from 'react-router-dom';


/**
* Component that adds a left arrow and a link to go back one page
*
* @memberof Components
*/
class BackButton extends React.Component {
function BackButton() {
const history = useHistory();

/**
* Called when link is clicked and goes back one page
*
* @param {Object} e Event emitted when link is clicked
*/
goBack = (e) => {
const goBack = (e) => {
e.preventDefault();
this.props.history.goBack();
history.goBack();
}

render = () => {
return (
<div className="d-flex flex-row align-items-center back-div mb-3">
<i className="fa fa-long-arrow-left mr-2" />
<a href="true" onClick={(e) => this.goBack(e)}>{t`Back`}</a>
</div>
)
}
return (
<div className="d-flex flex-row align-items-center back-div mb-3">
<i className="fa fa-long-arrow-left mr-2" />
<a href="true" onClick={(e) => goBack(e)}>{t`Back`}</a>
</div>
)
}

export default BackButton;
Loading

0 comments on commit c50b515

Please sign in to comment.