aboutsummaryrefslogtreecommitdiffstats
path: root/ethpub
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-22 23:56:33 +0800
committerobscuren <geffobscura@gmail.com>2014-05-22 23:56:33 +0800
commitcc8464ce805279735f637ac710b25e2fb264f9aa (patch)
tree00a8f39f76da20eec6fe4016e2e7f32955486b57 /ethpub
parent230aafbf66ba747fb3796810adf3b1680f368e73 (diff)
downloaddexon-cc8464ce805279735f637ac710b25e2fb264f9aa.tar.gz
dexon-cc8464ce805279735f637ac710b25e2fb264f9aa.tar.zst
dexon-cc8464ce805279735f637ac710b25e2fb264f9aa.zip
Transaction querying
Diffstat (limited to 'ethpub')
-rw-r--r--ethpub/types.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/ethpub/types.go b/ethpub/types.go
index 7194de372..e8a2164a7 100644
--- a/ethpub/types.go
+++ b/ethpub/types.go
@@ -31,7 +31,18 @@ func (self *PBlock) ToString() string {
return ""
}
+func (self *PBlock) GetTransaction(hash string) *PTx {
+ tx := self.ref.GetTransaction(ethutil.FromHex(hash))
+ if tx == nil {
+ return nil
+ }
+
+ return NewPTx(tx)
+}
+
type PTx struct {
+ ref *ethchain.Transaction
+
Value, Hash, Address string
Contract bool
}
@@ -41,7 +52,11 @@ func NewPTx(tx *ethchain.Transaction) *PTx {
sender := hex.EncodeToString(tx.Recipient)
isContract := len(tx.Data) > 0
- return &PTx{Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: sender, Contract: isContract}
+ return &PTx{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: sender, Contract: isContract}
+}
+
+func (self *PTx) ToString() string {
+ return self.ref.String()
}
type PKey struct {