forked from cerc-io/plugeth
Minor update and fixes to the gui and console
This commit is contained in:
parent
a3c8f83562
commit
b962779a13
@ -135,18 +135,18 @@ Component {
|
|||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: txButton
|
id: txButton
|
||||||
|
/* enabled: false */
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "READY"
|
name: "READY"
|
||||||
PropertyChanges { target: txButton; enabled: true}
|
PropertyChanges { target: txButton; /*enabled: true*/}
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "NOTREADY"
|
name: "NOTREADY"
|
||||||
PropertyChanges { target: txButton; enabled:false}
|
PropertyChanges { target: txButton; /*enabled:false*/}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
text: "Send"
|
text: "Send"
|
||||||
enabled: false
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
//this.enabled = false
|
//this.enabled = false
|
||||||
var res = eth.createTx(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text)
|
var res = eth.createTx(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text)
|
||||||
|
@ -63,18 +63,18 @@ Component {
|
|||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
id: txSimpleButton
|
id: txSimpleButton
|
||||||
|
/*enabled: false*/
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "READY"
|
name: "READY"
|
||||||
PropertyChanges { target: txSimpleButton; enabled: true}
|
PropertyChanges { target: txSimpleButton; /*enabled: true*/}
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "NOTREADY"
|
name: "NOTREADY"
|
||||||
PropertyChanges { target: txSimpleButton; enabled: false}
|
PropertyChanges { target: txSimpleButton; /*enabled: false*/}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
text: "Send"
|
text: "Send"
|
||||||
enabled: false
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
//this.enabled = false
|
//this.enabled = false
|
||||||
var res = eth.createTx(txSimpleRecipient.text, txSimpleValue.text,"","","")
|
var res = eth.createTx(txSimpleRecipient.text, txSimpleValue.text,"","","")
|
||||||
|
@ -113,6 +113,7 @@ func (ui *Gui) Start(assetPath string) {
|
|||||||
}
|
}
|
||||||
if err != nil {
|
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'")
|
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)
|
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) {
|
func (lib *EthLib) CreateTx(recipient, valueStr, gasStr, gasPriceStr, data string) (string, error) {
|
||||||
|
fmt.Println("Create tx")
|
||||||
var hash []byte
|
var hash []byte
|
||||||
var contractCreation bool
|
var contractCreation bool
|
||||||
if len(recipient) == 0 {
|
if len(recipient) == 0 {
|
||||||
@ -64,18 +65,21 @@ func (lib *EthLib) CreateTx(recipient, valueStr, gasStr, gasPriceStr, data strin
|
|||||||
// Compile and assemble the given data
|
// Compile and assemble the given data
|
||||||
if contractCreation {
|
if contractCreation {
|
||||||
mainInput, initInput := ethutil.PreProcess(data)
|
mainInput, initInput := ethutil.PreProcess(data)
|
||||||
|
fmt.Println("Precompile done")
|
||||||
|
fmt.Println("main", mainInput)
|
||||||
mainScript, err := utils.Compile(mainInput)
|
mainScript, err := utils.Compile(mainInput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
fmt.Println("init", initInput)
|
||||||
initScript, err := utils.Compile(initInput)
|
initScript, err := utils.Compile(initInput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
tx = ethchain.NewContractCreationTx(value, gasPrice, mainScript, initScript)
|
tx = ethchain.NewContractCreationTx(value, gas, gasPrice, mainScript, initScript)
|
||||||
} else {
|
} else {
|
||||||
tx = ethchain.NewTransactionMessage(hash, value, gasPrice, gas, nil)
|
tx = ethchain.NewTransactionMessage(hash, value, gas, gasPrice, nil)
|
||||||
}
|
}
|
||||||
acc := lib.stateManager.GetAddrState(keyPair.Address())
|
acc := lib.stateManager.GetAddrState(keyPair.Address())
|
||||||
tx.Nonce = acc.Nonce
|
tx.Nonce = acc.Nonce
|
||||||
@ -99,7 +103,6 @@ func (lib *EthLib) GetBlock(hexHash string) *Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
block := lib.blockChain.GetBlock(hash)
|
block := lib.blockChain.GetBlock(hash)
|
||||||
fmt.Println(block)
|
|
||||||
|
|
||||||
return &Block{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())}
|
return &Block{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,14 @@ func (ui *UiLib) OpenHtml(path string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
win := component.CreateWindow(nil)
|
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)
|
win.Set("url", path)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
@ -126,7 +134,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(gasPriceStr), callerScript, nil)
|
callerTx := ethchain.NewContractCreationTx(ethutil.Big(valueStr), ethutil.Big(gasStr), ethutil.Big(gasPriceStr), callerScript, nil)
|
||||||
|
|
||||||
// Contract addr as test address
|
// Contract addr as test address
|
||||||
keyPair := ethutil.Config.Db.GetKeys()[0]
|
keyPair := ethutil.Config.Db.GetKeys()[0]
|
||||||
|
@ -204,7 +204,7 @@ func (i *Console) ParseInput(input string) bool {
|
|||||||
break
|
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]
|
key := ethutil.Config.Db.GetKeys()[0]
|
||||||
contract.Sign(key.PrivateKey)
|
contract.Sign(key.PrivateKey)
|
||||||
|
Loading…
Reference in New Issue
Block a user