Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth_sendRawTransaction JSON RPC #1267

Merged
merged 10 commits into from
Jun 18, 2015
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions rpc/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
}
*reply = v

case "eth_sendRawTransaction":
args := new(NewSigArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
v, err := api.xeth().PushTx(args.Data)
if err != nil {
return err
}
*reply = v

case "eth_sendTransaction", "eth_transact":
args := new(NewTxArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
Expand Down
15 changes: 15 additions & 0 deletions rpc/api/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var (
"eth_getData": (*ethApi).GetData,
"eth_getCode": (*ethApi).GetData,
"eth_sign": (*ethApi).Sign,
"eth_sendRawTransaction": (*ethApi).PushTx,
"eth_sendTransaction": (*ethApi).SendTransaction,
"eth_transact": (*ethApi).SendTransaction,
"eth_estimateGas": (*ethApi).EstimateGas,
Expand Down Expand Up @@ -247,6 +248,20 @@ func (self *ethApi) Sign(req *shared.Request) (interface{}, error) {
return v, nil
}


func (self *ethApi) PushTx(req *shared.Request) (interface{}, error) {
args := new(NewSigArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, shared.NewDecodeParamError(err.Error())
}

v, err := self.xeth.PushTx(args.Data)
if err != nil {
return nil, err
}
return v, nil
}

func (self *ethApi) SendTransaction(req *shared.Request) (interface{}, error) {
args := new(NewTxArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
Expand Down
1 change: 1 addition & 0 deletions rpc/api/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var (
"getData",
"getCode",
"sign",
"eth_sendRawTransaction",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one looks different than all the others.

"sendTransaction",
"transact",
"estimateGas",
Expand Down