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

Meta mask integr #508

Open
wants to merge 68 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f71fd5d
Merge pull request #477 from ethereum/develop
evertonfraga May 23, 2018
7ae5dfb
Move babel/@runtime to dependencies
ryanio Jun 4, 2018
1eeac1b
Update version
ryanio Jun 4, 2018
b615a48
Improving environment detection; removing yarn.lock; adding npm run b…
evertonfraga Jun 5, 2018
6155c56
Merge pull request #478 from ethereum/babelruntime
evertonfraga Jun 5, 2018
96c3a42
Merge branch 'master' of github.com:ethereum/meteor-dapp-wallet into …
evertonfraga Jun 5, 2018
663ef16
package-lock.json
evertonfraga Jun 5, 2018
e24d201
Using npm run
evertonfraga Jun 5, 2018
0023712
Adding circleci file
evertonfraga Jun 5, 2018
2886f69
Merge pull request #479 from ethereum/mist-mode-helpers
evertonfraga Jun 5, 2018
041a500
Update README.md
ryanio Jun 5, 2018
091939c
Indent
ryanio Jun 5, 2018
68006f7
Add colon
ryanio Jun 5, 2018
39f7768
Adding dependency of ecmascript
evertonfraga Jun 5, 2018
0e08054
Building on circleci
evertonfraga Jun 5, 2018
b0991c1
Building on circleci
evertonfraga Jun 5, 2018
80d67bf
Merge pull request #481 from ethereum/add-core-js
evertonfraga Jun 6, 2018
2163f6a
CI config
evertonfraga Jun 13, 2018
7b41a2f
CI config
evertonfraga Jun 13, 2018
c0ffa23
Merge branch 'master' into update-readme
evertonfraga Jun 13, 2018
7964461
Fixing account button on dashboard
evertonfraga Jun 14, 2018
cbf4fce
Merge pull request #480 from ethereum/update-readme
evertonfraga Jun 14, 2018
807df06
Merge branch 'master' into fix-account-button
evertonfraga Jun 14, 2018
ed498b5
Extract refactoring
evertonfraga Jun 14, 2018
d5d2072
Merge branch 'fix-account-button' of github.com:ethereum/meteor-dapp-…
evertonfraga Jun 14, 2018
6a6463b
Merge pull request #485 from ethereum/fix-account-button
evertonfraga Jun 14, 2018
337dedb
Updating contract placeholder with constructor syntax
evertonfraga Aug 15, 2018
8d9eb00
Hide gas section if isMist, since we are now handling this inside the…
ryanio Aug 31, 2018
8262ea6
Updated contract.js for broken token list url
berkantaydin Sep 14, 2018
221c3c6
Merge pull request #494 from berkantaydin/broken-tokenListURL-fix
evertonfraga Sep 14, 2018
42dc878
Merge branch 'master' into hide-gas-for-mist
evertonfraga Sep 14, 2018
633a436
[ImgBot] optimizes images
ImgBotApp Sep 23, 2018
efb0504
Merge pull request #1 from AYIDouble/imgbot
IDouble Sep 23, 2018
305ed1a
Merge branch 'master' into update-contract-placeholder
evertonfraga Oct 4, 2018
6b36a38
Merge pull request #488 from ethereum/update-contract-placeholder
evertonfraga Oct 4, 2018
59fd709
Merge branch 'master' into hide-gas-for-mist
evertonfraga Oct 4, 2018
4b56fc6
Merge branch 'develop' into hide-gas-for-mist
evertonfraga Oct 4, 2018
aaaf261
Merge branch 'master' into master
evertonfraga Oct 5, 2018
299358b
Merge pull request #489 from ethereum/hide-gas-for-mist
ryanio Oct 5, 2018
f680c56
Merge branch 'master' into master
alexvansande Oct 8, 2018
822de4a
Merge pull request #495 from AYIDouble/master
evertonfraga Oct 9, 2018
53048e5
Remove mist warning
evertonfraga Oct 9, 2018
2d48ac4
Add meteor-build-client as devDependency
evertonfraga Oct 9, 2018
f10de4d
Wallet interface
evertonfraga Oct 9, 2018
c8d6c25
Removing CI dependency cache (deterministic CI builds) and simplifyin…
evertonfraga Oct 9, 2018
a1f2608
Fixes autoscan erroring out on invalid token address
ryanio Oct 9, 2018
f3f95bc
Build files
evertonfraga Oct 9, 2018
d93ceaf
Triggering CI job
evertonfraga Oct 9, 2018
f195893
CI: Run npm script inside app dir
evertonfraga Oct 9, 2018
17277b9
CI: Run npm script inside app dir
evertonfraga Oct 9, 2018
3e2ef07
Fixes #4032
ryanio Jul 31, 2018
0f0a6b7
Build files
evertonfraga Oct 9, 2018
f191791
CI: fix cwd
evertonfraga Oct 9, 2018
bd5b521
Import wallet owner check should consider checksum version of address
evertonfraga Oct 9, 2018
b11570f
Refactor: avoiding dense IF statements
evertonfraga Oct 10, 2018
0e24a34
Fix: always return promise
evertonfraga Oct 10, 2018
94e0b23
Prevents log checking for wallet contracts on wallet observer, as it …
evertonfraga Oct 11, 2018
05b2dca
Allows wallet to be re-added, to get out from "Creating..." state
evertonfraga Oct 11, 2018
007b535
Refactor: function extraction
evertonfraga Oct 11, 2018
8d61dbf
Workaround: dealing with both checksum and lowercase addresses
evertonfraga Oct 11, 2018
6625014
Wallet static build
evertonfraga Oct 11, 2018
0263fff
Merge pull request #496 from ethereum/remove-warning
evertonfraga Oct 11, 2018
179803e
Fixes address queries (#501)
evertonfraga Nov 16, 2018
284905f
Static files (#502)
evertonfraga Nov 16, 2018
36d5704
updated babel
frozeman Jun 15, 2020
dd68f84
fixed babel
frozeman Jun 15, 2020
2d476ae
added meta mask compatibility
frozeman Jun 15, 2020
6673b65
fixed select adn build files
frozeman Jun 15, 2020
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
19 changes: 19 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Javascript Node CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:7.10

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

steps:
- checkout
- run: curl https://install.meteor.com/ | sh
- run: cd app && npm install && npm run build


7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ node_js: "7"
sudo: required

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

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

49 changes: 28 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,56 @@ 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!
**PLEASE NOTE:** This wallet is not yet officially released,
and can contain severe bugs! Please use at your own risk.

## Install

If you don't have [Meteor](https://www.meteor.com/install):

$ curl https://install.meteor.com/ | sh

Install npm dependencies:

$ cd meteor-dapp-wallet/app
$ npm install

## Development

Start an `geth` node and the app using meteor and open http://localhost:3000 in your browser:
Start a `geth` node:

$ geth --ws --wsorigins "http://localhost:3000" --unlock <your account>

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

$ cd meteor-dapp-wallet/app
$ meteor

Go to http://localhost:3000
Navigate to http://localhost:3000

## Deployment

To create a build version of your app run:
To create a build:

// install meteor-build-client
$ npm install -g meteor-build-client

// bundle dapp
$ npm install -g meteor-build-client
$ cd meteor-dapp-wallet/app
$ npm install
$ meteor-build-client ../build --path ""

This will generate the files in the `../build` folder. Double click the index.html to start the app.
To make routing work properly you need to build it using:
This will generate the files in the `../build` folder.

$ meteor-build-client ../build
Navigating to `index.html` will start the app, but you will need to serve it over a local server like [MAMP](https://www.mamp.info).

And start a local server which points with its document root into the `../build` folder,
so that you can open the app using `http://localhost:80/`
---

To deploy them to the **wallet.ethereum.org** site, execute these commands (from the app folder):
To deploy to the **wallet.ethereum.org** site, execute these commands:

git checkout gh-pages
git merge develop
cd app
meteor-build-client ../build --path "/"
$ git checkout gh-pages
$ git merge develop
$ cd app
$ meteor-build-client ../build --path "/"

And push (or PR) your changes to the gh-pages branch.
And push (or PR) your changes to the `gh-pages` branch.

---

Expand Down
2 changes: 1 addition & 1 deletion app/.meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ [email protected]
ethereum:[email protected]
ethereum:[email protected]
ethereum:[email protected]
ethereum:[email protected].0
ethereum:[email protected].1
ethereum:[email protected]
ethereum:[email protected]
[email protected]
Expand Down
3 changes: 3 additions & 0 deletions app/client/lib/ethereum/observeBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ observeLatestBlocks = function() {
updateBalances();

// GET the latest blockchain information
// setInterval(()=>{
// updateBalances();
// }, 1000 * 15);
web3.eth.subscribe('newBlockHeaders', function(e, res) {
if (!e) {
updateBalances();
Expand Down
5 changes: 3 additions & 2 deletions app/client/lib/ethereum/observeTransactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ addTransactionAfterSend = function(
to,
gasPrice,
estimatedGas,
data,
rawData,
tokenId
) {
var jsonInterface = undefined,
contractName = undefined,
data = undefined,
txId = Helpers.makeId('tx', txHash);

if (_.isObject(data)) {
contractName = data.contract.name.replace(/([A-Z])/g, ' $1');
jsonInterface = data.contract.jsonInterface;
data = data.data;
data = rawData.data;
}

Transactions.upsert(txId, {
Expand Down
153 changes: 73 additions & 80 deletions app/client/lib/ethereum/walletInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,91 +452,84 @@ checkWalletOwners = function(address) {
info: ''
};

if (web3.utils.isAddress(address)) {
address = address.toLowerCase();
WalletContract.options.address = address;
var myContract = WalletContract;

myContract.m_numOwners(function(e, numberOfOwners) {
if (!e) {
numberOfOwners = numberOfOwners.toNumber();

if (numberOfOwners > 0) {
var owners = [];

// go through the number of owners we stop
P.all(
_.map(_.range(100), function(i) {
return new P(function(resolve, reject) {
web3.eth.getStorageAt(address, 2 + i, function(
e,
ownerAddress
if (!web3.utils.isAddress(address)) return;
address = address.toLowerCase();
WalletContract.options.address = address;
var myContract = WalletContract;

myContract.methods.m_numOwners().call(function(e, numberOfOwners) {
if (e) reject(e);

numberOfOwners = Number(numberOfOwners);
if (numberOfOwners > 0) {
var owners = [];

// go through the number of owners we stop
P.all(
_.map(_.range(numberOfOwners), function(i) {
return new P(function(resolve, reject) {
web3.eth.getStorageAt(address, 2 + i, function(e, ownerAddress) {
if (!e) {
ownerAddress = ownerAddress.replace(
'0x000000000000000000000000',
'0x'
);

ownerAddress = web3.utils.toChecksumAddress(ownerAddress);

if (owners.length > numberOfOwners) return resolve();

if (
web3.utils.isAddress(ownerAddress) &&
ownerAddress !==
'0x0000000000000000000000000000000000000000'
) {
if (!e) {
ownerAddress = ownerAddress.replace(
'0x000000000000000000000000',
'0x'
);

if (owners.length > numberOfOwners) return resolve();

if (
web3.utils.isAddress(ownerAddress) &&
ownerAddress !==
'0x0000000000000000000000000000000000000000'
) {
myContract.isOwner.call(
ownerAddress,
{ from: ownerAddress },
function(e, isOwner) {
if (!e && isOwner) {
owners.push(ownerAddress);
owners = _.uniq(owners);
owners.sort();
}

resolve();
}
);
} else {
myContract.methods
.isOwner(ownerAddress)
.call({ from: ownerAddress }, function(e, isOwner) {
if (!e && isOwner) {
owners.push(ownerAddress);
owners = _.uniq(owners);
owners.sort();
}

resolve();
}
}
});
});
})
).then(
function() {
returnValue.owners = owners;

if ((account = Helpers.getAccountByAddress({ $in: owners }))) {
returnValue.info = TAPi18n.__(
'wallet.newWallet.accountType.import.youreOwner',
{ account: account.name }
);
} else {
returnValue.info = TAPi18n.__(
'wallet.newWallet.accountType.import.watchOnly'
);
});
} else {
resolve();
}
}
});
});
})
).then(
function() {
returnValue.owners = owners;

if ((account = Helpers.getAccountByAddress({ $in: owners }))) {
returnValue.info = TAPi18n.__(
'wallet.newWallet.accountType.import.youreOwner',
{ account: account.name }
);
} else {
returnValue.info = TAPi18n.__(
'wallet.newWallet.accountType.import.watchOnly'
);
}

resolve(returnValue);
return null;
},
function() {
reject();
}
);
} else {
returnValue.info = TAPi18n.__(
'wallet.newWallet.accountType.import.notWallet'
);
resolve(returnValue);
return null;
},
function() {
reject();
}
} else {
reject(e);
}
});
}
);
} else {
returnValue.info = TAPi18n.__(
'wallet.newWallet.accountType.import.notWallet'
);
resolve(returnValue);
}
});
});
};
39 changes: 30 additions & 9 deletions app/client/lib/helpers/helperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ Get the default contract example
@method getDefaultContractExample
**/
Helpers.getDefaultContractExample = function(withoutPragma) {
var source =
'contract MyContract {\n /* Constructor */\n function MyContract() public {\n\n }\n}';
var source = 'contract MyContract {\n constructor() public {\n\n }\n}';

if (withoutPragma) {
return source;
Expand Down Expand Up @@ -91,7 +90,7 @@ Helpers.getLocalStorageSize = function() {
var size = 0;
if (localStorage) {
_.each(Object.keys(localStorage), function(key) {
size += localStorage[key].length * 2 / 1024 / 1024;
size += (localStorage[key].length * 2) / 1024 / 1024;
});
}

Expand Down Expand Up @@ -192,6 +191,10 @@ Helpers.showNotification = function(i18nText, values, callback) {
if (typeof mist !== 'undefined') mist.sounds.bip();
};

var multipleCaseAddresses = function(address) {
return [address.toLowerCase(), web3.utils.toChecksumAddress(address)];
};

/**
Gets the docuement matching the given addess from the EthAccounts or Wallets collection.

Expand All @@ -200,13 +203,28 @@ Gets the docuement matching the given addess from the EthAccounts or Wallets col
@param {Boolean} reactive
*/
Helpers.getAccountByAddress = function(address, reactive) {
if (address == null) {
return null;
}
var options = reactive === false ? { reactive: false } : {};
// if(_.isString(address))
// address = address.toLowerCase();
var query;

if (_.isString(address)) {
query = { address: { $in: multipleCaseAddresses(address) } };
} else if ('$in' in address) {
// If provided query is a list of accounts, unwrap it and adds redundant addresses.
var addressArray = _.flatten(
address.$in.map(e => multipleCaseAddresses(e))
);
query = { address: { $in: addressArray } };
} else {
query = { address: address };
}

return (
EthAccounts.findOne({ address: address }, options) ||
Wallets.findOne({ address: address }, options) ||
CustomContracts.findOne({ address: address }, options)
EthAccounts.findOne(query, options) ||
Wallets.findOne(query, options) ||
CustomContracts.findOne(query, options)
);
};

Expand All @@ -219,7 +237,10 @@ Gets the docuement matching the given query from the EthAccounts or Wallets coll
*/
Helpers.getAccounts = function(query, reactive) {
var options = reactive === false ? { reactive: false } : {};
if (_.isString(query.address)) query.address = query.address.toLowerCase();
if (_.isString(query.address)) {
query.address = { $in: multipleCaseAddresses(query.address) };
}

return EthAccounts.find(query, options)
.fetch()
.concat(Wallets.find(query, options).fetch());
Expand Down
Loading