Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
ba8d161b
Commit
ba8d161b
authored
Feb 05, 2020
by
Iuri Matias
Committed by
Aniket
Feb 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix account list; fix newAccount function
parent
98aab3a1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
accounts.js
remix-simulator/src/methods/accounts.js
+8
-3
No files found.
remix-simulator/src/methods/accounts.js
View file @
ba8d161b
const
ethJSUtil
=
require
(
'ethereumjs-util'
)
const
BN
=
ethJSUtil
.
BN
const
{
BN
,
privateToAddress
,
isValidPrivate
}
=
require
(
'ethereumjs-util'
)
const
Web3
=
require
(
'web3'
)
const
crypto
=
require
(
'crypto'
)
const
Accounts
=
function
(
executionContext
)
{
this
.
web3
=
new
Web3
()
...
...
@@ -61,9 +62,12 @@ Accounts.prototype._addAccount = function (privateKey, balance) {
})
this
.
accounts
[
ethJSUtil
.
toChecksumAddress
(
'0x'
+
address
.
toString
(
'hex'
))]
=
{
privateKey
,
nonce
:
0
}
this
.
accounts
[
ethJSUtil
.
toChecksumAddress
(
'0x'
+
address
.
toString
(
'hex'
))]
=
{
privateKey
,
nonce
:
0
}
// this.accountsList[ethJSUtil.toChecksumAddress('0x' + address.toString('hex'))] = { privateKey, nonce: 0 }
}
Accounts
.
prototype
.
newAccount
=
(
_passwordPromptCb
,
cb
)
=>
{
Accounts
.
prototype
.
newAccount
=
function
(
cb
)
{
console
.
dir
(
"newAccount"
)
let
privateKey
do
{
privateKey
=
crypto
.
randomBytes
(
32
)
...
...
@@ -81,7 +85,8 @@ Accounts.prototype.methods = function () {
}
Accounts
.
prototype
.
eth_accounts
=
function
(
payload
,
cb
)
{
return
cb
(
null
,
this
.
accountsList
.
map
((
x
)
=>
ethJSUtil
.
toChecksumAddress
(
x
.
address
)))
// return cb(null, this.accountsList.map((x) => ethJSUtil.toChecksumAddress(x.address)))
return
cb
(
null
,
Object
.
keys
(
this
.
accounts
))
}
Accounts
.
prototype
.
eth_getBalance
=
function
(
payload
,
cb
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment