Integrate eth_accounts and eth_transact to use new account manager
* Add from to eth_transact / xeth.Transact and add static pass in lieu of integrating with native Mist window for user passphrase entry * Make eth_accounts return AccountManager.Accounts() * Add a Generate Key menu item in Mist
This commit is contained in:
committed by
Felix Lange
parent
e64f727529
commit
bc45e5c6de
@ -190,6 +190,11 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Generate key"
|
||||
shortcut: "Ctrl+k"
|
||||
onTriggered: gui.generateKey()
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
|
@ -49,7 +49,7 @@ func (gui *Gui) LogPrint(level logger.LogLevel, msg string) {
|
||||
}
|
||||
*/
|
||||
}
|
||||
func (gui *Gui) Transact(recipient, value, gas, gasPrice, d string) (string, error) {
|
||||
func (gui *Gui) Transact(from, recipient, value, gas, gasPrice, d string) (string, error) {
|
||||
var data string
|
||||
if len(recipient) == 0 {
|
||||
code, err := ethutil.Compile(d, false)
|
||||
@ -61,7 +61,7 @@ func (gui *Gui) Transact(recipient, value, gas, gasPrice, d string) (string, err
|
||||
data = ethutil.Bytes2Hex(utils.FormatTransactionData(d))
|
||||
}
|
||||
|
||||
return gui.xeth.Transact(recipient, value, gas, gasPrice, data)
|
||||
return gui.xeth.Transact(from, recipient, value, gas, gasPrice, data)
|
||||
}
|
||||
|
||||
// functions that allow Gui to implement interface guilogger.LogSystem
|
||||
|
@ -175,6 +175,13 @@ func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) {
|
||||
func (gui *Gui) ImportKey(filePath string) {
|
||||
}
|
||||
|
||||
func (gui *Gui) GenerateKey() {
|
||||
_, err := gui.eth.AccountManager().NewAccount("hurr")
|
||||
if err != nil {
|
||||
// TODO: UI feedback?
|
||||
}
|
||||
}
|
||||
|
||||
func (gui *Gui) showKeyImport(context *qml.Context) (*qml.Window, error) {
|
||||
context.SetVar("lib", gui)
|
||||
component, err := gui.engine.LoadFile(gui.uiLib.AssetPath("qml/first_run.qml"))
|
||||
|
@ -171,6 +171,7 @@ func (self *UiLib) Transact(params map[string]interface{}) (string, error) {
|
||||
object := mapToTxParams(params)
|
||||
|
||||
return self.XEth.Transact(
|
||||
object["from"],
|
||||
object["to"],
|
||||
object["value"],
|
||||
object["gas"],
|
||||
|
Reference in New Issue
Block a user