aboutsummaryrefslogtreecommitdiffstats
path: root/ethrpc
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-21 18:46:24 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-21 18:46:24 +0800
commitd658a7f4ab7691783157151912f43c177825b0e8 (patch)
treef6c28a7c79bbaffbe453a24f2331450fae0288be /ethrpc
parent0e9c8568fd689fdee0cce2584ad96ecce60c60d7 (diff)
downloadgo-tangerine-d658a7f4ab7691783157151912f43c177825b0e8.tar
go-tangerine-d658a7f4ab7691783157151912f43c177825b0e8.tar.gz
go-tangerine-d658a7f4ab7691783157151912f43c177825b0e8.tar.bz2
go-tangerine-d658a7f4ab7691783157151912f43c177825b0e8.tar.lz
go-tangerine-d658a7f4ab7691783157151912f43c177825b0e8.tar.xz
go-tangerine-d658a7f4ab7691783157151912f43c177825b0e8.tar.zst
go-tangerine-d658a7f4ab7691783157151912f43c177825b0e8.zip
Implemented missing EthPub calls in RPC server
Diffstat (limited to 'ethrpc')
-rw-r--r--ethrpc/packages.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/ethrpc/packages.go b/ethrpc/packages.go
index 4ec2b4602..87cfc99b2 100644
--- a/ethrpc/packages.go
+++ b/ethrpc/packages.go
@@ -182,6 +182,66 @@ func (p *EthereumApi) GetStorageAt(args *GetStorageArgs, reply *string) error {
return nil
}
+type GetTxCountArgs struct {
+ Address string `json:"address"`
+}
+type GetTxCountRes struct {
+ Nonce int `json:"nonce"`
+}
+
+func (a *GetTxCountArgs) requirements() error {
+ if a.Address == "" {
+ return NewErrorResponse("GetTxCountAt requires an 'address' value as argument")
+ }
+ return nil
+}
+
+type GetPeerCountRes struct {
+ PeerCount int `json:"peerCount"`
+}
+
+func (p *EthereumApi) GetPeerCount(args *interface{}, reply *string) error {
+ *reply = NewSuccessRes(GetPeerCountRes{PeerCount: p.ethp.GetPeerCount()})
+ return nil
+}
+
+type GetListeningRes struct {
+ IsListening bool `json:"isListening"`
+}
+
+func (p *EthereumApi) GetIsListening(args *interface{}, reply *string) error {
+ *reply = NewSuccessRes(GetListeningRes{IsListening: p.ethp.GetIsListening()})
+ return nil
+}
+
+type GetCoinbaseRes struct {
+ Coinbase string `json:"coinbase"`
+}
+
+func (p *EthereumApi) GetCoinbase(args *interface{}, reply *string) error {
+ *reply = NewSuccessRes(GetCoinbaseRes{Coinbase: p.ethp.GetCoinBase()})
+ return nil
+}
+
+type GetMiningRes struct {
+ IsMining bool `json:"isMining"`
+}
+
+func (p *EthereumApi) GetIsMining(args *interface{}, reply *string) error {
+ *reply = NewSuccessRes(GetMiningRes{IsMining: p.ethp.GetIsMining()})
+ return nil
+}
+
+func (p *EthereumApi) GetTxCountAt(args *GetTxCountArgs, reply *string) error {
+ err := args.requirements()
+ if err != nil {
+ return err
+ }
+ state := p.ethp.GetTxCountAt(args.Address)
+ *reply = NewSuccessRes(GetTxCountRes{Nonce: state})
+ return nil
+}
+
type GetBalanceArgs struct {
Address string
}