mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Merge branch 'master' into i328-MultiVault
This commit is contained in:
commit
6eb6968037
@ -2,7 +2,14 @@
|
||||
|
||||
## Current Master
|
||||
|
||||
## 2.13.6 2016-10-26
|
||||
|
||||
- Add a check for improper Transaction data.
|
||||
- Inject up to date version of web3.js
|
||||
- Now nicknaming new accounts "Account #" instead of "Wallet #" for clarity.
|
||||
- Fix bug where custom provider selection could show duplicate items.
|
||||
- Fix bug where connecting to a local morden node would make two providers appear selected.
|
||||
- Fix bug that was sometimes preventing transactions from being sent.
|
||||
|
||||
## 2.13.5 2016-10-18
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "MetaMask",
|
||||
"short_name": "Metamask",
|
||||
"version": "2.13.5",
|
||||
"version": "2.13.6",
|
||||
"manifest_version": 2,
|
||||
"author": "https://metamask.io",
|
||||
"description": "Ethereum Browser Extension",
|
||||
|
@ -245,17 +245,11 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone
|
||||
// perform static analyis on the target contract code
|
||||
function analyzeForDelegateCall(cb){
|
||||
if (txParams.to) {
|
||||
query.getCode(txParams.to, function (err, result) {
|
||||
query.getCode(txParams.to, (err, result) => {
|
||||
if (err) return cb(err)
|
||||
var code = ethUtil.toBuffer(result)
|
||||
if (code !== '0x') {
|
||||
var ops = ethBinToOps(code)
|
||||
var containsDelegateCall = ops.some((op) => op.name === 'DELEGATECALL')
|
||||
txData.containsDelegateCall = containsDelegateCall
|
||||
cb()
|
||||
} else {
|
||||
cb()
|
||||
}
|
||||
var containsDelegateCall = self.checkForDelegateCall(result)
|
||||
txData.containsDelegateCall = containsDelegateCall
|
||||
cb()
|
||||
})
|
||||
} else {
|
||||
cb()
|
||||
@ -280,6 +274,17 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone
|
||||
}
|
||||
}
|
||||
|
||||
IdentityStore.prototype.checkForDelegateCall = function (codeHex) {
|
||||
const code = ethUtil.toBuffer(codeHex)
|
||||
if (code !== '0x') {
|
||||
const ops = ethBinToOps(code)
|
||||
const containsDelegateCall = ops.some((op) => op.name === 'DELEGATECALL')
|
||||
return containsDelegateCall
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
IdentityStore.prototype.addGasBuffer = function (gasHex) {
|
||||
var gas = new BN(gasHex, 16)
|
||||
var buffer = new BN('100000', 10)
|
||||
@ -419,7 +424,7 @@ IdentityStore.prototype._loadIdentities = function () {
|
||||
// // add to ethStore
|
||||
this._ethStore.addAccount(ethUtil.addHexPrefix(address))
|
||||
// add to identities
|
||||
const defaultLabel = 'Wallet ' + (i + 1)
|
||||
const defaultLabel = 'Account ' + (i + 1)
|
||||
const nickname = configManager.nicknameForWallet(address)
|
||||
var identity = {
|
||||
name: nickname || defaultLabel,
|
||||
|
@ -3,4 +3,22 @@ start the dual servers (dapp + mascara)
|
||||
node server.js
|
||||
```
|
||||
|
||||
open the example dapp at `http://localhost:9002/`
|
||||
open the example dapp at `http://localhost:9002/`
|
||||
|
||||
*You will need to build MetaMask in order for this to work*
|
||||
```
|
||||
gulp dev
|
||||
```
|
||||
to build MetaMask and have it live reload if you make changes
|
||||
|
||||
|
||||
## First time use:
|
||||
|
||||
- navigate to: http://127.0.0.1:9001/popup/popup.html
|
||||
- Create an Account
|
||||
- go back to http://localhost:9002/
|
||||
- open devTools
|
||||
- click Sync Tx
|
||||
|
||||
### Todos
|
||||
- Look into using [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API)
|
||||
|
@ -17,7 +17,7 @@ function startApp(){
|
||||
console.log('getting main account...')
|
||||
web3.eth.getAccounts(function(err, addresses){
|
||||
if (err) throw err
|
||||
console.log('set address')
|
||||
console.log('set address', addresses[0])
|
||||
primaryAccount = addresses[0]
|
||||
})
|
||||
|
||||
|
@ -4,7 +4,6 @@ const setupProvider = require('./lib/setup-provider.js')
|
||||
//
|
||||
// setup web3
|
||||
//
|
||||
|
||||
var provider = setupProvider()
|
||||
hijackProvider(provider)
|
||||
var web3 = new Web3(provider)
|
||||
@ -27,7 +26,7 @@ var shouldPop = false
|
||||
window.addEventListener('click', function(){
|
||||
if (!shouldPop) return
|
||||
shouldPop = false
|
||||
window.open('http://127.0.0.1:9001/popup/popup.html', '', 'width=1000')
|
||||
window.open('http://127.0.0.1:9001/popup/popup.html', '', 'width=360 height=500')
|
||||
console.log('opening window...')
|
||||
})
|
||||
|
||||
@ -41,4 +40,4 @@ function hijackProvider(provider){
|
||||
}
|
||||
_super(payload, cb)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,15 +80,6 @@ function createBundle(entryPoint){
|
||||
plugin: [watchify],
|
||||
})
|
||||
|
||||
// global transpile
|
||||
var bablePreset = require.resolve('babel-preset-es2015')
|
||||
|
||||
bundler.transform(babelify, {
|
||||
global: true,
|
||||
presets: [bablePreset],
|
||||
babelrc: false,
|
||||
})
|
||||
|
||||
bundler.on('update', bundle)
|
||||
bundle()
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
"dnode": "^1.2.2",
|
||||
"end-of-stream": "^1.1.0",
|
||||
"ensnare": "^1.0.0",
|
||||
"eth-bin-to-ops": "^1.0.0",
|
||||
"eth-bin-to-ops": "^1.0.1",
|
||||
"eth-lightwallet": "^2.3.3",
|
||||
"eth-query": "^1.0.3",
|
||||
"eth-store": "^1.1.0",
|
||||
@ -84,14 +84,13 @@
|
||||
"three.js": "^0.73.2",
|
||||
"through2": "^2.0.1",
|
||||
"vreme": "^3.0.2",
|
||||
"web3": "ethereum/web3.js#260ac6e78a8ce4b2e13f5bb0fdb65f4088585876",
|
||||
"web3": "0.17.0-beta",
|
||||
"web3-provider-engine": "^8.1.5",
|
||||
"web3-stream-provider": "^2.0.6",
|
||||
"xtend": "^4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^6.0.5",
|
||||
"babel-preset-es2015": "^6.6.0",
|
||||
"babel-register": "^6.7.2",
|
||||
"babelify": "^7.2.0",
|
||||
"beefy": "^2.1.5",
|
||||
|
3
test/lib/example-code.json
Normal file
3
test/lib/example-code.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"delegateCallCode": "0x606060405260e060020a60003504637bd703e8811461003157806390b98a111461005c578063f8b2cb4f1461008e575b005b6100b4600435600073f28c53067227848f8145355c455da5cfdd20e3136396e4ee3d6100da84610095565b6100c660043560243533600160a060020a03166000908152602081905260408120548290101561011f57506000610189565b6100b46004355b600160a060020a0381166000908152602081905260409020545b919050565b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60026040518360e060020a02815260040180838152602001828152602001925050506020604051808303818660325a03f4156100025750506040515191506100af9050565b33600160a060020a0390811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060015b9291505056"
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
var assert = require('assert')
|
||||
var IdentityStore = require('../../app/scripts/lib/idStore')
|
||||
var configManagerGen = require('../lib/mock-config-manager')
|
||||
const async = require('async')
|
||||
const assert = require('assert')
|
||||
const ethUtil = require('ethereumjs-util')
|
||||
const BN = ethUtil.BN
|
||||
const async = require('async')
|
||||
const configManagerGen = require('../lib/mock-config-manager')
|
||||
const delegateCallCode = require('../lib/example-code.json').delegateCallCode
|
||||
const IdentityStore = require('../../app/scripts/lib/idStore')
|
||||
|
||||
describe('IdentityStore', function() {
|
||||
|
||||
@ -156,4 +157,16 @@ describe('IdentityStore', function() {
|
||||
assert.ok(bnResult.gt(gas), 'added more gas as buffer.')
|
||||
assert.equal(result.indexOf('0x'), 0, 'include hex prefix')
|
||||
})
|
||||
|
||||
describe('#checkForDelegateCall', function() {
|
||||
const idStore = new IdentityStore({
|
||||
configManager: configManagerGen(),
|
||||
ethStore: {
|
||||
addAccount(acct) { accounts.push(ethUtil.addHexPrefix(acct)) },
|
||||
},
|
||||
})
|
||||
|
||||
var result = idStore.checkForDelegateCall(delegateCallCode)
|
||||
assert.equal(result, true, 'no delegate call in provided code')
|
||||
})
|
||||
})
|
||||
|
@ -236,6 +236,7 @@ App.prototype.renderNetworkDropdown = function () {
|
||||
action: () => props.dispatch(actions.setProviderType('testnet')),
|
||||
icon: h('.menu-icon.red-dot'),
|
||||
activeNetworkRender: props.network,
|
||||
provider: props.provider,
|
||||
}),
|
||||
|
||||
h(DropMenuItem, {
|
||||
@ -246,13 +247,6 @@ App.prototype.renderNetworkDropdown = function () {
|
||||
activeNetworkRender: props.provider.rpcTarget,
|
||||
}),
|
||||
|
||||
h(DropMenuItem, {
|
||||
label: 'Custom RPC',
|
||||
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
||||
action: () => this.props.dispatch(actions.showConfigPage()),
|
||||
icon: h('i.fa.fa-question-circle.fa-lg'),
|
||||
}),
|
||||
|
||||
this.renderCustomOption(props.provider.rpcTarget),
|
||||
])
|
||||
}
|
||||
@ -493,7 +487,12 @@ App.prototype.toggleMetamaskActive = function () {
|
||||
App.prototype.renderCustomOption = function (rpcTarget) {
|
||||
switch (rpcTarget) {
|
||||
case undefined:
|
||||
return null
|
||||
return h(DropMenuItem, {
|
||||
label: 'Custom RPC',
|
||||
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
||||
action: () => this.props.dispatch(actions.showConfigPage()),
|
||||
icon: h('i.fa.fa-question-circle.fa-lg'),
|
||||
})
|
||||
|
||||
case 'http://localhost:8545':
|
||||
return null
|
||||
|
@ -42,7 +42,7 @@ DropMenuItem.prototype.activeNetworkRender = function () {
|
||||
if (providerType === 'mainnet') return h('.check', '✓')
|
||||
break
|
||||
case 'Morden Test Network':
|
||||
if (activeNetwork === '2') return h('.check', '✓')
|
||||
if (provider.type === 'testnet') return h('.check', '✓')
|
||||
break
|
||||
case 'Localhost 8545':
|
||||
if (activeNetwork === 'http://localhost:8545') return h('.check', '✓')
|
||||
|
Loading…
Reference in New Issue
Block a user