Skip to content

Commit

Permalink
Merge pull request #307 from poanetwork/develop
Browse files Browse the repository at this point in the history
NW release 4.11.8
  • Loading branch information
vbaranov committed Jul 3, 2019
2 parents 7885613 + 5a1aff9 commit 188d6d8
Show file tree
Hide file tree
Showing 46 changed files with 20,230 additions and 19,327 deletions.
50 changes: 25 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ workflows:
- test-unit:
requires:
- prep-deps-npm
- test-integration-mascara-chrome:
requires:
- prep-deps-npm
- prep-scss
# - test-integration-mascara-chrome:
# requires:
# - prep-deps-npm
# - prep-scss
# - test-integration-mascara-firefox:
# requires:
# - prep-deps-npm
Expand All @@ -53,7 +53,7 @@ workflows:
- test-unit
- test-e2e-chrome
# - test-e2e-firefox
- test-integration-mascara-chrome
# - test-integration-mascara-chrome
# - test-integration-mascara-firefox
- test-integration-flat-chrome
- test-integration-flat-firefox
Expand Down Expand Up @@ -92,7 +92,7 @@ workflows:
jobs:
prep-deps-npm:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -108,7 +108,7 @@ jobs:

prep-build:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -127,7 +127,7 @@ jobs:

prep-docs:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -142,7 +142,7 @@ jobs:

prep-scss:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -161,7 +161,7 @@ jobs:

test-lint:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -172,7 +172,7 @@ jobs:

# test-deps:
# docker:
# - image: circleci/node:8.15.0-browsers
# - image: circleci/node:10.16.0-browsers
# steps:
# - checkout
# - restore_cache:
Expand All @@ -183,7 +183,7 @@ jobs:

test-e2e-chrome:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -208,7 +208,7 @@ jobs:

test-e2e-firefox:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -229,7 +229,7 @@ jobs:

test-e2e-beta-chrome:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -245,7 +245,7 @@ jobs:

test-e2e-beta-firefox:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -266,7 +266,7 @@ jobs:

job-screens:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -283,7 +283,7 @@ jobs:

job-publish-prerelease:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -310,7 +310,7 @@ jobs:

job-publish-release:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -323,7 +323,7 @@ jobs:

job-publish-postrelease:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -346,7 +346,7 @@ jobs:

test-unit:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -359,7 +359,7 @@ jobs:
environment:
browsers: '["Firefox"]'
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -383,7 +383,7 @@ jobs:
environment:
browsers: '["Chrome"]'
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -402,7 +402,7 @@ jobs:
environment:
browsers: '["Firefox"]'
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -426,7 +426,7 @@ jobs:
environment:
browsers: '["Chrome"]'
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -443,7 +443,7 @@ jobs:

all-tests-pass:
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:10.16.0-browsers
steps:
- run:
name: All Tests Passed
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.15.0
v10.16.0
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Current Master

## 4.11.8 Wed Jul 03 2019

