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

[WIP] Update Electron dependancy (LEGACY) #3363

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e20faac
Updated Electron and patched api usage
409H Jul 14, 2020
45a5c0a
Fixed ts error
409H Jul 28, 2020
454dcdc
Update some dependencies
FrederikBolding Aug 3, 2020
89bf2a1
Update dependancys to run electron7
409H Aug 11, 2020
eb1bcc8
Bumped electron updater for smooother build
409H Aug 11, 2020
356402b
Update node version for CI
FrederikBolding Aug 12, 2020
021d623
Fix some TS issues
FrederikBolding Aug 12, 2020
f559093
Bumped node-sass
FrederikBolding Aug 12, 2020
0475325
Fix more TS issues
FrederikBolding Aug 12, 2020
f24b72f
Update yarn.lock
FrederikBolding Aug 20, 2020
b31321a
Fix issues with toChecksumAddress
FrederikBolding Aug 20, 2020
526e061
Fix a buffer issue
FrederikBolding Aug 20, 2020
68e5604
Fix most TSC errors & fix jest
Mrtenz Aug 28, 2020
1df2022
Fix remaining Jest/TS issues
Mrtenz Sep 8, 2020
767c332
Fix hexEncodeData function
Mrtenz Sep 8, 2020
27228d4
Get Electron running again
Mrtenz Sep 8, 2020
7fef639
Fix package.json
Mrtenz Sep 8, 2020
bb150d7
Merge branch 'legacy' into security/update_electron
Mrtenz Sep 8, 2020
af0d2ff
Fix yarn.lock
Mrtenz Sep 8, 2020
df2454a
Downgrade Electron to v9
Mrtenz Sep 24, 2020
65e966e
Fix issue with private keys
Mrtenz Sep 24, 2020
370e4ff
Disable build for 32bit windows
409H Nov 3, 2020
f38771b
Added explicitly the eth-enclave to connect-src csp
409H Nov 9, 2020
2bd0c16
Fix csp error for enclave
409H Nov 9, 2020
22fdcf0
Fix issue with contract abi being null|undefined
409H Jan 5, 2021
662c28b
Potentially fix signing and sending transactions
Mrtenz Jan 5, 2021
3e28206
Fix Ledger and Trezor
Mrtenz Jan 5, 2021
f364396
Fix sending with Ledger
Mrtenz Jan 6, 2021
3b72b38
Update ledger dependency to latest
409H Jan 6, 2021
a0734a7
Bump Node version
Mrtenz Jan 6, 2021
c62ea76
Bump Ledger libs
Mrtenz Jan 6, 2021
2649440
Replace webapp-webpack-plugin
Mrtenz Jan 7, 2021
1c1051a
Bump version
409H Jan 7, 2021
dc63a15
Once again fix Ledger
Mrtenz Jan 11, 2021
c979ecf
Fix node version in GitHub workflow
Mrtenz Jan 11, 2021
34ee15a
Attempt to use Electron v10
Mrtenz Jan 11, 2021
d33da1f
Remove node-gyp dependency
Mrtenz Jan 16, 2021
467a573
Add libudev to CI
Mrtenz Jan 17, 2021
b1319c4
Fix yarn.lock
Mrtenz Jan 17, 2021
57e7790
Fixed for keystore generation and unlocking
409H Jan 26, 2021
ee8d40f
Fixed Trezor pin popup for non-touchscreen Trezor hardware
409H Mar 11, 2021
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
51 changes: 33 additions & 18 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
{
"presets": [
"@babel/preset-react",
"@babel/preset-typescript",
[
"@babel/preset-env",
{
"modules": false
}
]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-syntax-dynamic-import",
"react-hot-loader/babel"
]
}
{
"presets": [
"@babel/preset-react",
"@babel/preset-typescript",
[
"@babel/preset-env",
{
"modules": false
}
]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-syntax-dynamic-import",
"react-hot-loader/babel"
],
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"modules": "commonjs",
"targets": {
"node": "current"
}
}
]
]
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Specify node version
uses: actions/setup-node@v1
with:
node-version: '8.16.0'
node-version: '10.22.0'

