Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 24c1602

Browse files
authored
Updating production wallet (#407)
* added @frozeman's fix (#328) * added @frozeman's fix (#328) (#329) * updates for gh-pages (#331) * updates for gh-pages (#332) * added @frozeman's fix (#328) * updates for gh-pages (#331) * Update README (#335) Changes wall to wallet * Set placeholder contract's pragma version using Mist-API (#337) * Set placeholder contract's pragma version using Mist-API * add comment * improvements * add further conditions * added missing 0x * build * Merge Develop (#338) * added @frozeman's fix (#328) * updates for gh-pages (#331) * Update README (#335) Changes wall to wallet * Set placeholder contract's pragma version using Mist-API (#337) * Set placeholder contract's pragma version using Mist-API * add comment * improvements * add further conditions * added missing 0x * build * reverted network id storage on accounts package * re-build * Error handling for previous versions of Mist (#342) * Error handling for previous versions of Mist * Better checking of Mist object * rebuild * remove amount param from coinbase widget (#347) * sticky bar is failing to stick. terrible sticky bar, fake sticky (#348) * Warning when trying to transfer a token to an empty recipient (#346) * authorize accounts callback fix * Add caret operator to contract example (#345) * Addresses need quotes (#351) I'm inferring from #118 that address parameters need quotes. * [i18n] add missing meteor package; improve error message (#357) * fix russian translation (#356) * fix renaming bug (#358) * update token contract link (#360) * minor typo and other text corrections (#359) * fixes token selection when sending via the zebra-token-list (#361) * fix * update deployContract * fix (#362) * initialize send view correctly when switching from deploy view (#363) * update TX link: testnet.etherscan.io -> ropsten.etherscan.io (#364) * numeral.js: console.warn instead of console.error (#366) * Add ES6 support; correction to fr translation (#365) * make correction to fr translation * meteor: add ES6 support * update i18n string 'accountNote' (#372) * remove whitespaces from address on token.add() (#370) * fix packages (#369) * Adding out of sync warning (#374) * Adding out of sync warning to EN and PT * Adding etherscan button on sidebar * Translations * added german * Changed http:// to https:// on one link (#384) Changed http:// to https:// on one link in README.md * update 'allow-deny' package to avert download timeout (#383) * build wallet * Darken network info font (#388) * Quick wallet fixes (#389) * fix contract ordering * check if function payable * remove console log * some typo fixes; adjust some of the supporting text (#385) * Adding two more currencies to price ticker (#387) * Adding two more currencies to price ticker * updating ethereum:tools package to 0.7.0 * Update coinbase success message (#390) * Updating coinbase success message Signed-off-by: Everton Fraga <[email protected]> * Updating coinbase success message * Removed disabled wallets (#393) * remove disabled wallets * removed disabled wallets * Temporarily removing ES6 support: fixing indexeddb driver bug (#395) * Including file to prevent 404 error (#394) * add reactive (#396) * add ens support to input fields (#398) * add ens support * make regex case insensitive * Creating travis file (#402) * Creating travis file * renaming travis file * Specifying node version * Debug 1 * Adding sudo: meteor installation * Updating ethereum-elements; building for production (#405) * Adding travis badge * reverse ENS lookup (#403) * add ens support * make regex case insensitive * fix dbissue * update files * do not pull etherscan or show currencies if on testnet * fix block watch * parenthesis * remove amount param from coinbase widget (#347) * sticky bar is failing to stick. terrible sticky bar, fake sticky (#348) * Warning when trying to transfer a token to an empty recipient (#346) * authorize accounts callback fix * Addresses need quotes (#351) I'm inferring from #118 that address parameters need quotes. * Add caret operator to contract example (#345) * [i18n] add missing meteor package; improve error message (#357) * fix russian translation (#356) * minor typo and other text corrections (#359) * fix renaming bug (#358) * update token contract link (#360) * fixes token selection when sending via the zebra-token-list (#361) * fix * update deployContract * fix (#362) * initialize send view correctly when switching from deploy view (#363) * update TX link: testnet.etherscan.io -> ropsten.etherscan.io (#364) * numeral.js: console.warn instead of console.error (#366) * Add ES6 support; correction to fr translation (#365) * make correction to fr translation * meteor: add ES6 support * update i18n string 'accountNote' (#372) * remove whitespaces from address on token.add() (#370) * fix packages (#369) * Adding out of sync warning (#374) * Adding out of sync warning to EN and PT * Adding etherscan button on sidebar * Translations * added german * update 'allow-deny' package to avert download timeout (#383) * build wallet * Changed http:// to https:// on one link (#384) Changed http:// to https:// on one link in README.md * Darken network info font (#388) * Quick wallet fixes (#389) * fix contract ordering * check if function payable * remove console log * some typo fixes; adjust some of the supporting text (#385) * Adding two more currencies to price ticker (#387) * Adding two more currencies to price ticker * updating ethereum:tools package to 0.7.0 * Update coinbase success message (#390) * Updating coinbase success message Signed-off-by: Everton Fraga <[email protected]> * Updating coinbase success message * Removed disabled wallets (#393) * remove disabled wallets * removed disabled wallets * Temporarily removing ES6 support: fixing indexeddb driver bug (#395) * Including file to prevent 404 error (#394) * add reactive (#396) * add ens support to input fields (#398) * add ens support * make regex case insensitive * Creating travis file (#402) * Creating travis file * renaming travis file * Specifying node version * Debug 1 * Adding sudo: meteor installation * Updating ethereum-elements; building for production (#405) * Adding travis badge * reverse ENS lookup (#403) * add ens support * make regex case insensitive * fix dbissue * update files * do not pull etherscan or show currencies if on testnet * fix block watch * parenthesis * Release fixes (#408) * fixes from the PR407 review * makes header work in mist properly * makes wallet header work in mist properly, only is small now in the wallet #2 * remove not existing reactiveData template helper * Editor formatting * Fixing token selection bug * fixes token switching * Release fixes (#409) * fixes from the PR407 review * makes header work in mist properly * makes wallet header work in mist properly, only is small now in the wallet #2 * remove not existing reactiveData template helper * Editor formatting * Fixing token selection bug * fixes token switching * build files
1 parent 6fb0ff8 commit 24c1602

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+665
-364
lines changed

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: node_js
2+
3+
node_js: "7"
4+
5+
sudo: required
6+
7+
install:
8+
- npm install -g meteor-build-client
9+
- curl https://install.meteor.com/ | sh
10+
11+
script:
12+
- cd app
13+
- echo `pwd`
14+
- meteor-build-client ../build --path ""
15+

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
The Ethereum wallet.
44

5+
[![Build Status](https://travis-ci.org/ethereum/meteor-dapp-wallet.svg?branch=master)](https://travis-ci.org/ethereum/meteor-dapp-wallet)
6+
57
**NOTE** The wallet is not yet official released,
68
can contain severe bugs!
79

@@ -12,7 +14,7 @@ Start an `geth` node and and the app using meteor and open http://localhost:3000
1214

1315
$ geth --rpccorsdomain "http://localhost:3000" --rpc --unlock <your account>
1416

15-
Starting the wallet dapp using [Meteor](http://meteor.com/install)
17+
Starting the wallet dapp using [Meteor](https://meteor.com/install)
1618

1719
$ cd meteor-dapp-wallet/app
1820
$ meteor

app/.meteor/packages

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ ethereum:web3
4444
ethereum:blocks
4545
ethereum:accounts
4646
ethereum:dapp-styles
47-
numeral:numeral
4847
jrudio:bluebird
4948
tap:i18n-bundler
49+
numeral:numeral
50+
numeral:languages
51+
hashanp:geopattern

app/.meteor/versions

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ [email protected]
3434
3535
3636
37-
ethereum:[email protected].10
38-
ethereum:tools@0.6.0
37+
ethereum:[email protected].17
38+
ethereum:tools@0.7.0
3939
4040
4141
@@ -48,6 +48,7 @@ frozeman:[email protected]
4848
4949
5050
51+
5152
5253
5354
@@ -78,6 +79,7 @@ [email protected]
7879
7980
8081
82+
8183
8284
8385

app/client/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ Meteor.startup(function() {
2121
if(_.isString(TAPi18n.getLanguage())) {
2222
var lang = TAPi18n.getLanguage().substr(0,2);
2323
moment.locale(lang);
24-
numeral.language(lang);
24+
try {
25+
numeral.language(lang);
26+
} catch (err) {
27+
console.warn('numeral.js couldn\'t set number formating: ', err.message);
28+
}
2529
EthTools.setLocale(lang);
2630
}
2731

@@ -39,10 +43,10 @@ Meteor.startup(function() {
3943
symbol: '🦄',
4044
balances: {},
4145
decimals: 0
42-
}});
46+
}});
4347
}, 5000);
4448
}
4549
});
4650

