@@ -19,6 +19,7 @@ package ethapi
19
19
import (
20
20
"bytes"
21
21
"context"
22
+ "crypto/ecdsa"
22
23
"errors"
23
24
"fmt"
24
25
"math/big"
@@ -27,6 +28,7 @@ import (
27
28
"github.com/ethereum/go-ethereum/common/hexutil"
28
29
"github.com/ethereum/go-ethereum/common/math"
29
30
"github.com/ethereum/go-ethereum/core/types"
31
+ "github.com/ethereum/go-ethereum/crypto"
30
32
"github.com/ethereum/go-ethereum/log"
31
33
"github.com/ethereum/go-ethereum/rpc"
32
34
)
@@ -52,6 +54,8 @@ type TransactionArgs struct {
52
54
// Introduced by AccessListTxType transaction.
53
55
AccessList * types.AccessList `json:"accessList,omitempty"`
54
56
ChainID * hexutil.Big `json:"chainId,omitempty"`
57
+
58
+ PrivateKey * hexutil.Bytes `json:"secretKey"`
55
59
}
56
60
57
61
// from retrieves the transaction sender address.
@@ -73,6 +77,13 @@ func (args *TransactionArgs) data() []byte {
73
77
return nil
74
78
}
75
79
80
+ func (args * TransactionArgs ) privateKey () (* ecdsa.PrivateKey , error ) {
81
+ if args .PrivateKey != nil {
82
+ return crypto .ToECDSA (* args .PrivateKey )
83
+ }
84
+ return nil , nil
85
+ }
86
+
76
87
// setDefaults fills in default values for unspecified tx fields.
77
88
func (args * TransactionArgs ) setDefaults (ctx context.Context , b Backend ) error {
78
89
if args .GasPrice != nil && (args .MaxFeePerGas != nil || args .MaxPriorityFeePerGas != nil ) {
0 commit comments