- name: Cache depedendencies
id: cache
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ package-lock.json
.wwp-cache

# MacOSX
.DS_Store
.DS_Store

.env
3 changes: 1 addition & 2 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
v8.16.0

v10.22.0
1 change: 1 addition & 0 deletions common/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ const LegacyRoutes = withRouter(props => {
});

const CaptureRouteNotFound = withRouter(({ children, location }) => {
// @ts-ignore
return location && location.state && location.state.error ? (
<PageNotFound />
) : (
Expand Down
2 changes: 1 addition & 1 deletion common/components/LogOutPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ export default connect(
resetWallet: walletActions.resetWallet,
web3UnsetNode: configNodesStaticActions.web3UnsetNode
}
)(withRouter<Props>(LogOutPromptClass));
)(withRouter(LogOutPromptClass));
2 changes: 1 addition & 1 deletion common/components/NavigationLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ class NavigationLinkClass extends React.PureComponent<Props, {}> {
}

// withRouter is a HOC which provides NavigationLink with a react-router location prop
export default withRouter<Props>(NavigationLinkClass);
export default withRouter(NavigationLinkClass);
2 changes: 1 addition & 1 deletion common/components/WalletDecrypt/WalletDecrypt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const MISC_WALLETS = Object.values(MiscWalletName);

const web3info = getWeb3ProviderInfo();

const WalletDecrypt = withRouter<Props>(
const WalletDecrypt = withRouter(
class WalletDecryptClass extends Component<RouteComponentProps<{}> & Props, State> {
// https://github.com/Microsoft/TypeScript/issues/13042
// index signature should become [key: Wallets] (from config) once typescript bug is fixed
Expand Down
4 changes: 3 additions & 1 deletion common/components/WalletDecrypt/components/Mnemonic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class MnemonicDecryptClass extends PureComponent<Props, State> {
/>
</div>
<div className="form-group">
<p>{translate('ADD_LABEL_8')} <MnemonicPasswordSaltWarning /></p>
<p>
{translate('ADD_LABEL_8')} <MnemonicPasswordSaltWarning />
</p>
<Input
isValid={true}
showValidAsPlain={true}
Expand Down
2 changes: 1 addition & 1 deletion common/components/renderCbs/Query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interface Query {
[key: string]: string;
}

export const Query = withRouter<Props>(
export const Query = withRouter(
class extends React.Component<Props, {}> {
public render() {
const { withQuery, params, location } = this.props;
Expand Down
2 changes: 1 addition & 1 deletion common/components/ui/DateTime/DateTime.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import moment from 'moment';
import moment from 'moment-timezone';
import CalendarContainer from './CalendarContainer';
import TimeView from './TimeView';
import { ClickableWrapper } from './ClickableWrapper';
Expand Down
4 changes: 2 additions & 2 deletions common/components/ui/Warning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ interface WarningProps {

const Warning: React.SFC<WarningProps> = ({ highlighted, children }) => {
const className = `Warning ${highlighted ? 'highlighted' : ''}`;
const addMarginTop = isDesktop() ? 0 : "1em"; //Add extra margin to fix a small CSS issue of the warning being too close to the Banner
const addMarginTop = isDesktop() ? 0 : '1em'; //Add extra margin to fix a small CSS issue of the warning being too close to the Banner

return (
<section className={className} style={{'marginTop': addMarginTop}}>
<section className={className} style={{ marginTop: addMarginTop }}>
<section className="Warning-icon">
<i className="fa fa-exclamation-triangle" />
</section>
Expand Down
4 changes: 2 additions & 2 deletions common/config/addressMessages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toChecksumAddress } from 'ethereumjs-util';
import { toChecksumAddress, addHexPrefix } from 'ethereumjs-util';

export interface AddressMessage {
msg: string;
Expand Down Expand Up @@ -189,6 +189,6 @@ export const ADDRESS_MESSAGES: { [key: string]: AddressMessage } = {

export function getAddressMessage(address: string): AddressMessage | undefined {
const lowerAddr = address.toLowerCase();
const checksumAddr = toChecksumAddress(address);
const checksumAddr = toChecksumAddress(addHexPrefix(address));
return ADDRESS_MESSAGES[lowerAddr] || ADDRESS_MESSAGES[checksumAddr];
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Option } from 'react-select';
import moment from 'moment';
import 'moment-timezone';
import moment from 'moment-timezone';

import translate from 'translations';
import { scheduleActions, scheduleSelectors } from 'features/schedule';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
transactionSelectors
} from 'features/transaction';
import * as derivedSelectors from 'features/selectors';
import { TxObj } from 'mycrypto-shepherd/dist/lib/types';
import { TxObj } from 'mycrypto-shepherd/src/types';
import './SchedulingModals.scss';

interface Props {
Expand Down
6 changes: 3 additions & 3 deletions common/features/deterministicWallets/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export function* getDeterministicWalletsSaga(
// if pubKey & chainCode present, treat as HW wallet

if (seed) {
hdk = HDKey.fromMasterSeed(new Buffer(seed, 'hex'));
hdk = HDKey.fromMasterSeed(Buffer.from(seed, 'hex'));
pathBase = dPath;
} else if (publicKey && chainCode) {
hdk = new HDKey();
hdk.publicKey = new Buffer(publicKey, 'hex');
hdk.chainCode = new Buffer(chainCode, 'hex');
hdk.publicKey = Buffer.from(publicKey, 'hex');
hdk.chainCode = Buffer.from(chainCode, 'hex');
pathBase = 'm';
} else {
return;
Expand Down
8 changes: 4 additions & 4 deletions common/features/domainResolution/common/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SagaIterator } from 'redux-saga';
import { select, apply, call } from 'redux-saga/effects';
import ethUtil from 'ethereumjs-util';
import { addHexPrefix, keccak256 } from 'ethereumjs-util';

import { INode } from 'libs/nodes/INode';
import ENS from 'libs/ens/contracts';
Expand Down Expand Up @@ -110,9 +110,9 @@ export function* resolveEndDomainRequest(name: string): SagaIterator {
const nameHash: string = getNameHash(`${lowercaseName}.${ensTLD}`);

if (splitName.length === 2) {
hash = ethUtil.sha3(splitName[1]);
hash = keccak256(Buffer.from(splitName[1]));
} else {
hash = ethUtil.sha3(splitName[0]);
hash = keccak256(Buffer.from(splitName[0]));
}
const domainData: typeof ENS.auction.entries.outputType = yield call(makeEthCallAndDecode, {
to: ensAddresses.public.ethAuction,
Expand Down Expand Up @@ -144,7 +144,7 @@ export function* resolveEndDomainRequest(name: string): SagaIterator {
name,
...domainData,
...result,
labelHash: ethUtil.addHexPrefix(hash.toString('hex')),
labelHash: addHexPrefix(hash.toString('hex')),
nameHash
};
return returnValue;
Expand Down
3 changes: 1 addition & 2 deletions common/features/schedule/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import moment from 'moment';
import 'moment-timezone';
import moment from 'moment-timezone';
import BN from 'bn.js';

import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
Expand Down
2 changes: 1 addition & 1 deletion common/features/transaction/fields/sagas.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Fields Saga', () => {
};

describe('handleDataInput*', () => {
const payload = 'payload';
const payload = '0xf00f00';
const action: any = { payload };
const validData = true;

Expand Down
2 changes: 1 addition & 1 deletion common/features/transaction/meta/sagas.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Meta Sagas', () => {
const tokenValue: any = {
value: 'value2'
};
const data: any = 'data';
const data: any = '0x1234';

const gens: any = {};
gens.gen = cloneableGenerator(sagas.handleTokenTo)(action);
Expand Down
48 changes: 5 additions & 43 deletions common/features/wallet/__snapshots__/sagas.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,7 @@ Object {
"@@redux-saga/IO": true,
"PUT": Object {
"action": Object {
"payload": Wallet {
"_privKey": Object {
"data": Array [
139,
203,
68,
86,
239,
3,
86,
206,
6,
44,
133,
124,
239,
221,
62,
209,
186,
180,
84,
50,
207,
118,
214,
213,
52,
8,
153,
207,
208,
247,
2,
232,
],
"type": "Buffer",
},
"_pubKey": undefined,
"payload": Promise {
"signMessage": [Function],
"signRawTransaction": [Function],
"unlock": [Function],
Expand All @@ -61,7 +23,7 @@ Object {
"PUT": Object {
"action": Object {
"payload": Wallet {
"_privKey": Object {
"privateKey": Object {
"data": Array [
49,
233,
Expand Down Expand Up @@ -98,7 +60,7 @@ Object {
],
"type": "Buffer",
},
"_pubKey": undefined,
"publicKey": undefined,
"signMessage": [Function],
"signRawTransaction": [Function],
"unlock": [Function],
Expand All @@ -116,7 +78,7 @@ Object {
"PUT": Object {
"action": Object {
"payload": Wallet {
"_privKey": Object {
"privateKey": Object {
"data": Array [
49,
233,
Expand Down Expand Up @@ -153,7 +115,7 @@ Object {
],
"type": "Buffer",
},
"_pubKey": undefined,
"publicKey": undefined,
"signMessage": [Function],
"signRawTransaction": [Function],
"unlock": [Function],
Expand Down
2 changes: 1 addition & 1 deletion common/features/wallet/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function unlockWeb3(): types.UnlockWeb3Action {
}

export type TSetWallet = typeof setWallet;
export function setWallet(value: IWallet): types.SetWalletAction {
export function setWallet(value: IWallet | null): types.SetWalletAction {
return {
type: types.WalletActions.SET,
payload: value
Expand Down
6 changes: 3 additions & 3 deletions common/features/wallet/sagas.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { apply, call, fork, put, select, take, cancel } from 'redux-saga/effects';
import { cloneableGenerator, createMockTask } from 'redux-saga/utils';
import { IFullWallet, IV3Wallet, fromV3 } from 'ethereumjs-wallet';
import Wallet from 'ethereumjs-wallet';

import { translateRaw } from 'translations';
import configuredStore from 'features/store';
Expand Down Expand Up @@ -46,7 +46,7 @@ const token2: Token = {
};
const tokens = [token1, token2];

const utcKeystore: IV3Wallet = {
const utcKeystore = {
version: 3,
id: 'cb788af4-993d-43ad-851b-0d2031e52c61',
address: '25a24679f35e447f778cf54a3823facf39904a63',
Expand Down Expand Up @@ -241,7 +241,7 @@ describe('unlockKeystore*', () => {

//keystore in this case decrypts quickly, so use fromV3 in ethjs-wallet to avoid testing with promises
it('should call stopLoadingSpinner', () => {
const mockWallet: IFullWallet = fromV3(action.payload.file, action.payload.password, true);
const mockWallet = Wallet.fromV3(action.payload.file, action.payload.password, true);
expect(gen.next(mockWallet).value).toEqual(call(sagas.stopLoadingSpinner, mockTask));
});

Expand Down
2 changes: 1 addition & 1 deletion common/features/wallet/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface UnlockWeb3Action {

export interface SetWalletAction {
type: WalletActions.SET;
payload: IWallet;
payload: IWallet | null;
}

export interface ResetWalletAction {
Expand Down
5 changes: 2 additions & 3 deletions common/libs/ens/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import uts46 from 'idna-uts46';
import ethUtil from 'ethereumjs-util';
import { keccak256 } from 'ethereumjs-util';

export function normalise(name: string): string {
try {
Expand All @@ -15,11 +15,10 @@ export const getNameHash = (name: string = ''): string => {
}

const normalizedName = normalise(name);
const sha3 = ethUtil.sha3;
const labels = normalizedName.split('.');
const emptyNode = Buffer.alloc(32);
const rawNode = labels.reduceRight((node, currentLabel) => {
return sha3(Buffer.concat([node, sha3(currentLabel)]));
return keccak256(Buffer.concat([node, keccak256(Buffer.from(currentLabel))]));
}, emptyNode);

return `0x${rawNode.toString('hex')}`;
Expand Down
Loading