|
|
|
@ -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')) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
@ -50,37 +53,14 @@ class VMProvider { |
|
|
|
|
this.web3.eth.getBalance(address, cb) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
signMessage (message, account, _passphrase, cb) { |
|
|
|
|
console.dir("-----") |
|
|
|
|
console.dir("--- signMessage") |
|
|
|
|
signMessage(message, account, _passphrase, cb) { |
|
|
|
|
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 () { |
|
|
|
|