aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/packages.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-01-26 04:50:43 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-01-28 02:29:07 +0800
commitd790229a33b1f3e6256ca6916be17a0cc3663076 (patch)
tree66351ba83d698b077a29f7374f6805b9ecfcda66 /rpc/packages.go
parent7a894e37388fccef1fa7945bb20b7cf8f0c1ce3c (diff)
downloaddexon-d790229a33b1f3e6256ca6916be17a0cc3663076.tar.gz
dexon-d790229a33b1f3e6256ca6916be17a0cc3663076.tar.zst
dexon-d790229a33b1f3e6256ca6916be17a0cc3663076.zip
Move HTTP transport to sub package of RPC
Diffstat (limited to 'rpc/packages.go')
-rw-r--r--rpc/packages.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/rpc/packages.go b/rpc/packages.go
index e87e0db7c..8b5965069 100644
--- a/rpc/packages.go
+++ b/rpc/packages.go
@@ -33,6 +33,15 @@ import (
"github.com/ethereum/go-ethereum/xeth"
)
+type RpcServer interface {
+ Start()
+ Stop()
+}
+
+func NewEthereumApi(xeth *xeth.JSXEth) *EthereumApi {
+ return &EthereumApi{pipe: xeth}
+}
+
type EthereumApi struct {
pipe *xeth.JSXEth
}
@@ -103,7 +112,7 @@ func (p *EthereumApi) GetStorageAt(args *GetStorageArgs, reply *interface{}) err
i, _ := new(big.Int).SetString(args.Key, 10)
hx = ethutil.Bytes2Hex(i.Bytes())
}
- jsonlogger.Debugf("GetStorageAt(%s, %s)\n", args.Address, hx)
+ rpclogger.Debugf("GetStorageAt(%s, %s)\n", args.Address, hx)
value := state.Storage(ethutil.Hex2Bytes(hx))
*reply = GetStorageAtRes{Address: args.Address, Key: args.Key, Value: value.Str()}
return nil
@@ -159,7 +168,7 @@ func (p *EthereumApi) GetCodeAt(args *GetCodeAtArgs, reply *interface{}) error {
func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error {
// Spec at https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC
- jsonlogger.DebugDetailf("%T %s", req.Params, req.Params)
+ rpclogger.DebugDetailf("%T %s", req.Params, req.Params)
switch req.Method {
case "eth_coinbase":
return p.GetCoinbase(reply)
@@ -203,6 +212,6 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return NewErrorResponse(ErrorNotImplemented)
}
- jsonlogger.DebugDetailf("Reply: %T %s", reply, reply)
+ rpclogger.DebugDetailf("Reply: %T %s", reply, reply)
return nil
}