Skip to content

Commit

Permalink
Merge pull request #271 from poanetwork/develop
Browse files Browse the repository at this point in the history
NW release 4.11.2
  • Loading branch information
vbaranov committed Mar 28, 2019
2 parents 60aaa78 + 3609630 commit 1804aa8
Show file tree
Hide file tree
Showing 18 changed files with 354 additions and 416 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ workflows:
requires:
- prep-deps-npm
- prep-scss
- test-integration-mascara-firefox:
requires:
- prep-deps-npm
- prep-scss
# - test-integration-mascara-firefox:
# requires:
# - prep-deps-npm
# - prep-scss
- test-integration-flat-chrome:
requires:
- prep-deps-npm
Expand All @@ -54,7 +54,7 @@ workflows:
- test-e2e-chrome
# - test-e2e-firefox
- test-integration-mascara-chrome
- test-integration-mascara-firefox
# - test-integration-mascara-firefox
- test-integration-flat-chrome
- test-integration-flat-firefox
- job-screens:
Expand Down Expand Up @@ -193,8 +193,8 @@ jobs:
- run: #STABLE
name: Install Chromedriver latest version
command: |
sudo apt-get update
sudo apt-get install lsb-release libappindicator3-1
# sudo apt-get update
# sudo apt-get install lsb-release libappindicator3-1
curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome.deb
sudo sed -i 's|HERE/chrome"|HERE/chrome" --no-sandbox|g' /opt/google/chrome/google-chrome
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Current Master

## 4.11.2 Wed Mar 27 2019

