mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 04:57:17 +00:00
Signing (almost) works.
This commit is contained in:
parent
a487396b76
commit
3a01e3e39b
3692
jsre/ethereum_js.go
3692
jsre/ethereum_js.go
File diff suppressed because one or more lines are too long
35
rpc/args.go
35
rpc/args.go
@ -171,6 +171,41 @@ type NewSigArgs struct {
|
|||||||
Data string
|
Data string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (args *NewSigArgs) UnmarshalJSON(b []byte) (err error) {
|
||||||
|
var obj []json.RawMessage
|
||||||
|
var ext struct {
|
||||||
|
From string
|
||||||
|
Data string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode byte slice to array of RawMessages
|
||||||
|
if err := json.Unmarshal(b, &obj); err != nil {
|
||||||
|
return NewDecodeParamError(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for sufficient params
|
||||||
|
if len(obj) < 1 {
|
||||||
|
return NewInsufficientParamsError(len(obj), 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode 0th RawMessage to temporary struct
|
||||||
|
if err := json.Unmarshal(obj[0], &ext); err != nil {
|
||||||
|
return NewDecodeParamError(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(ext.From) == 0 {
|
||||||
|
return NewValidationError("from", "is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(ext.Data) == 0 {
|
||||||
|
return NewValidationError("data", "is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
args.From = ext.From
|
||||||
|
args.Data = ext.Data
|
||||||
|
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
|
||||||
var ext struct {
|
var ext struct {
|
||||||
|
@ -2,7 +2,6 @@ package rpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/jsre"
|
"github.com/ethereum/go-ethereum/jsre"
|
||||||
"github.com/robertkrimen/otto"
|
"github.com/robertkrimen/otto"
|
||||||
)
|
)
|
||||||
@ -35,7 +34,6 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jsonreq, err := json.Marshal(reqif)
|
jsonreq, err := json.Marshal(reqif)
|
||||||
|
|
||||||
var reqs []RpcRequest
|
var reqs []RpcRequest
|
||||||
batch := true
|
batch := true
|
||||||
err = json.Unmarshal(jsonreq, &reqs)
|
err = json.Unmarshal(jsonreq, &reqs)
|
||||||
|
Loading…
Reference in New Issue
Block a user