From b962779a1318138e08c6e84a537fdbc6c9ebfd97 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 23 Apr 2014 11:51:48 +0200 Subject: [PATCH] Minor update and fixes to the gui and console --- ethereal/assets/qml/newTransaction/_new_contract.qml | 6 +++--- ethereal/assets/qml/newTransaction/_simple_send.qml | 6 +++--- ethereal/ui/gui.go | 1 + ethereal/ui/library.go | 9 ++++++--- ethereal/ui/ui_lib.go | 10 +++++++++- ethereum/dev_console.go | 2 +- 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/ethereal/assets/qml/newTransaction/_new_contract.qml b/ethereal/assets/qml/newTransaction/_new_contract.qml index abaac16959..29e26a5621 100644 --- a/ethereal/assets/qml/newTransaction/_new_contract.qml +++ b/ethereal/assets/qml/newTransaction/_new_contract.qml @@ -135,18 +135,18 @@ Component { Button { id: txButton + /* enabled: false */ states: [ State { name: "READY" - PropertyChanges { target: txButton; enabled: true} + PropertyChanges { target: txButton; /*enabled: true*/} }, State { name: "NOTREADY" - PropertyChanges { target: txButton; enabled:false} + PropertyChanges { target: txButton; /*enabled:false*/} } ] text: "Send" - enabled: false onClicked: { //this.enabled = false var res = eth.createTx(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text) diff --git a/ethereal/assets/qml/newTransaction/_simple_send.qml b/ethereal/assets/qml/newTransaction/_simple_send.qml index 981766160b..d460797eae 100644 --- a/ethereal/assets/qml/newTransaction/_simple_send.qml +++ b/ethereal/assets/qml/newTransaction/_simple_send.qml @@ -63,18 +63,18 @@ Component { } Button { id: txSimpleButton + /*enabled: false*/ states: [ State { name: "READY" - PropertyChanges { target: txSimpleButton; enabled: true} + PropertyChanges { target: txSimpleButton; /*enabled: true*/} }, State { name: "NOTREADY" - PropertyChanges { target: txSimpleButton; enabled: false} + PropertyChanges { target: txSimpleButton; /*enabled: false*/} } ] text: "Send" - enabled: false onClicked: { //this.enabled = false var res = eth.createTx(txSimpleRecipient.text, txSimpleValue.text,"","","") diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index fd29c48204..0e5d57c93b 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -113,6 +113,7 @@ func (ui *Gui) Start(assetPath string) { } if err != nil { ethutil.Config.Log.Infoln("FATAL: asset not found: you can set an alternative asset path on on the command line using option 'asset_path'") + panic(err) } diff --git a/ethereal/ui/library.go b/ethereal/ui/library.go index 6c6f7557ab..b097ddbb27 100644 --- a/ethereal/ui/library.go +++ b/ethereal/ui/library.go @@ -44,6 +44,7 @@ func (lib *EthLib) CreateAndSetPrivKey() (string, string, string, string) { } func (lib *EthLib) CreateTx(recipient, valueStr, gasStr, gasPriceStr, data string) (string, error) { + fmt.Println("Create tx") var hash []byte var contractCreation bool if len(recipient) == 0 { @@ -64,18 +65,21 @@ func (lib *EthLib) CreateTx(recipient, valueStr, gasStr, gasPriceStr, data strin // Compile and assemble the given data if contractCreation { mainInput, initInput := ethutil.PreProcess(data) + fmt.Println("Precompile done") + fmt.Println("main", mainInput) mainScript, err := utils.Compile(mainInput) if err != nil { return "", err } + fmt.Println("init", initInput) initScript, err := utils.Compile(initInput) if err != nil { return "", err } - tx = ethchain.NewContractCreationTx(value, gasPrice, mainScript, initScript) + tx = ethchain.NewContractCreationTx(value, gas, gasPrice, mainScript, initScript) } else { - tx = ethchain.NewTransactionMessage(hash, value, gasPrice, gas, nil) + tx = ethchain.NewTransactionMessage(hash, value, gas, gasPrice, nil) } acc := lib.stateManager.GetAddrState(keyPair.Address()) tx.Nonce = acc.Nonce @@ -99,7 +103,6 @@ func (lib *EthLib) GetBlock(hexHash string) *Block { } block := lib.blockChain.GetBlock(hash) - fmt.Println(block) return &Block{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())} } diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go index 096af16db3..09f81c67e5 100644 --- a/ethereal/ui/ui_lib.go +++ b/ethereal/ui/ui_lib.go @@ -59,6 +59,14 @@ func (ui *UiLib) OpenHtml(path string) { return } win := component.CreateWindow(nil) + if filepath.Ext(path) == "eth" { + fmt.Println("Ethereum package not yet supported") + + return + + // TODO + ethutil.OpenPackage(path) + } win.Set("url", path) go func() { @@ -126,7 +134,7 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string) for _, str := range dis { ui.win.Root().Call("setAsm", str) } - callerTx := ethchain.NewContractCreationTx(ethutil.Big(valueStr), ethutil.Big(gasPriceStr), callerScript, nil) + callerTx := ethchain.NewContractCreationTx(ethutil.Big(valueStr), ethutil.Big(gasStr), ethutil.Big(gasPriceStr), callerScript, nil) // Contract addr as test address keyPair := ethutil.Config.Db.GetKeys()[0] diff --git a/ethereum/dev_console.go b/ethereum/dev_console.go index 0f03b5e536..583b8bd0b6 100644 --- a/ethereum/dev_console.go +++ b/ethereum/dev_console.go @@ -204,7 +204,7 @@ func (i *Console) ParseInput(input string) bool { break } - contract := ethchain.NewContractCreationTx(ethutil.Big(tokens[0]), ethutil.Big(tokens[1]), mainScript, initScript) + contract := ethchain.NewContractCreationTx(ethutil.Big(tokens[0]), ethutil.Big(tokens[1]), ethutil.Big(tokens[1]), mainScript, initScript) key := ethutil.Config.Db.GetKeys()[0] contract.Sign(key.PrivateKey)