aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Wei <wei.chen@cobinhood.com>2019-09-22 18:01:02 +0800
committerChen Wei <wei.chen@cobinhood.com>2019-09-22 18:01:02 +0800
commit80dae5532d85a0d113b969389d83a5be8d31c2dd (patch)
treef7a7f399c4ef2fde1ff1964dfd2ce652e2edb5f9
parentb30a3f35b1518ef243c09d4ec11f8c069f15dc0d (diff)
downloadtangerine-wallet-browser-80dae5532d85a0d113b969389d83a5be8d31c2dd.tar
tangerine-wallet-browser-80dae5532d85a0d113b969389d83a5be8d31c2dd.tar.gz
tangerine-wallet-browser-80dae5532d85a0d113b969389d83a5be8d31c2dd.tar.bz2
tangerine-wallet-browser-80dae5532d85a0d113b969389d83a5be8d31c2dd.tar.lz
tangerine-wallet-browser-80dae5532d85a0d113b969389d83a5be8d31c2dd.tar.xz
tangerine-wallet-browser-80dae5532d85a0d113b969389d83a5be8d31c2dd.tar.zst
tangerine-wallet-browser-80dae5532d85a0d113b969389d83a5be8d31c2dd.zip
add mainnet
-rw-r--r--app/_locales/en/messages.json3
-rw-r--r--app/_locales/zh_CN/messages.json3
-rw-r--r--app/_locales/zh_TW/messages.json3
-rw-r--r--app/scripts/controllers/network/enums.js10
-rw-r--r--app/scripts/controllers/network/network.js13
-rw-r--r--ui/app/components/app/dropdowns/network-dropdown.js24
-rw-r--r--ui/app/components/app/network.js13
-rw-r--r--ui/app/pages/settings/networks-tab/networks-tab.constants.js9
8 files changed, 75 insertions, 3 deletions
diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json
index de5c6ca1c..90de7c93f 100644
--- a/app/_locales/en/messages.json
+++ b/app/_locales/en/messages.json
@@ -1,4 +1,7 @@
{
+ "tangerine_mainnet": {
+ "message": "Tangerine Network"
+ },
"tangerine_testnet": {
"message": "Tangerine Testnet"
},
diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json
index 2266f6bba..9c0a5b922 100644
--- a/app/_locales/zh_CN/messages.json
+++ b/app/_locales/zh_CN/messages.json
@@ -1,4 +1,7 @@
{
+ "tangerine_mainnet": {
+ "message": "Tangerine Network"
+ },
"tangerine_testnet": {
"message": "Tangerine Testnet"
},
diff --git a/app/_locales/zh_TW/messages.json b/app/_locales/zh_TW/messages.json
index 7e540fcae..7ff8aaffd 100644
--- a/app/_locales/zh_TW/messages.json
+++ b/app/_locales/zh_TW/messages.json
@@ -1,4 +1,7 @@
{
+ "tangerine_mainnet": {
+ "message": "Tangerine Network"
+ },
"tangerine_testnet": {
"message": "Tangerine Testnet"
},
diff --git a/app/scripts/controllers/network/enums.js b/app/scripts/controllers/network/enums.js
index 0ebea4509..37aad9383 100644
--- a/app/scripts/controllers/network/enums.js
+++ b/app/scripts/controllers/network/enums.js
@@ -6,6 +6,7 @@ const LOCALHOST = 'localhost'
const GOERLI = 'goerli'
const TANGERINE_TESTNET = 'tangerine_testnet'
+const TANGERINE_MAINNET = 'tangerine_mainnet';
const MAINNET_CODE = 1
const ROPSTEN_CODE = 3
@@ -13,6 +14,7 @@ const RINKEYBY_CODE = 4
const KOVAN_CODE = 42
const GOERLI_CODE = 5
+const TANGERINE_MAINNET_CODE = 411
const TANGERINE_TESTNET_CODE = 374
const ROPSTEN_DISPLAY_NAME = 'Ropsten'
@@ -24,6 +26,9 @@ const GOERLI_DISPLAY_NAME = 'Goerli'
const TANGERINE_TESTNET_DISPLAYNAME = 'Tangerine Testnet Displayname'
const TANGERINE_TESTNET_RPC = 'https://testnet-rpc.tangerine-network.io'
+const TANGERINE_MAINNET_DISPLAYNAME = 'Tangerine Mainnet Displayname'
+const TANGERINE_MAINNET_RPC = 'https://mainnet-rpc.tangerine-network.io'
+
module.exports = {
ROPSTEN,
RINKEBY,
@@ -42,6 +47,11 @@ module.exports = {
MAINNET_DISPLAY_NAME,
GOERLI_DISPLAY_NAME,
// Tangerine Network
+ TANGERINE_MAINNET,
+ TANGERINE_MAINNET_CODE,
+ TANGERINE_MAINNET_DISPLAYNAME,
+ TANGERINE_MAINNET_RPC,
+
TANGERINE_TESTNET,
TANGERINE_TESTNET_CODE,
TANGERINE_TESTNET_DISPLAYNAME,
diff --git a/app/scripts/controllers/network/network.js b/app/scripts/controllers/network/network.js
index 01a283347..89814c29b 100644
--- a/app/scripts/controllers/network/network.js
+++ b/app/scripts/controllers/network/network.js
@@ -23,9 +23,16 @@ const {
GOERLI,
TANGERINE_TESTNET,
TANGERINE_TESTNET_RPC,
+ TANGERINE_MAINNET,
+ TANGERINE_MAINNET_RPC,
} = require('./enums')
const INFURA_PROVIDER_TYPES = [ROPSTEN, RINKEBY, KOVAN, MAINNET, GOERLI]
-const TANGERINE_PROVIDER_TYPES = [TANGERINE_TESTNET]
+const TANGERINE_PROVIDER_TYPES = [TANGERINE_TESTNET, TANGERINE_MAINNET]
+
+const TANGERINE_RPC_MAPPING = {
+ [TANGERINE_TESTNET]: TANGERINE_TESTNET_RPC,
+ [TANGERINE_MAINNET]: TANGERINE_MAINNET_RPC
+};
const env = process.env.METAMASK_ENV
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
@@ -213,7 +220,9 @@ module.exports = class NetworkController extends EventEmitter {
_configureTangerineProvider ({ type }) {
log.info('NetworkController - configureTangerineProvider', type)
- const networkClient = createJsonRpcClient({ rpcUrl: TANGERINE_TESTNET_RPC })
+ const networkClient = createJsonRpcClient({
+ rpcUrl: TANGERINE_RPC_MAPPING[type],
+ })
this._setNetworkClient(networkClient)
}
diff --git a/ui/app/components/app/dropdowns/network-dropdown.js b/ui/app/components/app/dropdowns/network-dropdown.js
index 1d3ff521f..4d4b07cff 100644
--- a/ui/app/components/app/dropdowns/network-dropdown.js
+++ b/ui/app/components/app/dropdowns/network-dropdown.js
@@ -138,7 +138,27 @@ NetworkDropdown.prototype.render = function () {
// }, this.context.t('mainnet')),
// ]
// ),
-
+ h(
+ DropdownMenuItem,
+ {
+ key: 'tangerine_mainnet',
+ closeMenu: () => this.props.hideNetworkDropdown(),
+ onClick: () => this.handleClick('tangerine_mainnet'),
+ style: dropdownMenuItemStyle,
+ },
+ [
+ providerType === 'tangerine_mainnet' ? h('i.fa.fa-check') : h('.network-check__transparent', '✓'),
+ h(NetworkDropdownIcon, {
+ backgroundColor: '#ff9248',
+ isSelected: providerType === 'tangerine_mainnet',
+ }),
+ h('span.network-name-item', {
+ style: {
+ color: providerType === 'tangerine_testnet' ? '#ffffff' : '#9b9b9b',
+ },
+ }, this.context.t('tangerine_mainnet')),
+ ]
+ ),
h(
DropdownMenuItem,
{
@@ -307,6 +327,8 @@ NetworkDropdown.prototype.getNetworkName = function () {
let name
if (providerName === 'tangerine_testnet') {
+ name = this.context.t('tangerine_mainnet')
+ } else if (providerName === 'tangerine_testnet') {
name = this.context.t('tangerine_testnet')
} else if (providerName === 'mainnet') {
name = this.context.t('mainnet')
diff --git a/ui/app/components/app/network.js b/ui/app/components/app/network.js
index 178710bd1..77558b85f 100644
--- a/ui/app/components/app/network.js
+++ b/ui/app/components/app/network.js
@@ -50,6 +50,9 @@ Network.prototype.render = function () {
} else if (providerName === 'goerli') {
hoverText = context.t('goerli')
iconName = 'goerli-test-network'
+ } else if (providerName === 'tangerine_mainnet') {
+ hoverText = context.t('tangerine_mainnet')
+ iconName = 'tangerine_mainnet'
} else if (providerName === 'tangerine_testnet') {
hoverText = context.t('tangerine_testnet')
iconName = 'tangerine_testnet'
@@ -77,6 +80,16 @@ Network.prototype.render = function () {
}, [
(function () {
switch (iconName) {
+ case 'tangerine_mainnet':
+ return h('.network-indicator', [
+ h(NetworkDropdownIcon, {
+ backgroundColor: '#ff9248 ', // $wild-strawberry
+ nonSelectBackgroundColor: '#15afb2',
+ loading: networkNumber === 'loading',
+ }),
+ h('.network-name', context.t('tangerine_mainnet')),
+ h('.network-indicator__down-arrow'),
+ ])
case 'tangerine_testnet':
return h('.network-indicator', [
h(NetworkDropdownIcon, {
diff --git a/ui/app/pages/settings/networks-tab/networks-tab.constants.js b/ui/app/pages/settings/networks-tab/networks-tab.constants.js
index 39e864d16..73f8bbd4d 100644
--- a/ui/app/pages/settings/networks-tab/networks-tab.constants.js
+++ b/ui/app/pages/settings/networks-tab/networks-tab.constants.js
@@ -45,6 +45,15 @@ const defaultNetworksData = [
// blockExplorerUrl: 'https://goerli.etherscan.io',
// },
{
+ labelKey: 'tangerine_mainnet',
+ iconColor: '#FF9248',
+ providerType: 'tangerine_mainnet',
+ rpcUrl: 'https://mainnet-rpc.tangerine-network.io',
+ chainId: '411',
+ ticker: 'ETH',
+ blockExplorerUrl: 'https://tangerine.explorer',
+ },
+ {
labelKey: 'tangerine_testnet',
iconColor: '#FF4A8D',
providerType: 'tangerine_testnet',