Minor update and fixes to the gui and console

pull/34/head
obscuren 11 years ago
parent a3c8f83562
commit b962779a13
  1. 6
      ethereal/assets/qml/newTransaction/_new_contract.qml
  2. 6
      ethereal/assets/qml/newTransaction/_simple_send.qml
  3. 1
      ethereal/ui/gui.go
  4. 9
      ethereal/ui/library.go
  5. 10
      ethereal/ui/ui_lib.go
  6. 2
      ethereum/dev_console.go

@ -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)

@ -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,"","","")

@ -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)
}

@ -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())}
}

@ -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]

@ -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)

Loading…
Cancel
Save