diff options
Diffstat (limited to 'rpc/api/eth_args.go')
-rw-r--r-- | rpc/api/eth_args.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index bf8ffead6..39c003f66 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -5,8 +5,11 @@ import ( "fmt" "math/big" + "strconv" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc/shared" ) @@ -858,3 +861,34 @@ func (args *SubmitWorkArgs) UnmarshalJSON(b []byte) (err error) { return nil } + +type tx struct { + tx *types.Transaction + + To string + From string + Nonce string + Value string + Data string + GasLimit string + GasPrice string +} + +func newTx(t *types.Transaction) *tx { + from, _ := t.From() + var to string + if t := t.To(); t != nil { + to = t.Hex() + } + + return &tx{ + tx: t, + To: to, + From: from.Hex(), + Value: t.Amount.String(), + Nonce: strconv.Itoa(int(t.Nonce())), + Data: "0x" + common.Bytes2Hex(t.Data()), + GasLimit: t.GasLimit.String(), + GasPrice: t.GasPrice().String(), + } +} |