accounts/external, signer/core: add support for EIP-2930 transactions (#22585)

This adds support for signing EIP-2930 with clef.
This commit is contained in:
Martin Holst Swende
2021-04-21 13:03:33 +02:00
committed by GitHub
parent 4b783c0064
commit 67da83aca5
4 changed files with 65 additions and 3 deletions

View File

@ -212,6 +212,20 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio
To: to,
From: common.NewMixedcaseAddress(account.Address),
}
// We should request the default chain id that we're operating with
// (the chain we're executing on)
if chainID != nil {
args.ChainID = (*hexutil.Big)(chainID)
}
// However, if the user asked for a particular chain id, then we should
// use that instead.
if tx.Type() != types.LegacyTxType && tx.ChainId() != nil {
args.ChainID = (*hexutil.Big)(tx.ChainId())
}
if tx.Type() == types.AccessListTxType {
accessList := tx.AccessList()
args.AccessList = &accessList
}
var res signTransactionResult
if err := api.client.Call(&res, "account_signTransaction", args); err != nil {
return nil, err