added net.version

pull/1436/head
Bas van Kervel 10 years ago
parent a2333bcbb4
commit e84f3ec1d4
  1. 2
      jsre/pp_js.go
  2. 5
      rpc/api/net.go
  3. 4
      rpc/api/net_js.go
  4. 3
      rpc/api/txpool_js.go

@ -116,7 +116,7 @@ var isBigNumber = function (object) {
var result = typeof BigNumber !== 'undefined' && object instanceof BigNumber; var result = typeof BigNumber !== 'undefined' && object instanceof BigNumber;
if (!result) { if (!result) {
if(typeof(object) === "object") { if (typeof(object) === "object" && object.constructor != null) {
result = object.constructor.toString().indexOf("function BigNumber(") == 0; result = object.constructor.toString().indexOf("function BigNumber(") == 0;
} }
} }

@ -32,6 +32,7 @@ var (
netMapping = map[string]nethandler{ netMapping = map[string]nethandler{
"net_peerCount": (*netApi).PeerCount, "net_peerCount": (*netApi).PeerCount,
"net_listening": (*netApi).IsListening, "net_listening": (*netApi).IsListening,
"net_version": (*netApi).Version,
} }
) )
@ -93,3 +94,7 @@ func (self *netApi) IsListening(req *shared.Request) (interface{}, error) {
return self.xeth.IsListening(), nil return self.xeth.IsListening(), nil
} }
func (self *netApi) Version(req *shared.Request) (interface{}, error) {
return self.xeth.NetworkVersion(), nil
}

@ -30,6 +30,10 @@ web3._extend({
], ],
properties: properties:
[ [
new web3._extend.Property({
name: 'version',
getter: 'net_version'
})
] ]
}); });
` `

@ -26,8 +26,7 @@ web3._extend({
[ [
new web3._extend.Property({ new web3._extend.Property({
name: 'status', name: 'status',
getter: 'txpool_status', getter: 'txpool_status'
outputFormatter: function(obj) { return obj; }
}) })
] ]
}); });

Loading…
Cancel
Save