feat(client): gasless transactions for POLY_PROXY (Magic Link proxy wallet)#8
Merged
Merged
Conversation
9a052f6 to
9c372e5
Compare
9c372e5 to
71c68e4
Compare
71c68e4 to
449dad2
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 449dad2. Configure here.
e7c11de to
f1705f8
Compare
Extends prepareGaslessTransaction to handle Magic Link proxy wallets
(WalletType.POLY_PROXY) alongside the existing Safe-backed flow.
The proxy signing contract differs from Safe's EIP-712 approach: it
uses the GSN relay hub protocol — keccak256("rlx:" ++ from ++ to ++
data ++ relayerFee ++ gasPrice ++ gasLimit ++ nonce ++ relayHub ++
relay) — signed with personal_sign semantics. The calldata targets
the proxy factory's proxy() function rather than the wallet directly.
Changes:
- environments.ts: add relayHub address to EnvironmentConfig (production: 0xD216153c06E857cD7f72665E0aF1d7D82172F494)
- abis.ts: add encodeProxyCall() for proxy((uint8,address,uint256,bytes)[]) ABI encoding
- workflow.ts: add SignGaslessHashRequest for raw 32-byte hash signing
- viem.ts / ethers-v5.ts / privy.ts: handle signGaslessHash in completeWith
- account.ts: export deriveProxyWalletAddress as @internal
- actions/gasless.ts: add proxy branch in prepareGaslessTransaction; add buildProxyTransactionHash and helpers
- testing.ts: add deriveProxyAddress helper
- gasless.test.ts / clients.test.ts: add proxy wallet classification and workflow tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f1705f8 to
a1bde68
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
prepareGaslessTransactionto supportWalletType.POLY_PROXYalongside the existing Safe flowSignGaslessHashRequestworkflow step for raw-hash personal signingrelayHubaddress toEnvironmentConfig(production:0xD216153c06E857cD7f72665E0aF1d7D82172F494)encodeProxyCall()inabis.tsto encode the proxy factoryproxy(...)ABI callWhy the proxy flow is different from Safe
Safe uses EIP-712 typed-data over a
SafeTxstruct. Proxy uses the original GSN relay hub signing protocol:…then personal-sign (EIP-191) over that 32-byte hash. The calldata targets the proxy factory (
proxyFactoryaddress), not the wallet, and the relayer request type isPROXYnotSAFE.The implementation was verified against:
relayer-v2/packages/api/pkg/signatures/hash.go— hash constructionrelayer-v2/packages/api/pkg/signatures/verify.go— personal-sign semanticsrelayer-v2/packages/api/pkg/validate/validate.go—isValidProxySigParamsrequirementsbuilder-relayer-client/src/builder/proxy.ts— client-side referenceFiles changed
environments.tsrelayHub: EvmAddressto config type + production valueabis.tsencodeProxyCall()workflow.tsSignGaslessHashRequestviem.ts/ethers-v5.ts/privy.tssignGaslessHashincompleteWithaccount.tsderiveProxyWalletAddressas@internalactions/gasless.tsprepareGaslessTransaction;buildProxyTransactionHashtesting.tsderiveProxyAddresstest helpergasless.test.ts/clients.test.tsInvariants preserved
prepareGaslessWalletremains Safe-onlyTest plan
pnpm lint— passes (biome, no fixes needed)pnpm typecheck— passes (zero tsc errors)gasless.test.tsproxy suite — verifiessignGaslessHashshape and rejects EOAclients.test.tsproxy classification — verifieswalletType === POLY_PROXYfor a deterministic proxy walletResidual risks / follow-ups
10_000_000(reference client fallback). Gas estimation would require an RPC provider in the workflow — deferred.gasPrice: '0'andrelay: ZERO_ADDRESSare acceptable per backend validation but carry no real relay signal.🤖 Generated with Claude Code
Note
Medium Risk
Touches transaction signing and relayer submission logic (hash construction, signature payloads, and environment addresses), where small mismatches can break execution. Changes are scoped to gasless workflows and covered by updated tests.
Overview
Adds gasless transaction support for
WalletType.POLY_PROXYalongside the existing Safe flow by building a relayer-compatible proxy transaction hash ("rlx:" preimage) and submittingRelayerTransactionType.PROXYexecutions targeting the proxy factory.Refactors the gasless signing step so
signGaslessMessagenow carries a raw 32-byte hex digest (Safe EIP-712 digests are precomputed; proxy uses the new hash builder), updates viem/ethers-v5/privy adapters accordingly, and extends environment/config + ABI helpers (relayHubaddress andencodeProxyCall). Tests are updated/added to cover proxy wallet classification and the new workflow shape.Reviewed by Cursor Bugbot for commit a1bde68. Bugbot is set up for automated code reviews on this repo. Configure here.