Skip to content

Commit

Permalink
feat: erc7821 (#3169)
Browse files Browse the repository at this point in the history
* chore: skip test

* wip: checkpoint

* wip: checkpoint

* wip: checkpoint

* wip: checkpoint

* wip: checkpoint

* docs

* chore: changeset

* chore: changeset

* w

* w
  • Loading branch information
jxom authored Dec 30, 2024
1 parent 1fc8008 commit 0acee2b
Show file tree
Hide file tree
Showing 27 changed files with 1,568 additions and 111 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-badgers-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

**Experimental:** Added experimental ERC-7821 actions.
2 changes: 1 addition & 1 deletion contracts/lib/solady
Submodule solady updated 142 files
25 changes: 25 additions & 0 deletions contracts/src/ERC7821Example.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pragma solidity ^0.8.17;

// SPDX-License-Identifier: UNLICENSED

import "solady/accounts/ERC7821.sol";

contract ERC7821Example is ERC7821 {
event OpData(bytes opData);

function _execute(
bytes32 mode,
bytes calldata executionData,
Call[] calldata calls,
bytes calldata opData
) internal virtual override {
mode = mode;
executionData = executionData;

require(msg.sender == address(this));
if (opData.length > 0) {
emit OpData(opData);
}
return _execute(calls, bytes32(0));
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"src": {
"entry": [
"index.ts!",
"{account-abstraction,accounts,actions,celo,chains,ens,experimental,experimental/erc7739,linea,node,nonce,op-stack,siwe,utils,window,zksync}/index.ts!",
"{account-abstraction,accounts,actions,celo,chains,ens,experimental,experimental/erc7739,experimental/erc7821,linea,node,nonce,op-stack,siwe,utils,window,zksync}/index.ts!",
"chains/utils.ts!"
],
"ignore": ["node/trustedSetups_cjs.ts"]
Expand Down
16 changes: 16 additions & 0 deletions site/pages/experimental/erc7821/client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Extending Client with ERC-7821 Actions [Setting up your Viem Client]

To use the experimental functionality of [ERC-7821](https://eips.ethereum.org/EIPS/eip-7821), you can extend your existing (or new) Viem Client with experimental [ERC-7821](https://eips.ethereum.org/EIPS/eip-7821) Actions.

```ts
import { createClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { erc7821Actions } from 'viem/experimental' // [!code focus]
const client = createClient({
chain: mainnet,
transport: http(),
}).extend(erc7821Actions()) // [!code focus]

const hash = await client.execute({/* ... */})
```
Loading

0 comments on commit 0acee2b

Please sign in to comment.