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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
c496aad2
Commit
c496aad2
authored
11 years ago
by
Maran Hidskes
Browse files
Options
Downloads
Patches
Plain Diff
Renamed Ethereum RPC package
parent
8adad065
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
etherpc/packages.go
+16
-9
16 additions, 9 deletions
etherpc/packages.go
etherpc/server.go
+1
-1
1 addition, 1 deletion
etherpc/server.go
with
17 additions
and
10 deletions
etherpc/packages.go
+
16
−
9
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
}
This diff is collapsed.
Click to expand it.
etherpc/server.go
+
1
−
1
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
{
...
...
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