Skip to content

Commit

Permalink
Merge 573744e into 4c85760
Browse files Browse the repository at this point in the history
  • Loading branch information
pbca26 authored Jan 24, 2022
2 parents 4c85760 + 573744e commit 758fa9b
Show file tree
Hide file tree
Showing 30 changed files with 1,006 additions and 254 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Supported browsers
Current version is tested to work in Chrome. Other browser like Opera or Firefox might not work well in WEB USB mode.

Also, you can consult with this page to see if your browser is capable to commuicate with Ledger/Trezor device [U2F](https://caniuse.com/#feat=u2f), [WEBUSB](https://caniuse.com/#feat=webusb).
Also, you can consult with this page to see if your browser is capable to commuicate with Ledger/Trezor device [WEBUSB](https://caniuse.com/#feat=webusb).

## Usage on Ledger

Expand Down
25 changes: 18 additions & 7 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ const {createAdapter} = require('iocane');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;
let pw;

function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
width: 1024,
height: 768,
webPreferences: {
nativeWindowOpen: true, // <-- important for trezor
nodeIntegration: true,
Expand All @@ -36,6 +37,7 @@ function createWindow() {
},
});

// TODO: refactor
require("@electron/remote/main").enable(mainWindow.webContents);

require(path.join(__dirname, 'menu'));
Expand All @@ -57,7 +59,7 @@ function createWindow() {
{ role: 'selectall' },
]);

