diff --git a/accounts/abi/bind/auth.go b/accounts/abi/bind/auth.go index e51f0bd8ea..83d73ae4f3 100644 --- a/accounts/abi/bind/auth.go +++ b/accounts/abi/bind/auth.go @@ -23,7 +23,6 @@ import ( "io/ioutil" "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/external" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -80,17 +79,3 @@ func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts { }, } } - -// NewClefTransactor is a utility method to easily create a transaction signer -// with a clef backend. -func NewClefTransactor(clef *external.ExternalSigner, account accounts.Account) *TransactOpts { - return &TransactOpts{ - From: account.Address, - Signer: func(signer types.Signer, address common.Address, transaction *types.Transaction) (*types.Transaction, error) { - if address != account.Address { - return nil, errors.New("not authorized to sign this account") - } - return clef.SignTx(account, transaction, nil) // Clef enforces its own chain id - }, - } -} diff --git a/accounts/abi/bind/auth_clef.go b/accounts/abi/bind/auth_clef.go new file mode 100644 index 0000000000..56a0bc376b --- /dev/null +++ b/accounts/abi/bind/auth_clef.go @@ -0,0 +1,26 @@ +// +build !js + +package bind + +import ( + "errors" + + "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/accounts/external" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" +) + +// NewClefTransactor is a utility method to easily create a transaction signer +// with a clef backend. +func NewClefTransactor(clef *external.ExternalSigner, account accounts.Account) *TransactOpts { + return &TransactOpts{ + From: account.Address, + Signer: func(signer types.Signer, address common.Address, transaction *types.Transaction) (*types.Transaction, error) { + if address != account.Address { + return nil, errors.New("not authorized to sign this account") + } + return clef.SignTx(account, transaction, nil) // Clef enforces its own chain id + }, + } +}