Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit e562478

Browse files
committed
Merge branch 'develop'
2 parents 8406f61 + 9abd4cd commit e562478

File tree

11 files changed

+230
-56
lines changed

11 files changed

+230
-56
lines changed

README.md

Lines changed: 59 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,90 @@
22
<img src="./public/images/banner.png" alt="Metronome Wallet Desktop" width="50%">
33
</h1>
44

5-
💻💰 Metronome wallet for desktop devices
5+
💻💰 Metronome Wallet for desktop computers
66

7-
[![Build Status](https://travis-ci.com/MetronomeToken/metronome-desktop-wallet.svg?token=zFtwnjoHbEAEPUQyswR1&branch=master)](https://travis-ci.com/MetronomeToken/metronome-desktop-wallet)
7+
[![Build Status](https://travis-ci.com/autonomoussoftware/metronome-wallet-desktop.svg?branch=master)](https://travis-ci.com/autonomoussoftware/metronome-wallet-desktop)
88
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
99

10-
## Index
10+
## Development
1111

12-
1. [Requirements](#requirements)
13-
1. [Configuration](#configuration)
14-
1. [Dev Setup](#dev-Setup)
15-
1. [Prod Setup](#prod-setup)
16-
1. [Logs](#logs)
17-
1. [Development Notes](#development-notes)
18-
1. [License](#license)
12+
### Requirements
1913

20-
## Requirements
14+
* [Node.js](https://nodejs.org) LTS (v8)
2115

22-
* [Node.js](https://nodejs.org) v8 (or greater)
23-
24-
## Dev Setup
16+
### Launch
2517

2618
```bash
2719
# Install dependencies
2820
npm i
2921

3022
# Run dev mode
3123
npm run dev
32-
33-
# Run test cases
34-
npm test
3524
```
3625

37-
## Prod Setup
26+
### Logs
3827

39-
```bash
40-
# Run build process
41-
npm run dist
28+
The log output is in the next directories:
4229

43-
# Run build process and publish to GitHub release
44-
npm run release
30+
* **Linux:** `~/.config/<app name>/log.log`
31+
* **macOS:** `~/Library/Logs/<app name>/log.log`
32+
* **Windows:** `%USERPROFILE%\AppData\Roaming\<app name>\log.log`
33+
34+
More info [github.com/megahertz/electron-log](https://github.com/megahertz/electron-log)
35+
36+
### Settings
37+
38+
* **Linux**: `~/.config/metronome-desktop-wallet/Settings`
39+
* **macOS**: `~/Library/Application Support/metronome-desktop-wallet/Settings`
40+
* **Windows**: `%APPDATA%\\metronome-desktop-wallet\\Settings`
41+
42+
To completely remove the application and start over, remove the settings file too.
43+
44+
### Run in Ropsten Testnet
45+
46+
Modify the `Settings` file replacing the following properties:
47+
48+
```json
49+
{
50+
"app": {
51+
"chain": "ropsten",
52+
"node": {
53+
"jsonRpcApiUrl": "https://eth.met.bloqrock.net:8545",
54+
"websocketApiUrl": "wss://eth.met.bloqrock.net:8546"
55+
},
56+
"indexerApiUrl": "https://indexer.met.bloqrock.net",
57+
"tracerApiUrl": "https://tracer.met.bloqrock.net"
58+
},
59+
"tokens": {
60+
"0xf3e9a687fdf24112745d4d7dee150ba87a07ecc3": {
61+
"decimals": 18,
62+
"name": "Metronome",
63+
"symbol": "MET"
64+
}
65+
}
66+
}
4567
```
4668

47-
## Logs
48-
49-
The log output is in the next directories:
69+
Then, start the wallet setting the proper environment variable as follows:
5070

51-
* **Linux:** `~/.config/<app name>/log.log`
52-
* **macOS:** `~/Library/Logs/<app name>/log.log`
53-
* **Windows:** `%USERPROFILE%\AppData\Roaming\<app name>\log.log`
71+
```bash
72+
REACT_APP_ETH_CHAIN=ropsten npm run dev
73+
```
5474

55-
> More info [github.com/megahertz/electron-log](https://github.com/megahertz/electron-log)
75+
Alternatively, a `.env` file can also be used to set the chain variable.
5676

57-
## Development Notes
77+
### Production Build
5878

59-
To remove app settings and start over again:
79+
```bash
80+
# Run build process
81+
npm run dist
6082

61-
* **Linux**:
62-
```bash
63-
rm ~/.config/metronome-desktop-wallet/Settings
64-
```
65-
* **macOS**:
66-
```bash
67-
rm ~/Library/Application\ Support/metronome-desktop-wallet/Settings
68-
```
69-
* **Windows**:
70-
```bat
71-
del %APPDATA%\\metronome-desktop-wallet\\Settings
72-
```
83+
# Run build process and publish to GitHub releases
84+
npm run release
85+
```
7386

87+
To sign the macOS installers, execute `npm run dist:mac`. The signing certificate shall be in the root folder and be named `met.p12`. The certificate password will be required before signing.
7488

7589
## LICENSE
7690

77-
[MIT License](https://github.com/MetronomeToken/metronome-desktop-wallet/blob/develop/LICENSE).
91+
MIT

package-lock.json

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"styled-components": "^3.0.2",
8585
"supports-color": "^5.3.0",
8686
"tough-cookie": "^2.3.4",
87+
"universal-analytics": "0.4.17",
8788
"web3": "1.0.0-beta.34"
8889
},
8990
"devDependencies": {

public/analytics.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use strict'
2+
3+
const { app } = require('electron')
4+
const ua = require('universal-analytics')
5+
const { noop } = require('lodash')
6+
const settings = require('electron-settings')
7+
const isDev = require('electron-is-dev')
8+
9+
const visitor = ua(settings.get('app.trackingId'))
10+
const analytics = {}
11+
12+
visitor.set('ds', 'app')
13+
visitor.set('an', app.getName())
14+
visitor.set('av', app.getVersion())
15+
16+
analytics.screenview = function (...args) {
17+
visitor.screenview(...args).send()
18+
}
19+
20+
analytics.event = function (...args) {
21+
visitor.event(...args).send()
22+
}
23+
24+
analytics.init = function () {
25+
analytics.event('App', 'App initiated')
26+
}
27+
28+
const analyticsDev = {
29+
init: noop,
30+
event: noop,
31+
screenview: noop
32+
}
33+
34+
module.exports = isDev ? analyticsDev : analytics

public/electron.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ const Raven = require('raven')
66
const { app } = require('electron')
77
const isDev = require('electron-is-dev')
88

9+
const analytics = require('./analytics')
910
const logger = require('./logger')
1011
const config = require('./config')
1112
const initMenu = require('./menu')
1213
const initContextMenu = require('./contextMenu')
1314

15+
analytics.init()
16+
1417
if (isDev) {
1518
require('dotenv').config()
1619

public/main/plugins/ethWallet/transactionParser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function transactionParser ({ transaction, receipt, walletId }) {
2020
}
2121

2222
meta.contractCallFailed = receipt &&
23-
(receipt.status === 0 || // byzantium fork
23+
(receipt.status === false || // byzantium fork
2424
(input !== '0x' && gas === receipt.gasUsed && !receipt.logs.length))
2525

2626
if (meta.ours) {

public/main/plugins/metronome/api.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
const logger = require('electron-log')
4+
const analytics = require('./../../../analytics')
45

56
const {
67
getAuctionGasLimit
@@ -25,10 +26,19 @@ function createApi ({ ethWallet, tokens }) {
2526
logger.verbose('Buying MET in auction', {
2627
from, value, address, gasLimit, gasPrice
2728
})
29+
analytics.event({ ec: 'Buy', ea: 'Buy MET in auction initiated' })
2830

2931
return ethWallet.sendTransaction({
3032
password, from, to: address, value, gasLimit, gasPrice
3133
})
34+
.then(function (response) {
35+
analytics.event({ ec: 'Buy', ea: 'Buy MET in auction succeeded' })
36+
return response
37+
})
38+
.catch(function (err) {
39+
analytics.event({ ec: 'Buy', ea: 'Buy MET in auction failed' })
40+
throw err
41+
})
3242
}
3343

3444
function onConvertEthToMtn ({ password, from, value, minReturn, gasLimit, gasPrice }) {
@@ -37,6 +47,7 @@ function createApi ({ ethWallet, tokens }) {
3747
const data = encodeConvertEthToMtn({ web3, address, value, minReturn })
3848

3949
logger.verbose('Converting ETH to MET', { from, value, address })
50+
analytics.event({ ec: 'Convert', ea: 'Convert ETH to MET initiated' })
4051

4152
return ethWallet.sendTransaction({
4253
password,
@@ -47,12 +58,22 @@ function createApi ({ ethWallet, tokens }) {
4758
gasLimit,
4859
gasPrice
4960
})
61+
.then(function (response) {
62+
analytics.event({ ec: 'Convert', ea: 'Convert ETH to MET succeeded' })
63+
return response
64+
})
65+
.catch(function (err) {
66+
analytics.event({ ec: 'Convert', ea: 'Convert ETH to MET failed' })
67+
throw err
68+
})
5069
}
5170

5271
function onConvertMtnToEth ({ password, from, value, minReturn, gasPrice, gasLimit }) {
5372
const token = getTokenAddress()
5473
const address = getConverterAddress()
5574

75+
analytics.event({ ec: 'Convert', ea: 'Convert MET to ETH initiated' })
76+
5677
return tokens.getAllowance({ token, from, to: address })
5778
.then(function (allowance) {
5879
logger.debug('Current allowance', allowance)
@@ -85,6 +106,10 @@ function createApi ({ ethWallet, tokens }) {
85106
return ethWallet.sendTransaction({
86107
password, from, to: address, data, gasPrice, gasLimit
87108
})
109+
.then(function (response) {
110+
analytics.event({ ec: 'Convert', ea: 'Convert MET to ETH succeeded' })
111+
return response
112+
})
88113
})
89114
.catch(function (err) {
90115
logger.warn('Conversion failed - removing approval')
@@ -103,6 +128,7 @@ function createApi ({ ethWallet, tokens }) {
103128
})
104129
})
105130
.catch(function (err) {
131+
analytics.event({ ec: 'Convert', ea: 'Convert MET to ETH failed' })
106132
throw err
107133
})
108134
}

public/main/settings/defaultSettings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
},
88
"defaultDerivationPath": "m/44'/60'/0'/0",
99
"indexerApiUrl": "https://indexer.metronome.io",
10-
"tracerApiUrl": "https://tracer.metronome.io"
10+
"tracerApiUrl": "https://tracer.metronome.io",
11+
"trackingId": "UA-116275666-3"
1112
},
1213
"coincap": {
1314
"ethPriceEmitRate": 5
@@ -19,5 +20,5 @@
1920
"symbol": "MET"
2021
}
2122
},
22-
"settingsVersion": 12
23+
"settingsVersion": 13
2324
}

0 commit comments

Comments
 (0)