signer/core: move API JSON types to separate package (#23275)
This PR moves (some) account types into a standalone package, to avoid depending on signer/core from accounts/external.
This commit is contained in:
committed by
GitHub
parent
8f11d279d2
commit
295bc35ecf
@ -23,14 +23,14 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/signer/core"
|
||||
"github.com/ethereum/go-ethereum/signer/core/apitypes"
|
||||
)
|
||||
|
||||
// ValidateTransaction does a number of checks on the supplied transaction, and
|
||||
// returns either a list of warnings, or an error (indicating that the transaction
|
||||
// should be immediately rejected).
|
||||
func (db *Database) ValidateTransaction(selector *string, tx *core.SendTxArgs) (*core.ValidationMessages, error) {
|
||||
messages := new(core.ValidationMessages)
|
||||
func (db *Database) ValidateTransaction(selector *string, tx *apitypes.SendTxArgs) (*apitypes.ValidationMessages, error) {
|
||||
messages := new(apitypes.ValidationMessages)
|
||||
|
||||
// Prevent accidental erroneous usage of both 'input' and 'data' (show stopper)
|
||||
if tx.Data != nil && tx.Input != nil && !bytes.Equal(*tx.Data, *tx.Input) {
|
||||
@ -90,7 +90,7 @@ func (db *Database) ValidateTransaction(selector *string, tx *core.SendTxArgs) (
|
||||
|
||||
// ValidateCallData checks if the ABI call-data + method selector (if given) can
|
||||
// be parsed and seems to match.
|
||||
func (db *Database) ValidateCallData(selector *string, data []byte, messages *core.ValidationMessages) {
|
||||
func (db *Database) ValidateCallData(selector *string, data []byte, messages *apitypes.ValidationMessages) {
|
||||
// If the data is empty, we have a plain value transfer, nothing more to do
|
||||
if len(data) == 0 {
|
||||
return
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/signer/core"
|
||||
"github.com/ethereum/go-ethereum/signer/core/apitypes"
|
||||
)
|
||||
|
||||
func mixAddr(a string) (*common.MixedcaseAddress, error) {
|
||||
@ -36,7 +36,7 @@ func toHexUint(h string) hexutil.Uint64 {
|
||||
b := big.NewInt(0).SetBytes(common.FromHex(h))
|
||||
return hexutil.Uint64(b.Uint64())
|
||||
}
|
||||
func dummyTxArgs(t txtestcase) *core.SendTxArgs {
|
||||
func dummyTxArgs(t txtestcase) *apitypes.SendTxArgs {
|
||||
to, _ := mixAddr(t.to)
|
||||
from, _ := mixAddr(t.from)
|
||||
n := toHexUint(t.n)
|
||||
@ -55,7 +55,7 @@ func dummyTxArgs(t txtestcase) *core.SendTxArgs {
|
||||
input = &a
|
||||
|
||||
}
|
||||
return &core.SendTxArgs{
|
||||
return &apitypes.SendTxArgs{
|
||||
From: *from,
|
||||
To: to,
|
||||
Value: value,
|
||||
|
Reference in New Issue
Block a user