const decodeStoredData = (str, pw) => {
const decodeStoredData = (str/*, pw*/) => {
return new Promise((resolve, reject) => {
if (str.length) {
createAdapter()
Expand All @@ -76,7 +78,7 @@ function createWindow() {
});
};

const encodeStoredData = (str, pw) => {
const encodeStoredData = (str/*, pw*/) => {
return new Promise((resolve, reject) => {
createAdapter()
.encrypt(str, pw)
Expand All @@ -90,6 +92,13 @@ function createWindow() {
});
};

const getPW = () => {
return pw;
};
const setPW = (_pw) => {
pw = _pw;
};

global.app = {
isDev,
noFWCheck: true,
Expand All @@ -98,6 +107,8 @@ function createWindow() {
helpers: {
decodeStoredData,
encodeStoredData,
getPW,
setPW,
},
};

Expand All @@ -124,7 +135,7 @@ function createWindow() {
});

// Emitted when the window is closed.
mainWindow.on('closed', function() {
mainWindow.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
Expand All @@ -142,15 +153,15 @@ function createWindow() {
app.on('ready', createWindow);

// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin' || isDev) {
app.quit();
}
});

app.on('activate', function() {
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
Expand Down
6 changes: 3 additions & 3 deletions electron/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "hw-kmd-wallet-electron",
"version": "0.2.9",
"version": "0.3.1",
"description": "Komodo Hardware Wallet Electron App",
"main": "main.js",
"scripts": {
Expand All @@ -23,10 +23,10 @@
"author": "Komodo Platform",
"license": "MIT",
"devDependencies": {
"electron": "^15.2.0",
"electron": "15.3.5",
"electron-builder": "22.13.1",
"electron-devtools-installer": "^3.2.0",
"electron-rebuild": "^3.2.3"
"electron-rebuild": "3.2.3"
},
"dependencies": {
"@electron/remote": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hw-kmd-wallet",
"version": "0.2.9",
"version": "0.3.1",
"author": "Luke Childs <[email protected]> (http://lukechilds.co.uk), Komodo Platform (https://komodoplatform.com)",
"repository": "pbca26/hw-kmd-wallet",
"homepage": "https://pbca26.github.io/hw-kmd-wallet",
Expand Down
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 26 additions & 3 deletions src/AboutModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import {
repository,
version,
} from '../package.json';
import {
isElectron,
shell,
} from './Electron';
//import './AboutModal.scss';

class AboutModal extends React.Component {
Expand All @@ -28,11 +32,30 @@ class AboutModal extends React.Component {
});
}

renderLink(href, title) {
return (
<React.Fragment>
{isElectron &&
<a onClick={() => shell.openExternal(href)}>{title}</a>
}
{!isElectron &&
<a
target="_blank"
rel="noopener noreferrer"
href={href}>{title}</a>
}
</React.Fragment>
);
}

render() {
return (
<React.Fragment>
<li onClick={() => this.open()}>
<i className="fa fa-copyright"></i>
{this.props.sidebarSize === 'full' &&
<span className="sidebar-item-title">About</span>
}
</li>
<Modal
title="About"
Expand All @@ -41,12 +64,12 @@ class AboutModal extends React.Component {
isCloseable={true}
className="Modal-about">
<p>
<strong>KMD hardware wallet</strong> by <a target="_blank" rel="noopener noreferrer" href="https://github.com/atomiclabs">Atomic Labs</a> and <a target="_blank" rel="noopener noreferrer" href="https://github.com/komodoplatform">Komodo Platform</a>.
<strong>KMD hardware wallet</strong> by {this.renderLink('https://github.com/atomiclabs', 'Atomic Labs')} and {this.renderLink('https://github.com/komodoplatform', 'Komodo Platform')}.
</p>
<p>
The <a target="_blank" rel="noopener noreferrer" href={`https://github.com/${repository}`}>source code</a> is licensed under <a target="_blank" rel="noopener noreferrer" href={`https://github.com/${repository}/blob/master/LICENSE`}>MIT</a>.
The {this.renderLink(`https://github.com/${repository}`, 'source code')} is licensed under {this.renderLink(`https://github.com/${repository}/blob/master/LICENSE`, 'MIT')}.
<br />
View the <a target="_blank" rel="noopener noreferrer" href={`https://github.com/${repository}#usage`}>README</a> for usage instructions.
View the {this.renderLink(`https://github.com/${repository}#usage`, 'README')} for usage instructions.
</p>
</Modal>
</React.Fragment>
Expand Down
18 changes: 15 additions & 3 deletions src/Accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import './Account.scss';
import {
isElectron,
appData,
shell,
} from './Electron';
import {writeLog} from './Debug';
import {getLocalStorageVar} from './lib/localstorage-util';
import coinsList from './lib/coins';

class Account extends React.Component {
state = this.initialState;
Expand Down Expand Up @@ -155,6 +157,18 @@ const Accounts = ({
</table>
</div>
</div>
{coinsList[activeCoin].airdrop &&
<div className="accounts-airdop-helper-link">
{isElectron &&
<a onClick={() => shell.openExternal('https://github.com/pbca26/hw-kmd-wallet/wiki/How-to-use-address-discovery-options-to-claim-airdrop-coins')}>Unable to find airdrop coins?</a>
}
{!isElectron &&
<a
target="_blank"
href="https://github.com/pbca26/hw-kmd-wallet/wiki/How-to-use-address-discovery-options-to-claim-airdrop-coins">Unable to find airdrop coins?</a>
}
</div>
}
{activeCoin === 'KMD' &&
activeAccount !== null &&
coins[activeCoin].accounts[activeAccount].balance > 0 &&
Expand All @@ -163,7 +177,6 @@ const Accounts = ({
{coins[activeCoin].accounts[activeAccount].claimableAmount > 0 &&
<ClaimRewardsButton
account={coins[activeCoin].accounts[activeAccount]}
handleRewardClaim={this.handleRewardClaim}
vendor={vendor}
balance={coins[activeCoin].accounts[activeAccount].balance}
syncData={syncData}
Expand All @@ -180,8 +193,7 @@ const Accounts = ({
<Transactions
accounts={coins[activeCoin].accounts.filter((acc) => acc.enabled)}
activeAccount={activeAccount}
coin={activeCoin}
/>
coin={activeCoin} />
</div>
);

Expand Down
8 changes: 8 additions & 0 deletions src/AddCoinModal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,12 @@
}
}
}

.switch {
margin: 7px 0 10px 20px;
}

.select-coin-airdrop-settings {
padding-bottom: 20px;
}
}
Loading

0 comments on commit 758fa9b

Please sign in to comment.