Merge pull request #1352 from MetaMask/rinkeby

Rinkeby
feature/default_network_editable
Thomas Huang 8 years ago committed by GitHub
commit d8a5e6a8e4
  1. 1
      CHANGELOG.md
  2. 25
      README.md
  3. 2
      app/scripts/config.js
  4. 4
      app/scripts/lib/buy-eth-url.js
  5. 5
      app/scripts/lib/config-manager.js
  6. 9
      ui/app/app.js
  7. 8
      ui/app/components/buy-button-subview.js
  8. 3
      ui/app/components/drop-menu-item.js
  9. 12
      ui/app/components/network.js
  10. 2
      ui/app/components/transaction-list-item.js
  11. 5
      ui/app/config.js
  12. 4
      ui/app/css/lib.css
  13. 3
      ui/lib/account-link.js
  14. 3
      ui/lib/explorer-link.js

@ -5,6 +5,7 @@
- Fix occasional nonce tracking issue. - Fix occasional nonce tracking issue.
- Fix bug where some events would not be emitted by web3. - Fix bug where some events would not be emitted by web3.
- Fix bug where an error would be thrown when composing signatures for networks with large ID values. - Fix bug where an error would be thrown when composing signatures for networks with large ID values.
- Add Rinkeby Test Network to our network list.
## 3.5.3 2017-4-24 ## 3.5.3 2017-4-24

@ -168,3 +168,28 @@ To delete a notice:
npm run deleteNotice npm run deleteNotice
``` ```
A list of active notices will pop up. Enter the corresponding id in the command line prompt and add and commit the new changes afterwards. A list of active notices will pop up. Enter the corresponding id in the command line prompt and add and commit the new changes afterwards.
## Adding Custom Networks
To add another network to our dropdown menu, make sure the following files are adjusted properly:
```
app/scripts/config.js
app/scripts/lib/buy-eth-url.js
app/scripts/lib/config-manager.js
ui/app/app.js
ui/app/components/buy-button-subview.js
ui/app/components/drop-menu-item.js
ui/app/components/network.js
ui/app/components/transaction-list-item.js
ui/app/config.js
ui/app/css/lib.css
ui/lib/account-link.js
ui/lib/explorer-link.js
```
You will need:
+ The network ID
+ An RPC Endpoint url
+ An explorer link
+ CSS for the display icon

@ -1,6 +1,7 @@
const MAINET_RPC_URL = 'https://mainnet.infura.io/metamask' const MAINET_RPC_URL = 'https://mainnet.infura.io/metamask'
const TESTNET_RPC_URL = 'https://ropsten.infura.io/metamask' const TESTNET_RPC_URL = 'https://ropsten.infura.io/metamask'
const KOVAN_RPC_URL = 'https://kovan.infura.io/metamask' const KOVAN_RPC_URL = 'https://kovan.infura.io/metamask'
const RINKEBY_RPC_URL = 'https://rinkeby.infura.io/metamask'
const DEFAULT_RPC_URL = TESTNET_RPC_URL const DEFAULT_RPC_URL = TESTNET_RPC_URL
global.METAMASK_DEBUG = 'GULP_METAMASK_DEBUG' global.METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
@ -12,5 +13,6 @@ module.exports = {
testnet: TESTNET_RPC_URL, testnet: TESTNET_RPC_URL,
morden: TESTNET_RPC_URL, morden: TESTNET_RPC_URL,
kovan: KOVAN_RPC_URL, kovan: KOVAN_RPC_URL,
rinkeby: RINKEBY_RPC_URL,
}, },
} }

