forked from cerc-io/plugeth
Merge pull request #1076 from obscuren/rpc_sign
core: added RPC sign back in
This commit is contained in:
commit
f7415c0bbc
20
rpc/api.go
20
rpc/api.go
@ -158,16 +158,16 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
|
|||||||
v := api.xethAtStateNum(args.BlockNumber).CodeAtBytes(args.Address)
|
v := api.xethAtStateNum(args.BlockNumber).CodeAtBytes(args.Address)
|
||||||
*reply = newHexData(v)
|
*reply = newHexData(v)
|
||||||
|
|
||||||
// case "eth_sign":
|
case "eth_sign":
|
||||||
// args := new(NewSigArgs)
|
args := new(NewSigArgs)
|
||||||
// if err := json.Unmarshal(req.Params, &args); err != nil {
|
if err := json.Unmarshal(req.Params, &args); err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
// v, err := api.xeth().Sign(args.From, args.Data, false)
|
v, err := api.xeth().Sign(args.From, args.Data, false)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
// *reply = v
|
*reply = v
|
||||||
|
|
||||||
case "eth_sendTransaction", "eth_transact":
|
case "eth_sendTransaction", "eth_transact":
|
||||||
args := new(NewTxArgs)
|
args := new(NewTxArgs)
|
||||||
|
64
rpc/args.go
64
rpc/args.go
@ -166,45 +166,45 @@ type NewTxArgs struct {
|
|||||||
BlockNumber int64
|
BlockNumber int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// type NewSigArgs struct {
|
type NewSigArgs struct {
|
||||||
// From string
|
From string
|
||||||
// Data string
|
Data string
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func (args *NewSigArgs) UnmarshalJSON(b []byte) (err error) {
|
func (args *NewSigArgs) UnmarshalJSON(b []byte) (err error) {
|
||||||
// var obj []json.RawMessage
|
var obj []json.RawMessage
|
||||||
// var ext struct {
|
var ext struct {
|
||||||
// From string
|
From string
|
||||||
// Data string
|
Data string
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Decode byte slice to array of RawMessages
|
// Decode byte slice to array of RawMessages
|
||||||
// if err := json.Unmarshal(b, &obj); err != nil {
|
if err := json.Unmarshal(b, &obj); err != nil {
|
||||||
// return NewDecodeParamError(err.Error())
|
return NewDecodeParamError(err.Error())
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Check for sufficient params
|
// Check for sufficient params
|
||||||
// if len(obj) < 1 {
|
if len(obj) < 1 {
|
||||||
// return NewInsufficientParamsError(len(obj), 1)
|
return NewInsufficientParamsError(len(obj), 1)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Decode 0th RawMessage to temporary struct
|
// Decode 0th RawMessage to temporary struct
|
||||||
// if err := json.Unmarshal(obj[0], &ext); err != nil {
|
if err := json.Unmarshal(obj[0], &ext); err != nil {
|
||||||
// return NewDecodeParamError(err.Error())
|
return NewDecodeParamError(err.Error())
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if len(ext.From) == 0 {
|
if len(ext.From) == 0 {
|
||||||
// return NewValidationError("from", "is required")
|
return NewValidationError("from", "is required")
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if len(ext.Data) == 0 {
|
if len(ext.Data) == 0 {
|
||||||
// return NewValidationError("data", "is required")
|
return NewValidationError("data", "is required")
|
||||||
// }
|
}
|
||||||
|
|
||||||
// args.From = ext.From
|
args.From = ext.From
|
||||||
// args.Data = ext.Data
|
args.Data = ext.Data
|
||||||
// return nil
|
return nil
|
||||||
// }
|
}
|
||||||
|
|
||||||
func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
|
func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
|
||||||
var obj []json.RawMessage
|
var obj []json.RawMessage
|
||||||
|
Loading…
Reference in New Issue
Block a user