diff options
author | Bas van Kervel <bas@ethdev.com> | 2015-06-10 15:42:14 +0800 |
---|---|---|
committer | Bas van Kervel <basvankervel@gmail.com> | 2015-06-11 20:43:05 +0800 |
commit | 7584e68c21cfd155a9e72b29422d8d458691d4ae (patch) | |
tree | f552bef4bb93ae8a0199a84fe1cb20a6ffb12b4b /rpc/api | |
parent | 1fe617fa5791bffb6b3cc60636c6629c7aca36d3 (diff) | |
download | dexon-7584e68c21cfd155a9e72b29422d8d458691d4ae.tar.gz dexon-7584e68c21cfd155a9e72b29422d8d458691d4ae.tar.zst dexon-7584e68c21cfd155a9e72b29422d8d458691d4ae.zip |
upgrade web3.js with _extend support
Diffstat (limited to 'rpc/api')
-rw-r--r-- | rpc/api/admin.go | 16 | ||||
-rw-r--r-- | rpc/api/debug.go | 8 | ||||
-rw-r--r-- | rpc/api/debug_js.go | 7 | ||||
-rw-r--r-- | rpc/api/personal.go | 8 | ||||
-rw-r--r-- | rpc/api/personal_js.go | 2 | ||||
-rw-r--r-- | rpc/api/shh.go | 8 | ||||
-rw-r--r-- | rpc/api/txpool.go | 8 |
7 files changed, 51 insertions, 6 deletions
diff --git a/rpc/api/admin.go b/rpc/api/admin.go index 6b89942b2..a6b9cf050 100644 --- a/rpc/api/admin.go +++ b/rpc/api/admin.go @@ -16,7 +16,7 @@ import ( ) const ( - AdminVersion = "1.0.0" + AdminApiversion = "1.0" importBatchSize = 2500 ) @@ -82,6 +82,10 @@ func (self *adminApi) Name() string { return AdminApiName } +func (self *adminApi) ApiVersion() string { + return AdminApiversion +} + func (self *adminApi) AddPeer(req *shared.Request) (interface{}, error) { args := new(AddPeerArgs) if err := self.codec.Decode(req.Params, &args); err != nil { @@ -215,8 +219,14 @@ func (self *adminApi) Verbosity(req *shared.Request) (interface{}, error) { } func (self *adminApi) ChainSyncStatus(req *shared.Request) (interface{}, error) { - pending, cached := self.ethereum.Downloader().Stats() - return map[string]interface{}{"blocksAvailable": pending, "blocksWaitingForImport": cached}, nil + pending, cached, importing, estimate := self.ethereum.Downloader().Stats() + + return map[string]interface{}{ + "blocksAvailable": pending, + "blocksWaitingForImport": cached, + "importing": importing, + "estimate": estimate.String(), + }, nil } func (self *adminApi) SetSolc(req *shared.Request) (interface{}, error) { diff --git a/rpc/api/debug.go b/rpc/api/debug.go index 2930ad870..5b6a449dc 100644 --- a/rpc/api/debug.go +++ b/rpc/api/debug.go @@ -14,7 +14,7 @@ import ( ) const ( - DebugVersion = "1.0.0" + DebugApiVersion = "1.0" ) var ( @@ -74,6 +74,10 @@ func (self *debugApi) Name() string { return DebugApiName } +func (self *debugApi) ApiVersion() string { + return DebugApiVersion +} + func (self *debugApi) PrintBlock(req *shared.Request) (interface{}, error) { args := new(BlockNumArg) if err := self.codec.Decode(req.Params, &args); err != nil { @@ -100,7 +104,7 @@ func (self *debugApi) DumpBlock(req *shared.Request) (interface{}, error) { return nil, nil } - return stateDb.Dump(), nil + return stateDb.RawDump(), nil } func (self *debugApi) GetBlockRlp(req *shared.Request) (interface{}, error) { diff --git a/rpc/api/debug_js.go b/rpc/api/debug_js.go index fe19a077d..35fecb75f 100644 --- a/rpc/api/debug_js.go +++ b/rpc/api/debug_js.go @@ -39,6 +39,13 @@ web3._extend({ params: 1, inputFormatter: [web3._extend.formatters.formatInputInt], outputFormatter: web3._extend.formatters.formatOutputString + }) , + new web3._extend.Method({ + name: 'dumpBlock', + call: 'debug_dumpBlock', + params: 1, + inputFormatter: [web3._extend.formatters.formatInputInt], + outputFormatter: function(obj) { return obj; } }) ], properties: diff --git a/rpc/api/personal.go b/rpc/api/personal.go index 08dc4bff5..7a6c91c82 100644 --- a/rpc/api/personal.go +++ b/rpc/api/personal.go @@ -10,6 +10,10 @@ import ( "github.com/ethereum/go-ethereum/xeth" ) +const ( + PersonalApiVersion = "1.0" +) + var ( // mapping between methods and handlers personalMapping = map[string]personalhandler{ @@ -65,6 +69,10 @@ func (self *personalApi) Name() string { return PersonalApiName } +func (self *personalApi) ApiVersion() string { + return PersonalApiVersion +} + func (self *personalApi) ListAccounts(req *shared.Request) (interface{}, error) { return self.xeth.Accounts(), nil } diff --git a/rpc/api/personal_js.go b/rpc/api/personal_js.go index ddd47f6a4..463a2c7f5 100644 --- a/rpc/api/personal_js.go +++ b/rpc/api/personal_js.go @@ -23,7 +23,7 @@ web3._extend({ properties: [ new web3._extend.Property({ - name: 'accounts', + name: 'listAccounts', getter: 'personal_listAccounts', outputFormatter: function(obj) { return obj; } }) diff --git a/rpc/api/shh.go b/rpc/api/shh.go index 04c53c93e..e83a7b22e 100644 --- a/rpc/api/shh.go +++ b/rpc/api/shh.go @@ -9,6 +9,10 @@ import ( "github.com/ethereum/go-ethereum/xeth" ) +const ( + ShhApiVersion = "1.0" +) + var ( // mapping between methods and handlers shhMapping = map[string]shhhandler{ @@ -71,6 +75,10 @@ func (self *shhApi) Name() string { return ShhApiName } +func (self *shhApi) ApiVersion() string { + return ShhApiVersion +} + func (self *shhApi) Version(req *shared.Request) (interface{}, error) { w := self.xeth.Whisper() if w == nil { diff --git a/rpc/api/txpool.go b/rpc/api/txpool.go index ebbe199b1..64550bdaf 100644 --- a/rpc/api/txpool.go +++ b/rpc/api/txpool.go @@ -7,6 +7,10 @@ import ( "github.com/ethereum/go-ethereum/xeth" ) +const ( + TxPoolApiVersion = "1.0" +) + var ( // mapping between methods and handlers txpoolMapping = map[string]txpoolhandler{ @@ -59,6 +63,10 @@ func (self *txPoolApi) Name() string { return TxPoolApiName } +func (self *txPoolApi) ApiVersion() string { + return TxPoolApiVersion +} + func (self *txPoolApi) Status(req *shared.Request) (interface{}, error) { return map[string]int{ "pending": self.ethereum.TxPool().GetTransactions().Len(), |