This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 975
Add geth + Ethereum Wallet integration into Brave #13177
Closed
Closed
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
e26429a
[WIP] eth wallet support
diracdeltas 99fa452
geth runs when wallet is enabled
jumde 7c46a0b
lint errors
jumde 00cdfdd
move UI into a browserAction
diracdeltas aebc91e
fixed args for spawn
jumde 566444c
Merge remote-tracking branch 'origin/feature/ethwallet' into feature/…
diracdeltas 9e09bb3
Add tooling for upgrading geth, bundling
evq 166cc16
style fixes
diracdeltas e94bb0f
exit issue
jumde 84628d1
lint issue
jumde 821fcde
lint issue
jumde b66ce0e
lint issue
jumde d54b113
add ETHEREUM_NETWORK env var to launch geth with --testnet
evq f4edf64
update package-lock.json
diracdeltas 61a91a8
add buttons to browserAction
diracdeltas 9a8da0c
fix about:ethwallet paths with more than one slash
diracdeltas 994baaa
separate geth download from tools/downloadEthwallet
diracdeltas d3729f4
update meteor-dapp-wallet-prebuilt
diracdeltas daab0dd
remove ethwallet about: url mapping
diracdeltas a960129
remove unused fs require
diracdeltas b4a5bcd
Fix ethereum wallet title display in titleMode
diracdeltas 28386ec
WIP: adding BAT balance display
diracdeltas d403826
fixup geth downloader, only dl once plus updates, change bin path
evq 3a2c479
missing lint
evq f1d0d12
add hacky way to load transfer funds URL
diracdeltas 8d77930
resized ethereum logo
jumde 08713f3
resized ethereum logo
jumde 72ea6a7
make transfer funds button slightly less hacky
diracdeltas 0eb9686
fix geth download on macos
diracdeltas fd18cc7
fix launching geth for packaged builds
evq 4560cbf
store geth data in user data dir
evq fb55f53
remove BAT balance for now
diracdeltas 352dcca
resolving conflicts
jumde d4cb3b7
lint
jumde 1fd6668
add bat contract on first load
evq 771b53c
style
jumde 964537a
invert colors
evq 4bedfca
More style fixes, simplify create-wallet IPC
diracdeltas 0c2229a
use new geth binary, WIP read geth pw from stdin
diracdeltas 3c5a6d3
end geth stdin
diracdeltas 851ae67
open ethwallet tab when wallet creation is done
diracdeltas e56e25f
switch to using ipc directly vs shelling out to get for account creation
evq f146f5f
pass ipcath explicitly
evq df3e5fe
UI tweaks
diracdeltas 65820f2
remove unneccessary console.log
diracdeltas b0e9d2e
update Geth to 1.8.1
evq bfdab47
update Geth to 1.8.12
evq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict' | ||
|
||
const ipc = window.chrome.ipcRenderer | ||
|
||
window.addEventListener('load', () => { | ||
document.body.style.zoom = '120%' | ||
ipc.send('ethwallet-index-loaded') | ||
}) | ||
|
||
Meteor.startup(function() { | ||
Tracker.autorun(function(){ | ||
// If on ropsten, add the testnet BAT token, only once. | ||
if (!localStorage['dapp_hasBAT'] && Session.get('network') === 'ropsten'){ | ||
localStorage.setItem('dapp_hasBAT', true) | ||
|
||
// wait 5s, to allow the tokens to be loaded from the localstorage first | ||
Meteor.setTimeout(function(){ | ||
const batToken = '0x60b10c134088ebd63f80766874e2cade05fc987b' | ||
const tokenId = Helpers.makeId('token', batToken) | ||
Tokens.upsert(tokenId, {$set: { | ||
address: batToken, | ||
name: 'BAT Ropsten', | ||
symbol: 'BATr', | ||
balances: {}, | ||
decimals: 18 | ||
}}) | ||
}, 5000) | ||
|
||
// If on main net, add the BAT token, only once. | ||
} else if (!localStorage['dapp_hasBAT'] && Session.get('network') === 'main'){ | ||
localStorage.setItem('dapp_hasBAT', true) | ||
|
||
// wait 5s, to allow the tokens to be loaded from the localstorage first | ||
Meteor.setTimeout(function(){ | ||
const batToken = '0x0D8775F648430679A709E98d2b0Cb6250d2887EF' | ||
const tokenId = Helpers.makeId('token', batToken) | ||
Tokens.upsert(tokenId, {$set: { | ||
address: batToken, | ||
name: 'Basic Attention Token', | ||
symbol: 'BAT', | ||
balances: {}, | ||
decimals: 18 | ||
}}) | ||
}, 5000) | ||
} | ||
}) | ||
}) | ||
|
||
|
||
var sheet = document.styleSheets[0] | ||
sheet.insertRule('body { filter: invert(100%) }', 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!DOCTYPE html> | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
<html> | ||
<head> | ||
<style> | ||
html, body { | ||
background: #222; | ||
} | ||
button { | ||
font-size: 14px; | ||
font-weight: bold; | ||
padding: 10px; | ||
margin: 10px; | ||
margin-left: 8px; | ||
margin-top: 6px; | ||
text-align: center; | ||
width: 250px; | ||
} | ||
input { | ||
font-size: 15px; | ||
margin-left: 8px; | ||
margin-bottom: 8px; | ||
margin-top: 8px; | ||
width: 240px; | ||
} | ||
#label { | ||
font-size: 14px; | ||
font-weight: bold; | ||
margin-left: 8px; | ||
color: white; | ||
} | ||
.hidden { | ||
display: none; | ||
} | ||
.visible { | ||
display: block; | ||
} | ||
</style> | ||
<script src="ethwallet-popup.js" async></script> | ||
</head> | ||
<body> | ||
<div id="appContainer" class="visible"> | ||
<div id='batBalance'></div> | ||
<div> | ||
<button id="openEthwallet">Open Ethereum Wallet</button> | ||
</div> | ||
<div> | ||
<button id="transferFunds">Transfer Funds to Brave Wallet...</button> | ||
</div> | ||
<div> | ||
<button id="createWallet">Create Ethereum Wallet...</button> | ||
</div> | ||
</div> | ||
<div id="create" class="hidden"> | ||
<div id="label">Enter Wallet Password: </div> | ||
<div> | ||
<input type="password" id="pwd" /> | ||
</div> | ||
<div> | ||
<button id="createEthWallet">Create</button> | ||
</div> | ||
<div> | ||
<button id="back">Back</button> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
'use strict' | ||
|
||
const ipc = window.chrome.ipcRenderer | ||
let batAddress = null | ||
const indexUrl = `${window.location.origin}/index.html` | ||
|
||
ipc.send('get-popup-bat-balance') | ||
ipc.on('popup-bat-balance', (e, amount, walletAddress) => { | ||
/* | ||
if (amount) { | ||
document.getElementById('batBalance').innerText = `Brave Wallet Balance: ${amount} BAT` | ||
} | ||
*/ | ||
batAddress = walletAddress | ||
}) | ||
|
||
const doAction = (message, args) => { | ||
args.actionType = message | ||
ipc.send('dispatch-action', JSON.stringify([args])) | ||
} | ||
|
||
const onBack = () => { | ||
document.getElementById('create').classList.remove('visible') | ||
document.getElementById('create').classList.add('hidden') | ||
document.getElementById('appContainer').classList.remove('hidden') | ||
document.getElementById('appContainer').classList.add('visible') | ||
} | ||
|
||
document.getElementById('createEthWallet').onclick = () => { | ||
var pwd = document.getElementById('pwd').value | ||
ipc.send('create-wallet', pwd) | ||
onBack() | ||
} | ||
|
||
document.getElementById('createWallet').onclick = () => { | ||
document.getElementById('create').classList.add('visible') | ||
document.getElementById('create').classList.remove('hidden') | ||
document.getElementById('appContainer').classList.add('hidden') | ||
document.getElementById('appContainer').classList.remove('visible') | ||
} | ||
|
||
document.getElementById('back').onclick = onBack | ||
|
||
document.getElementById('openEthwallet').onclick = () => { | ||
doAction('app-create-tab-requested', { | ||
createProperties: { | ||
url: indexUrl | ||
} | ||
}) | ||
} | ||
|
||
document.getElementById('transferFunds').onclick = () => { | ||
const sendUrl = `${window.location.origin}/#!send/${batAddress || ''}` | ||
doAction('app-create-tab-requested', { | ||
createProperties: { | ||
url: indexUrl | ||
} | ||
}) | ||
// Meteor can't load sendUrl until indexUrl has already been loaded :( | ||
ipc.once('ethwallet-index-loaded', () => { | ||
doAction('app-load-url-in-active-tab-requested', { | ||
url: sendUrl | ||
}) | ||
}) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't have a good way to do state updates in extensions with redux so an ipc message is ok, but for sending messages to the browser process we should be using actions which do work in extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is sending the message back to the popup window, which is a browserAction popup and not in the redux appState. is there a way to get the correct webcontents in reducers using
event.sender.getId()
if the sender isn't a redux tab?