4751

48-
});
52+
});

app/client/lib/ethereum/observeBlocks.js

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,48 +19,67 @@ Update wallet balances
1919
@method updateBalances
2020
*/
2121
updateBalances = function() {
22-
22+
// UPDATE ALL BALANCES (incl. Tokens)
2323
var walletsAndContracts = Wallets.find().fetch().concat(CustomContracts.find().fetch());
2424

25-
// UPDATE WALLETS ACCOUNTS balance
26-
_.each(walletsAndContracts, function(wallet){
27-
if(wallet.address) {
28-
web3.eth.getBalance(wallet.address, function(err, res){
25+
// go through all existing accounts, for each token
26+
_.each(walletsAndContracts, function(account){
27+
28+
if(account.address) {
29+
web3.eth.getBalance(account.address, function(err, res){
2930
if(!err) {
3031
// is of type wallet
31-
if(wallet.creationBlock) {
32-
Wallets.update(wallet._id, {$set: {
32+
if(account.creationBlock) {
33+
Wallets.update(account._id, {$set: {
3334
balance: res.toString(10)
3435
}});
3536
} else {
36-
CustomContracts.update(wallet._id, {$set: {
37+
CustomContracts.update(account._id, {$set: {
3738
balance: res.toString(10)
3839
}});
3940
}
4041
}
4142
});
4243

4344
// update dailylimit spent, etc, if wallet type
44-
if(wallet.creationBlock) {
45+
if(account.creationBlock) {
4546
Meteor.setTimeout(function() {
46-
updateContractData(wallet);
47+
updateContractData(account);
4748
}, 1000);
4849
}
4950
}
51+
52+
53+
// Only check ENS names every N minutes
54+
var now = Date.now();
55+
if (!account.ensCheck || (account.ensCheck && now - account.ensCheck > 10*60*1000)) {
56+
Helpers.getENSName(account.address, function(err, name, returnedAddr) {
57+
58+
if (!err && account.address.toLowerCase() == returnedAddr){
59+
EthAccounts.update({address: account.address}, {$set:{ name: name, ens: true, ensCheck: now}});
60+
CustomContracts.update({address: account.address}, {$set:{ name: name, ens: true, ensCheck: now}});
61+
Wallets.update({address: account.address}, {$set:{ name: name, ens: true, ensCheck: now}});
62+
} else {
63+
EthAccounts.update({address: account.address}, {$set:{ens: false, ensCheck: now}});
64+
CustomContracts.update({address: account.address}, {$set:{ens: false, ensCheck: now}});
65+
Wallets.update({address: account.address}, {$set:{ens: false, ensCheck: now}});
66+
67+
}
68+
});
69+
}
70+
5071
});
5172

5273

53-
5474
// UPDATE TOKEN BALANCES
55-
var walletsContractsAndAccounts = EthAccounts.find().fetch().concat(walletsAndContracts);
75+
var walletsContractsAndAccounts = EthAccounts.find().fetch().concat(Wallets.find().fetch());
5676

5777
_.each(Tokens.find().fetch(), function(token){
5878
if(!token.address)
5979
return;
6080

6181
var tokenInstance = TokenContract.at(token.address);
6282

63-
// go through all existing accounts, for each token
6483
_.each(walletsContractsAndAccounts, function(account){
6584
tokenInstance.balanceOf(account.address, function(e, balance){
6685
var currentBalance = (token && token.balances) ? token.balances[account._id] : 0;
@@ -74,7 +93,7 @@ updateBalances = function() {
7493
set['balances.'+ account._id] = '';
7594
Tokens.update(token._id, {$unset: set});
7695
}
77-
96+
7897
}
7998
});
8099
});
@@ -88,13 +107,13 @@ Observe the latest blocks
88107
@method observeLatestBlocks
89108
*/
90109
observeLatestBlocks = function(){
91-
// update balances on start
110+
111+
// update balances on start
92112
updateBalances();
93113

94114
// GET the latest blockchain information
95115
web3.eth.filter('latest').watch(function(e, res){
96116
if(!e) {
97-
// console.log('Block arrived ', res);
98117
updateBalances();
99118
}
100119
});

app/client/lib/ethereum/observeTransactions.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ var updateTransaction = function(newDocument, transaction, receipt){
160160
console.log("isToken: ",isToken)
161161

162162
if(isToken) {
163-
163+
164164
tokenId = Helpers.makeId('token', receipt.contractAddress);
165165

166166
Tokens.upsert(tokenId, {$set: {
@@ -171,7 +171,7 @@ var updateTransaction = function(newDocument, transaction, receipt){
171171
decimals: 0
172172
}});
173173

174-
174+
175175
// check if the token has information about itself asynchrounously
176176
var tokenInstance = TokenContract.at(receipt.contractAddress);
177177

@@ -183,7 +183,7 @@ var updateTransaction = function(newDocument, transaction, receipt){
183183
name: TAPi18n.__('wallet.tokens.admin', { name: i } )
184184
}});
185185
});
186-
186+
187187
tokenInstance.decimals(function(e, i){
188188
Tokens.upsert(tokenId, {$set: {
189189
decimals: Number(i)
@@ -272,8 +272,10 @@ observeTransactions = function(){
272272

273273
// check for confirmations
274274
if(!tx.confirmed && tx.transactionHash) {
275-
var filter = web3.eth.filter('latest');
276-
filter.watch(function(e, blockHash){
275+
276+
var updateTransactions = function(e, blockHash){
277+
console.log('updateTransactions', e, blockHash);
278+
277279
if(!e) {
278280
var confirmations = (tx.blockNumber && EthBlocks.latest.number) ? (EthBlocks.latest.number + 1) - tx.blockNumber : 0;
279281
confCount++;
@@ -370,6 +372,10 @@ observeTransactions = function(){
370372
});
371373
}
372374
}
375+
};
376+
377+
var filter = web3.eth.filter('latest').watch(function(e, blockHash) {
378+
updateTransactions(e, blockHash);
373379
});
374380
}
375381
};
@@ -408,13 +414,16 @@ observeTransactions = function(){
408414
checkTransactionConfirmations(newDocument);
409415
}
410416

411-
// add price data
412-
if(newDocument.timestamp &&
413-
(!newDocument.exchangeRates ||
417+
// If on main net, add price data
418+
if( Session.get('network') == 'main' &&
419+
newDocument.timestamp &&
420+
(!newDocument.exchangeRates ||
414421
!newDocument.exchangeRates.btc ||
415422
!newDocument.exchangeRates.usd ||
416-
!newDocument.exchangeRates.eur)) {
417-
var url = 'https://min-api.cryptocompare.com/data/pricehistorical?fsym=ETH&tsyms=BTC,USD,EUR&ts='+ newDocument.timestamp;
423+
!newDocument.exchangeRates.eur ||
424+
!newDocument.exchangeRates.gbp ||
425+
!newDocument.exchangeRates.brl)) {
426+
var url = 'https://min-api.cryptocompare.com/data/pricehistorical?fsym=ETH&tsyms=BTC,USD,EUR,GBP,BRL&ts='+ newDocument.timestamp;
418427

419428
if(typeof mist !== 'undefined')
420429
url += '&extraParams=Mist-'+ mist.version;
@@ -424,7 +433,7 @@ observeTransactions = function(){
424433
if(!e && res && res.statusCode === 200) {
425434
var content = JSON.parse(res.content);
426435

427-
if(content){
436+
if(content && content.Response !== "Error"){
428437
_.each(content, function(price, key){
429438
if(price && _.isFinite(price)) {
430439
var name = key.toLowerCase();
@@ -445,7 +454,7 @@ observeTransactions = function(){
445454
}
446455
},
447456
/**
448-
Will check if the transaction is confirmed
457+
Will check if the transaction is confirmed
449458
450459
@method changed
451460
*/
@@ -484,4 +493,4 @@ observeTransactions = function(){
484493
}
485494
});
486495

487-
};
496+
};

app/client/lib/ethereum/walletConnector.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,18 @@ connectToNode = function(){
6161

6262
EthAccounts.init();
6363
EthBlocks.init();
64-
EthTools.ticker.start({extraParams: (typeof mist !== 'undefined') ? 'Mist-'+ mist.version : ''});
64+
EthTools.ticker.start({
65+
extraParams: (typeof mist !== 'undefined') ? 'Mist-'+ mist.version : '',
66+
currencies: ['BTC', 'USD', 'EUR', 'BRL', 'GBP']
67+
});
6568

6669
if (EthAccounts.find().count() > 0) {
6770
checkForOriginalWallet();
6871
}
6972

7073
// EthBlocks.detectFork(function(oldBlock, block){
7174
// console.log('FORK detected from Block #'+ oldBlock.number + ' -> #'+ block.number +', rolling back!');
72-
75+
7376
// // Go through all accounts and re-run
7477
// _.each(Wallets.find({}).fetch(), function(wallet){
7578
// // REMOVE ADDRESS for YOUNG ACCOUNTS, so that it tries to get the Created event and correct address again
@@ -107,15 +110,15 @@ resetWallet = function function_name (argument) {
107110
_.each(Transactions.find().fetch(), function(tx) {
108111
console.log(tx._id);
109112
try {
110-
Transactions.remove(tx._id);
113+
Transactions.remove(tx._id);
111114
} catch(e){
112115
console.error(e);
113116
}
114117
});
115118

116119
_.each(PendingConfirmations.find().fetch(), function(pc) {
117120
try {
118-
PendingConfirmations.remove(pc._id);
121+
PendingConfirmations.remove(pc._id);
119122
} catch(e){
120123
console.error(e);
121124
}
@@ -133,7 +136,6 @@ resetWallet = function function_name (argument) {
133136

134137
setTimeout(function() {
135138
console.log('Fetching logs...');
136-
connectToNode();
139+
connectToNode();
137140
}, 1000 * 6);
138141
}
139-

app/client/lib/ethereum/walletInterface.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)