diff options
author | Maran <maran.hidskes@gmail.com> | 2014-05-28 22:19:31 +0800 |
---|---|---|
committer | Maran <maran.hidskes@gmail.com> | 2014-05-28 22:19:31 +0800 |
commit | 95adac7522d6041a2d6bf7b2c6b1fd311c4e6e2a (patch) | |
tree | e1a297edd5d71d5b0dca94f828467c585ca511e1 /ethpub | |
parent | 818cbcbdd41854eff7b4943039e10c1e609b240d (diff) | |
parent | 76a59274bfce73ec988131804c643be743d2b4d2 (diff) | |
download | dexon-95adac7522d6041a2d6bf7b2c6b1fd311c4e6e2a.tar dexon-95adac7522d6041a2d6bf7b2c6b1fd311c4e6e2a.tar.gz dexon-95adac7522d6041a2d6bf7b2c6b1fd311c4e6e2a.tar.bz2 dexon-95adac7522d6041a2d6bf7b2c6b1fd311c4e6e2a.tar.lz dexon-95adac7522d6041a2d6bf7b2c6b1fd311c4e6e2a.tar.xz dexon-95adac7522d6041a2d6bf7b2c6b1fd311c4e6e2a.tar.zst dexon-95adac7522d6041a2d6bf7b2c6b1fd311c4e6e2a.zip |
Merge branch 'release/poc5-rc11'
Diffstat (limited to 'ethpub')
-rw-r--r-- | ethpub/types.go | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/ethpub/types.go b/ethpub/types.go index 348ae3f25..de1149a26 100644 --- a/ethpub/types.go +++ b/ethpub/types.go @@ -57,25 +57,33 @@ func (self *PBlock) GetTransaction(hash string) *PTx { type PTx struct { ref *ethchain.Transaction - Value string `json:"value"` - Gas string `json:"gas"` - GasPrice string `json:"gasPrice"` - Hash string `json:"hash"` - Address string `json:"address"` - Sender string `json:"sender"` - Data string `json:"data"` - Contract bool `json:"isContract"` + Value string `json:"value"` + Gas string `json:"gas"` + GasPrice string `json:"gasPrice"` + Hash string `json:"hash"` + Address string `json:"address"` + Sender string `json:"sender"` + RawData string `json:"rawData"` + Data string `json:"data"` + Contract bool `json:"isContract"` + CreatesContract bool `json:"createsContract"` } func NewPTx(tx *ethchain.Transaction) *PTx { hash := hex.EncodeToString(tx.Hash()) receiver := hex.EncodeToString(tx.Recipient) + + if receiver == "" { + receiver = hex.EncodeToString(tx.CreationAddress()) + } sender := hex.EncodeToString(tx.Sender()) + createsContract := tx.CreatesContract() + data := strings.Join(ethchain.Disassemble(tx.Data), "\n") isContract := len(tx.Data) > 0 - return &PTx{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: receiver, Contract: isContract, Gas: tx.Gas.String(), GasPrice: tx.GasPrice.String(), Data: data, Sender: sender} + return &PTx{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: receiver, Contract: isContract, Gas: tx.Gas.String(), GasPrice: tx.GasPrice.String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: hex.EncodeToString(tx.Data)} } func (self *PTx) ToString() string { |