Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
961e4da7
Commit
961e4da7
authored
Jan 13, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for CodeAt
parent
b178414a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
2 deletions
+58
-2
json.go
rpc/json.go
+6
-2
message.go
rpc/message.go
+15
-0
packages.go
rpc/packages.go
+37
-0
No files found.
rpc/json.go
View file @
961e4da7
...
...
@@ -72,8 +72,12 @@ func (self jsonWrapper) GetRequestReply(xeth *EthereumApi, req *RpcRequest, repl
return
err
}
return
xeth
.
GetTxCountAt
(
args
,
reply
)
// case "eth_codeAt":
// return nil
case
"eth_codeAt"
:
args
,
err
:=
req
.
ToGetCodeAtArgs
()
if
err
!=
nil
{
return
err
}
return
xeth
.
GetCodeAt
(
args
,
reply
)
case
"eth_balanceAt"
:
args
,
err
:=
req
.
ToGetBalanceArgs
()
if
err
!=
nil
{
...
...
rpc/message.go
View file @
961e4da7
...
...
@@ -147,6 +147,21 @@ func (req *RpcRequest) ToGetBalanceArgs() (*GetBalanceArgs, error) {
return
args
,
nil
}
func
(
req
*
RpcRequest
)
ToGetCodeAtArgs
()
(
*
GetCodeAtArgs
,
error
)
{
if
len
(
req
.
Params
)
<
1
{
return
nil
,
NewErrorResponse
(
ErrorArguments
)
}
args
:=
new
(
GetCodeAtArgs
)
r
:=
bytes
.
NewReader
(
req
.
Params
[
0
])
err
:=
json
.
NewDecoder
(
r
)
.
Decode
(
args
)
if
err
!=
nil
{
return
nil
,
NewErrorResponse
(
ErrorDecodeArgs
)
}
jsonlogger
.
DebugDetailf
(
"%T %v"
,
args
,
args
)
return
args
,
nil
}
// func NewSuccessRes(object JsonResponse) string {
// e := SuccessRes{Error: false, Result: object}
// res, err := json.Marshal(e)
...
...
rpc/packages.go
View file @
961e4da7
...
...
@@ -149,6 +149,15 @@ func (p *EthereumApi) GetBalanceAt(args *GetBalanceArgs, reply *interface{}) err
return
nil
}
func
(
p
*
EthereumApi
)
GetCodeAt
(
args
*
GetCodeAtArgs
,
reply
*
interface
{})
error
{
err
:=
args
.
requirements
()
if
err
!=
nil
{
return
err
}
*
reply
=
p
.
pipe
.
CodeAt
(
args
.
Address
)
return
nil
}
type
GetBlockArgs
struct
{
BlockNumber
int32
Hash
string
...
...
@@ -236,6 +245,15 @@ type GetStorageArgs struct {
Key
string
}
func
(
obj
*
GetStorageArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
arg0
:=
""
if
err
=
json
.
Unmarshal
(
b
,
arg0
);
err
==
nil
{
obj
.
Address
=
arg0
return
}
return
NewErrorResponse
(
ErrorDecodeArgs
)
}
func
(
a
*
GetStorageArgs
)
requirements
()
error
{
if
a
.
Address
==
""
{
return
NewErrorResponse
(
"GetStorageAt requires an 'address' value as argument"
)
...
...
@@ -316,3 +334,22 @@ type BalanceRes struct {
Balance
string
`json:"balance"`
Address
string
`json:"address"`
}
type
GetCodeAtArgs
struct
{
Address
string
}
func
(
obj
*
GetCodeAtArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
arg0
:=
""
if
err
=
json
.
Unmarshal
(
b
,
&
arg0
);
err
==
nil
{
obj
.
Address
=
arg0
return
}
return
NewErrorResponse
(
ErrorDecodeArgs
)
}
func
(
a
*
GetCodeAtArgs
)
requirements
()
error
{
if
a
.
Address
==
""
{
return
NewErrorResponse
(
"GetCodeAt requires an 'address' value as argument"
)
}
return
nil
}
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