Skip to content

feat: support beacon deposit wallets - #34

Merged
cesarenaldi merged 7 commits into
mainfrom
feature/pro-318-sdk-work
May 28, 2026
Merged

feat: support beacon deposit wallets#34
cesarenaldi merged 7 commits into
mainfrom
feature/pro-318-sdk-work

Conversation

@cesarenaldi

@cesarenaldi cesarenaldi commented May 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add beacon deposit-wallet CREATE2 derivation for internal client use without exporting it from the package root
  • detect at runtime whether the configured factory reports a beacon before deriving the expected deposit wallet address
  • preserve existing UUPS users by returning the UUPS address when it is already deployed
  • fall back to UUPS derivation when the factory has no beacon/reverts
  • add trailing RelayClient options for overriding the viem chain, defaulting to viem's polygon chain and validating chain.id matches chainId
  • deprecate the standalone UUPS deriveDepositWallet helper in favor of RelayClient.deriveDepositWalletAddress()
  • use an internal deriveUupsDepositWallet helper for SDK internals and keep deriveDepositWallet as a deprecated wrapper
  • cover UUPS, beacon, runtime selection, deployed UUPS fallback, and chain-option validation with tests
  • add direct ethersproject dependencies required by pnpm-isolated builds

Verification

  • pnpm build
  • pnpm test

Linear: PRO-318


Note

Medium Risk
Wrong address prediction could misroute funds or batch signing; mitigated by deployed-UUPS fallback, beacon-absent fallback, and regression tests.

Overview
Adds beacon-based deposit wallet support so predicted addresses match factories that deploy ERC-1967 beacon clones, not only legacy UUPS CREATE2 math.

RelayClient.deriveDepositWalletAddress() now uses an on-chain viem public client: it reads the factory beacon (or treats revert/missing beacon as none), returns the UUPS address when there is no beacon or that wallet is already deployed, otherwise returns the beacon CREATE2 address. A trailing RelayClientOptions lets callers override the viem chain (must match chainId). The standalone deriveDepositWallet() export stays as a deprecated UUPS-only wrapper; beacon derivation is internal and not re-exported from the package root.

Docs steer integrators to client.deriveDepositWalletAddress(). Tests cover fixed UUPS/beacon hashes and the three runtime branches; @ethersproject/providers and wallet are added for pnpm-isolated builds.

Reviewed by Cursor Bugbot for commit ce0b684. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a74e346. Configure here.

Comment thread src/client.ts

@adi-poly adi-poly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@cesarenaldi
cesarenaldi merged commit ec6a192 into main May 28, 2026
5 checks passed
@cesarenaldi
cesarenaldi deleted the feature/pro-318-sdk-work branch May 28, 2026 18:21
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.

2 participants