- [#270](https://github.com/poanetwork/nifty-wallet/pull/270): (Feature) Support of gas price oracles for ETH, ETC
- [#268](https://github.com/poanetwork/nifty-wallet/pull/268): (Feature) Support of Ethereum Classic chain

## 4.11.1 Wed Mar 20 2019

- [#266](https://github.com/poanetwork/nifty-wallet/pull/266): (Fix) Support of the latest trezor-connect version 7
Expand Down
2 changes: 1 addition & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "__MSG_appName__",
"version": "4.11.1",
"version": "4.11.2",
"manifest_version": 2,
"author": "POA Network",
"description": "__MSG_appDescription__",
Expand Down
8 changes: 8 additions & 0 deletions app/scripts/controllers/network/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const ROPSTEN = 'ropsten'
const RINKEBY = 'rinkeby'
const KOVAN = 'kovan'
const GOERLI_TESTNET = 'goerli_testnet'
const CLASSIC = 'classic'
const LOCALHOST = 'localhost'

const POA_CODE = 99
Expand All @@ -16,6 +17,7 @@ const ROPSTEN_CODE = 3
const RINKEBY_CODE = 4
const KOVAN_CODE = 42
const GOERLI_TESTNET_CODE = 5
const CLASSIC_CODE = 61

const POA_DISPLAY_NAME = 'POA Network'
const DAI_DISPLAY_NAME = 'xDai Chain'
Expand All @@ -25,6 +27,7 @@ const ROPSTEN_DISPLAY_NAME = 'Ropsten'
const RINKEBY_DISPLAY_NAME = 'Rinkeby'
const KOVAN_DISPLAY_NAME = 'Kovan'
const GOERLI_TESTNET_DISPLAY_NAME = 'Görli Testnet'
const CLASSIC_DISPLAY_NAME = 'Ethereum Classic'

const DROPDOWN_POA_DISPLAY_NAME = POA_DISPLAY_NAME
const DROPDOWN_DAI_DISPLAY_NAME = DAI_DISPLAY_NAME
Expand All @@ -34,6 +37,7 @@ const DROPDOWN_ROPSTEN_DISPLAY_NAME = 'Ropsten Test Net'
const DROPDOWN_RINKEBY_DISPLAY_NAME = 'Rinkeby Test Net'
const DROPDOWN_KOVAN_DISPLAY_NAME = 'Kovan Test Net'
const DROPDOWN_GOERLI_TESTNET_DISPLAY_NAME = 'Görli Test Net'
const DROPDOWN_CLASSIC_DISPLAY_NAME = 'Ethereum Classic'

const chainTypes = {
TEST: 1,
Expand All @@ -49,6 +53,7 @@ module.exports = {
RINKEBY,
KOVAN,
GOERLI_TESTNET,
CLASSIC,
LOCALHOST,
POA_CODE,
DAI_CODE,
Expand All @@ -58,6 +63,7 @@ module.exports = {
RINKEBY_CODE,
KOVAN_CODE,
GOERLI_TESTNET_CODE,
CLASSIC_CODE,
POA_DISPLAY_NAME,
DAI_DISPLAY_NAME,
POA_SOKOL_DISPLAY_NAME,
Expand All @@ -66,6 +72,7 @@ module.exports = {
RINKEBY_DISPLAY_NAME,
KOVAN_DISPLAY_NAME,
GOERLI_TESTNET_DISPLAY_NAME,
CLASSIC_DISPLAY_NAME,
DROPDOWN_POA_DISPLAY_NAME,
DROPDOWN_DAI_DISPLAY_NAME,
DROPDOWN_POA_SOKOL_DISPLAY_NAME,
Expand All @@ -74,5 +81,6 @@ module.exports = {
DROPDOWN_RINKEBY_DISPLAY_NAME,
DROPDOWN_KOVAN_DISPLAY_NAME,
DROPDOWN_GOERLI_TESTNET_DISPLAY_NAME,
DROPDOWN_CLASSIC_DISPLAY_NAME,
chainTypes,
}
14 changes: 13 additions & 1 deletion app/scripts/controllers/network/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const createJsonRpcClient = require('./createJsonRpcClient')
const createLocalhostClient = require('./createLocalhostClient')
const { createSwappableProxy, createEventEmitterProxy } = require('swappable-obj-proxy')
const ethNetProps = require('eth-net-props')
const parse = require('url-parse')

const {
ROPSTEN,
Expand All @@ -23,10 +24,12 @@ const {
POA,
DAI,
GOERLI_TESTNET,
CLASSIC,
POA_CODE,
DAI_CODE,
POA_SOKOL_CODE,
GOERLI_TESTNET_CODE,
CLASSIC_CODE,
} = require('./enums')
const INFURA_PROVIDER_TYPES = [ROPSTEN, RINKEBY, KOVAN, MAINNET]

Expand Down Expand Up @@ -90,13 +93,19 @@ module.exports = class NetworkController extends EventEmitter {
}

lookupNetwork () {
const { type, rpcTarget } = this.providerStore.getState()
// Prevent firing when provider is not defined.
if (!this._provider) {
return log.warn('NetworkController - lookupNetwork aborted due to missing provider')
}
const ethQuery = new EthQuery(this._provider)
ethQuery.sendAsync({ method: 'net_version' }, (err, network) => {
if (err) return this.setNetworkState('loading')
const targetHost = parse(rpcTarget, true).host
const classicHost = parse(ethNetProps.RPCEndpoints(CLASSIC_CODE)[0], true).host
if (type === CLASSIC || targetHost === classicHost) {
network = CLASSIC_CODE.toString()
} // workaround to avoid Mainnet and Classic are having the same network ID
log.info('web3.getNetwork returned ' + network)
this.setNetworkState(network)
})
Expand All @@ -117,7 +126,8 @@ module.exports = class NetworkController extends EventEmitter {
type === POA_SOKOL ||
type === POA ||
type === DAI ||
type === GOERLI_TESTNET
type === GOERLI_TESTNET ||
type === CLASSIC
, `NetworkController - Unknown rpc type "${type}"`)
const providerConfig = { type }
this.providerConfig = providerConfig
Expand Down Expand Up @@ -161,6 +171,8 @@ module.exports = class NetworkController extends EventEmitter {
this._configureStandardProvider({ rpcUrl: ethNetProps.RPCEndpoints(POA_SOKOL_CODE)[0] })
} else if (type === GOERLI_TESTNET) {
this._configureStandardProvider({ rpcUrl: ethNetProps.RPCEndpoints(GOERLI_TESTNET_CODE)[0] })
} else if (type === CLASSIC) {
this._configureStandardProvider({ rpcUrl: ethNetProps.RPCEndpoints(CLASSIC_CODE)[0] })
} else if (type === LOCALHOST) {
this._configureLocalhostProvider()
// url-based rpc endpoints
Expand Down
23 changes: 19 additions & 4 deletions app/scripts/controllers/network/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
RINKEBY,
KOVAN,
GOERLI_TESTNET,
CLASSIC,
POA_CODE,
DAI_CODE,
POA_SOKOL_CODE,
Expand All @@ -15,6 +16,7 @@ const {
RINKEBY_CODE,
KOVAN_CODE,
GOERLI_TESTNET_CODE,
CLASSIC_CODE,
POA_DISPLAY_NAME,
DAI_DISPLAY_NAME,
POA_SOKOL_DISPLAY_NAME,
Expand All @@ -23,6 +25,7 @@ const {
RINKEBY_DISPLAY_NAME,
KOVAN_DISPLAY_NAME,
GOERLI_TESTNET_DISPLAY_NAME,
CLASSIC_DISPLAY_NAME,
DROPDOWN_POA_DISPLAY_NAME,
DROPDOWN_DAI_DISPLAY_NAME,
DROPDOWN_POA_SOKOL_DISPLAY_NAME,
Expand All @@ -31,6 +34,7 @@ const {
DROPDOWN_RINKEBY_DISPLAY_NAME,
DROPDOWN_KOVAN_DISPLAY_NAME,
DROPDOWN_GOERLI_TESTNET_DISPLAY_NAME,
DROPDOWN_CLASSIC_DISPLAY_NAME,
chainTypes,
} = require('./enums')

Expand Down Expand Up @@ -81,8 +85,19 @@ const MAINNET_OBJ = {
networks[MAINNET_CODE] = MAINNET_OBJ
networks[MAINNET] = MAINNET_OBJ

const ROPSTEN_OBJ = {
const CLASSIC_OBJ = {
order: 5,
chainType: PROD,
providerName: CLASSIC,
networkID: CLASSIC_CODE,
displayName: CLASSIC_DISPLAY_NAME,
displayNameDropdown: DROPDOWN_CLASSIC_DISPLAY_NAME,
}
networks[CLASSIC_CODE] = CLASSIC_OBJ
networks[CLASSIC] = CLASSIC_OBJ

const ROPSTEN_OBJ = {
order: 6,
chainType: TEST,
providerName: ROPSTEN,
networkID: ROPSTEN_CODE,
Expand All @@ -93,7 +108,7 @@ networks[ROPSTEN_CODE] = ROPSTEN_OBJ
networks[ROPSTEN] = ROPSTEN_OBJ

const KOVAN_OBJ = {
order: 6,
order: 7,
chainType: TEST,
providerName: KOVAN,
networkID: KOVAN_CODE,
Expand All @@ -104,7 +119,7 @@ networks[KOVAN_CODE] = KOVAN_OBJ
networks[KOVAN] = KOVAN_OBJ

const RINKEBY_OBJ = {
order: 7,
order: 8,
chainType: TEST,
providerName: RINKEBY,
networkID: RINKEBY_CODE,
Expand All @@ -115,7 +130,7 @@ networks[RINKEBY_CODE] = RINKEBY_OBJ
networks[RINKEBY] = RINKEBY_OBJ

const GOERLI_TESTNET_OBJ = {
order: 7,
order: 9,
providerName: GOERLI_TESTNET,
networkID: GOERLI_TESTNET_CODE,
displayName: GOERLI_TESTNET_DISPLAY_NAME,
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class TransactionController extends EventEmitter {
txMeta.gasPriceSpecified = Boolean(txParams.gasPrice)
let gasPrice = txParams.gasPrice
if (!gasPrice) {
gasPrice = this.getGasPrice ? this.getGasPrice() : await this.query.gasPrice()
gasPrice = this.getGasPrice ? await this.getGasPrice() : await this.query.gasPrice()
}
txParams.gasPrice = ethUtil.addHexPrefix(gasPrice.toString(16))
// set gasLimit
Expand Down
18 changes: 14 additions & 4 deletions app/scripts/lib/buy-eth-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ module.exports = {
}
const ethNetProps = require('eth-net-props')

const { POA_CODE,
const {
POA_CODE,
DAI_CODE,
POA_SOKOL_CODE,
MAINNET_CODE,
CLASSIC_CODE,
ROPSTEN_CODE,
RINKEBY_CODE,
KOVAN_CODE,
GOERLI_TESTNET_CODE } = require('../controllers/network/enums')
GOERLI_TESTNET_CODE} = require('../controllers/network/enums')

/**
* Gives the caller a url at which the user can acquire coin, depending on the network they are in
Expand All @@ -32,6 +34,7 @@ function getBuyEthUrl ({ network, amount, address, ind }) {
case MAINNET_CODE:
case POA_CODE:
case DAI_CODE:
case CLASSIC_CODE:
url = getExchanges({network, amount, address})[ind].link
break
case ROPSTEN_CODE:
Expand Down Expand Up @@ -73,7 +76,14 @@ function getExchanges ({network, amount, address}) {
link: `https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${amount}&address=${address}&crypto_currency=ETH`,
},
]
case 99:
case CLASSIC_CODE:
return [
{
name: 'Binance',
link: 'https://www.binance.com/en/trade/ETC_ETH',
},
]
case POA_CODE:
return [
{
name: 'Binance',
Expand All @@ -92,7 +102,7 @@ function getExchanges ({network, amount, address}) {
link: 'https://hitbtc.com/POA-to-ETH',
},
]
case 100:
case DAI_CODE:
return [
{
name: 'xDai TokenBridge',
Expand Down
Loading

0 comments on commit 1804aa8

Please sign in to comment.