diff options
author | Bas van Kervel <bas@ethdev.com> | 2015-06-09 22:06:51 +0800 |
---|---|---|
committer | Bas van Kervel <basvankervel@gmail.com> | 2015-06-11 20:01:41 +0800 |
commit | cc9ae399338557b6671e8fc83bb696c5ddb068fe (patch) | |
tree | 718e82c53c9dffebaf83cda6d1d1afe652e94e25 /rpc/api/web3.go | |
parent | 08d72a9245ce6f1e11f84a6b59d66cb083bea9f9 (diff) | |
download | go-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/web3.go')
-rw-r--r-- | rpc/api/web3.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/rpc/api/web3.go b/rpc/api/web3.go index c46457ce6..42b0b7fd9 100644 --- a/rpc/api/web3.go +++ b/rpc/api/web3.go @@ -15,24 +15,24 @@ const ( var ( // mapping between methods and handlers Web3Mapping = map[string]web3handler{ - "web3_sha3": (*web3).Sha3, - "web3_clientVersion": (*web3).ClientVersion, + "web3_sha3": (*web3Api).Sha3, + "web3_clientVersion": (*web3Api).ClientVersion, } ) // web3 callback handler -type web3handler func(*web3, *shared.Request) (interface{}, error) +type web3handler func(*web3Api, *shared.Request) (interface{}, error) // web3 api provider -type web3 struct { +type web3Api struct { xeth *xeth.XEth methods map[string]web3handler codec codec.ApiCoder } // create a new web3 api instance -func NewWeb3(xeth *xeth.XEth, coder codec.Codec) *web3 { - return &web3{ +func NewWeb3Api(xeth *xeth.XEth, coder codec.Codec) *web3Api { + return &web3Api{ xeth: xeth, methods: Web3Mapping, codec: coder.New(nil), @@ -40,7 +40,7 @@ func NewWeb3(xeth *xeth.XEth, coder codec.Codec) *web3 { } // collection with supported methods -func (self *web3) Methods() []string { +func (self *web3Api) Methods() []string { methods := make([]string, len(self.methods)) i := 0 for k := range self.methods { @@ -51,7 +51,7 @@ func (self *web3) Methods() []string { } // Execute given request -func (self *web3) Execute(req *shared.Request) (interface{}, error) { +func (self *web3Api) Execute(req *shared.Request) (interface{}, error) { if callback, ok := self.methods[req.Method]; ok { return callback(self, req) } @@ -59,17 +59,17 @@ func (self *web3) Execute(req *shared.Request) (interface{}, error) { return nil, &shared.NotImplementedError{req.Method} } -func (self *web3) Name() string { +func (self *web3Api) Name() string { return Web3ApiName } // Version of the API this instance provides -func (self *web3) Version() string { +func (self *web3Api) Version() string { return Web3Version } // Calculates the sha3 over req.Params.Data -func (self *web3) Sha3(req *shared.Request) (interface{}, error) { +func (self *web3Api) Sha3(req *shared.Request) (interface{}, error) { args := new(Sha3Args) if err := self.codec.Decode(req.Params, &args); err != nil { return nil, err @@ -79,6 +79,6 @@ func (self *web3) Sha3(req *shared.Request) (interface{}, error) { } // returns the xeth client vrsion -func (self *web3) ClientVersion(req *shared.Request) (interface{}, error) { +func (self *web3Api) ClientVersion(req *shared.Request) (interface{}, error) { return self.xeth.ClientVersion(), nil } |