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
a52b2c4e
Commit
a52b2c4e
authored
Apr 20, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix linting issues
parent
b41f3966
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
34 deletions
+28
-34
accounts.js
remix-simulator/src/methods/accounts.js
+3
-3
blocks.js
remix-simulator/src/methods/blocks.js
+2
-2
misc.js
remix-simulator/src/methods/misc.js
+2
-3
transactions.js
remix-simulator/src/methods/transactions.js
+10
-10
whisper.js
remix-simulator/src/methods/whisper.js
+3
-4
provider.js
remix-simulator/src/provider.js
+8
-12
No files found.
remix-simulator/src/methods/accounts.js
View file @
a52b2c4e
var
Web3
=
require
(
'web3'
)
var
Accounts
=
function
(
web3
)
{
var
Accounts
=
function
(
)
{
this
.
web3
=
new
Web3
()
// TODO: make it random and/or use remix-libs
this
.
accounts
=
[
this
.
web3
.
eth
.
accounts
.
create
([
'abcd'
])]
...
...
@@ -15,8 +15,8 @@ Accounts.prototype.methods = function () {
}
}
Accounts
.
prototype
.
eth_accounts
=
function
(
payload
,
cb
)
{
Accounts
.
prototype
.
eth_accounts
=
function
(
payload
,
cb
)
{
return
cb
(
null
,
this
.
accounts
.
map
((
x
)
=>
x
.
address
))
}
module
.
exports
=
Accounts
;
module
.
exports
=
Accounts
remix-simulator/src/methods/blocks.js
View file @
a52b2c4e
var
Blocks
=
function
()
{
var
Blocks
=
function
()
{
}
Blocks
.
prototype
.
methods
=
function
()
{
...
...
@@ -39,4 +39,4 @@ Blocks.prototype.eth_gasPrice = function (payload, cb) {
cb
(
null
,
1
)
}
module
.
exports
=
Blocks
;
module
.
exports
=
Blocks
remix-simulator/src/methods/misc.js
View file @
a52b2c4e
var
version
=
require
(
'../../package.json'
).
version
var
Misc
=
function
()
{
var
Misc
=
function
()
{
}
Misc
.
prototype
.
methods
=
function
()
{
...
...
@@ -13,5 +13,4 @@ Misc.prototype.web3_clientVersion = function (payload, cb) {
cb
(
null
,
'Remix Simulator/'
+
version
)
}
module
.
exports
=
Misc
;
module
.
exports
=
Misc
remix-simulator/src/methods/transactions.js
View file @
a52b2c4e
...
...
@@ -2,8 +2,8 @@ var RemixLib = require('remix-lib')
var
executionContext
=
RemixLib
.
execution
.
executionContext
var
processTx
=
require
(
'./txProcess.js'
)
var
Transactions
=
function
(
accounts
)
{
this
.
accounts
=
accounts
;
var
Transactions
=
function
(
accounts
)
{
this
.
accounts
=
accounts
// TODO: fix me; this is a temporary and very hackish thing just to get the getCode working for now
this
.
deployedContracts
=
{}
}
...
...
@@ -18,12 +18,12 @@ Transactions.prototype.methods = function () {
}
}
Transactions
.
prototype
.
eth_sendTransaction
=
function
(
payload
,
cb
)
{
processTx
(
this
.
accounts
,
payload
,
false
,
cb
)
;
Transactions
.
prototype
.
eth_sendTransaction
=
function
(
payload
,
cb
)
{
processTx
(
this
.
accounts
,
payload
,
false
,
cb
)
}
Transactions
.
prototype
.
eth_getTransactionReceipt
=
function
(
payload
,
cb
)
{
const
self
=
this
;
Transactions
.
prototype
.
eth_getTransactionReceipt
=
function
(
payload
,
cb
)
{
const
self
=
this
executionContext
.
web3
().
eth
.
getTransactionReceipt
(
payload
.
params
[
0
],
(
error
,
receipt
)
=>
{
if
(
error
)
{
return
cb
(
error
)
...
...
@@ -46,18 +46,18 @@ Transactions.prototype.eth_getTransactionReceipt = function(payload, cb) {
})
}
Transactions
.
prototype
.
eth_estimateGas
=
function
(
payload
,
cb
)
{
Transactions
.
prototype
.
eth_estimateGas
=
function
(
payload
,
cb
)
{
cb
(
null
,
3000000
)
}
Transactions
.
prototype
.
eth_getCode
=
function
(
payload
,
cb
)
{
Transactions
.
prototype
.
eth_getCode
=
function
(
payload
,
cb
)
{
let
address
=
payload
.
params
[
0
]
cb
(
null
,
this
.
deployedContracts
[
address
]
||
'0x'
)
}
Transactions
.
prototype
.
eth_call
=
function
(
payload
,
cb
)
{
Transactions
.
prototype
.
eth_call
=
function
(
payload
,
cb
)
{
processTx
(
this
.
accounts
,
payload
,
true
,
cb
)
}
module
.
exports
=
Transactions
;
module
.
exports
=
Transactions
remix-simulator/src/methods/whisper.js
View file @
a52b2c4e
var
Whisper
=
function
()
{
var
Whisper
=
function
()
{
}
Whisper
.
prototype
.
methods
=
function
()
{
Whisper
.
prototype
.
methods
=
function
()
{
return
{
shh_version
:
this
.
shh_version
.
bind
(
this
)
}
}
Whisper
.
prototype
.
shh_version
=
function
(
payload
,
cb
)
{
Whisper
.
prototype
.
shh_version
=
function
(
payload
,
cb
)
{
cb
(
null
,
5
)
}
module
.
exports
=
Whisper
remix-simulator/src/provider.js
View file @
a52b2c4e
var
RemixLib
=
require
(
'remix-lib'
)
const
log
=
require
(
'fancy-log'
)
const
merge
=
require
(
'merge'
)
const
Accounts
=
require
(
'./methods/accounts.js'
)
const
Blocks
=
require
(
'./methods/blocks.js'
)
const
Misc
=
require
(
'./methods/misc.js'
)
const
Transactions
=
require
(
'./methods/transactions.js'
)
const
Whisper
=
require
(
'./methods/whisper.js'
)
const
merge
=
require
(
'merge'
)
function
jsonRPCResponse
(
id
,
result
)
{
return
{
'id'
:
id
,
'jsonrpc'
:
'2.0'
,
'result'
:
result
}
}
var
Provider
=
function
()
{
this
.
Accounts
=
new
Accounts
()
;
this
.
Accounts
=
new
Accounts
()
this
.
methods
=
{}
this
.
methods
=
merge
(
this
.
methods
,
this
.
Accounts
.
methods
())
...
...
@@ -24,19 +20,19 @@ var Provider = function () {
}
Provider
.
prototype
.
sendAsync
=
function
(
payload
,
callback
)
{
const
self
=
this
log
.
info
(
'payload method is '
,
payload
.
method
)
let
method
=
this
.
methods
[
payload
.
method
]
if
(
method
)
{
return
method
.
call
(
method
,
payload
,
(
err
,
result
)
=>
{
if
(
err
)
{
return
callback
(
{
error
:
err
}
)
return
callback
(
err
)
}
callback
(
null
,
jsonRPCResponse
(
payload
.
id
,
result
))
});
let
response
=
{
'id'
:
payload
.
id
,
'jsonrpc'
:
'2.0'
,
'result'
:
result
}
callback
(
null
,
response
)
})
}
callback
(
"unknown method "
+
payload
.
method
);
callback
(
new
Error
(
'unknown method '
+
payload
.
method
))
}
Provider
.
prototype
.
isConnected
=
function
()
{
...
...
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