New main script through init return value
This commit is contained in:
parent
5f8911f7cb
commit
d35380c19e
@ -9,7 +9,6 @@ import (
|
|||||||
"github.com/ethereum/eth-go/ethpub"
|
"github.com/ethereum/eth-go/ethpub"
|
||||||
"github.com/ethereum/eth-go/ethutil"
|
"github.com/ethereum/eth-go/ethutil"
|
||||||
"github.com/go-qml/qml"
|
"github.com/go-qml/qml"
|
||||||
"github.com/obscuren/mutan"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -262,7 +261,7 @@ func (gui *Gui) Transact(recipient, value, gas, gasPrice, data string) (*ethpub.
|
|||||||
func (gui *Gui) Create(recipient, value, gas, gasPrice, data string) (*ethpub.PReceipt, error) {
|
func (gui *Gui) Create(recipient, value, gas, gasPrice, data string) (*ethpub.PReceipt, error) {
|
||||||
keyPair := ethutil.GetKeyRing().Get(0)
|
keyPair := ethutil.GetKeyRing().Get(0)
|
||||||
|
|
||||||
mainInput, initInput := mutan.PreParse(data)
|
//mainInput, initInput := mutan.PreParse(data)
|
||||||
|
|
||||||
return gui.pub.Create(ethutil.Hex(keyPair.PrivateKey), value, gas, gasPrice, initInput, mainInput)
|
return gui.pub.Create(ethutil.Hex(keyPair.PrivateKey), value, gas, gasPrice, data)
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string)
|
|||||||
for _, str := range dis {
|
for _, str := range dis {
|
||||||
ui.win.Root().Call("setAsm", str)
|
ui.win.Root().Call("setAsm", str)
|
||||||
}
|
}
|
||||||
callerTx := ethchain.NewContractCreationTx(ethutil.Big(valueStr), ethutil.Big(gasStr), ethutil.Big(gasPriceStr), callerScript, nil)
|
callerTx := ethchain.NewContractCreationTx(ethutil.Big(valueStr), ethutil.Big(gasStr), ethutil.Big(gasPriceStr), nil)
|
||||||
|
|
||||||
// Contract addr as test address
|
// Contract addr as test address
|
||||||
keyPair := ethutil.GetKeyRing().Get(0)
|
keyPair := ethutil.GetKeyRing().Get(0)
|
||||||
|
@ -31,7 +31,7 @@ func Init() {
|
|||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
flag.StringVar(&Identifier, "i", "", "Custom client identifier")
|
flag.StringVar(&Identifier, "i", "", "custom client identifier")
|
||||||
flag.BoolVar(&StartMining, "m", false, "start dagger mining")
|
flag.BoolVar(&StartMining, "m", false, "start dagger mining")
|
||||||
flag.BoolVar(&ShowGenesis, "g", false, "prints genesis header and exits")
|
flag.BoolVar(&ShowGenesis, "g", false, "prints genesis header and exits")
|
||||||
flag.BoolVar(&StartRpc, "r", false, "start rpc server")
|
flag.BoolVar(&StartRpc, "r", false, "start rpc server")
|
||||||
@ -47,7 +47,6 @@ func Init() {
|
|||||||
flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)")
|
flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)")
|
||||||
flag.IntVar(&MaxPeer, "x", 10, "maximum desired peers")
|
flag.IntVar(&MaxPeer, "x", 10, "maximum desired peers")
|
||||||
flag.BoolVar(&StartJsConsole, "js", false, "exp")
|
flag.BoolVar(&StartJsConsole, "js", false, "exp")
|
||||||
//flag.StringVar(&InputFile, "e", "", "Run javascript file")
|
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
@ -48,13 +48,22 @@ func (self *JSRepl) parseInput(code string) {
|
|||||||
|
|
||||||
// The JSEthereum object attempts to wrap the PEthereum object and returns
|
// The JSEthereum object attempts to wrap the PEthereum object and returns
|
||||||
// meaningful javascript objects
|
// meaningful javascript objects
|
||||||
|
type JSBlock struct {
|
||||||
|
*ethpub.PBlock
|
||||||
|
eth *JSEthereum
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *JSBlock) GetTransaction(hash string) otto.Value {
|
||||||
|
return self.eth.toVal(self.PBlock.GetTransaction(hash))
|
||||||
|
}
|
||||||
|
|
||||||
type JSEthereum struct {
|
type JSEthereum struct {
|
||||||
*ethpub.PEthereum
|
*ethpub.PEthereum
|
||||||
vm *otto.Otto
|
vm *otto.Otto
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *JSEthereum) GetBlock(hash string) otto.Value {
|
func (self *JSEthereum) GetBlock(hash string) otto.Value {
|
||||||
return self.toVal(self.PEthereum.GetBlock(hash))
|
return self.toVal(&JSBlock{self.PEthereum.GetBlock(hash), self})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *JSEthereum) GetKey() otto.Value {
|
func (self *JSEthereum) GetKey() otto.Value {
|
||||||
@ -76,8 +85,8 @@ func (self *JSEthereum) Transact(key, recipient, valueStr, gasStr, gasPriceStr,
|
|||||||
return self.toVal(r)
|
return self.toVal(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *JSEthereum) Create(key, valueStr, gasStr, gasPriceStr, initStr, bodyStr string) otto.Value {
|
func (self *JSEthereum) Create(key, valueStr, gasStr, gasPriceStr, scriptStr string) otto.Value {
|
||||||
r, err := self.PEthereum.Create(key, valueStr, gasStr, gasPriceStr, initStr, bodyStr)
|
r, err := self.PEthereum.Create(key, valueStr, gasStr, gasPriceStr, scriptStr)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -102,7 +102,7 @@ L:
|
|||||||
break L
|
break L
|
||||||
}
|
}
|
||||||
|
|
||||||
addHistory(str) //allow user to recall this line
|
addHistory(str[:len(str)-1]) //allow user to recall this line
|
||||||
|
|
||||||
self.parseInput(str)
|
self.parseInput(str)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user