Minor update and fixes to the gui and console

This commit is contained in:
obscuren 2014-04-23 11:51:48 +02:00
parent a3c8f83562
commit b962779a13
6 changed files with 23 additions and 11 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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