diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-24 06:01:22 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-24 06:01:22 +0800 |
commit | bb72347acf8a82d1c20e8aae25c84e5dc75903dd (patch) | |
tree | c2ab64cf4bbbe23a9efab8efa1087ba775e12aa2 /ethereal/ui | |
parent | 43f1214f97e52863b1f1ef7913991bef3d00c58e (diff) | |
download | dexon-bb72347acf8a82d1c20e8aae25c84e5dc75903dd.tar dexon-bb72347acf8a82d1c20e8aae25c84e5dc75903dd.tar.gz dexon-bb72347acf8a82d1c20e8aae25c84e5dc75903dd.tar.bz2 dexon-bb72347acf8a82d1c20e8aae25c84e5dc75903dd.tar.lz dexon-bb72347acf8a82d1c20e8aae25c84e5dc75903dd.tar.xz dexon-bb72347acf8a82d1c20e8aae25c84e5dc75903dd.tar.zst dexon-bb72347acf8a82d1c20e8aae25c84e5dc75903dd.zip |
Minor fixes and sample coin "improvements"
Diffstat (limited to 'ethereal/ui')
-rw-r--r-- | ethereal/ui/gui.go | 14 | ||||
-rw-r--r-- | ethereal/ui/library.go | 24 | ||||
-rw-r--r-- | ethereal/ui/ui_lib.go | 2 |
3 files changed, 38 insertions, 2 deletions
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index 0e5d57c93..80498d718 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -8,7 +8,7 @@ import ( "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethdb" "github.com/ethereum/eth-go/ethutil" - "github.com/niemeyer/qml" + "github.com/go-qml/qml" "math/big" "strings" ) @@ -24,6 +24,18 @@ type Tx struct { Contract bool } +type Key struct { + Address string +} + +type KeyRing struct { + Keys []interface{} +} + +func NewKeyRing(keys []interface{}) *KeyRing { + return &KeyRing{Keys: keys} +} + func NewTxFromTransaction(tx *ethchain.Transaction) *Tx { hash := hex.EncodeToString(tx.Hash()) sender := hex.EncodeToString(tx.Recipient) diff --git a/ethereal/ui/library.go b/ethereal/ui/library.go index 537cfa994..5ca2b4273 100644 --- a/ethereal/ui/library.go +++ b/ethereal/ui/library.go @@ -10,6 +10,20 @@ import ( "strings" ) +type Contract struct { + object *ethchain.StateObject +} + +func NewContract(object *ethchain.StateObject) *Contract { + return &Contract{object: object} +} + +func (c *Contract) GetStorage(address string) string { + val := c.object.GetMem(ethutil.Big("0x" + address)) + + return val.BigInt().String() +} + type EthLib struct { stateManager *ethchain.StateManager blockChain *ethchain.BlockChain @@ -43,6 +57,16 @@ func (lib *EthLib) CreateAndSetPrivKey() (string, string, string, string) { return mnemonicString, fmt.Sprintf("%x", pair.Address()), fmt.Sprintf("%x", prv), fmt.Sprintf("%x", pub) } +func (lib *EthLib) GetKey() string { + return ethutil.Hex(ethutil.Config.Db.GetKeys()[0].Address()) +} + +func (lib *EthLib) GetStateObject(address string) *Contract { + stateObject := lib.stateManager.ProcState().GetContract(ethutil.FromHex(address)) + + return NewContract(stateObject) +} + func (lib *EthLib) CreateTx(recipient, valueStr, gasStr, gasPriceStr, dataStr string) (string, error) { var hash []byte var contractCreation bool diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go index 09f81c67e..9191e5ea9 100644 --- a/ethereal/ui/ui_lib.go +++ b/ethereal/ui/ui_lib.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/go-ethereum/utils" - "github.com/niemeyer/qml" + "github.com/go-qml/qml" "os" "path" "path/filepath" |