good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
594a34a8
Commit
594a34a8
authored
Jun 8, 2015
by
Bas van Kervel
Browse files
Options
Downloads
Patches
Plain Diff
changed send methods for backwards compatability in geth console
parent
1b59f890
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/geth/main.go
+0
-2
0 additions, 2 deletions
cmd/geth/main.go
rpc/jeth.go
+54
-0
54 additions, 0 deletions
rpc/jeth.go
with
54 additions
and
2 deletions
cmd/geth/main.go
+
0
−
2
View file @
594a34a8
...
@@ -307,7 +307,6 @@ func console(ctx *cli.Context) {
...
@@ -307,7 +307,6 @@ func console(ctx *cli.Context) {
repl
:=
newJSRE
(
repl
:=
newJSRE
(
ethereum
,
ethereum
,
ctx
.
String
(
utils
.
JSpathFlag
.
Name
),
ctx
.
String
(
utils
.
JSpathFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
IPCPathFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
RPCCORSDomainFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
RPCCORSDomainFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
IPCPathFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
IPCPathFlag
.
Name
),
true
,
true
,
...
@@ -330,7 +329,6 @@ func execJSFiles(ctx *cli.Context) {
...
@@ -330,7 +329,6 @@ func execJSFiles(ctx *cli.Context) {
repl
:=
newJSRE
(
repl
:=
newJSRE
(
ethereum
,
ethereum
,
ctx
.
String
(
utils
.
JSpathFlag
.
Name
),
ctx
.
String
(
utils
.
JSpathFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
IPCPathFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
RPCCORSDomainFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
RPCCORSDomainFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
IPCPathFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
IPCPathFlag
.
Name
),
false
,
false
,
...
...
This diff is collapsed.
Click to expand it.
rpc/jeth.go
+
54
−
0
View file @
594a34a8
...
@@ -44,6 +44,60 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) {
...
@@ -44,6 +44,60 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) {
return
self
.
err
(
call
,
-
32700
,
err
.
Error
(),
nil
)
return
self
.
err
(
call
,
-
32700
,
err
.
Error
(),
nil
)
}
}
jsonreq
,
err
:=
json
.
Marshal
(
reqif
)
var
reqs
[]
RpcRequest
batch
:=
true
err
=
json
.
Unmarshal
(
jsonreq
,
&
reqs
)
if
err
!=
nil
{
reqs
=
make
([]
RpcRequest
,
1
)
err
=
json
.
Unmarshal
(
jsonreq
,
&
reqs
[
0
])
batch
=
false
}
call
.
Otto
.
Set
(
"response_len"
,
len
(
reqs
))
call
.
Otto
.
Run
(
"var ret_response = new Array(response_len);"
)
for
i
,
req
:=
range
reqs
{
var
respif
interface
{}
err
=
self
.
ethApi
.
GetRequestReply
(
&
req
,
&
respif
)
if
err
!=
nil
{
fmt
.
Println
(
"Error response:"
,
err
)
return
self
.
err
(
call
,
-
32603
,
err
.
Error
(),
req
.
Id
)
}
call
.
Otto
.
Set
(
"ret_jsonrpc"
,
jsonrpcver
)
call
.
Otto
.
Set
(
"ret_id"
,
req
.
Id
)
res
,
_
:=
json
.
Marshal
(
respif
)
call
.
Otto
.
Set
(
"ret_result"
,
string
(
res
))
call
.
Otto
.
Set
(
"response_idx"
,
i
)
response
,
err
=
call
.
Otto
.
Run
(
`
ret_response[response_idx] = { jsonrpc: ret_jsonrpc, id: ret_id, result: JSON.parse(ret_result) };
`
)
}
if
!
batch
{
call
.
Otto
.
Run
(
"ret_response = ret_response[0];"
)
}
if
call
.
Argument
(
1
)
.
IsObject
()
{
call
.
Otto
.
Set
(
"callback"
,
call
.
Argument
(
1
))
call
.
Otto
.
Run
(
`
if (Object.prototype.toString.call(callback) == '[object Function]') {
callback(null, ret_response);
}
`
)
}
return
}
func
(
self
*
Jeth
)
SendIpc
(
call
otto
.
FunctionCall
)
(
response
otto
.
Value
)
{
reqif
,
err
:=
call
.
Argument
(
0
)
.
Export
()
if
err
!=
nil
{
return
self
.
err
(
call
,
-
32700
,
err
.
Error
(),
nil
)
}
client
,
err
:=
comms
.
NewIpcClient
(
comms
.
IpcConfig
{
self
.
ipcpath
},
codec
.
JSON
)
client
,
err
:=
comms
.
NewIpcClient
(
comms
.
IpcConfig
{
self
.
ipcpath
},
codec
.
JSON
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"Unable to connect to geth."
)
fmt
.
Println
(
"Unable to connect to geth."
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment