ethpipe => xeth (eXtended ETHereum)
This commit is contained in:
@@ -10,11 +10,11 @@ import (
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/chain"
|
||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||
"github.com/ethereum/go-ethereum/ethpipe"
|
||||
"github.com/ethereum/go-ethereum/ethstate"
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ethereum/go-ethereum/logger"
|
||||
"github.com/ethereum/go-ethereum/xeth"
|
||||
"github.com/obscuren/otto"
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ var jsrelogger = logger.NewLogger("JSRE")
|
||||
type JSRE struct {
|
||||
ethereum *eth.Ethereum
|
||||
Vm *otto.Otto
|
||||
pipe *ethpipe.JSPipe
|
||||
pipe *xeth.JSXEth
|
||||
|
||||
events event.Subscription
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
|
||||
re := &JSRE{
|
||||
ethereum,
|
||||
otto.New(),
|
||||
ethpipe.NewJSPipe(ethereum),
|
||||
xeth.NewJSXEth(ethereum),
|
||||
nil,
|
||||
make(map[string][]otto.Value),
|
||||
}
|
||||
|
@@ -4,15 +4,15 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/ethpipe"
|
||||
"github.com/ethereum/go-ethereum/ethstate"
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
"github.com/ethereum/go-ethereum/ui"
|
||||
"github.com/ethereum/go-ethereum/xeth"
|
||||
"github.com/obscuren/otto"
|
||||
)
|
||||
|
||||
type JSStateObject struct {
|
||||
*ethpipe.JSObject
|
||||
*xeth.JSObject
|
||||
eth *JSEthereum
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ func (self *JSStateObject) EachStorage(call otto.FunctionCall) otto.Value {
|
||||
// The JSEthereum object attempts to wrap the PEthereum object and returns
|
||||
// meaningful javascript objects
|
||||
type JSBlock struct {
|
||||
*ethpipe.JSBlock
|
||||
*xeth.JSBlock
|
||||
eth *JSEthereum
|
||||
}
|
||||
|
||||
@@ -67,33 +67,33 @@ func NewJSMessage(message *ethstate.Message) JSMessage {
|
||||
}
|
||||
|
||||
type JSEthereum struct {
|
||||
*ethpipe.JSPipe
|
||||
*xeth.JSXEth
|
||||
vm *otto.Otto
|
||||
ethereum *eth.Ethereum
|
||||
}
|
||||
|
||||
func (self *JSEthereum) GetBlock(hash string) otto.Value {
|
||||
return self.toVal(&JSBlock{self.JSPipe.BlockByHash(hash), self})
|
||||
return self.toVal(&JSBlock{self.JSXEth.BlockByHash(hash), self})
|
||||
}
|
||||
|
||||
func (self *JSEthereum) GetPeers() otto.Value {
|
||||
return self.toVal(self.JSPipe.Peers())
|
||||
return self.toVal(self.JSXEth.Peers())
|
||||
}
|
||||
|
||||
func (self *JSEthereum) GetKey() otto.Value {
|
||||
return self.toVal(self.JSPipe.Key())
|
||||
return self.toVal(self.JSXEth.Key())
|
||||
}
|
||||
|
||||
func (self *JSEthereum) GetStateObject(addr string) otto.Value {
|
||||
return self.toVal(&JSStateObject{ethpipe.NewJSObject(self.JSPipe.World().SafeGet(ethutil.Hex2Bytes(addr))), self})
|
||||
return self.toVal(&JSStateObject{xeth.NewJSObject(self.JSXEth.World().SafeGet(ethutil.Hex2Bytes(addr))), self})
|
||||
}
|
||||
|
||||
func (self *JSEthereum) Peers() otto.Value {
|
||||
return self.toVal(self.JSPipe.Peers())
|
||||
return self.toVal(self.JSXEth.Peers())
|
||||
}
|
||||
|
||||
func (self *JSEthereum) Transact(key, recipient, valueStr, gasStr, gasPriceStr, dataStr string) otto.Value {
|
||||
r, err := self.JSPipe.Transact(key, recipient, valueStr, gasStr, gasPriceStr, dataStr)
|
||||
r, err := self.JSXEth.Transact(key, recipient, valueStr, gasStr, gasPriceStr, dataStr)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
||||
@@ -104,7 +104,7 @@ func (self *JSEthereum) Transact(key, recipient, valueStr, gasStr, gasPriceStr,
|
||||
}
|
||||
|
||||
func (self *JSEthereum) Create(key, valueStr, gasStr, gasPriceStr, scriptStr string) otto.Value {
|
||||
r, err := self.JSPipe.Transact(key, "", valueStr, gasStr, gasPriceStr, scriptStr)
|
||||
r, err := self.JSXEth.Transact(key, "", valueStr, gasStr, gasPriceStr, scriptStr)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
Reference in New Issue
Block a user