upstream from develop branch
This commit is contained in:
commit
cc2d0128ae
|
@ -7,6 +7,7 @@ const RINKEBY = 'rinkeby'
|
|||
const KOVAN = 'kovan'
|
||||
const GOERLI_TESTNET = 'goerli_testnet'
|
||||
const CLASSIC = 'classic'
|
||||
const RSK = 'rsk'
|
||||
const LOCALHOST = 'localhost'
|
||||
|
||||
const POA_CODE = 99
|
||||
|
@ -18,8 +19,9 @@ const RINKEBY_CODE = 4
|
|||
const KOVAN_CODE = 42
|
||||
const GOERLI_TESTNET_CODE = 5
|
||||
const CLASSIC_CODE = 61
|
||||
const RSK_CODE = 30
|
||||
|
||||
const POA_DISPLAY_NAME = 'POA Network'
|
||||
const POA_DISPLAY_NAME = 'POA Core'
|
||||
const DAI_DISPLAY_NAME = 'xDai Chain'
|
||||
const POA_SOKOL_DISPLAY_NAME = 'Sokol'
|
||||
const MAINNET_DISPLAY_NAME = 'Main Ethereum Network'
|
||||
|
@ -28,6 +30,7 @@ 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 RSK_DISPLAY_NAME = 'RSK Mainnet'
|
||||
|
||||
const DROPDOWN_POA_DISPLAY_NAME = POA_DISPLAY_NAME
|
||||
const DROPDOWN_DAI_DISPLAY_NAME = DAI_DISPLAY_NAME
|
||||
|
@ -38,6 +41,7 @@ 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 DROPDOWN_RSK_DISPLAY_NAME = 'RSK Main Net'
|
||||
|
||||
const chainTypes = {
|
||||
TEST: 1,
|
||||
|
@ -54,6 +58,7 @@ module.exports = {
|
|||
KOVAN,
|
||||
GOERLI_TESTNET,
|
||||
CLASSIC,
|
||||
RSK,
|
||||
LOCALHOST,
|
||||
POA_CODE,
|
||||
DAI_CODE,
|
||||
|
@ -64,6 +69,7 @@ module.exports = {
|
|||
KOVAN_CODE,
|
||||
GOERLI_TESTNET_CODE,
|
||||
CLASSIC_CODE,
|
||||
RSK_CODE,
|
||||
POA_DISPLAY_NAME,
|
||||
DAI_DISPLAY_NAME,
|
||||
POA_SOKOL_DISPLAY_NAME,
|
||||
|
@ -73,6 +79,7 @@ module.exports = {
|
|||
KOVAN_DISPLAY_NAME,
|
||||
GOERLI_TESTNET_DISPLAY_NAME,
|
||||
CLASSIC_DISPLAY_NAME,
|
||||
RSK_DISPLAY_NAME,
|
||||
DROPDOWN_POA_DISPLAY_NAME,
|
||||
DROPDOWN_DAI_DISPLAY_NAME,
|
||||
DROPDOWN_POA_SOKOL_DISPLAY_NAME,
|
||||
|
@ -82,5 +89,6 @@ module.exports = {
|
|||
DROPDOWN_KOVAN_DISPLAY_NAME,
|
||||
DROPDOWN_GOERLI_TESTNET_DISPLAY_NAME,
|
||||
DROPDOWN_CLASSIC_DISPLAY_NAME,
|
||||
DROPDOWN_RSK_DISPLAY_NAME,
|
||||
chainTypes,
|
||||
}
|
||||
|
|
|
@ -25,11 +25,13 @@ const {
|
|||
DAI,
|
||||
GOERLI_TESTNET,
|
||||
CLASSIC,
|
||||
RSK,
|
||||
POA_CODE,
|
||||
DAI_CODE,
|
||||
POA_SOKOL_CODE,
|
||||
GOERLI_TESTNET_CODE,
|
||||
CLASSIC_CODE,
|
||||
RSK_CODE,
|
||||
} = require('./enums')
|
||||
const INFURA_PROVIDER_TYPES = [ROPSTEN, RINKEBY, KOVAN, MAINNET]
|
||||
|
||||
|
@ -127,7 +129,8 @@ module.exports = class NetworkController extends EventEmitter {
|
|||
type === POA ||
|
||||
type === DAI ||
|
||||
type === GOERLI_TESTNET ||
|
||||
type === CLASSIC
|
||||
type === CLASSIC ||
|
||||
type === RSK
|
||||
, `NetworkController - Unknown rpc type "${type}"`)
|
||||
const providerConfig = { type }
|
||||
this.providerConfig = providerConfig
|
||||
|
@ -173,6 +176,8 @@ module.exports = class NetworkController extends EventEmitter {
|
|||
this._configureStandardProvider({ rpcUrl: ethNetProps.RPCEndpoints(GOERLI_TESTNET_CODE)[0] })
|
||||
} else if (type === CLASSIC) {
|
||||
this._configureStandardProvider({ rpcUrl: ethNetProps.RPCEndpoints(CLASSIC_CODE)[0] })
|
||||
} else if (type === RSK) {
|
||||
this._configureStandardProvider({ rpcUrl: ethNetProps.RPCEndpoints(RSK_CODE)[0] })
|
||||
} else if (type === LOCALHOST) {
|
||||
this._configureLocalhostProvider()
|
||||
// url-based rpc endpoints
|
||||
|
|
|
@ -8,6 +8,7 @@ const {
|
|||
KOVAN,
|
||||
GOERLI_TESTNET,
|
||||
CLASSIC,
|
||||
RSK,
|
||||
POA_CODE,
|
||||
DAI_CODE,
|
||||
POA_SOKOL_CODE,
|
||||
|
@ -17,6 +18,7 @@ const {
|
|||
KOVAN_CODE,
|
||||
GOERLI_TESTNET_CODE,
|
||||
CLASSIC_CODE,
|
||||
RSK_CODE,
|
||||
POA_DISPLAY_NAME,
|
||||
DAI_DISPLAY_NAME,
|
||||
POA_SOKOL_DISPLAY_NAME,
|
||||
|
@ -26,6 +28,7 @@ const {
|
|||
KOVAN_DISPLAY_NAME,
|
||||
GOERLI_TESTNET_DISPLAY_NAME,
|
||||
CLASSIC_DISPLAY_NAME,
|
||||
RSK_DISPLAY_NAME,
|
||||
DROPDOWN_POA_DISPLAY_NAME,
|
||||
DROPDOWN_DAI_DISPLAY_NAME,
|
||||
DROPDOWN_POA_SOKOL_DISPLAY_NAME,
|
||||
|
@ -35,6 +38,7 @@ const {
|
|||
DROPDOWN_KOVAN_DISPLAY_NAME,
|
||||
DROPDOWN_GOERLI_TESTNET_DISPLAY_NAME,
|
||||
DROPDOWN_CLASSIC_DISPLAY_NAME,
|
||||
DROPDOWN_RSK_DISPLAY_NAME,
|
||||
chainTypes,
|
||||
} = require('./enums')
|
||||
|
||||
|
@ -139,6 +143,16 @@ const GOERLI_TESTNET_OBJ = {
|
|||
networks[GOERLI_TESTNET_CODE] = GOERLI_TESTNET_OBJ
|
||||
networks[GOERLI_TESTNET] = GOERLI_TESTNET_OBJ
|
||||
|
||||
const RSK_OBJ = {
|
||||
order: 10,
|
||||
providerName: RSK,
|
||||
networkID: RSK_CODE,
|
||||
displayName: RSK_DISPLAY_NAME,
|
||||
displayNameDropdown: DROPDOWN_RSK_DISPLAY_NAME,
|
||||
}
|
||||
networks[RSK_CODE] = RSK_OBJ
|
||||
networks[RSK] = RSK_OBJ
|
||||
|
||||
const getNetworkDisplayName = key => networks[key].displayName
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -14,7 +14,8 @@ const {
|
|||
ROPSTEN_CODE,
|
||||
RINKEBY_CODE,
|
||||
KOVAN_CODE,
|
||||
GOERLI_TESTNET_CODE} = require('../controllers/network/enums')
|
||||
GOERLI_TESTNET_CODE,
|
||||
RSK_CODE} = require('../controllers/network/enums')
|
||||
|
||||
/**
|
||||
* Gives the caller a url at which the user can acquire coin, depending on the network they are in
|
||||
|
@ -35,6 +36,7 @@ function getBuyEthUrl ({ network, amount, address, ind }) {
|
|||
case POA_CODE:
|
||||
case DAI_CODE:
|
||||
case CLASSIC_CODE:
|
||||
case RSK_CODE:
|
||||
url = getExchanges({network, amount, address})[ind].link
|
||||
break
|
||||
case ROPSTEN_CODE:
|
||||
|
@ -109,6 +111,21 @@ function getExchanges ({network, amount, address}) {
|
|||
link: 'https://dai-bridge.poa.network/',
|
||||
},
|
||||
]
|
||||
case RSK_CODE:
|
||||
return [
|
||||
{
|
||||
name: 'Huobi',
|
||||
link: 'https://www.huobi.com/',
|
||||
},
|
||||
{
|
||||
name: 'Bitfinex',
|
||||
link: 'https://www.bitfinex.com/',
|
||||
},
|
||||
{
|
||||
name: 'Bitso',
|
||||
link: 'https://bitso.com/',
|
||||
},
|
||||
]
|
||||
default:
|
||||
return []
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ const getBlockscoutApiNetworkPrefix = (network) => {
|
|||
case 42:
|
||||
case 3:
|
||||
case 4:
|
||||
return 'mainnet'
|
||||
return 'eth'
|
||||
case 99:
|
||||
case 77:
|
||||
case 100:
|
||||
|
|
|
@ -24,6 +24,7 @@ const { POA_CODE,
|
|||
KOVAN_CODE,
|
||||
GOERLI_TESTNET_CODE,
|
||||
CLASSIC_CODE,
|
||||
RSK_CODE,
|
||||
} = require('../../../app/scripts/controllers/network/enums')
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
|
@ -84,7 +85,8 @@ TransactionListItem.prototype.render = function () {
|
|||
numericNet === POA_CODE ||
|
||||
numericNet === DAI_CODE ||
|
||||
numericNet === GOERLI_TESTNET_CODE ||
|
||||
numericNet === CLASSIC_CODE
|
||||
numericNet === CLASSIC_CODE ||
|
||||
numericNet === RSK_CODE
|
||||
|
||||
var isMsg = ('msgParams' in transaction)
|
||||
var isTx = ('txParams' in transaction)
|
||||
|
|
|
@ -295,6 +295,8 @@ module.exports = {
|
|||
buttons: {
|
||||
send: By.css('#app-content > div > div.app-primary.from-right > div > div > div.flex-row > button:nth-child(4)'),
|
||||
buy: By.css('#app-content > div > div.app-primary.from-right > div > div > div.flex-row > button:nth-child(3)'),
|
||||
sendRSK: By.css('#app-content > div > div.app-primary.from-left > div > div > div.flex-row > button:nth-child(4)'),
|
||||
buyRSK: By.css('#app-content > div > div.app-primary.from-left > div > div > div.flex-row > button:nth-child(3)'),
|
||||
sendText: 'Send',
|
||||
save: By.className('editable-button'),
|
||||
},
|
||||
|
@ -323,6 +325,7 @@ module.exports = {
|
|||
},
|
||||
buyEther: {
|
||||
title: By.className('flex-center buy-title'),
|
||||
faucetLinkRSK: By.className('buy-option cursor-pointer'),
|
||||
buttonArrow: By.className('fa fa-arrow-left fa-lg cursor-pointer'),
|
||||
},
|
||||
info: {
|
||||
|
@ -400,6 +403,7 @@ module.exports = {
|
|||
KOVAN: 'kovan',
|
||||
RINKEBY: 'rinkeby',
|
||||
GOERLI: 'goerli',
|
||||
RSK: 'rsk',
|
||||
LOCALHOST: 'localhost',
|
||||
CUSTOM: 'http://test.com',
|
||||
},
|
||||
|
|
|
@ -138,14 +138,17 @@ class Functions {
|
|||
case NETWORKS.GOERLI:
|
||||
counter = 8
|
||||
break
|
||||
case NETWORKS.LOCALHOST:
|
||||
case NETWORKS.RSK:
|
||||
counter = 9
|
||||
break
|
||||
case NETWORKS.CUSTOM:
|
||||
case NETWORKS.LOCALHOST:
|
||||
counter = 10
|
||||
break
|
||||
case NETWORKS.CUSTOM:
|
||||
counter = 11
|
||||
break
|
||||
default:
|
||||
counter = 9
|
||||
counter = 10
|
||||
}
|
||||
await this.driver.executeScript("document.getElementsByClassName('dropdown-menu-item')[" + counter + '].click();')
|
||||
}
|
||||
|
|
|
@ -165,6 +165,11 @@ const addCustomToken = async (f, account1, account2) => {
|
|||
await f.setProvider(NETWORKS.RINKEBY)
|
||||
assert.equal(await f.assertTokensNotDisplayed(), true, 'tokens are displayed')
|
||||
})
|
||||
|
||||
it('token should not be displayed in RSK network', async () => {
|
||||
await f.setProvider(NETWORKS.RSK)
|
||||
assert.equal(await f.assertTokensNotDisplayed(), true, 'tokens are displayed')
|
||||
})
|
||||
})
|
||||
|
||||
describe.skip('Custom tokens validation ', async () => {
|
||||
|
@ -200,6 +205,11 @@ const addCustomToken = async (f, account1, account2) => {
|
|||
assert(await f.isDisabledAddInexistentToken(tokenAddress), true, 'can add inexistent token in MAINNET')
|
||||
})
|
||||
|
||||
it('can not add inexistent token to RSK mainnet', async () => {
|
||||
await f.setProvider(NETWORKS.RSK)
|
||||
assert(await f.isDisabledAddInexistentToken(tokenAddress), true, 'can add inexistent token in RSK mainnet')
|
||||
})
|
||||
|
||||
it('can not add inexistent token to LOCALHOST network', async () => {
|
||||
await f.setProvider(NETWORKS.LOCALHOST)
|
||||
assert(await f.isDisabledAddInexistentToken(tokenAddress.slice(0, tokenAddress.length - 2) + '0'), true, 'can add inexistent token in LOCALHOST network')
|
||||
|
|
|
@ -250,6 +250,11 @@ const addTokeFromSearch = async (f) => {
|
|||
await f.setProvider(NETWORKS.RINKEBY)
|
||||
assert.equal(await f.assertTokensNotDisplayed(), true, 'tokens are displayed')
|
||||
})
|
||||
|
||||
it('token should not be displayed in RSK mainnet', async () => {
|
||||
await f.setProvider(NETWORKS.RSK)
|
||||
assert.equal(await f.assertTokensNotDisplayed(), true, 'tokens are displayed')
|
||||
})
|
||||
})
|
||||
describe('remove Mainnet\'s tokens', function () {
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ const { ENVIRONMENT_TYPE_NOTIFICATION } = require('../../app/scripts/lib/enums')
|
|||
const { POA,
|
||||
DAI,
|
||||
POA_SOKOL,
|
||||
RSK,
|
||||
CLASSIC } = require('../../app/scripts/controllers/network/enums')
|
||||
const { hasUnconfirmedTransactions } = require('./helpers/confirm-transaction/util')
|
||||
const WebcamUtils = require('../lib/webcam-utils')
|
||||
|
@ -2014,7 +2015,8 @@ function setProviderType (type) {
|
|||
const newCoin = type === POA || type === POA_SOKOL ?
|
||||
'poa' : type === DAI ?
|
||||
'dai' : type === CLASSIC ?
|
||||
'etc' : 'eth'
|
||||
'etc' : type === RSK ?
|
||||
'rbtc' : 'eth'
|
||||
background.setCurrentCoin(newCoin, (err, data) => {
|
||||
if (err) {
|
||||
log.error(err.stack)
|
||||
|
|
Loading…
Reference in New Issue