-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support EIP 7702 #4916
Comments
Oh! Is it finally deployed on a testnet? I’ve been waiting for that, as that is a good indication the spec of likely done changing. Plus it enables trying it out to test it. :) Initially this will be available on |
@ricmoo it's deployed on Pectra Devnet, Odyssey and a few others. Looking forward to this |
FYI https://blog.ethereum.org/2025/02/14/pectra-testnet-announcement
|
Thanks! Yes, I have a local implementation (in BaseWallet and Transaction) ready to release on the 24th once I can test it out. :) |
@ricmoo let me know if this requires any contribution, as I've already tested this out on mekong |
any way I can initiate the new transaction type already with ethers? |
Almost. I have a PR I'll be pushing up later. I'm just waiting for it to go live on Sepolia so I can make sure my tests work. :) |
Does anyone know of a JSON-RPC endpoint for Sepolia that this works on? It should have definitely activated by now. I've tried Infura, but I get the error:
But that could just mean my encoding is incorrect or there is some other issue and the error is half red-herring. If someone has a know good JSON-RPC endpoint, it'd be appreciated. :) |
I've added a branch with initial support. I'm going to test it a bit more and then publish it as an alpha release on npm. |
To use it: // You may optionally specify a nonce and chainId; if omitted the current provider is used
// to get the chain ID and nonce. A chainID of 0 must be explicitly set.
const auth = await authSigner.authorize({ address })
// The sending wallet can be the same signer or any other signer
const tx = await sendSigner.sendTransaction({
type: 4,
to: someAddress,
authorizationList: [ auth ]
});
console.log(tx);
const receipt = await tx.wait();
console.log(receipt); |
Is there a way to delegate and call in the same tx, something like this?
Refs: https://viem.sh/experimental/eip7702/sending-transactions |
Yes, the above code (converted to ethers syntax) would work just fine on the new branch. But if that is a common pattern, I think it also makes sense to add |
Having that in the contract class is a must IMO |
It is worth noting in the current Ethers implementation that the below usage will break when const auth = await authSigner.authorize({ address })
const tx = await authSigner.sendTransaction({
type: 4,
to: someAddress,
authorizationList: [ auth ]
});
console.log(tx);
const receipt = await tx.wait();
console.log(receipt); |
Good to know! Thanks. Does Viem have special logic to detect this and populate it? Or does it rely on the authSigner to manually supply the bumped nonce? |
There's no special logic unfortunately – we have a It's a shame that this behavior isn't handled on the execution layer though. |
Yeah. Ditto, still experimenting with ideas. I wonder if it would make sense to have some sort of DeferredNonce object or callback that TransactionRequest would allow in authorizationList items, which would get called with the populated transaction, giving it a chance to update before the actually signing based on the populated transaction… Something like |
Yeah, I thought about getting smart like that. I wonder if the implementation complexity is worth it though if this feature will only be used by Wallets (who I would assume know what they are doing :P) – whereby, the current Ethers implementation would be fine, and they can just increment the nonce themself if they want the EOA to self-upgrade... and maybe self-upgrading wouldn't be a much common case anyway? |
will this ship for both v5 and v6? |
This is already available in v6 (on the experimental eip-7703 branch and the npm There are no plans to make any feature changes to v5. There was recently a v5 release to address two security concerns in its dependencies (keep in mind the In general, any new projects should be using v6, which has new features added as the Ethereum networks add them (recent examples include BLoB and EIP-7702 support). The v5 code is primarily maintained for those that require pre-2017 era browser support. If you need any help migrating to v6 though, please reach out. :) |
Describe the Feature
Add support for tx type 0x04 and
authorization_list
in transaction typeshttps://eips.ethereum.org/EIPS/eip-7702
Code Example
No response
The text was updated successfully, but these errors were encountered: