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
f7415c0b
Commit
f7415c0b
authored
May 22, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Plain Diff
Merge pull request #1076 from obscuren/rpc_sign
core: added RPC sign back in
parents
01ddaf56
6539ccae
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
rpc/api.go
+10
-10
10 additions, 10 deletions
rpc/api.go
rpc/args.go
+32
-32
32 additions, 32 deletions
rpc/args.go
with
42 additions
and
42 deletions
rpc/api.go
+
10
−
10
View file @
f7415c0b
...
...
@@ -158,16 +158,16 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
v
:=
api
.
xethAtStateNum
(
args
.
BlockNumber
)
.
CodeAtBytes
(
args
.
Address
)
*
reply
=
newHexData
(
v
)
//
case "eth_sign":
//
args := new(NewSigArgs)
//
if err := json.Unmarshal(req.Params, &args); err != nil {
//
return err
//
}
//
v, err := api.xeth().Sign(args.From, args.Data, false)
//
if err != nil {
//
return err
//
}
//
*reply = v
case
"eth_sign"
:
args
:=
new
(
NewSigArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
}
v
,
err
:=
api
.
xeth
()
.
Sign
(
args
.
From
,
args
.
Data
,
false
)
if
err
!=
nil
{
return
err
}
*
reply
=
v
case
"eth_sendTransaction"
,
"eth_transact"
:
args
:=
new
(
NewTxArgs
)
...
...
This diff is collapsed.
Click to expand it.
rpc/args.go
+
32
−
32
View file @
f7415c0b
...
...
@@ -166,45 +166,45 @@ type NewTxArgs struct {
BlockNumber
int64
}
//
type NewSigArgs struct {
//
From string
//
Data string
//
}
type
NewSigArgs
struct
{
From
string
Data
string
}
//
func (args *NewSigArgs) UnmarshalJSON(b []byte) (err error) {
//
var obj []json.RawMessage
//
var ext struct {
//
From string
//
Data string
//
}
func
(
args
*
NewSigArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
json
.
RawMessage
var
ext
struct
{
From
string
Data
string
}
//
// Decode byte slice to array of RawMessages
//
if err := json.Unmarshal(b, &obj); err != nil {
//
return NewDecodeParamError(err.Error())
//
}
// Decode byte slice to array of RawMessages
if
err
:=
json
.
Unmarshal
(
b
,
&
obj
);
err
!=
nil
{
return
NewDecodeParamError
(
err
.
Error
())
}
//
// Check for sufficient params
//
if len(obj) < 1 {
//
return NewInsufficientParamsError(len(obj), 1)
//
}
// Check for sufficient params
if
len
(
obj
)
<
1
{
return
NewInsufficientParamsError
(
len
(
obj
),
1
)
}
//
// Decode 0th RawMessage to temporary struct
//
if err := json.Unmarshal(obj[0], &ext); err != nil {
//
return NewDecodeParamError(err.Error())
//
}
// Decode 0th RawMessage to temporary struct
if
err
:=
json
.
Unmarshal
(
obj
[
0
],
&
ext
);
err
!=
nil
{
return
NewDecodeParamError
(
err
.
Error
())
}
//
if len(ext.From) == 0 {
//
return NewValidationError("from", "is required")
//
}
if
len
(
ext
.
From
)
==
0
{
return
NewValidationError
(
"from"
,
"is required"
)
}
//
if len(ext.Data) == 0 {
//
return NewValidationError("data", "is required")
//
}
if
len
(
ext
.
Data
)
==
0
{
return
NewValidationError
(
"data"
,
"is required"
)
}
//
args.From = ext.From
//
args.Data = ext.Data
//
return nil
//
}
args
.
From
=
ext
.
From
args
.
Data
=
ext
.
Data
return
nil
}
func
(
args
*
NewTxArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
json
.
RawMessage
...
...
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