Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
gabmontes committed Jun 26, 2019
2 parents 0716f83 + 2a73ba1 commit fa256d7
Show file tree
Hide file tree
Showing 19 changed files with 3,155 additions and 2,121 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ ppa/metronome-desktop-walle*
.eslintcache

# Certificates
*.p12
*.p12
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ for:
build_script:
- npm run env
- npm run release

skip_tags: true
5,033 changes: 2,975 additions & 2,058 deletions package-lock.json

Large diffs are not rendered by default.

48 changes: 25 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metronome-desktop-wallet",
"version": "1.3.0",
"version": "1.4.0",
"author": {
"name": "Autonomous Software",
"email": "info@autonomous.sh",
Expand All @@ -20,6 +20,7 @@
"env:win32": ".\\scripts\\env.bat",
"env:darwin:linux": "./scripts/env.sh",
"ppa": "./scripts/ppa.sh",
"postinstall": "electron-rebuild",
"prepare": "patch-package",
"release": "npm run dist -- --publish always"
},
Expand All @@ -30,24 +31,25 @@
"chalk": "2.4.2",
"credential-plus": "2.0.7",
"credential-plus-pbkdf2": "2.0.4",
"cuid": "2.1.4",
"cuid": "2.1.6",
"dotenv": "5.0.1",
"electron-context-menu": "0.9.1",
"electron-debug": "1.5.0",
"electron-is-dev": "0.3.0",
"electron-log": "3.0.1",
"electron-context-menu": "0.11.0",
"electron-debug": "2.1.0",
"electron-is-dev": "1.0.1",
"electron-log": "3.0.5",
"electron-settings": "3.2.0",
"electron-unhandled": "1.1.0",
"electron-updater": "2.23.3",
"electron-unhandled": "2.1.0",
"electron-updater": "4.0.6",
"electron-window-state": "5.0.3",
"fast-password-entropy": "1.1.0",
"fast-password-entropy": "1.1.1",
"json-stringify-safe": "5.0.1",
"lodash": "4.17.11",
"metronome-contracts": "2.0.0",
"metronome-wallet-core": "2.0.2",
"metronome-wallet-ui-logic": "3.2.0",
"metronome-contracts": "2.4.0",
"metronome-wallet-core": "2.4.3",
"metronome-wallet-ui-logic": "3.5.0",
"nedb": "1.8.0",
"p-timeout": "2.0.1",
"patch-package": "5.1.1",
"qrcode.react": "0.7.2",
"raven": "2.6.4",
"raven-js": "3.27.0",
Expand All @@ -68,25 +70,25 @@
"devDependencies": {
"concurrently": "3.6.0",
"devtron": "1.4.0",
"electron": "1.8.8",
"electron-builder": "20.22.0",
"electron": "4.0.5",
"electron-builder": "20.38.5",
"electron-devtools-installer": "2.2.4",
"electron-rebuild": "1.8.4",
"eslint": "5.6.0",
"eslint-config-bloq": "1.3.0",
"eslint-config-prettier": "2.9.0",
"eslint-config-bloq": "2.1.0",
"eslint-config-prettier": "4.1.0",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jsdoc": "3.15.1",
"eslint-plugin-mocha": "5.2.1",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-jsdoc": "4.8.3",
"eslint-plugin-mocha": "5.3.0",
"eslint-plugin-node": "8.0.1",
"eslint-plugin-prefer-arrow": "1.1.3",
"eslint-plugin-promise": "4.0.1",
"eslint-plugin-prefer-arrow": "1.1.5",
"eslint-plugin-promise": "4.1.1",
"eslint-plugin-require-path-exists": "1.1.9",
"eslint-plugin-standard": "4.0.0",
"expect": "22.4.3",
"husky": "1.3.1",
"lint-staged": "8.1.0",
"merkletreejs": "0.0.20",
"patch-package": "5.1.1",
"prettier": "1.15.3",
"proxyquire": "1.8.0",
"react-testing-library": "1.10.0",
Expand Down
16 changes: 16 additions & 0 deletions patches/web3-eth+1.0.0-beta.37.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
patch-package
--- a/node_modules/web3-eth/src/index.js
+++ b/node_modules/web3-eth/src/index.js
@@ -368,6 +368,12 @@ var Eth = function Eth() {
inputFormatter: [formatter.inputLogFormatter],
outputFormatter: formatter.outputLogFormatter
}),
+ new Method({
+ name: 'getChainId',
+ call: 'eth_chainId',
+ params: 0,
+ outputFormatter: utils.hexToNumber
+ }),

