-
Notifications
You must be signed in to change notification settings - Fork 13
[TASK-6418] refactor: batch peanut wallet transactions #570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe pull request introduces modifications to the Changes
Sequence DiagramsequenceDiagram
participant User
participant CreateLink
participant WalletContext
participant PaymasterService
User->>CreateLink: Initiate Transaction
CreateLink->>WalletContext: Prepare User Operations
alt PEANUT Wallet
WalletContext->>PaymasterService: Request Gasless Sponsorship
PaymasterService-->>WalletContext: Return Sponsorship Data
end
WalletContext->>WalletContext: Encode User Operations
WalletContext->>PaymasterService: Send Batch User Operations
PaymasterService-->>WalletContext: Transaction Confirmation
WalletContext-->>CreateLink: Transaction Result
CreateLink-->>User: Transaction Completed
Possibly related PRs
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/components/Create/useCreateLink.tsx (1)
513-513
: Remove unnecessary increment ofidx
before returning.The variable
idx
is incremented withidx++
, but the function returns immediately afterward, rendering the increment ineffective. Sinceidx
is not used beyond this point, consider removing this line to clean up the code.- idx++ return signedTxsResponse[signedTxsResponse.length - 1]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/Create/useCreateLink.tsx
(2 hunks)src/context/walletContext/zeroDevContext.context.tsx
(5 hunks)
🔇 Additional comments (7)
src/components/Create/useCreateLink.tsx (2)
505-515
: New logic for isActiveWalletPW
wallet type is correctly implemented.
The addition of the isActiveWalletPW
condition and associated logic correctly handles transactions for PEANUT
wallets by mapping the unsigned transactions and using handleSendUserOpEncoded
. The parameters are appropriately constructed, and the asynchronous call is handled correctly.
530-530
: Condition for isActiveWalletBYOW
wallet type is correctly added.
The addition of the if (isActiveWalletBYOW)
condition appropriately handles transactions for BYOW wallet types, ensuring that the transaction flow is correctly managed based on the active wallet type.
src/context/walletContext/zeroDevContext.context.tsx (5)
2-2
: Import of useCallback
is appropriate.
The addition of useCallback
in the imports from React is necessary for the newly implemented functions that leverage this hook.
35-37
: Verify type changes in UserOpEncodedParams
for consistency.
Changing the to
type from Address
to Hex
, and making value
and data
optional (bigint | undefined
and Hex | undefined
), may affect how this type is used elsewhere in the codebase. Ensure that all usages of UserOpEncodedParams
accommodate these changes and that functions interacting with this type handle optional value
and data
correctly.
50-50
: Update method signature to accept array of UserOpEncodedParams
.
The handleSendUserOpEncoded
function now accepts an array of UserOpEncodedParams
, allowing batch processing of user operations. Confirm that all calls to this method pass the correct parameters and that the functions processing these operations can handle arrays as expected.
114-124
: Enhanced error handling in getPaymasterData
improves robustness.
Wrapping the sponsorUserOperation
call in a try-catch block and logging errors enhances the function's resilience by providing better visibility into potential issues during user operation sponsorship.
216-224
: Batch processing in handleSendUserOpEncoded
is correctly implemented.
The function handleSendUserOpEncoded
now processes multiple user operations by accepting an array of UserOpEncodedParams
and encoding them using kernelClient.account!.encodeCalls(calls)
. Ensure that encodeCalls
supports arrays and that this change is compatible with the account client's expectations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great!
Summary by CodeRabbit
New Features
Bug Fixes
Documentation