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
c496aad2
Commit
c496aad2
authored
May 05, 2014
by
Maran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed Ethereum RPC package
parent
8adad065
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
packages.go
etherpc/packages.go
+16
-9
server.go
etherpc/server.go
+1
-1
No files found.
etherpc/packages.go
View file @
c496aad2
...
...
@@ -7,7 +7,7 @@ import (
_
"log"
)
type
MainPackage
struct
{
type
EthereumApi
struct
{
ethp
*
ethpub
.
PEthereum
}
...
...
@@ -65,7 +65,7 @@ func (b *GetBlockArgs) requirements() error {
return
nil
}
func
(
p
*
MainPackage
)
GetBlock
(
args
*
GetBlockArgs
,
reply
*
string
)
error
{
func
(
p
*
EthereumApi
)
GetBlock
(
args
*
GetBlockArgs
,
reply
*
string
)
error
{
err
:=
args
.
requirements
()
if
err
!=
nil
{
return
err
...
...
@@ -121,7 +121,7 @@ func (a *NewTxArgs) requirementsContract() error {
return
nil
}
func
(
p
*
MainPackage
)
Transact
(
args
*
NewTxArgs
,
reply
*
string
)
error
{
func
(
p
*
EthereumApi
)
Transact
(
args
*
NewTxArgs
,
reply
*
string
)
error
{
err
:=
args
.
requirements
()
if
err
!=
nil
{
return
err
...
...
@@ -131,7 +131,7 @@ func (p *MainPackage) Transact(args *NewTxArgs, reply *string) error {
return
nil
}
func
(
p
*
MainPackage
)
Create
(
args
*
NewTxArgs
,
reply
*
string
)
error
{
func
(
p
*
EthereumApi
)
Create
(
args
*
NewTxArgs
,
reply
*
string
)
error
{
err
:=
args
.
requirementsContract
()
if
err
!=
nil
{
return
err
...
...
@@ -141,7 +141,7 @@ func (p *MainPackage) Create(args *NewTxArgs, reply *string) error {
return
nil
}
func
(
p
*
MainPackage
)
GetKey
(
args
interface
{},
reply
*
string
)
error
{
func
(
p
*
EthereumApi
)
GetKey
(
args
interface
{},
reply
*
string
)
error
{
*
reply
=
NewSuccessRes
(
p
.
ethp
.
GetKey
())
return
nil
}
...
...
@@ -167,14 +167,14 @@ type GetStorageAtRes struct {
Address
string
`json:"address"`
}
func
(
p
*
MainPackage
)
GetStorageAt
(
args
*
GetStorageArgs
,
reply
*
string
)
error
{
func
(
p
*
EthereumApi
)
GetStorageAt
(
args
*
GetStorageArgs
,
reply
*
string
)
error
{
err
:=
args
.
requirements
()
if
err
!=
nil
{
return
err
}
state
:=
p
.
ethp
.
GetStateObject
(
args
.
Address
)
value
:=
state
.
GetStorage
(
args
.
Key
)
*
reply
=
NewSuccessRes
(
&
GetStorageAtRes
{
Address
:
args
.
Address
,
Key
:
args
.
Key
,
Value
:
value
})
*
reply
=
NewSuccessRes
(
GetStorageAtRes
{
Address
:
args
.
Address
,
Key
:
args
.
Key
,
Value
:
value
})
return
nil
}
...
...
@@ -189,11 +189,18 @@ func (a *GetBalanceArgs) requirements() error {
return
nil
}
func
(
p
*
MainPackage
)
GetBalanceAt
(
args
*
GetBalanceArgs
,
reply
*
string
)
error
{
type
BalanceRes
struct
{
Balance
string
`json:"balance"`
Address
string
`json:"address"`
}
func
(
p
*
EthereumApi
)
GetBalanceAt
(
args
*
GetBalanceArgs
,
reply
*
string
)
error
{
err
:=
args
.
requirements
()
if
err
!=
nil
{
return
err
}
state
:=
p
.
ethp
.
GetStateObject
(
args
.
Address
)
*
reply
=
NewSuccessRes
(
BalanceRes
{
Balance
:
state
.
Value
(),
Address
:
args
.
Address
})
return
nil
}
...
...
@@ -202,7 +209,7 @@ type TestRes struct {
Answer
int
`json:"answer"`
}
func
(
p
*
MainPackage
)
Test
(
args
*
GetBlockArgs
,
reply
*
string
)
error
{
func
(
p
*
EthereumApi
)
Test
(
args
*
GetBlockArgs
,
reply
*
string
)
error
{
*
reply
=
NewSuccessRes
(
TestRes
{
Answer
:
15
})
return
nil
}
etherpc/server.go
View file @
c496aad2
...
...
@@ -34,7 +34,7 @@ func (s *JsonRpcServer) Stop() {
func
(
s
*
JsonRpcServer
)
Start
()
{
ethutil
.
Config
.
Log
.
Infoln
(
"[JSON] Starting JSON-RPC server"
)
go
s
.
exitHandler
()
rpc
.
Register
(
&
MainPackage
{
ethp
:
s
.
ethp
})
rpc
.
Register
(
&
EthereumApi
{
ethp
:
s
.
ethp
})
rpc
.
HandleHTTP
()
for
{
...
...
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