Skip to content

Add Safe instance manual signing helpers#190

Open
Sednaoui wants to merge 1 commit into
devfrom
add-safe-instance-manual-signing-helpers
Open

Add Safe instance manual signing helpers#190
Sednaoui wants to merge 1 commit into
devfrom
add-safe-instance-manual-signing-helpers

Conversation

@Sednaoui
Copy link
Copy Markdown
Member

@Sednaoui Sednaoui commented May 28, 2026

Summary

  • add instance-level Safe manual signing helpers for EIP-712 data, hashes, and signature formatting
  • make SafeMultiChainSigAccountV1 helpers inherit the account's entrypoint/module context and force multichain signature encoding
  • cover the multichain manual signing path with regression tests

Tests

  • yarn build
  • yarn test:signer
  • yarn test:types

Summary by CodeRabbit

  • New Features

    • Safe accounts: instance-level helpers for building EIP-712 typed data, hashing it, and formatting UserOperation signatures.
    • Multichain Safe accounts: single-operation signing, forced multichain signature semantics, and gas estimation aware of multichain defaults.
  • Documentation

    • Quickstart updated to clarify account-class default EntryPoint guidance.
  • Tests

    • Added tests verifying instance builders/formatters and multichain signature behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 79ca5a1a-363e-484a-870d-1bd8c7ed5913

📥 Commits

Reviewing files that changed from the base of the PR and between 8cc4dc2 and 9be7fff.

📒 Files selected for processing (5)
  • README.md
  • src/account/Safe/SafeAccount.ts
  • src/account/Safe/SafeMultiChainSigAccount.ts
  • test/signer/signer.test.js
  • test/types/signer-api.ts
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/account/Safe/SafeAccount.ts
  • test/signer/signer.test.js

📝 Walkthrough

Walkthrough

Adds instance methods to SafeAccount and SafeMultiChainSigAccountV1 for building EIP-712 typed data, computing its hash, and formatting UserOperation signatures; refactors single-op multichain signature formatting, wires multichain gas estimation, updates README, and adds tests.

Changes

Instance helpers for manual EIP-712 UserOperation signing

Layer / File(s) Summary
Type import updates
src/account/Safe/SafeMultiChainSigAccount.ts
Update type-only imports to include multichain/UserOperation types used by new methods.
SafeMultiChainSigAccountV1 instance methods
src/account/Safe/SafeMultiChainSigAccount.ts
Added estimateUserOperationGas and instance getUserOperationEip712Data, getUserOperationEip712Hash, formatUserOperationSignature that default to the instance's entrypoint/module and enforce multichain signature/WebAuthn defaults.
Single-op multichain formatter refactor
src/account/Safe/SafeMultiChainSigAccount.ts
Introduced private formatSingleUserOperationSignature and routed the length-1 branch of formatSignaturesToUseroperationsSignatures through it to centralize Safe Passkey v0.2.1 defaults and set isMultiChainSignature: true.
SafeAccount EIP-712 instance methods
src/account/Safe/SafeAccount.ts
Added getUserOperationEip712Data, getUserOperationEip712Hash, and formatUserOperationSignature as public instance wrappers that inject instance entrypointAddress and safe4337ModuleAddress and delegate to static helpers; updated deprecation JSDoc reference.
README default EntryPoint note
README.md
Added guidance that each account class has a class-specific default EntryPoint and when to override entrypointAddress.
Verification tests & imports
test/signer/signer.test.js, test/types/signer-api.ts
Added tests asserting instance typed-data/hash and signature formatting behavior for SafeMultiChainSigAccountV1 and an integration-style snippet using estimateUserOperationGas.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • sherifahmed990
  • andrewwahid

Poem

A rabbit found a signing key,
Typed data hopped in harmony,
Instance helpers stitched the flow,
Hashes, sigs, and tests in tow,
Multichain carrots, ready to go. 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding instance-level manual signing helpers to Safe account classes, which is the primary focus of the changeset.
Description check ✅ Passed The pull request description follows the template with all required sections (Summary, Tests, Risk/Compatibility) populated. It clearly describes the changes and includes testing steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@Sednaoui Sednaoui force-pushed the add-safe-instance-manual-signing-helpers branch from d68cadb to 8cc4dc2 Compare May 28, 2026 15:31
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@Sednaoui Sednaoui force-pushed the add-safe-instance-manual-signing-helpers branch from 8cc4dc2 to 9be7fff Compare May 28, 2026 15:47
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant