aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/personal.go
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-06-09 22:06:51 +0800
committerBas van Kervel <basvankervel@gmail.com>2015-06-11 20:01:41 +0800
commitcc9ae399338557b6671e8fc83bb696c5ddb068fe (patch)
tree718e82c53c9dffebaf83cda6d1d1afe652e94e25 /rpc/api/personal.go
parent08d72a9245ce6f1e11f84a6b59d66cb083bea9f9 (diff)
downloadgo-tangerine-cc9ae399338557b6671e8fc83bb696c5ddb068fe.tar
go-tangerine-cc9ae399338557b6671e8fc83bb696c5ddb068fe.tar.gz
go-tangerine-cc9ae399338557b6671e8fc83bb696c5ddb068fe.tar.bz2
go-tangerine-cc9ae399338557b6671e8fc83bb696c5ddb068fe.tar.lz
go-tangerine-cc9ae399338557b6671e8fc83bb696c5ddb068fe.tar.xz
go-tangerine-cc9ae399338557b6671e8fc83bb696c5ddb068fe.tar.zst
go-tangerine-cc9ae399338557b6671e8fc83bb696c5ddb068fe.zip
added admin API
Diffstat (limited to 'rpc/api/personal.go')
-rw-r--r--rpc/api/personal.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/rpc/api/personal.go b/rpc/api/personal.go
index d00363627..08dc4bff5 100644
--- a/rpc/api/personal.go
+++ b/rpc/api/personal.go
@@ -13,18 +13,18 @@ import (
var (
// mapping between methods and handlers
personalMapping = map[string]personalhandler{
- "personal_listAccounts": (*personal).ListAccounts,
- "personal_newAccount": (*personal).NewAccount,
- "personal_deleteAccount": (*personal).DeleteAccount,
- "personal_unlockAccount": (*personal).UnlockAccount,
+ "personal_listAccounts": (*personalApi).ListAccounts,
+ "personal_newAccount": (*personalApi).NewAccount,
+ "personal_deleteAccount": (*personalApi).DeleteAccount,
+ "personal_unlockAccount": (*personalApi).UnlockAccount,
}
)
// net callback handler
-type personalhandler func(*personal, *shared.Request) (interface{}, error)
+type personalhandler func(*personalApi, *shared.Request) (interface{}, error)
// net api provider
-type personal struct {
+type personalApi struct {
xeth *xeth.XEth
ethereum *eth.Ethereum
methods map[string]personalhandler
@@ -32,8 +32,8 @@ type personal struct {
}
// create a new net api instance
-func NewPersonal(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *personal {
- return &personal{
+func NewPersonalApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *personalApi {
+ return &personalApi{
xeth: xeth,
ethereum: eth,
methods: personalMapping,
@@ -42,7 +42,7 @@ func NewPersonal(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *persona
}
// collection with supported methods
-func (self *personal) Methods() []string {
+func (self *personalApi) Methods() []string {
methods := make([]string, len(self.methods))
i := 0
for k := range self.methods {
@@ -53,7 +53,7 @@ func (self *personal) Methods() []string {
}
// Execute given request
-func (self *personal) Execute(req *shared.Request) (interface{}, error) {
+func (self *personalApi) Execute(req *shared.Request) (interface{}, error) {
if callback, ok := self.methods[req.Method]; ok {
return callback(self, req)
}
@@ -61,15 +61,15 @@ func (self *personal) Execute(req *shared.Request) (interface{}, error) {
return nil, shared.NewNotImplementedError(req.Method)
}
-func (self *personal) Name() string {
+func (self *personalApi) Name() string {
return PersonalApiName
}
-func (self *personal) ListAccounts(req *shared.Request) (interface{}, error) {
+func (self *personalApi) ListAccounts(req *shared.Request) (interface{}, error) {
return self.xeth.Accounts(), nil
}
-func (self *personal) NewAccount(req *shared.Request) (interface{}, error) {
+func (self *personalApi) NewAccount(req *shared.Request) (interface{}, error) {
args := new(NewAccountArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, shared.NewDecodeParamError(err.Error())
@@ -80,7 +80,7 @@ func (self *personal) NewAccount(req *shared.Request) (interface{}, error) {
return acc.Address.Hex(), err
}
-func (self *personal) DeleteAccount(req *shared.Request) (interface{}, error) {
+func (self *personalApi) DeleteAccount(req *shared.Request) (interface{}, error) {
args := new(DeleteAccountArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, shared.NewDecodeParamError(err.Error())
@@ -95,7 +95,7 @@ func (self *personal) DeleteAccount(req *shared.Request) (interface{}, error) {
}
}
-func (self *personal) UnlockAccount(req *shared.Request) (interface{}, error) {
+func (self *personalApi) UnlockAccount(req *shared.Request) (interface{}, error) {
args := new(UnlockAccountArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, shared.NewDecodeParamError(err.Error())