Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Adding rinkeby support #2723

Merged
merged 18 commits into from
Jul 10, 2017
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions interface/client/lib/helpers/helperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,23 +210,31 @@ Helpers.detectNetwork = function (hash) {
case '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3':
console.log('Network is mainnet');
network.type = 'mainnet';
network.name = 'Main';
break;

case '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d':
console.log('Network is Testnet #3 (Ropsten)');
network.type = 'testnet';
network.name = 'Testnet #3 (Ropsten)';
network.name = 'Ropsten';
break;

case '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177':
console.log('Network is Testnet #4 (Rinkeby)');
network.type = 'testnet';
network.name = 'Rinkeby';
break;

case '0x0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303':
console.log('Network is Testnet #2 (Morden)');
network.type = 'testnet';
network.name = 'Testnet #2 (Morden)';
network.name = 'Morden';
break;

default:
console.log('Network is privatenet');
network.type = 'privatenet';
network.name = 'Private';
}

return network;
Expand Down
1 change: 1 addition & 0 deletions interface/client/styles/onboardingScreen.import.less
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

button, a.button {
font-size: 110%;
text-align: left;
}
}

Expand Down
2 changes: 1 addition & 1 deletion interface/client/templates/elements/networkIndicator.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{{#if $eq (TemplateVar.get "network") "testnet"}}
<div class="testnet indicator" title="This is the global Morden test network">
{{i18n "mist.nodeInfo.testNetwork"}}
{{TemplateVar.get "networkName"}}
</div>
{{/if}}

Expand Down
5 changes: 1 addition & 4 deletions interface/client/templates/elements/networkIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var checkNetworkType = function (template) {
console.error('Got error fetching block 0', e);
} else {
TemplateVar.set(template, 'network', Helpers.detectNetwork(res.hash).type);
TemplateVar.set(template, 'networkName', Helpers.detectNetwork(res.hash).name);
}
});
} catch (err) {
Expand All @@ -51,9 +52,7 @@ Template['elements_networkIndicator'].onRendered(function () {
case 'stopping':
case 'connected':
console.debug('Node status changing, reset network type indicator');

TemplateVar.set(template, 'network', 'unknown');

break;
}
});
Expand All @@ -68,5 +67,3 @@ Template['elements_networkIndicator'].onRendered(function () {
}
});
});


15 changes: 6 additions & 9 deletions interface/client/templates/elements/nodeInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,24 @@
<div title="{{TemplateVar.get 'peerCount'}} {{i18n 'mist.nodeInfo.peers'}}">
<i class="icon-users"></i> {{TemplateVar.get "peerCount"}}
</div>
<div>
<div>
<i class="icon-cloud-download"></i> {{progress}}%
</div>
<progress max="100" value="{{progress}}"></progress>
{{else}}
<div class='block-number' title="{{i18n 'mist.nodeInfo.blockNumber'}}">
<i class="icon-layers"></i> {{formattedBlockNumber}}
<i class="icon-layers"></i> {{formattedBlockNumber}}
</div>
<div title="{{TemplateVar.get 'peerCount'}} {{i18n 'mist.nodeInfo.peers'}}">
<i class="icon-users"></i> {{TemplateVar.get "peerCount"}}
</div>
<div title="{{i18n 'mist.nodeInfo.timeSinceBlock'}}">
<div title="{{i18n 'mist.nodeInfo.timeSinceBlock'}}">
<i class="icon-clock"></i> {{{timeSinceBlock}}}
</div>
{{/with}}

