aboutsummaryrefslogtreecommitdiffstats
path: root/ethpipe/js_types.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-18 16:17:45 +0800
committerobscuren <geffobscura@gmail.com>2014-08-18 16:17:45 +0800
commitb0ae61c6521003d7861d89944e1d426e939535bb (patch)
treeb3b332f939df52963341a5f05d4327b76b50009f /ethpipe/js_types.go
parent793e666f36e512bceb0d92d0a8dfe1d7c508c0e2 (diff)
downloadgo-tangerine-b0ae61c6521003d7861d89944e1d426e939535bb.tar.gz
go-tangerine-b0ae61c6521003d7861d89944e1d426e939535bb.tar.zst
go-tangerine-b0ae61c6521003d7861d89944e1d426e939535bb.zip
Removed the "Get" part
Diffstat (limited to 'ethpipe/js_types.go')
-rw-r--r--ethpipe/js_types.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/ethpipe/js_types.go b/ethpipe/js_types.go
index e1743486b..0fb3a3876 100644
--- a/ethpipe/js_types.go
+++ b/ethpipe/js_types.go
@@ -7,6 +7,7 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethcrypto"
+ "github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
)
@@ -175,3 +176,33 @@ func NewJSReciept(contractCreation bool, creationAddress, hash, address []byte)
ethutil.Bytes2Hex(address),
}
}
+
+type JSMessage struct {
+ To string `json:"to"`
+ From string `json:"from"`
+ Input string `json:"input"`
+ Output string `json:"output"`
+ Path int32 `json:"path"`
+ Origin string `json:"origin"`
+ Timestamp int32 `json:"timestamp"`
+ Coinbase string `json:"coinbase"`
+ Block string `json:"block"`
+ Number int32 `json:"number"`
+ Value string `json:"value"`
+}
+
+func NewJSMessage(message *ethstate.Message) JSMessage {
+ return JSMessage{
+ To: ethutil.Bytes2Hex(message.To),
+ From: ethutil.Bytes2Hex(message.From),
+ Input: ethutil.Bytes2Hex(message.Input),
+ Output: ethutil.Bytes2Hex(message.Output),
+ Path: int32(message.Path),
+ Origin: ethutil.Bytes2Hex(message.Origin),
+ Timestamp: int32(message.Timestamp),
+ Coinbase: ethutil.Bytes2Hex(message.Origin),
+ Block: ethutil.Bytes2Hex(message.Block),
+ Number: int32(message.Number.Int64()),
+ Value: message.Value.String(),
+ }
+}