A signed EIP-7702 authorization.
Wraps an Ethers.Authorization together with its secp256k1 signature. Signed
authorizations are what goes into the authorization_list of a type-4 transaction
(Ethers.Transaction.Eip7702) and serialize to the on-wire tuple
[chain_id, address, nonce, y_parity, r, s].
Produce one with Ethers.sign_authorization/2. Use recover_authority/1 to get the
address of the account that signed (the authority — the EOA whose code will be set).
Summary
Functions
Recovers the authority (signer) address of a signed authorization.
Types
@type t() :: %Ethers.Authorization.Signed{ authorization: Ethers.Authorization.t(), signature_r: binary(), signature_s: binary(), signature_y_parity: 0 | 1 }
A signed EIP-7702 authorization incorporating the following fields:
authorization- the signedEthers.Authorizationpayloadsignature_y_parity- signature recovery bit (0or1)signature_r- signaturervalue (big-endian binary)signature_s- signaturesvalue (big-endian binary)
Functions
@spec recover_authority(t()) :: {:ok, Ethers.Types.t_address()} | {:error, term()}
Recovers the authority (signer) address of a signed authorization.
Enforces the EIP-2 low-s rule that EIP-7702 mandates: a signature with
s > secp256k1n / 2 returns {:error, :invalid_signature_s} because the chain would
silently skip such an authorization.
Returns
{:ok, address}with the checksummed authority address on success.{:error, reason}if the signature is malformed or recovery fails.