Skip to content

Commit daa2270

Browse files
jeffsmale90ccharly
andauthored
feat: add optional signEip7702Authorization method to Keyring type (#231)
EIP-7702 defines a new struct Authorization which represents authority to set a pointer to a contract address at an EOA - effectively making the EOA perform as a smart contract. This change adds an optional `signEip7702Authorization` method to the `Keyring` type which is implemented on `@metamask/eth-simple-keyring` and `@metamask/eth-hd-keyring` in MetaMask/accounts#182. See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7702.md for details --------- Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
1 parent 253f206 commit daa2270

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/keyring.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,22 @@ export type Keyring<State extends Json> = {
169169
options?: Record<string, unknown>,
170170
): Promise<string>;
171171

172+
/**
173+
* Sign an EIP-7702 authorization. This is a signing method for authorizing a
174+
* specific contract on a specific chain.
175+
*
176+
* @param address - The address of the account to use for signing.
177+
* @param authorization - An array containing the chain ID, contract address,
178+
* and nonce.
179+
* @param options - Signing options; differs between keyrings.
180+
* @returns The signed authorization as a hex string.
181+
*/
182+
signEip7702Authorization?(
183+
address: Hex,
184+
authorization: [chainId: number, contractAddress: Hex, nonce: number],
185+
options?: Record<string, unknown>,
186+
): Promise<string>;
187+
172188
/**
173189
* Sign a message. This is equivalent to the `eth_sign` Ethereum JSON-RPC
174190
* method, which is exposed by MetaMask as the method `personal_sign`. See

0 commit comments

Comments
 (0)