Commit 27ddc177 authored by Iuri Matias's avatar Iuri Matias Committed by yann300

cleanup

parent 72d3e8ec
...@@ -56,18 +56,6 @@ class Blockchain { ...@@ -56,18 +56,6 @@ class Blockchain {
this.executionContext.event.register('removeProvider', (name) => { this.executionContext.event.register('removeProvider', (name) => {
this.event.trigger('removeProvider', [name]) this.event.trigger('removeProvider', [name])
}) })
// this.udapp.event.register('initiatingTransaction', (timestamp, tx, payLoad) => {
// this.event.trigger('initiatingTransaction', [timestamp, tx, payLoad])
// })
// this.udapp.event.register('transactionExecuted', (error, from, to, data, call, txResult, timestamp) => {
// this.event.trigger('transactionExecuted', [error, from, to, data, call, txResult, timestamp])
// })
// this.udapp.event.register('transactionBroadcasted', (txhash, networkName) => {
// this.event.trigger('transactionBroadcasted', [txhash, networkName])
// })
} }
setupProviders () { setupProviders () {
......
...@@ -42,6 +42,9 @@ class VMProvider { ...@@ -42,6 +42,9 @@ class VMProvider {
getBalanceInEther (address, cb) { getBalanceInEther (address, cb) {
address = stripHexPrefix(address) address = stripHexPrefix(address)
this.web3.eth.getBalance(address, (err, res) => { this.web3.eth.getBalance(address, (err, res) => {
if (err) {
return cb(err)
}
cb(null, Web3.utils.fromWei(new BN(res).toString(10), 'ether')) cb(null, Web3.utils.fromWei(new BN(res).toString(10), 'ether'))
}) })
} }
...@@ -50,37 +53,14 @@ class VMProvider { ...@@ -50,37 +53,14 @@ class VMProvider {
this.web3.eth.getBalance(address, cb) this.web3.eth.getBalance(address, cb)
} }
signMessage (message, account, _passphrase, cb) { signMessage(message, account, _passphrase, cb) {
console.dir("-----")
console.dir("--- signMessage")
const hashedMsg = Web3.utils.sha3(message) const hashedMsg = Web3.utils.sha3(message)
try { this.web3.eth.sign(hashedMsg, account, (error, signedData) => {
// this.web3.eth.sign(account, hashedMsg, (error, signedData) => { if (error) {
this.web3.eth.sign(hashedMsg, account, (error, signedData) => { return cb(error)
if (error) { }
return cb(error) cb(null, hashedMsg, signedData)
} })
console.dir("------")
console.dir(error)
console.dir("------")
cb(null, hashedMsg, signedData)
})
} catch (e) {
console.dir("======")
console.dir(e)
console.dir("======")
cb(e.message)
}
// const personalMsg = ethJSUtil.hashPersonalMessage(Buffer.from(message))
// // const privKey = this.providers.vm.accounts[account].privateKey
// const privKey = this.RemixSimulatorProvider.Accounts.accounts[account].privateKey
// try {
// const rsv = ethJSUtil.ecsign(personalMsg, privKey)
// const signedData = ethJSUtil.toRpcSig(rsv.v, rsv.r, rsv.s)
// cb(null, '0x' + personalMsg.toString('hex'), signedData)
// } catch (e) {
// cb(e.message)
// }
} }
getProvider () { getProvider () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment