upgrade web3.js with _extend support
This commit is contained in:
		
				
					committed by
					
						
						Bas van Kervel
					
				
			
			
				
	
			
			
			
						parent
						
							1fe617fa57
						
					
				
				
					commit
					7584e68c21
				
			@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ web3._extend({
 | 
			
		||||
	properties:
 | 
			
		||||
	[
 | 
			
		||||
		new web3._extend.Property({
 | 
			
		||||
			name: 'accounts',
 | 
			
		||||
			name: 'listAccounts',
 | 
			
		||||
			getter: 'personal_listAccounts',
 | 
			
		||||
			outputFormatter: function(obj) { return obj; }
 | 
			
		||||
		})
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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(),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user