@ -11,6 +11,10 @@ function getBuyEthUrl ({ network, amount, address }) {
url = 'https://faucet.metamask.io/' url = 'https://faucet.metamask.io/'
break break
case '4':
url = 'https://www.rinkeby.io/'
break
case '42': case '42':
url = 'https://github.com/kovan-testnet/faucet' url = 'https://github.com/kovan-testnet/faucet'
break break

@ -6,6 +6,8 @@ const TESTNET_RPC = MetamaskConfig.network.testnet
const MAINNET_RPC = MetamaskConfig.network.mainnet const MAINNET_RPC = MetamaskConfig.network.mainnet
const MORDEN_RPC = MetamaskConfig.network.morden const MORDEN_RPC = MetamaskConfig.network.morden
const KOVAN_RPC = MetamaskConfig.network.kovan const KOVAN_RPC = MetamaskConfig.network.kovan
const RINKEBY_RPC = MetamaskConfig.network.rinkeby
/* The config-manager is a convenience object /* The config-manager is a convenience object
* wrapping a pojo-migrator. * wrapping a pojo-migrator.
@ -153,6 +155,9 @@ ConfigManager.prototype.getCurrentRpcAddress = function () {
case 'kovan': case 'kovan':
return KOVAN_RPC return KOVAN_RPC
case 'rinkeby':
return RINKEBY_RPC
default: default:
return provider && provider.rpcTarget ? provider.rpcTarget : TESTNET_RPC return provider && provider.rpcTarget ? provider.rpcTarget : TESTNET_RPC

@ -264,6 +264,15 @@ App.prototype.renderNetworkDropdown = function () {
provider: props.provider, provider: props.provider,
}), }),
h(DropMenuItem, {
label: 'Rinkeby Test Network',
closeMenu: () => this.setState({ isNetworkMenuOpen: false}),
action: () => props.dispatch(actions.setProviderType('rinkeby')),
icon: h('.menu-icon.golden-square'),
activeNetworkRender: props.network,
provider: props.provider,
}),
h(DropMenuItem, { h(DropMenuItem, {
label: 'Localhost 8545', label: 'Localhost 8545',
closeMenu: () => this.setState({ isNetworkMenuOpen: false }), closeMenu: () => this.setState({ isNetworkMenuOpen: false }),

@ -152,13 +152,19 @@ BuyButtonSubview.prototype.formVersionSubview = function () {
marginBottom: '15px', marginBottom: '15px',
}, },
}, 'In order to access this feature, please switch to the Main Network'), }, 'In order to access this feature, please switch to the Main Network'),
((network === '3') || (network === '42')) ? h('h3.text-transform-uppercase', 'or go to the') : null, ((network === '3') || (network === '4') || (network === '42')) ? h('h3.text-transform-uppercase', 'or go to the') : null,
(network === '3') ? h('button.text-transform-uppercase', { (network === '3') ? h('button.text-transform-uppercase', {
onClick: () => this.props.dispatch(actions.buyEth({ network })), onClick: () => this.props.dispatch(actions.buyEth({ network })),
style: { style: {
marginTop: '15px', marginTop: '15px',
}, },
}, 'Ropsten Test Faucet') : null, }, 'Ropsten Test Faucet') : null,
(network === '4') ? h('button.text-transform-uppercase', {
onClick: () => this.props.dispatch(actions.buyEth({ network })),
style: {
marginTop: '15px',
},
}, 'Rinkeby Test Faucet') : null,
(network === '42') ? h('button.text-transform-uppercase', { (network === '42') ? h('button.text-transform-uppercase', {
onClick: () => this.props.dispatch(actions.buyEth({ network })), onClick: () => this.props.dispatch(actions.buyEth({ network })),
style: { style: {

@ -47,6 +47,9 @@ DropMenuItem.prototype.activeNetworkRender = function () {
case 'Kovan Test Network': case 'Kovan Test Network':
if (providerType === 'kovan') return h('.check', '✓') if (providerType === 'kovan') return h('.check', '✓')
break break
case 'Rinkeby Test Network':
if (providerType === 'rinkeby') return h('.check', '✓')
break
case 'Localhost 8545': case 'Localhost 8545':
if (activeNetwork === 'http://localhost:8545') return h('.check', '✓') if (activeNetwork === 'http://localhost:8545') return h('.check', '✓')
break break

@ -43,6 +43,9 @@ Network.prototype.render = function () {
} else if (providerName === 'kovan') { } else if (providerName === 'kovan') {
hoverText = 'Kovan Test Network' hoverText = 'Kovan Test Network'
iconName = 'kovan-test-network' iconName = 'kovan-test-network'
} else if (providerName === 'rinkeby') {
hoverText = 'Rinkeby Test Network'
iconName = 'rinkeby-test-network'
} else { } else {
hoverText = 'Unknown Private Network' hoverText = 'Unknown Private Network'
iconName = 'unknown-private-network' iconName = 'unknown-private-network'
@ -82,6 +85,15 @@ Network.prototype.render = function () {
}}, }},
'Kovan Test Net'), 'Kovan Test Net'),
]) ])
case 'rinkeby-test-network':
return h('.network-indicator', [
h('.menu-icon.golden-square'),
h('.network-name', {
style: {
color: '#550077',
}},
'Rinkeby Test Net'),
])
default: default:
return h('.network-indicator', [ return h('.network-indicator', [
h('i.fa.fa-question-circle.fa-lg', { h('i.fa.fa-question-circle.fa-lg', {

@ -27,7 +27,7 @@ TransactionListItem.prototype.render = function () {
let isLinkable = false let isLinkable = false
const numericNet = parseInt(network) const numericNet = parseInt(network)
isLinkable = numericNet === 1 || numericNet === 3 || numericNet === 42 isLinkable = numericNet === 1 || numericNet === 3 || numericNet === 4 || numericNet === 42
var isMsg = ('msgParams' in transaction) var isMsg = ('msgParams' in transaction)
var isTx = ('txParams' in transaction) var isTx = ('txParams' in transaction)

@ -166,6 +166,11 @@ function currentProviderDisplay (metamaskState) {
value = 'Kovan Test Network' value = 'Kovan Test Network'
break break
case 'rinkeby':
title = 'Current Network'
value = 'Rinkeby Test Network'
break
default: default:
title = 'Current RPC' title = 'Current RPC'
value = metamaskState.provider.rpcTarget value = metamaskState.provider.rpcTarget

@ -191,6 +191,10 @@ hr.horizontal-line {
border: 3px solid #690496; border: 3px solid #690496;
} }
.golden-square {
background: #EBB33F;
}
.pending-dot { .pending-dot {
background: red; background: red;
left: 14px; left: 14px;

@ -11,6 +11,9 @@ module.exports = function (address, network) {
case 3: // ropsten test net case 3: // ropsten test net
link = `http://ropsten.etherscan.io/address/${address}` link = `http://ropsten.etherscan.io/address/${address}`
break break
case 4: // rinkeby test net
link = `http://rinkeby.etherscan.io/address/${address}`
break
case 42: // kovan test net case 42: // kovan test net
link = `http://kovan.etherscan.io/address/${address}` link = `http://kovan.etherscan.io/address/${address}`
break break

@ -8,6 +8,9 @@ module.exports = function (hash, network) {
case 3: // ropsten test net case 3: // ropsten test net
prefix = 'ropsten.' prefix = 'ropsten.'
break break
case 4: // rinkeby test net
prefix = 'rinkeby.'
break
case 42: // kovan test net case 42: // kovan test net
prefix = 'kovan.' prefix = 'kovan.'
break break

Loading…
Cancel
Save