- [#305](https://github.com/poanetwork/nifty-wallet/pull/305): (Feature) gas price for RSK from the last block
- [#298](https://github.com/poanetwork/nifty-wallet/pull/298): (Feature) isNiftyWallet property added
- [#299](https://github.com/poanetwork/nifty-wallet/pull/299): (Upgrade) Node 10 support
- [#306](https://github.com/poanetwork/nifty-wallet/pull/306): (Fix) Replace Goerli RPC endpoint
- [#302](https://github.com/poanetwork/nifty-wallet/pull/302): (Fix) Return scrolls in dropdowns

## 4.11.7 Tue Jun 25 2019

- [#294](https://github.com/poanetwork/nifty-wallet/pull/294): Address checksum for RSK chains. RSKIP60
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

## Building locally

- Install [Node.js](https://nodejs.org/en/) version 8.11.3 and npm version 6.1.0
- Install [Node.js](https://nodejs.org/en/) version 10.16.0 and npm version 6.9.0
- If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you.
- Select npm 6.1.0: ```npm install -g npm@6.1.0```
- Select npm 6.9.0: ```npm install -g npm@6.9.0```
- Install dependencies: ```npm install```
- Install gulp globally with `npm install -g gulp-cli`.
- Build the project to the `./dist/` folder with `gulp build`.
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.7",
"version": "4.11.8",
"manifest_version": 2,
"author": "POA Network",
"description": "__MSG_appDescription__",
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/inpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require('web3/dist/web3.min.js')
const log = require('loglevel')
const LocalMessageDuplexStream = require('post-message-stream')
const setupDappAutoReload = require('./lib/auto-reload.js')
const MetamaskInpageProvider = require('metamask-inpage-provider')
const MetamaskInpageProvider = require('nifty-wallet-inpage-provider')

restoreContextAfterImports()

Expand Down
44 changes: 31 additions & 13 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,11 @@ const ethUtil = require('ethereumjs-util')
const sigUtil = require('eth-sig-util')
const { importTypes } = require('../../old-ui/app/accounts/import/enums')
const { LEDGER, TREZOR } = require('../../old-ui/app/components/connect-hardware/enum')
const { ifPOA, ifRSK } = require('../../old-ui/app/util')

const {
POA_CODE,
DAI_CODE,
POA_SOKOL_CODE,
CLASSIC_CODE,
MAINNET_CODE,
RSK_CODE,
RSK_TESTNET_CODE } = require('./controllers/network/enums')
MAINNET_CODE } = require('./controllers/network/enums')
const accountsPerPage = 5

module.exports = class MetamaskController extends EventEmitter {
Expand Down Expand Up @@ -1522,6 +1518,7 @@ module.exports = class MetamaskController extends EventEmitter {
const networkIdStr = networkController.store.getState().network
const networkId = parseInt(networkIdStr)
const isETHC = networkId === CLASSIC_CODE || networkId === MAINNET_CODE
const isRSK = ifRSK(networkId)
let gasPrice

if (isETHC) {
Expand All @@ -1537,6 +1534,9 @@ module.exports = class MetamaskController extends EventEmitter {
gasPrice = this.getGasPriceFromBlocks(networkId)
resolve(gasPrice)
}
} else if (isRSK) {
gasPrice = this.getGasPriceFromLastBlockRSK(networkId)
resolve(gasPrice)
} else {
gasPrice = this.getGasPriceFromBlocks(networkId)
resolve(gasPrice)
Expand All @@ -1554,7 +1554,7 @@ module.exports = class MetamaskController extends EventEmitter {
getGasPriceFromBlocks (networkId) {
const { recentBlocksController } = this
const { recentBlocks } = recentBlocksController.store.getState()
const isPOA = networkId === POA_SOKOL_CODE || networkId === POA_CODE || networkId === DAI_CODE
const isPOA = ifPOA(networkId)

// Return 1 gwei if using a POA network or if there are no blocks have been observed:
if (isPOA || recentBlocks.length === 0) {
Expand All @@ -1575,17 +1575,35 @@ module.exports = class MetamaskController extends EventEmitter {
})
.map(number => number && number.div(GWEI_BN).toNumber()).filter(number => typeof number !== 'undefined' && number !== 0)

if (networkId === RSK_CODE || networkId === RSK_TESTNET_CODE) {
if (lowestPrices.length === 0) {
lowestPrices.push(1)
}
}

const percentileNum = percentile(65, lowestPrices)
const percentileNumBn = new BN(percentileNum)
return '0x' + percentileNumBn.mul(GWEI_BN).toString(16)
}

/**
* A method to get min gas price from the best block (last block in the chain) for RSK.
* https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP09.md
* Related issue: https://github.com/poanetwork/nifty-wallet/issues/301
* @returns {string} A hex representation of the suggested wei gas price.
*/
getGasPriceFromLastBlockRSK (networkId) {
const { recentBlocksController } = this
const { recentBlocks } = recentBlocksController.store.getState()

const recentBlock = recentBlocks
.sort((block1, block2) => block1.number - block2.number)[recentBlocks.length - 1]

const gasPrice = recentBlock && recentBlock.minimumGasPrice

const gasPriceInt = parseInt(gasPrice, 10)

if (gasPriceInt !== 0) {
return '0x' + gasPriceInt.toString(16)
} else {
return '0x' + GWEI_BN.toString(16)
}
}

/**
* A method for retrieving of gas price from POA gas price oracles
*
Expand Down
5 changes: 4 additions & 1 deletion old-ui/app/add-suggested-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@ AddSuggestedTokenScreen.prototype.render = function () {

h('div', [
h(Tooltip, {
position: 'top',
title: 'The contract of the actual token contract. Click for more info.',
position: 'top',
id: 'addSuggestedToken',
}, [
h('a', {
style: { fontWeight: 'bold', paddingRight: '10px'},
href: 'https://support.metamask.io/kb/article/24-what-is-a-token-contract-address',
target: '_blank',
'data-tip': '',
'data-for': 'addSuggestedToken',
}, [
h('span', 'Token Contract Address '),
h('i.fa.fa-question-circle'),
Expand Down
4 changes: 2 additions & 2 deletions old-ui/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const NoticeScreen = require('./components/notice')
const generateLostAccountsNotice = require('../lib/lost-accounts-notice')
// other views
const ConfigScreen = require('./config')
const AddTokenScreen = require('./components/add-token')
import AddTokenScreen from './components/add-token'
const ConfirmAddTokenScreen = require('./components/confirm-add-token')
const RemoveTokenScreen = require('./remove-token')
import RemoveTokenScreen from './remove-token'
const AddSuggestedTokenScreen = require('./add-suggested-token')
const Import = require('./accounts/import')
const ForgetDeviceScreen = require('./components/connect-hardware/forget-screen')
Expand Down
Loading

0 comments on commit 188d6d8

Please sign in to comment.