// subscriptions
new Subscriptions({
26 changes: 24 additions & 2 deletions patches/web3-eth-accounts+1.0.0-beta.37.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
patch-package
--- a/node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js
+++ b/node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js
@@ -6,7 +6,7 @@ var at = function at(bytes, index) {

var random = function random(bytes) {
var rnd = void 0;
- if (typeof window !== "undefined" && window.crypto && window.crypto.getRandomValues) rnd = window.crypto.getRandomValues(new Uint8Array(bytes));else if (typeof require !== "undefined") rnd = require("c" + "rypto").randomBytes(bytes);else throw "Safe random numbers not available.";
+ if (typeof window !== "undefined" && window.crypto && window.crypto.getRandomValues) rnd = window.crypto.getRandomValues(new Uint8Array(bytes));else if (typeof require !== "undefined") rnd = require("crypto").randomBytes(bytes);else throw "Safe random numbers not available.";
var hex = "0x";
for (var i = 0; i < bytes; ++i) {
hex += ("00" + rnd[i].toString(16)).slice(-2);
--- a/node_modules/web3-eth-accounts/src/index.js
+++ b/node_modules/web3-eth-accounts/src/index.js
@@ -69,7 +69,7 @@ var Accounts = function Accounts() {
@@ -68,8 +68,8 @@ var Accounts = function Accounts() {

var _ethereumCall = [
new Method({
name: 'getId',
- name: 'getId',
- call: 'net_version',
+ name: 'getChainId',
+ call: 'eth_chainId',
params: 0,
outputFormatter: utils.hexToNumber
}),
@@ -220,7 +220,7 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca

// Otherwise, get the missing info from the Ethereum Node
return Promise.all([
- isNot(tx.chainId) ? _this._ethereumCall.getId() : tx.chainId,
+ isNot(tx.chainId) ? _this._ethereumCall.getChainId() : tx.chainId,
isNot(tx.gasPrice) ? _this._ethereumCall.getGasPrice() : tx.gasPrice,
isNot(tx.nonce) ? _this._ethereumCall.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce
]).then(function (args) {
32 changes: 32 additions & 0 deletions patches/web3-utils+1.0.0-beta.37.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
patch-package
--- a/node_modules/web3-utils/src/index.js
+++ b/node_modules/web3-utils/src/index.js
@@ -225,7 +225,7 @@ var getUnitValue = function (unit) {
*
* @method fromWei
* @param {Number|String} number can be a number, number string or a HEX of a decimal
- * @param {String} unit the unit to convert to, default ether
+ * @param {String} [unit] the unit to convert to, default ether
* @return {String|Object} When given a BN object it returns one as well, otherwise a number
*/
var fromWei = function(number, unit) {
@@ -257,7 +257,7 @@ var fromWei = function(number, unit) {
*
* @method toWei
* @param {Number|String|BN} number can be a number, number string or a HEX of a decimal
- * @param {String} unit the unit to convert from, default ether
+ * @param {String} [unit] the unit to convert from, default ether
* @return {String|Object} When given a BN object it returns one as well, otherwise a number
*/
var toWei = function(number, unit) {
--- a/node_modules/web3-utils/src/utils.js
+++ b/node_modules/web3-utils/src/utils.js
@@ -320,7 +320,7 @@ var hexToBytes = function(hex) {
*
* @method toHex
* @param {String|Number|BN|Object} value
- * @param {Boolean} returnType
+ * @param {Boolean} [returnType]
* @return {String}
*/
var toHex = function (value, returnType) {
29 changes: 29 additions & 0 deletions public/config/etcMainnet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict'

const MetronomeContracts = require('metronome-contracts')
const contracts = MetronomeContracts['classic']

module.exports = {
displayName: 'Ethereum Classic',
chainId: 61,
symbol: 'ETC',

// contracts addresses
tokenPorterAddress: contracts.TokenPorter.address,
converterAddress: contracts.AutonomousConverter.address,
validatorAddress: contracts.Validator.address,
metTokenAddress: contracts.METToken.address,
auctionAddress: contracts.Auctions.address,

// urls
explorerUrl: 'https://blockscout.com/etc/mainnet/tx/{{hash}}/internal_transactions',
indexerUrl: 'https://etc.indexer.metronome.io',
metApiUrl: 'https://etc.api.metronome.io/',
wsApiUrl: 'wss://etc.wallet.metronome.io:8546',

// defauls
coinDefaultGasLimit: '21000',
metDefaultGasLimit: '250000',
defaultGasPrice: '10000000000',
maxGasPrice: '200000000000000000'
}
18 changes: 11 additions & 7 deletions public/config/etcMordenLocal.js → public/config/etcMorden.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
'use strict'

const MetronomeContracts = require('metronome-contracts')
const contracts = MetronomeContracts.morden
const contracts = MetronomeContracts['morden']

const indexerUrl = process.env.MORDEN_INDEXER_URL || 'http://localhost:3015'
const metApiUrl = process.env.MORDEN_API_URL || 'http://localhost:3012/'
const wsApiUrl = process.env.MORDEN_NODE_URL || 'ws://localhost:8556'

module.exports = {
displayName: 'Morden (Local)',
chainId: 2,
displayName: 'Morden',
chainId: 62,
symbol: 'ETC',

// contracts addresses
Expand All @@ -16,10 +20,10 @@ module.exports = {
auctionAddress: contracts.Auctions.address,

// urls
explorerUrl: 'https://mordenexplorer.ethertrack.io/tx/{{hash}}',
indexerUrl: 'http://localhost:3015',
metApiUrl: 'http://localhost:3012/',
wsApiUrl: 'ws://localhost:8556',
explorerUrl: 'https://mordenexplorer.ethernode.io/tx/{{hash}}',
indexerUrl,
metApiUrl,
wsApiUrl,

// defauls
coinDefaultGasLimit: '21000',
Expand Down
2 changes: 1 addition & 1 deletion public/config/ethMainnet.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const MetronomeContracts = require('metronome-contracts')
const contracts = MetronomeContracts.mainnet
const contracts = MetronomeContracts['mainnet']

module.exports = {
displayName: 'Ethereum',
Expand Down
14 changes: 9 additions & 5 deletions public/config/ethRopstenLocal.js → public/config/ethRopsten.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
'use strict'

const MetronomeContracts = require('metronome-contracts')
const contracts = MetronomeContracts.ropsten
const contracts = MetronomeContracts['ropsten']

const indexerUrl = process.env.ROPSTEN_INDEXER_URL || 'http://localhost:3005'
const metApiUrl = process.env.ROPSTEN_API_URL || 'http://localhost:3002/'
const wsApiUrl = process.env.ROPSTEN_NODE_URL || 'ws://localhost:8546'

module.exports = {
displayName: 'Ropsten (Local)',
displayName: 'Ropsten',
chainId: 3,
symbol: 'ETH',

Expand All @@ -17,9 +21,9 @@ module.exports = {

// urls
explorerUrl: 'https://ropsten.etherscan.io/tx/{{hash}}',
indexerUrl: 'http://localhost:3005',
metApiUrl: 'http://localhost:3002/',
wsApiUrl: 'ws://localhost:8546',
indexerUrl,
metApiUrl,
wsApiUrl,

// defauls
coinDefaultGasLimit: '21000',
Expand Down
4 changes: 2 additions & 2 deletions public/config/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const enabledChains = (process.env.ENABLED_CHAINS || 'ethRopstenLocal')
const enabledChains = (process.env.ENABLED_CHAINS || 'ethRopsten,etcMorden')
.split(',')
.map(name => name.trim())

Expand All @@ -16,7 +16,7 @@ module.exports = {
enabledChains,
explorerDebounce: 2000,
ratesUpdateMs: 30000,
requiredPasswordEntropy: parseInt(process.env.REQUIRED_PASSWORD_ENTROPY || 72, 10),
requiredPasswordEntropy: parseInt(process.env.REQUIRED_PASSWORD_ENTROPY || '72', 10),
scanTransactionTimeout: 240000,
sentryDsn: process.env.SENTRY_DSN,
statePersistanceDebounce: 2000,
Expand Down
10 changes: 5 additions & 5 deletions public/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ const unhandled = require('electron-unhandled')

logger.transports.file.appName = 'metronome-desktop-wallet'

if (isDev) {
logger.transports.console.level = 'debug'
logger.transports.file.level = 'debug'
}

function getColorLevel (level = '') {
const colors = {
error: 'red',
Expand Down Expand Up @@ -41,6 +36,11 @@ logger.transports.console = function ({ date, level, data }) {
)
}

if (isDev) {
logger.transports.console.level = 'debug'
logger.transports.file.level = 'debug'
}

unhandled({ logger: logger.error })

module.exports = logger
1 change: 1 addition & 0 deletions public/main/client/handlers/multi-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function portMetronome (data, cores) {
importCore
)
)
.catch(e => Promise.reject(new WalletError(e.message)))
})
})
}
Expand Down
6 changes: 6 additions & 0 deletions public/main/main-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const restart = require('./client/electron-restart')

let mainWindow

// Disable electron security warnings since local content is served via http
if (isDev) {
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true
}

function showUpdateNotification (info = {}) {
if (!Notification.isSupported()) { return }

Expand Down Expand Up @@ -80,6 +85,7 @@ function loadWindow () {
backgroundColor: '#323232',
webPreferences: {
nodeIntegration: false,
contextIsolation: false,
preload: path.join(__dirname, 'preload.js')
},
x: mainWindowState.x,
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/tx-list/TxList.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class TxList extends React.Component {
)

filterExtractValue = ({ txType }) =>
['import-requested', 'imported', 'exported'].includes(txType)
['import-requested', 'imported', 'exported', 'attestation'].includes(txType)
? 'ported'
: txType

Expand Down
5 changes: 4 additions & 1 deletion src/components/dashboard/tx-list/row/ReceivedDetails.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import FilteredMessage from 'metronome-wallet-ui-logic/src/components/FilteredMessage'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import React from 'react'
Expand All @@ -24,7 +25,9 @@ export default class ReceivedDetails extends React.Component {
return (
<div>
{this.props.isPending ? 'Pending' : 'Received'} from{' '}
<Address>{this.props.from}</Address>
<Address>
<FilteredMessage>{this.props.from}</FilteredMessage>
</Address>
</div>
)
}
Expand Down
Loading

0 comments on commit fa256d7

Please sign in to comment.