aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2015-10-10 14:14:18 +0800
committerkumavis <aaron@kumavis.me>2015-10-10 14:14:18 +0800
commit2ecea44f929446d2d4e18626d9ee21841aa8b808 (patch)
treea1155cc42d4db137f22a31609b90266b505c5d10
parent6bf98c6923624d565619ecf68c9d4c41d76510ba (diff)
downloadtangerine-wallet-browser-2ecea44f929446d2d4e18626d9ee21841aa8b808.tar
tangerine-wallet-browser-2ecea44f929446d2d4e18626d9ee21841aa8b808.tar.gz
tangerine-wallet-browser-2ecea44f929446d2d4e18626d9ee21841aa8b808.tar.bz2
tangerine-wallet-browser-2ecea44f929446d2d4e18626d9ee21841aa8b808.tar.lz
tangerine-wallet-browser-2ecea44f929446d2d4e18626d9ee21841aa8b808.tar.xz
tangerine-wallet-browser-2ecea44f929446d2d4e18626d9ee21841aa8b808.tar.zst
tangerine-wallet-browser-2ecea44f929446d2d4e18626d9ee21841aa8b808.zip
major - migrate to blockapps-web3
-rw-r--r--app/scripts/inpage.js44
-rw-r--r--package.json6
2 files changed, 45 insertions, 5 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index 42f2de08a..5149bd37e 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -1,19 +1,55 @@
const web3 = require('web3')
-const MetamaskProvider = require('./lib/metamask-provider.js')
+const BlockAppsWeb3Provider = require('blockapps-web3')
+const Transaction = require('ethereumjs-tx')
+require('object.entries').shim()
+
+// const rpcUrl = 'https://rpc.metamask.io'
+
+// var provider = new MetamaskProvider(forwardPayload, rpcUrl)
+var provider = new BlockAppsWeb3Provider({
+ host: 'http://hacknet.blockapps.net',
+ // host: 'http://api.blockapps.net',
+ transaction_signer: {
+ // Can be any object that implements the following methods:
+ hasAddress: function(address, callback) {
+ console.log('metamask provider - asked for address ownership', address)
+ callback(null, true)
+ },
+ signTransaction: function(txParams, callback) {
+ txParams.gasLimit = txParams.gas
+ var tx = new Transaction(txParams)
+ tx.sign(new Buffer('0d0ba14043088cd629a978b49c8691deca5926f0271432bc0064e4745bac0a9f', 'hex'))
+ callback(null, '0x'+tx.serialize().toString('hex'))
+ },
+ },
+ coinbase: '0x00000000000',
+ accounts: ['0x985095ef977ba75fb2bb79cd5c4b84c81392dff6'],
+ // host: function(){ debugger },
+});
-const rpcUrl = 'https://rpc.metamask.io'
const documentOrigin = window.location.origin
const allowedMessageTarget = 'metamask'
const allowedMessageType = 'addUnsignedTx'
-
-var provider = new MetamaskProvider(forwardPayload, rpcUrl)
web3.setProvider(provider)
+// disable setProvider
+web3.setProvider = function(){}
// injecting web3
console.log('Metamask injected web3')
+
+
+// log all the stuff!
+// provider.verbosity = 1
+
+// web3.currentProvider.vm.onStep = function(data, cb){
+// console.log(data)
+// cb()
+// }
+
window.web3 = web3
+
function forwardPayload(payload){
window.postMessage({
to: allowedMessageTarget,
diff --git a/package.json b/package.json
index 183ccf6c9..70da4e216 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,13 @@
{
- "name": "metamask",
+ "name": "metamask-crx",
"version": "0.0.0",
+ "public": false,
"dependencies": {
"async": "^1.4.0",
+ "blockapps-web3": "git://github.com/kumavis/blockapps-web3.git#95d64e4fb35a9c17728003c2afcc5c7b84ec5f79",
+ "ethereumjs-tx": "^0.6.7",
"ethereumjs-util": "^1.3.5",
+ "object.entries": "^1.0.2",
"web3": "^0.9.2"
},
"devDependencies": {