Bypass gas estimation for Safe wallet connector#548
Bypass gas estimation for Safe wallet connector#548Hugo0 merged 3 commits intopeanutprotocol:mainfrom
Conversation
ardaerturk
commented
Nov 27, 2024
- Added Safe wallet detection to skip gas estimation
- Safe uses Account Abstraction (AA) wallet where gas is sponsored/handled by Safe
- AA wallets don't need to hold native tokens for gas, making standard gas estimation irrelevant
- Returns default gas values (0) when Safe detected to prevent estimation errors
- Normal gas estimation flow maintained for regular wallets
|
@ardaerturk is attempting to deploy a commit to the squirrellabs Team on Vercel. A member of the Team first needs to authorize it. |
📝 Walkthrough📝 WalkthroughWalkthroughThe changes in this pull request involve modifications to the Changes
Possibly related PRs
Suggested reviewers
Warning Rate limit exceeded@ardaerturk has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 46 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
src/components/Create/useCreateLink.tsx (2)
188-190: Enhance robustness of Safe wallet detectionThe current implementation could be improved to handle edge cases and provide better type safety.
Consider this enhanced implementation:
- const isSafeConnector = (connector?: string) => { - return connector?.toLowerCase() === 'safe' - } + const isSafeConnector = (connector?: { name?: string }): boolean => { + const name = connector?.name + if (!name) return false + return name.toLowerCase().includes('safe') + }This change:
- Adds proper typing for the connector parameter
- Handles undefined/null cases explicitly
- Uses
includes()to catch variations of Safe wallet names- Explicitly returns a boolean type
194-203: Consider using consistent BigInt typesThe code uses
BigNumber.from(0)for Safe wallets while the rest of the codebase might be using native BigInt. Consider maintaining consistency across the codebase.Consider this modification:
if (isSafeConnector(connector?.name)) { return { feeOptions: { - gasLimit: BigNumber.from(0), - maxFeePerGas: BigNumber.from(0), - gasPrice: BigNumber.from(0) + gasLimit: BigInt(0), + maxFeePerGas: BigInt(0), + gasPrice: BigInt(0) }, transactionCostUSD: 0 } }
ardaerturk
left a comment
There was a problem hiding this comment.
resolved ai bot suggestions