Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fetch minimal account address from bundler (#7919)
```
<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Replaces the hardcoded `MINIMAL_ACCOUNT_IMPLEMENTATION_ADDRESS` with a dynamic fetch from the bundler using the `tw_getDelegationContract` RPC method.

This change:
- Introduces an async function `getDelegationContractAddress` to fetch the address.
- Implements caching for the fetched address to prevent redundant RPC calls.
- Updates `_sendTxWithAuthorization` and `is7702MinimalAccount` to handle the async nature and use the dynamically fetched address.
- Ensures type safety for address fields.

## How to test

Unit tests cover the functionality. A temporary test was created and verified during development.
```
pnpm test packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.ts
```

-->
```

---
[Slack Thread](https://thirdwebdev.slack.com/archives/C085FEPFLN9/p1756220164604699?thread_ts=1756220164.604699&cid=C085FEPFLN9)

<a href="https://cursor.com/background-agent?bcId=bc-874d9753-17ac-4429-8dfb-c3d6776f6711">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg">
    <img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg">
  </picture>
</a>
<a href="https://cursor.com/agents?id=bc-874d9753-17ac-4429-8dfb-c3d6776f6711">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg">
    <img alt="Open in Web" src="https://cursor.com/open-in-web.svg">
  </picture>
</a>

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the `erc7702` extension, refining event filters, and modifying function signatures to enhance clarity and correctness. It also introduces delegation contract handling in the `minimal-account` implementation.

### Detailed summary
- Updated function signatures and event filters in multiple files to replace `signer` with `user` and `newSigner`.
- Improved data structures in the generated files for `MinimalAccount`.
- Added delegation contract address fetching in `minimal-account.ts`.
- Adjusted transaction handling logic to use the delegation contract address.
- Enhanced error handling for RPC responses.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- New Features
  - Minimal account updated: token-receiver callbacks, interface support check, payable receive, new executeWithSig entrypoint, and a ValueReceived event; SessionCreated/Executed events now include user/newSigner.

- Bug Fixes
  - Delegation contract resolved dynamically via bundler with caching and improved error handling.
  - Address normalization for transactions and nonce lookups to reduce mismatch errors.
  - Removed a redundant error from the ABI.

- Tests
  - Tests updated to assert renamed event fields (user/newSigner).
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
0xFirekeeper committed Sep 4, 2025
commit bb89561a1b6ccee68b80c0fa45dd706df463a1ca
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[
"error AllowanceExceeded(uint256 allowanceUsage, uint256 limit, uint64 period)",
"error CallPolicyViolated(address target, bytes4 selector)",
"error CallReverted()",
"error ConditionFailed(bytes32 param, bytes32 refValue, uint8 condition)",
"error InvalidDataLength(uint256 actualLength, uint256 expectedLength)",
"error InvalidSignature(address msgSender, address thisAddress)",
Expand All @@ -13,8 +12,9 @@
"error SessionZeroSigner()",
"error TransferPolicyViolated(address target)",
"error UIDAlreadyProcessed()",
"event Executed(address indexed to, uint256 value, bytes data)",
"event SessionCreated(address indexed signer, (address signer, bool isWildcard, uint256 expiresAt, (address target, bytes4 selector, uint256 maxValuePerUse, (uint8 limitType, uint256 limit, uint256 period) valueLimit, (uint8 condition, uint64 index, bytes32 refValue, (uint8 limitType, uint256 limit, uint256 period) limit)[] constraints)[] callPolicies, (address target, uint256 maxValuePerUse, (uint8 limitType, uint256 limit, uint256 period) valueLimit)[] transferPolicies, bytes32 uid) sessionSpec)",
"event Executed(address indexed user, address indexed signer, address indexed executor, uint256 batchSize)",
"event SessionCreated(address indexed user, address indexed newSigner, (address signer, bool isWildcard, uint256 expiresAt, (address target, bytes4 selector, uint256 maxValuePerUse, (uint8 limitType, uint256 limit, uint256 period) valueLimit, (uint8 condition, uint64 index, bytes32 refValue, (uint8 limitType, uint256 limit, uint256 period) limit)[] constraints)[] callPolicies, (address target, uint256 maxValuePerUse, (uint8 limitType, uint256 limit, uint256 period) valueLimit)[] transferPolicies, bytes32 uid) sessionSpec)",
"event ValueReceived(address indexed user, address indexed from, uint256 value)",
"function createSessionWithSig((address signer, bool isWildcard, uint256 expiresAt, (address target, bytes4 selector, uint256 maxValuePerUse, (uint8 limitType, uint256 limit, uint256 period) valueLimit, (uint8 condition, uint64 index, bytes32 refValue, (uint8 limitType, uint256 limit, uint256 period) limit)[] constraints)[] callPolicies, (address target, uint256 maxValuePerUse, (uint8 limitType, uint256 limit, uint256 period) valueLimit)[] transferPolicies, bytes32 uid) sessionSpec, bytes signature)",
"function eip712Domain() view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)",
"function execute((address target, uint256 value, bytes data)[] calls) payable",
Expand All @@ -23,5 +23,10 @@
"function getSessionExpirationForSigner(address signer) view returns (uint256)",
"function getSessionStateForSigner(address signer) view returns (((uint256 remaining, address target, bytes4 selector, uint256 index)[] transferValue, (uint256 remaining, address target, bytes4 selector, uint256 index)[] callValue, (uint256 remaining, address target, bytes4 selector, uint256 index)[] callParams))",
"function getTransferPoliciesForSigner(address signer) view returns ((address target, uint256 maxValuePerUse, (uint8 limitType, uint256 limit, uint256 period) valueLimit)[])",
"function isWildcardSigner(address signer) view returns (bool)"
"function isWildcardSigner(address signer) view returns (bool)",
"function onERC1155BatchReceived(address, address, uint256[], uint256[], bytes) returns (bytes4)",
"function onERC1155Received(address, address, uint256, uint256, bytes) returns (bytes4)",
"function onERC721Received(address, address, uint256, bytes) returns (bytes4)",
"function supportsInterface(bytes4 interfaceId) view returns (bool)",
"receive() external payable"
]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading