pull/1/head
Iuri Matias 5 years ago committed by yann300
parent 72d3e8ec35
commit 27ddc17747
  1. 12
      src/blockchain/blockchain.js
  2. 26
      src/blockchain/providers/vm.js

@ -56,18 +56,6 @@ class Blockchain {
this.executionContext.event.register('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 () {

@ -42,6 +42,9 @@ class VMProvider {
getBalanceInEther (address, cb) {
address = stripHexPrefix(address)
this.web3.eth.getBalance(address, (err, res) => {
if (err) {
return cb(err)
}
cb(null, Web3.utils.fromWei(new BN(res).toString(10), 'ether'))
})
}
@ -51,36 +54,13 @@ class VMProvider {
}
signMessage(message, account, _passphrase, cb) {
console.dir("-----")
console.dir("--- signMessage")
const hashedMsg = Web3.utils.sha3(message)
try {
// this.web3.eth.sign(account, hashedMsg, (error, signedData) => {
this.web3.eth.sign(hashedMsg, account, (error, signedData) => {
if (error) {
return cb(error)
}
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 () {

Loading…
Cancel
Save