aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal/ui
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-02 18:07:24 +0800
committerobscuren <geffobscura@gmail.com>2014-05-02 18:07:24 +0800
commit471bd398f380bc26ba3144a0834092036565e429 (patch)
tree2f68c43c1b90d976e0a4c304a19867de4d8f4bca /ethereal/ui
parent9e481804a72ce78792826e215cf3660819bbb18a (diff)
downloaddexon-471bd398f380bc26ba3144a0834092036565e429.tar
dexon-471bd398f380bc26ba3144a0834092036565e429.tar.gz
dexon-471bd398f380bc26ba3144a0834092036565e429.tar.bz2
dexon-471bd398f380bc26ba3144a0834092036565e429.tar.lz
dexon-471bd398f380bc26ba3144a0834092036565e429.tar.xz
dexon-471bd398f380bc26ba3144a0834092036565e429.tar.zst
dexon-471bd398f380bc26ba3144a0834092036565e429.zip
Moved Ext ethereum api
Moved the external ethereum api which can be used by any 3rd party application.
Diffstat (limited to 'ethereal/ui')
-rw-r--r--ethereal/ui/types.go83
1 files changed, 0 insertions, 83 deletions
diff --git a/ethereal/ui/types.go b/ethereal/ui/types.go
deleted file mode 100644
index 9e12a8892..000000000
--- a/ethereal/ui/types.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package ethui
-
-import (
- "encoding/hex"
- "github.com/ethereum/eth-go/ethchain"
- "github.com/ethereum/eth-go/ethutil"
-)
-
-// Block interface exposed to QML
-type QBlock struct {
- Number int
- Hash string
-}
-
-// Creates a new QML Block from a chain block
-func NewQBlock(block *ethchain.Block) *QBlock {
- info := block.BlockInfo()
- hash := hex.EncodeToString(block.Hash())
-
- return &QBlock{Number: int(info.Number), Hash: hash}
-}
-
-type QTx struct {
- Value, Hash, Address string
- Contract bool
-}
-
-func NewQTx(tx *ethchain.Transaction) *QTx {
- hash := hex.EncodeToString(tx.Hash())
- sender := hex.EncodeToString(tx.Recipient)
- isContract := len(tx.Data) > 0
-
- return &QTx{Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: sender, Contract: isContract}
-}
-
-type QKey struct {
- Address string
-}
-
-type QKeyRing struct {
- Keys []interface{}
-}
-
-func NewQKeyRing(keys []interface{}) *QKeyRing {
- return &QKeyRing{Keys: keys}
-}
-
-type QStateObject struct {
- object *ethchain.StateObject
-}
-
-func NewQStateObject(object *ethchain.StateObject) *QStateObject {
- return &QStateObject{object: object}
-}
-
-func (c *QStateObject) GetStorage(address string) string {
- // Because somehow, even if you return nil to QML it
- // still has some magical object so we can't rely on
- // undefined or null at the QML side
- if c.object != nil {
- val := c.object.GetMem(ethutil.Big("0x" + address))
-
- return val.BigInt().String()
- }
-
- return ""
-}
-
-func (c *QStateObject) Value() string {
- if c.object != nil {
- return c.object.Amount.String()
- }
-
- return ""
-}
-
-func (c *QStateObject) Address() string {
- if c.object != nil {
- return ethutil.Hex(c.object.Address())
- }
-
- return ""
-}