parent
1c9a1b7e3d
commit
5dfd594abd
@ -0,0 +1,22 @@ |
||||
var Web3 = require('web3') |
||||
|
||||
var Accounts = function(web3) { |
||||
this.web3 = new Web3() |
||||
// TODO: make it random and/or use remix-libs
|
||||
this.accounts = [this.web3.eth.accounts.create(['abcd'])] |
||||
|
||||
this.accounts[this.accounts[0].address.toLowerCase()] = this.accounts[0] |
||||
this.accounts[this.accounts[0].address.toLowerCase()].privateKey = Buffer.from(this.accounts[this.accounts[0].address.toLowerCase()].privateKey.slice(2), 'hex') |
||||
} |
||||
|
||||
Accounts.prototype.methods = function () { |
||||
return { |
||||
eth_accounts: this.eth_accounts.bind(this) |
||||
} |
||||
} |
||||
|
||||
Accounts.prototype.eth_accounts = function(payload, cb) { |
||||
return cb(null, this.accounts.map((x) => x.address)) |
||||
} |
||||
|
||||
module.exports = Accounts; |
@ -0,0 +1,16 @@ |
||||
|
||||
var Misc = function() { |
||||
} |
||||
|
||||
Misc.prototype.methods = function () { |
||||
return { |
||||
web3_clientVersion: 'web3_clientVersion' |
||||
} |
||||
} |
||||
|
||||
Misc.prototype.web3_clientVersion = function (payload, cb) { |
||||
cb(null, 'Remix Simulator/0.0.1') |
||||
} |
||||
|
||||
|
||||
module.exports = Misc; |
Loading…
Reference in new issue