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
348f1562
Commit
348f1562
authored
Jun 8, 2015
by
Bas van Kervel
Browse files
Options
Downloads
Patches
Plain Diff
restructured eth rpc API
parent
7e41d7ac
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
rpc/api/api.go
+3
-0
3 additions, 0 deletions
rpc/api/api.go
rpc/api/eth.go
+8
-0
8 additions, 0 deletions
rpc/api/eth.go
rpc/api/utils.go
+111
-0
111 additions, 0 deletions
rpc/api/utils.go
with
122 additions
and
0 deletions
rpc/api/api.go
+
3
−
0
View file @
348f1562
...
@@ -32,6 +32,9 @@ type EthereumApi interface {
...
@@ -32,6 +32,9 @@ type EthereumApi interface {
// API identifier
// API identifier
Name
()
string
Name
()
string
// API version
ApiVersion
()
string
// Execute the given request and returns the response or an error
// Execute the given request and returns the response or an error
Execute
(
*
shared
.
Request
)
(
interface
{},
error
)
Execute
(
*
shared
.
Request
)
(
interface
{},
error
)
...
...
This diff is collapsed.
Click to expand it.
rpc/api/eth.go
+
8
−
0
View file @
348f1562
...
@@ -11,6 +11,10 @@ import (
...
@@ -11,6 +11,10 @@ import (
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
)
)
const
(
EthApiVersion
=
"1.0"
)
// eth api provider
// eth api provider
// See https://github.com/ethereum/wiki/wiki/JSON-RPC
// See https://github.com/ethereum/wiki/wiki/JSON-RPC
type
ethApi
struct
{
type
ethApi
struct
{
...
@@ -97,6 +101,10 @@ func (self *ethApi) Name() string {
...
@@ -97,6 +101,10 @@ func (self *ethApi) Name() string {
return
EthApiName
return
EthApiName
}
}
func
(
self
*
ethApi
)
ApiVersion
()
string
{
return
EthApiVersion
}
func
(
self
*
ethApi
)
Accounts
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
func
(
self
*
ethApi
)
Accounts
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
return
self
.
xeth
.
Accounts
(),
nil
return
self
.
xeth
.
Accounts
(),
nil
}
}
...
...
This diff is collapsed.
Click to expand it.
rpc/api/utils.go
+
111
−
0
View file @
348f1562
...
@@ -10,6 +10,117 @@ import (
...
@@ -10,6 +10,117 @@ import (
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
)
)
var
(
// Mapping between the different methods each api supports
AutoCompletion
=
map
[
string
][]
string
{
"admin"
:
[]
string
{
"addPeer"
,
"peers"
,
"nodeInfo"
,
"exportChain"
,
"importChain"
,
"verbosity"
,
"chainSyncStatus"
,
"setSolc"
,
"datadir"
,
},
"debug"
:
[]
string
{
"dumpBlock"
,
"getBlockRlp"
,
"printBlock"
,
"processBlock"
,
"seedHash"
,
"setHead"
,
},
"eth"
:
[]
string
{
"accounts"
,
"blockNumber"
,
"getBalance"
,
"protocolVersion"
,
"coinbase"
,
"mining"
,
"gasPrice"
,
"getStorage"
,
"storageAt"
,
"getStorageAt"
,
"getTransactionCount"
,
"getBlockTransactionCountByHash"
,
"getBlockTransactionCountByNumber"
,
"getUncleCountByBlockHash"
,
"getUncleCountByBlockNumber"
,
"getData"
,
"getCode"
,
"sign"
,
"sendTransaction"
,
"transact"
,
"estimateGas"
,
"call"
,
"flush"
,
"getBlockByHash"
,
"getBlockByNumber"
,
"getTransactionByHash"
,
"getTransactionByBlockHashAndIndex"
,
"getUncleByBlockHashAndIndex"
,
"getUncleByBlockNumberAndIndex"
,
"getCompilers"
,
"compileSolidity"
,
"newFilter"
,
"newBlockFilter"
,
"newPendingTransactionFilter"
,
"uninstallFilter"
,
"getFilterChanges"
,
"getFilterLogs"
,
"getLogs"
,
"hashrate"
,
"getWork"
,
"submitWork"
,
},
"miner"
:
[]
string
{
"hashrate"
,
"makeDAG"
,
"setExtra"
,
"setGasPrice"
,
"startAutoDAG"
,
"start"
,
"stopAutoDAG"
,
"stop"
,
},
"net"
:
[]
string
{
"peerCount"
,
"listening"
,
},
"personal"
:
[]
string
{
"listAccounts"
,
"newAccount"
,
"deleteAccount"
,
"unlockAccount"
,
},
"shh"
:
[]
string
{
"version"
,
"post"
,
"hasIdentity"
,
"newIdentity"
,
"newFilter"
,
"uninstallFilter"
,
"getFilterChanges"
,
},
"txpool"
:
[]
string
{
"status"
,
},
"web3"
:
[]
string
{
"sha3"
,
"version"
,
"fromWei"
,
"toWei"
,
"toHex"
,
"toAscii"
,
"fromAscii"
,
"toBigNumber"
,
"isAddress"
,
},
}
)
// Parse a comma separated API string to individual api's
// Parse a comma separated API string to individual api's
func
ParseApiString
(
apistr
string
,
codec
codec
.
Codec
,
xeth
*
xeth
.
XEth
,
eth
*
eth
.
Ethereum
)
([]
EthereumApi
,
error
)
{
func
ParseApiString
(
apistr
string
,
codec
codec
.
Codec
,
xeth
*
xeth
.
XEth
,
eth
*
eth
.
Ethereum
)
([]
EthereumApi
,
error
)
{
if
len
(
strings
.
TrimSpace
(
apistr
))
==
0
{
if
len
(
strings
.
TrimSpace
(
apistr
))
==
0
{
...
...
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