|
|
@ -2,8 +2,9 @@ var RemixLib = require('remix-lib') |
|
|
|
var executionContext = RemixLib.execution.executionContext |
|
|
|
var executionContext = RemixLib.execution.executionContext |
|
|
|
var ethJSUtil = require('ethereumjs-util') |
|
|
|
var ethJSUtil = require('ethereumjs-util') |
|
|
|
var processTx = require('./txProcess.js') |
|
|
|
var processTx = require('./txProcess.js') |
|
|
|
|
|
|
|
var BN = ethJSUtil.BN |
|
|
|
|
|
|
|
|
|
|
|
function hexConvert(ints) { |
|
|
|
function hexConvert (ints) { |
|
|
|
var ret = '0x' |
|
|
|
var ret = '0x' |
|
|
|
for (var i = 0; i < ints.length; i++) { |
|
|
|
for (var i = 0; i < ints.length; i++) { |
|
|
|
var h = ints[i] |
|
|
|
var h = ints[i] |
|
|
@ -37,12 +38,10 @@ Transactions.prototype.eth_sendTransaction = function (payload, cb) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Transactions.prototype.eth_getTransactionReceipt = function (payload, cb) { |
|
|
|
Transactions.prototype.eth_getTransactionReceipt = function (payload, cb) { |
|
|
|
const self = this |
|
|
|
|
|
|
|
executionContext.web3().eth.getTransactionReceipt(payload.params[0], (error, receipt) => { |
|
|
|
executionContext.web3().eth.getTransactionReceipt(payload.params[0], (error, receipt) => { |
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
|
return cb(error) |
|
|
|
return cb(error) |
|
|
|
} |
|
|
|
} |
|
|
|
//self.deployedContracts[receipt.contractAddress] = receipt.data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var r = { |
|
|
|
var r = { |
|
|
|
'transactionHash': receipt.hash, |
|
|
|
'transactionHash': receipt.hash, |
|
|
@ -82,6 +81,9 @@ Transactions.prototype.eth_getTransactionCount = function (payload, cb) { |
|
|
|
let address = payload.params[0] |
|
|
|
let address = payload.params[0] |
|
|
|
|
|
|
|
|
|
|
|
executionContext.vm().stateManager.getAccount(address, (err, account) => { |
|
|
|
executionContext.vm().stateManager.getAccount(address, (err, account) => { |
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
|
|
|
return cb(err) |
|
|
|
|
|
|
|
} |
|
|
|
let nonce = new BN(account.nonce).toString(10) |
|
|
|
let nonce = new BN(account.nonce).toString(10) |
|
|
|
cb(null, nonce) |
|
|
|
cb(null, nonce) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -95,23 +97,23 @@ Transactions.prototype.eth_getTransactionByHash = function (payload, cb) { |
|
|
|
return cb(error) |
|
|
|
return cb(error) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
web3.eth.getBlock(receipt.hash).then((block) => { |
|
|
|
//executionContext.web3().eth.getBlock(receipt.hash).then((block) => {
|
|
|
|
const r = { |
|
|
|
const r = { |
|
|
|
"hash": receipt.transactionHash, |
|
|
|
'hash': receipt.transactionHash, |
|
|
|
//"nonce": 2,
|
|
|
|
// "nonce": 2,
|
|
|
|
"blockHash": receipt.hash, |
|
|
|
'blockHash': receipt.hash, |
|
|
|
"blockNumber": block.number, |
|
|
|
//'blockNumber': block.number,
|
|
|
|
//"transactionIndex": 0,
|
|
|
|
// "transactionIndex": 0,
|
|
|
|
"from": receipt.from, |
|
|
|
'from': receipt.from, |
|
|
|
"to": receipt.to, |
|
|
|
'to': receipt.to, |
|
|
|
"value": receipt.value, |
|
|
|
'value': receipt.value, |
|
|
|
"gas": receipt.gas, |
|
|
|
'gas': receipt.gas, |
|
|
|
"gasPrice": '2000000000000', |
|
|
|
'gasPrice': '2000000000000', |
|
|
|
"input": receipt.input |
|
|
|
'input': receipt.input |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cb(null, r) |
|
|
|
cb(null, r) |
|
|
|
}) |
|
|
|
//})
|
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|