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

Commit

Permalink
Updating production wallet (#407)
Browse files Browse the repository at this point in the history
* 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 <ev@ethereum.org>

* 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 <ev@ethereum.org>

* 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
  • Loading branch information
evertonfraga authored Jul 12, 2017
1 parent 6fb0ff8 commit 24c1602
Show file tree
Hide file tree
Showing 74 changed files with 665 additions and 364 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js

node_js: "7"

sudo: required

install:
- npm install -g meteor-build-client
- curl https://install.meteor.com/ | sh

script:
- cd app
- echo `pwd`
- meteor-build-client ../build --path ""

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

The Ethereum wallet.

[![Build Status](https://travis-ci.org/ethereum/meteor-dapp-wallet.svg?branch=master)](https://travis-ci.org/ethereum/meteor-dapp-wallet)

**NOTE** The wallet is not yet official released,
can contain severe bugs!

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

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

Starting the wallet dapp using [Meteor](http://meteor.com/install)
Starting the wallet dapp using [Meteor](https://meteor.com/install)

$ cd meteor-dapp-wallet/app
$ meteor
Expand Down
4 changes: 3 additions & 1 deletion app/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ ethereum:web3
ethereum:blocks
ethereum:accounts
ethereum:dapp-styles
numeral:numeral
jrudio:bluebird
tap:i18n-bundler
numeral:numeral
numeral:languages
hashanp:geopattern
6 changes: 4 additions & 2 deletions app/.meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ ejson@1.0.11
ethereum:accounts@0.4.0
ethereum:blocks@0.3.2
ethereum:dapp-styles@0.5.7
ethereum:elements@0.7.10
ethereum:tools@0.6.0
ethereum:elements@0.7.17
ethereum:tools@0.7.0
ethereum:web3@0.15.3
fastclick@1.0.11
frozeman:animation-helper@0.2.6
Expand All @@ -48,6 +48,7 @@ frozeman:simple-modal@0.0.7
frozeman:storage@0.1.9
frozeman:template-var@1.3.0
geojson-utils@1.0.8
hashanp:geopattern@0.0.1
hot-code-push@1.0.4
html-tools@1.0.9
htmljs@1.0.9
Expand Down Expand Up @@ -78,6 +79,7 @@ mongo@1.1.7
mongo-id@1.0.4
mrt:qrcodesvg@0.1.0
npm-mongo@1.4.43
numeral:languages@1.5.3
numeral:numeral@1.5.3_1
observe-sequence@1.0.11
ordered-dict@1.0.7
Expand Down
10 changes: 7 additions & 3 deletions app/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ Meteor.startup(function() {
if(_.isString(TAPi18n.getLanguage())) {
var lang = TAPi18n.getLanguage().substr(0,2);
moment.locale(lang);
numeral.language(lang);
try {
numeral.language(lang);
} catch (err) {
console.warn('numeral.js couldn\'t set number formating: ', err.message);
}
EthTools.setLocale(lang);
}

Expand All @@ -39,10 +43,10 @@ Meteor.startup(function() {
symbol: '🦄',
balances: {},
decimals: 0
}});
}});
}, 5000);
}
});


});
});
51 changes: 35 additions & 16 deletions app/client/lib/ethereum/observeBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,67 @@ Update wallet balances
@method updateBalances
*/
updateBalances = function() {

// UPDATE ALL BALANCES (incl. Tokens)
var walletsAndContracts = Wallets.find().fetch().concat(CustomContracts.find().fetch());

// UPDATE WALLETS ACCOUNTS balance
_.each(walletsAndContracts, function(wallet){
if(wallet.address) {
web3.eth.getBalance(wallet.address, function(err, res){
// go through all existing accounts, for each token
_.each(walletsAndContracts, function(account){

if(account.address) {
web3.eth.getBalance(account.address, function(err, res){
if(!err) {
// is of type wallet
if(wallet.creationBlock) {
Wallets.update(wallet._id, {$set: {
if(account.creationBlock) {
Wallets.update(account._id, {$set: {
balance: res.toString(10)
}});
} else {
CustomContracts.update(wallet._id, {$set: {
CustomContracts.update(account._id, {$set: {
balance: res.toString(10)
}});
}
}
});

// update dailylimit spent, etc, if wallet type
if(wallet.creationBlock) {
if(account.creationBlock) {
Meteor.setTimeout(function() {
updateContractData(wallet);
updateContractData(account);
}, 1000);
}
}


// Only check ENS names every N minutes
var now = Date.now();
if (!account.ensCheck || (account.ensCheck && now - account.ensCheck > 10*60*1000)) {
Helpers.getENSName(account.address, function(err, name, returnedAddr) {

if (!err && account.address.toLowerCase() == returnedAddr){
EthAccounts.update({address: account.address}, {$set:{ name: name, ens: true, ensCheck: now}});
CustomContracts.update({address: account.address}, {$set:{ name: name, ens: true, ensCheck: now}});
Wallets.update({address: account.address}, {$set:{ name: name, ens: true, ensCheck: now}});
} else {
EthAccounts.update({address: account.address}, {$set:{ens: false, ensCheck: now}});
CustomContracts.update({address: account.address}, {$set:{ens: false, ensCheck: now}});
Wallets.update({address: account.address}, {$set:{ens: false, ensCheck: now}});

}
});
}

});



// UPDATE TOKEN BALANCES
var walletsContractsAndAccounts = EthAccounts.find().fetch().concat(walletsAndContracts);
var walletsContractsAndAccounts = EthAccounts.find().fetch().concat(Wallets.find().fetch());

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

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

// go through all existing accounts, for each token
_.each(walletsContractsAndAccounts, function(account){
tokenInstance.balanceOf(account.address, function(e, balance){
var currentBalance = (token && token.balances) ? token.balances[account._id] : 0;
Expand All @@ -74,7 +93,7 @@ updateBalances = function() {
set['balances.'+ account._id] = '';
Tokens.update(token._id, {$unset: set});
}

}
});
});
Expand All @@ -88,13 +107,13 @@ Observe the latest blocks
@method observeLatestBlocks
*/
observeLatestBlocks = function(){
// update balances on start

// update balances on start
updateBalances();

// GET the latest blockchain information
web3.eth.filter('latest').watch(function(e, res){
if(!e) {
// console.log('Block arrived ', res);
updateBalances();
}
});
Expand Down
35 changes: 22 additions & 13 deletions app/client/lib/ethereum/observeTransactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ var updateTransaction = function(newDocument, transaction, receipt){
console.log("isToken: ",isToken)

if(isToken) {

tokenId = Helpers.makeId('token', receipt.contractAddress);

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


// check if the token has information about itself asynchrounously
var tokenInstance = TokenContract.at(receipt.contractAddress);

Expand All @@ -183,7 +183,7 @@ var updateTransaction = function(newDocument, transaction, receipt){
name: TAPi18n.__('wallet.tokens.admin', { name: i } )
}});
});

tokenInstance.decimals(function(e, i){
Tokens.upsert(tokenId, {$set: {
decimals: Number(i)
Expand Down Expand Up @@ -272,8 +272,10 @@ observeTransactions = function(){

// check for confirmations
if(!tx.confirmed && tx.transactionHash) {
var filter = web3.eth.filter('latest');
filter.watch(function(e, blockHash){

var updateTransactions = function(e, blockHash){
console.log('updateTransactions', e, blockHash);

if(!e) {
var confirmations = (tx.blockNumber && EthBlocks.latest.number) ? (EthBlocks.latest.number + 1) - tx.blockNumber : 0;
confCount++;
Expand Down Expand Up @@ -370,6 +372,10 @@ observeTransactions = function(){
});
}
}
};

var filter = web3.eth.filter('latest').watch(function(e, blockHash) {
updateTransactions(e, blockHash);
});
}
};
Expand Down Expand Up @@ -408,13 +414,16 @@ observeTransactions = function(){
checkTransactionConfirmations(newDocument);
}

// add price data
if(newDocument.timestamp &&
(!newDocument.exchangeRates ||
// If on main net, add price data
if( Session.get('network') == 'main' &&
newDocument.timestamp &&
(!newDocument.exchangeRates ||
!newDocument.exchangeRates.btc ||
!newDocument.exchangeRates.usd ||
!newDocument.exchangeRates.eur)) {
var url = 'https://min-api.cryptocompare.com/data/pricehistorical?fsym=ETH&tsyms=BTC,USD,EUR&ts='+ newDocument.timestamp;
!newDocument.exchangeRates.eur ||
!newDocument.exchangeRates.gbp ||
!newDocument.exchangeRates.brl)) {
var url = 'https://min-api.cryptocompare.com/data/pricehistorical?fsym=ETH&tsyms=BTC,USD,EUR,GBP,BRL&ts='+ newDocument.timestamp;

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

if(content){
if(content && content.Response !== "Error"){
_.each(content, function(price, key){
if(price && _.isFinite(price)) {
var name = key.toLowerCase();
Expand All @@ -445,7 +454,7 @@ observeTransactions = function(){
}
},
/**
Will check if the transaction is confirmed
Will check if the transaction is confirmed
@method changed
*/
Expand Down Expand Up @@ -484,4 +493,4 @@ observeTransactions = function(){
}
});

};
};
14 changes: 8 additions & 6 deletions app/client/lib/ethereum/walletConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ connectToNode = function(){

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

if (EthAccounts.find().count() > 0) {
checkForOriginalWallet();
}

// EthBlocks.detectFork(function(oldBlock, block){
// console.log('FORK detected from Block #'+ oldBlock.number + ' -> #'+ block.number +', rolling back!');

// // Go through all accounts and re-run
// _.each(Wallets.find({}).fetch(), function(wallet){
// // REMOVE ADDRESS for YOUNG ACCOUNTS, so that it tries to get the Created event and correct address again
Expand Down Expand Up @@ -107,15 +110,15 @@ resetWallet = function function_name (argument) {
_.each(Transactions.find().fetch(), function(tx) {
console.log(tx._id);
try {
Transactions.remove(tx._id);
Transactions.remove(tx._id);
} catch(e){
console.error(e);
}
});

_.each(PendingConfirmations.find().fetch(), function(pc) {
try {
PendingConfirmations.remove(pc._id);
PendingConfirmations.remove(pc._id);
} catch(e){
console.error(e);
}
Expand All @@ -133,7 +136,6 @@ resetWallet = function function_name (argument) {

setTimeout(function() {
console.log('Fetching logs...');
connectToNode();
connectToNode();
}, 1000 * 6);
}

12 changes: 6 additions & 6 deletions app/client/lib/ethereum/walletInterface.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 24c1602

Please sign in to comment.