{{#if $eq (TemplateVar.get "network") "testnet"}}
<span class="test-chain danger" title="{{i18n 'mist.nodeInfo.testnetExplain' name=(TemplateVar.get 'networkName')}}">{{i18n 'mist.nodeInfo.testNetwork'}}</span>
{{/if}}
{{#if $eq (TemplateVar.get "network") "privatenet"}}
<span class="test-chain danger" title="{{i18n 'mist.nodeInfo.privatenetExplain'}}">{{i18n 'mist.nodeInfo.privateNetwork'}}</span>
{{#if $neq (TemplateVar.get "network") "mainnet"}}
<span class="test-chain danger" title="{{i18n 'mist.nodeInfo.testnetExplain' name=(TemplateVar.get 'networkName')}}">{{TemplateVar.get "networkName"}}</span>
{{/if}}
</div>
</template>
</template>
16 changes: 8 additions & 8 deletions interface/client/templates/popupWindows/onboardingScreen.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<div class="onboarding-section onboarding-start">
<p class="description">{{i18n "mist.popupWindows.onboarding.description"}}</p>
<p>
<button class="start-testnet"> {{i18n "mist.popupWindows.onboarding.goToTestnet"}} </button>
{{i18n "mist.popupWindows.onboarding.goToTestnetDescription"}}
<button class="goto-import-account"> {{i18n "mist.popupWindows.onboarding.gotoMainnet"}} </button>
{{i18n "mist.popupWindows.onboarding.gotoMainnetDescription"}}
</p>
<p>
<button class="goto-import-account"> {{i18n "mist.popupWindows.onboarding.gotoMainnet"}} </button>
{{i18n "mist.popupWindows.onboarding.gotoMainnetDescription"}}
<button class="start-testnet"> {{i18n "mist.popupWindows.onboarding.goToTestnet"}} </button>
{{i18n "mist.popupWindows.onboarding.goToTestnetDescription"}}
</p>
</div>

Expand All @@ -35,7 +35,7 @@

<div class="onboarding-section onboarding-account row">
{{#if TemplateVar.get "testnet"}}
<h1>{{i18n "mist.popupWindows.onboarding.accountTitleTestnet"}} </h1>
<h1>{{i18n "mist.popupWindows.onboarding.learnIt"}} </h1>
{{else}}
<h1>{{i18n "mist.popupWindows.onboarding.accountTitle"}} </h1>
{{/if}}
Expand All @@ -46,7 +46,7 @@ <h1>{{i18n "mist.popupWindows.onboarding.accountTitle"}} </h1>
</p>

{{#if TemplateVar.get "testnet"}}
<p>{{{i18n "mist.popupWindows.onboarding.mineItDescription"}}}</p>
<p>{{{i18n "mist.popupWindows.onboarding.faucetDescription"}}}</p>
{{else}}
<p>{{{i18n "mist.popupWindows.onboarding.loadItDescription"}}}</p>
{{/if}}
Expand All @@ -66,7 +66,7 @@ <h6> {{{i18n "mist.popupWindows.onboarding.viaShapeshift"}}} </h6>
{{/if}}
</div>
<div class="col col-12 footer-buttons">
<button class="goto-start"> {{i18n "buttons.back"}} </button>
<button class="goto-start"> {{i18n "buttons.back"}} </button>
<button class="goto-tutorial-1 right-align"> {{i18n "buttons.next"}} </button>
</div>
</div>
Expand All @@ -79,7 +79,7 @@ <h1> {{i18n "mist.popupWindows.onboarding.learnIt"}} </h1>
</div>
<div class="col col-6 tutorial-token"></div>
<div class="col col-12 footer-buttons">
<button class="goto-start"> {{i18n "buttons.back"}} </button>
<button class="goto-account"> {{i18n "buttons.back"}} </button>
<button class="goto-tutorial-2 right-align"> {{i18n "buttons.next"}} </button>
</div>
</div>
Expand Down
53 changes: 34 additions & 19 deletions interface/client/templates/popupWindows/onboardingScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ var getPeerCount = function (template) {

Template['popupWindows_onboardingScreen'].onCreated(function () {
var template = this;
var oldData;
TemplateVar.set('readyToLaunch', false);
TemplateVar.set('newAccount', false);

// check for block status
this.syncFilter = web3.eth.isSyncing(function (error, syncing) {
Expand All @@ -39,7 +39,7 @@ Template['popupWindows_onboardingScreen'].onCreated(function () {
web3.reset(true);
} else if (_.isObject(syncing)) {
// loads syncing data and adds it to old by using 'extend'
var oldData = TemplateVar.get(template, 'syncing');
oldData = TemplateVar.get(template, 'syncing');

TemplateVar.set(template, 'syncing', _.extend(oldData || {}, syncing || {}));

Expand All @@ -50,6 +50,15 @@ Template['popupWindows_onboardingScreen'].onCreated(function () {
});


TemplateVar.set('newAccount', false);
web3.eth.getAccounts((err, acc) => {
console.log('newAccount', err, acc);
if (acc.length > 0) {
TemplateVar.set(template, 'newAccount', acc[0]);
}
});


// CHECK PEER COUNT
this.peerCountIntervalId = null;

Expand All @@ -72,7 +81,7 @@ Template['popupWindows_onboardingScreen'].onCreated(function () {


Template['popupWindows_onboardingScreen'].helpers({
'newAccountLowerCase': function () {
newAccountLowerCase() {
var account = TemplateVar.get('newAccount');
return (account) ? account.toLowerCase() : '';
},
Expand All @@ -81,7 +90,7 @@ Template['popupWindows_onboardingScreen'].helpers({

@method syncStatus
*/
'syncStatus': function () {
syncStatus() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats ES6 right here, if we would remove the ecmascript package, this would break.


// This functions loops trhough numbers while waiting for the node to respond
var template = Template.instance();
Expand Down Expand Up @@ -138,34 +147,38 @@ Template['popupWindows_onboardingScreen'].helpers({

@method syncStatusMessage
*/
'syncStatusMessage': function () {
syncStatusMessage() {
return TemplateVar.get('syncStatusMessageLive');
}
});

Template['popupWindows_onboardingScreen'].events({
'click .goto-start': function (e) {
'click .goto-start': function () {
TemplateVar.set('currentActive', 'start');
},
'click .goto-import-account': function () {
TemplateVar.set('currentActive', 'import-account');

// if testnet, make sure to switch to the mainnet
if (TemplateVar.get('testnet')) {
ipc.send('onBoarding_changeNet', false);
ipc.send('onBoarding_changeNet', /* isTestNet: */ false);
TemplateVar.set('testnet', false);
TemplateVar.set('syncing', null);
}
},
'click .start-testnet': function (e, template) {
if (!TemplateVar.get('testnet')) {
ipc.send('onBoarding_changeNet', true);
ipc.send('onBoarding_changeNet', /* isMainNet: */ true);
TemplateVar.set('testnet', true);
TemplateVar.set('syncing', null);
}

TemplateVar.set('currentActive', 'testnet');
template.$('.onboarding-testnet input.password').focus();
if (!TemplateVar.get('newAccount')) {
TemplateVar.set('currentActive', 'testnet');
template.$('.onboarding-testnet input.password').focus();
} else {
TemplateVar.set('currentActive', 'account');
}
},
'click .goto-password': function (e, template) {
TemplateVar.set('currentActive', 'password');
Expand Down Expand Up @@ -262,7 +275,7 @@ Template['popupWindows_onboardingScreen_importAccount'].events({
if (files.length) {
ipc.send('backendAction_checkWalletFile', files[0].path);

ipc.on('uiAction_checkedWalletFile', function (e, error, type) {
ipc.on('uiAction_checkedWalletFile', function (ev, error, type) {
switch (type) {
case 'presale':
console.log(`Imported ${type} account`);
Expand Down Expand Up @@ -318,7 +331,7 @@ Template['popupWindows_onboardingScreen_importAccount'].events({
ipc.send('backendAction_importWalletFile', TemplateVar.get('filePath'), pw);

TemplateVar.set('importing', true);
ipc.on('uiAction_importedWalletFile', function (e, error, address) {
ipc.on('uiAction_importedWalletFile', function (ev, error, address) {
TemplateVar.set(template, 'importing', false);
TemplateVar.set(template, 'filePath', false);

Expand Down Expand Up @@ -347,7 +360,8 @@ Template['popupWindows_onboardingScreen_importAccount'].events({
});
} else {
GlobalNotification.warning({
content: TAPi18n.__('mist.popupWindows.onboarding.errors.importFailed', { error: error }),
content: TAPi18n.__('mist.popupWindows.onboarding.errors.importFailed', { error
}),
duration: 4
});
}
Expand Down Expand Up @@ -404,8 +418,8 @@ Template['popupWindows_onboardingScreen_password'].events({
@event click button[type="button"]
*/
'input input, change input': function (e, template) {
var pw = template.find('input.password').value,
pwRepeat = template.find('input.password-repeat').value;
var pw = template.find('input.password').value;
var pwRepeat = template.find('input.password-repeat').value;

TemplateVar.set(template, 'passwordsNotEmpty', pw !== '' || pwRepeat !== '');
TemplateVar.set(template, 'passwordsMismatch', pwRepeat && pw !== pwRepeat);
Expand All @@ -417,8 +431,8 @@ Template['popupWindows_onboardingScreen_password'].events({
@event submit form
*/
'submit form': function (e, template) {
var pw = template.find('input.password').value,
pwRepeat = template.find('input.password-repeat').value;
var pw = template.find('input.password').value;
var pwRepeat = template.find('input.password-repeat').value;

if (pw !== pwRepeat) {
GlobalNotification.warning({
Expand All @@ -438,12 +452,13 @@ Template['popupWindows_onboardingScreen_password'].events({
// notifiy about backing up!
alert(TAPi18n.__('mist.popupWindows.requestAccount.backupHint'));

if(!e) {
if (!e) {
TemplateVar.setTo('.onboarding-account', 'newAccount', web3.toChecksumAddress(res));
TemplateVar.setTo('.onboarding-screen', 'currentActive', 'account');

// clear form
pw = pwRepeat = null;
pw = null;
pwRepeat = null;

} else {
GlobalNotification.warning({
Expand Down
2 changes: 1 addition & 1 deletion interface/i18n/mist.de.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
},
"onboarding": {
"description": "Ethereum ist eine dezentrale Plattform, um Anwendungen auf einer Blockchain zu bauen: Fälschungssichere Software, die Werte und Vermögen übertragen kann und für immer besteht",
"goToTestnet": "Verwende das Testnetz",
"goToTestnet": "Verwende das Testnetz (Rinkeby)",
"goToTestnetDescription": "Teste die Technologie frei in der Testnetz-Sandbox, ",
"gotoMainnet": "Verwende das Hauptnetz",
"gotoMainnetDescription": " Du wirst etwas Ether benötigen, um Verträge anzulegen und auszuführen. Wir werden dir helfen, etwas zu bekommen ...",
Expand Down
4 changes: 2 additions & 2 deletions interface/i18n/mist.en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
},
"onboarding": {
"description" : "Ethereum is a platform for decentralized blockchain apps with a fully featured programming language",
"goToTestnet" : "Use the test network",
"goToTestnet" : "Use the test network (Rinkeby)",
"goToTestnetDescription" : "Test the technology freely in a sandboxed testnet, without using real Ether.",
"gotoMainnet" : "Use the main network",
"gotoMainnetDescription" : "You’ll need some Ether to create and execute contracts. Don't worry, we'll help you get some...",
Expand All @@ -257,7 +257,7 @@
"accountTitleTestnet" : "Mine some!",
"etherDescription": "The ethereum network is based on a token called “Ether”. You’ll need a small amount of it to do anything on the Ethereum network.",
"loadItDescription" : "If you already own Bitcoin, or any other cryptocurrency, you can easily convert it to ether using Shapeshift. <br><br> We recommend loading somewhere between <strong>0.25 to 1 ether</strong>.",
"mineItDescription": "<strong>On the testnet you can mine Ether yourself by going to the <em>Develop</em> menu and choosing <em>Start Mining</em>. </strong> <br> <strong> DO NOT ATTEMPT TO SEND REAL ETHER TO THIS ADDRESS </strong>",
"faucetDescription": "The Rinkeby testnet uses Clique Proof of Authority as a consensus mechanism, therefore there's no mining. If you want to get some test ether, head to the Rinkeby Faucet: <strong> faucet.rinkeby.io </strong>",
"you" : "YOU",
"etherbase" : "Main account (etherbase)",
"depositBitcoin" : "Deposit using Bitcoin",
Expand Down
2 changes: 1 addition & 1 deletion interface/i18n/mist.es.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
},
"onboarding": {
"description": "Ethereum es una plataforma descentralizada para la construcción de aplicaciones en una blockchain: segura y a prueba de manipulaciones que puede transferir valor, propiedad y vive para siempre",
"goToTestnet": "Utiliza la red de pruebas",
"goToTestnet": "Utiliza la red de pruebas (Rinkeby)",
"goToTestnetDescription": "Pruebe la tecnología libremente en una red de pruebas sin utilizar ether reales.",
"gotoMainnet": "Utilizar la red principal",
"gotoMainnetDescription": " Necesitarás algunos Ether para poder crear y ejecutar contratos. No se preocupe, nosotros le ayudaremos a obtener algunos...",
Expand Down
2 changes: 1 addition & 1 deletion interface/i18n/mist.fa.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
},
"onboarding": {
"description": "Ethereum is a public blockchain that features a turing complete programming for building solid, decentralized applications.",
"goToTestnet": "Use the test network",
"goToTestnet": "Use the test network (Rinkeby)",
"goToTestnetDescription": "Test the technology freely in a sandboxed testnet, without using real ether.",
"gotoMainnet": "Use the main network",
"gotoMainnetDescription": "You’ll need some Ether in order to create and execute contracts. Don't worry, we'll help you get some...",
Expand Down
2 changes: 1 addition & 1 deletion interface/i18n/mist.fr.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
},
"onboarding": {
"description": "Ethereum est une plateforme décentralisée pour la création d'applications sur une blockchain (chaîne de blocs) : logiciel inviolable qui peut transférer de la valeur et de la propriété et qui vit pour toujours",
"goToTestnet": "Utiliser le réseau Testnet",
"goToTestnet": "Utiliser le réseau Testnet (Rinkeby)",
"goToTestnetDescription": "Testez la technologie librement sur le réseau sandboxé (bac à sable), sans utiliser d'ether réel.",
"gotoMainnet": "Utiliser le réseau réel",
"gotoMainnetDescription": "Vous aurez besoin de quelques Ether afin de créer et exécuter des contrats. Ne vous en faites pas, nous allons vous aider à en obtenir...",
Expand Down
2 changes: 1 addition & 1 deletion interface/i18n/mist.it.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
},
"onboarding": {
"description": "Ethereum é una piattaforma decentralizzata per costruire applicazioni sfruttando una blockchain: software a prova di manomissione che puó trasferire valore e proprietá vivendo per sempre",
"goToTestnet": "Usa la rete di test",
"goToTestnet": "Usa la rete di test (Rinkeby)",
"goToTestnetDescription": "Prova la tecnologia liberamente utilizzando una testnet, senza l'utilizzo di vero ether.",
"gotoMainnet": "Usa la rete principale",
"gotoMainnetDescription": " Avrai bisogno di un po di Ether per creare ed eseguire contratti. Non ti preoccupare, ti aiuteremo ad ottenerne un pó...",
Expand Down
Loading