|
|
@ -2,6 +2,7 @@ package ethui |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bitbucket.org/kardianos/osext" |
|
|
|
"bitbucket.org/kardianos/osext" |
|
|
|
|
|
|
|
"encoding/hex" |
|
|
|
"github.com/ethereum/eth-go" |
|
|
|
"github.com/ethereum/eth-go" |
|
|
|
"github.com/ethereum/eth-go/ethchain" |
|
|
|
"github.com/ethereum/eth-go/ethchain" |
|
|
|
"github.com/ethereum/eth-go/ethutil" |
|
|
|
"github.com/ethereum/eth-go/ethutil" |
|
|
@ -24,8 +25,9 @@ type UiLib struct { |
|
|
|
connected bool |
|
|
|
connected bool |
|
|
|
assetPath string |
|
|
|
assetPath string |
|
|
|
// The main application window
|
|
|
|
// The main application window
|
|
|
|
win *qml.Window |
|
|
|
win *qml.Window |
|
|
|
Db *Debugger |
|
|
|
Db *Debugger |
|
|
|
|
|
|
|
DbWindow *DebuggerWindow |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { |
|
|
|
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { |
|
|
@ -88,9 +90,26 @@ func (ui *UiLib) ConnectToPeer(addr string) { |
|
|
|
func (ui *UiLib) AssetPath(p string) string { |
|
|
|
func (ui *UiLib) AssetPath(p string) string { |
|
|
|
return path.Join(ui.assetPath, p) |
|
|
|
return path.Join(ui.assetPath, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (self *UiLib) StartDbWithContractAndData(contractHash, data string) { |
|
|
|
|
|
|
|
dbWindow := NewDebuggerWindow(self) |
|
|
|
|
|
|
|
object := self.eth.StateManager().CurrentState().GetStateObject(ethutil.FromHex(contractHash)) |
|
|
|
|
|
|
|
if len(object.Script()) > 0 { |
|
|
|
|
|
|
|
dbWindow.SetCode("0x" + hex.EncodeToString(object.Script())) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
dbWindow.SetData(data) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dbWindow.Show() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (self *UiLib) StartDbWithCode(code string) { |
|
|
|
|
|
|
|
dbWindow := NewDebuggerWindow(self) |
|
|
|
|
|
|
|
dbWindow.SetCode("0x" + code) |
|
|
|
|
|
|
|
dbWindow.Show() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (self *UiLib) StartDebugger() { |
|
|
|
func (self *UiLib) StartDebugger() { |
|
|
|
dbWindow := NewDebuggerWindow(self) |
|
|
|
dbWindow := NewDebuggerWindow(self) |
|
|
|
|
|
|
|
//self.DbWindow = dbWindow
|
|
|
|
|
|
|
|
|
|
|
|
dbWindow.Show() |
|
|
|
dbWindow.Show() |
|
|
|
} |
|
|
|
} |
|
|
|