Skip to content

Commit

Permalink
Merge pull request #428 from poanetwork/develop
Browse files Browse the repository at this point in the history
NW release 5.2.0
  • Loading branch information
vbaranov authored Nov 13, 2020
2 parents 2811647 + 908e104 commit 25a1049
Show file tree
Hide file tree
Showing 20 changed files with 819 additions and 351 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Nifty Wallet CI

on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop

jobs:
prep-deps-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install npm 6 + deps via npm
run: |
sudo npm install -g npm@6.14.5 && npm install --no-save
test-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install npm 6 + deps via npm
run: |
sudo npm install -g npm@6.14.5 && npm install --no-save
- name: lint
run: npm run lint

test-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install npm 6 + deps via npm
run: |
sudo npm install -g npm@6.14.5 && npm install --no-save
- name: test:coverage
run: npm run test:coverage

# test-integration-flat-chrome:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: '10.x'
# - name: Install npm 6 + deps via npm
# run: |
# sudo npm install -g npm@6.14.5 && npm install --no-save
# - name: Enable Chrome
# run: |
# sudo apt-get update
# sudo apt-get install xvfb
# xvfb-run --auto-servernum npm test
# - name: test:integration:flat
# run: npm run test:flat
# env:
# browsers: '["Chrome"]'

# test-e2e-chrome:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: '10.x'
# - name: Install npm 6 + deps via npm
# run: |
# sudo npm install -g npm@6.14.5 && npm install --no-save
# - name: Enable Chrome
# run: |
# sudo apt-get update
# sudo apt-get install xvfb
# xvfb-run --auto-servernum npm test
# - name: build:dist
# run: NODE_ENV='production' npm run dist
# - name: build:debug
# run: find dist/ -type f -exec md5sum {} \; | sort -k 2
# - name: Install Chromedriver latest version
# run: |
# # 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
# rm google-chrome.deb
# - name: test:e2e:chrome
# run: npm run test:e2e:chrome
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Current Master

## 5.2.0 Fri Nov 13 2020

- [#427](https://github.com/poanetwork/nifty-wallet/pull/427) - Fix support of eth_signTypedData_v4 (eip-712)
- [#426](https://github.com/poanetwork/nifty-wallet/pull/426) - Update inpage provider: add ethereum.request method support
- [#411](https://github.com/poanetwork/nifty-wallet/pull/411) - GitHub actions CI

## 5.1.6 Tue Oct 27 2020

- [#419](https://github.com/poanetwork/nifty-wallet/pull/419) - Add 10% margin for gas price in case of RSK chains
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": "5.1.6",
"version": "5.2.0",
"manifest_version": 2,
"author": "POA Network",
"description": "__MSG_appDescription__",
Expand Down
28 changes: 28 additions & 0 deletions app/scripts/controllers/network/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,33 @@ const CLASSIC_CODE = 61
const RSK_CODE = 30
const RSK_TESTNET_CODE = 31


const MAINNET_NETWORK_ID = '1'
const ROPSTEN_NETWORK_ID = '3'
const RINKEBY_NETWORK_ID = '4'
const GOERLI_NETWORK_ID = '5'
const KOVAN_NETWORK_ID = '42'
const POA_NETWORK_ID = '99'
const DAI_NETWORK_ID = '100'
const POA_SOKOL_NETWORK_ID = '77'
const CLASSIC_NETWORK_ID = '61'
const RSK_NETWORK_ID = '30'
const RSK_TESTNET_NETWORK_ID = '31'

const NETWORK_TYPE_TO_ID_MAP = {
[ROPSTEN]: { networkId: ROPSTEN_NETWORK_ID, chainId: ROPSTEN_CHAINID },
[RINKEBY]: { networkId: RINKEBY_NETWORK_ID, chainId: RINKEBY_CHAINID },
[KOVAN]: { networkId: KOVAN_NETWORK_ID, chainId: KOVAN_CHAINID },
[GOERLI_TESTNET]: { networkId: GOERLI_NETWORK_ID, chainId: GOERLI_TESTNET_CHAINID },
[MAINNET]: { networkId: MAINNET_NETWORK_ID, chainId: MAINNET_CHAINID },
[POA]: { networkId: POA_NETWORK_ID, chainId: POA_CHAINID },
[DAI]: { networkId: DAI_NETWORK_ID, chainId: DAI_CHAINID },
[POA_SOKOL]: { networkId: POA_SOKOL_NETWORK_ID, chainId: POA_SOKOL_CHAINID },
[CLASSIC]: { networkId: CLASSIC_NETWORK_ID, chainId: CLASSIC_CHAINID },
[RSK]: { networkId: RSK_NETWORK_ID, chainId: RSK_CHAINID },
[RSK_TESTNET]: { networkId: RSK_TESTNET_NETWORK_ID, chainId: RSK_TESTNET_CHAINID },
}

const POA_DISPLAY_NAME = 'POA'
const DAI_DISPLAY_NAME = 'xDai'
const POA_SOKOL_DISPLAY_NAME = 'Sokol Testnet'
Expand Down Expand Up @@ -141,4 +168,5 @@ module.exports = {
DROPDOWN_RSK_TESTNET_DISPLAY_NAME,
chainTypes,
customDPaths,
NETWORK_TYPE_TO_ID_MAP,
}
8 changes: 8 additions & 0 deletions app/scripts/controllers/network/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import ethNetProps from 'eth-net-props'
import parse from 'url-parse'
const networks = { networkList: {} }
const { isKnownProvider } = require('../../../../old-ui/app/util')
import {
NETWORK_TYPE_TO_ID_MAP,
} from './enums'

const {
ROPSTEN,
Expand Down Expand Up @@ -155,6 +158,11 @@ module.exports = class NetworkController extends EventEmitter {
})
}

getCurrentChainId () {
const { type, chainId: configChainId } = this.getProviderConfig()
return NETWORK_TYPE_TO_ID_MAP[type] ? NETWORK_TYPE_TO_ID_MAP[type].chainId : configChainId
}

setRpcTarget (rpcTarget, chainId, ticker = 'ETH', nickname = '', rpcPrefs) {
const providerConfig = {
type: 'rpc',
Expand Down
1 change: 1 addition & 0 deletions app/scripts/controllers/permissions/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const SAFE_METHODS = [
'eth_sendTransaction',
'eth_sign',
'personal_sign',
'personal_ecRecover',
'eth_signTypedData',
'eth_signTypedData_v1',
'eth_signTypedData_v3',
Expand Down
9 changes: 6 additions & 3 deletions app/scripts/controllers/permissions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CapabilitiesController as RpcCap } from 'rpc-cap'
import { ethErrors } from 'eth-json-rpc-errors'
import { cloneDeep } from 'lodash'

import createMethodMiddleware from './methodMiddleware'
import createMethodMiddleware from './permissionsMethodMiddleware'
import PermissionsLogController from './permissionsLog'

// Methods that do not require any permissions to use:
Expand Down Expand Up @@ -102,11 +102,14 @@ export class PermissionsController {
*/
getAccounts (origin) {
// return new Promise((resolve, _) => {

// const req = { method: 'eth_accounts' }
// const res = {}
// this.permissions.providerMiddlewareFunction(
// { origin }, req, res, () => {}, _end
// { origin },
// req,
// res,
// () => undefined,
// _end,
// )

// function _end () {
Expand Down
16 changes: 0 additions & 16 deletions app/scripts/lib/createProviderMiddleware.js

This file was deleted.

Loading

0 comments on commit 25a1049

Please sign in to comment.