-
Notifications
You must be signed in to change notification settings - Fork 540
[Insight] Make clientId optional and improve error handling #7158
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
[Insight] Make clientId optional and improve error handling #7158
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 0831769 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThe updates include making the Changes
Sequence Diagram(s)sequenceDiagram
participant TestSuite as "7702 Minimal Account Test"
participant Wallet as "In-App Wallet"
participant Sepolia as "Sepolia Chain"
participant Account as "Minimal Account"
TestSuite->>Wallet: Configure with EIP-7702, gas sponsorship
TestSuite->>Wallet: Connect as guest to Sepolia
Wallet->>Sepolia: Connect and authenticate
TestSuite->>Account: Prepare two zero-value transactions
TestSuite->>Wallet: Send batch transactions via Account
Wallet->>Sepolia: Submit batch transaction
Sepolia-->>Wallet: Return transaction hash
Wallet-->>TestSuite: Return transaction hash
TestSuite->>TestSuite: Assert transaction hash is defined
sequenceDiagram
participant GuestAuth as "guestAuthenticate"
participant Server as "Authentication Server"
GuestAuth->>Server: POST authentication request
Server-->>GuestAuth: Respond with status and body
alt Response not OK
GuestAuth->>GuestAuth: Read response body text
GuestAuth->>GuestAuth: Throw error with status, statusText, and body
else Response OK
GuestAuth->>GuestAuth: Proceed as normal
end
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (10)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used🧬 Code Graph Analysis (1)packages/thirdweb/src/extensions/erc721/drops/write/updateMetadata.test.ts (2)
⏰ Context from checks skipped due to timeout of 90000ms (8)
🔇 Additional comments (3)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
size-limit report 📦
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7158 +/- ##
==========================================
+ Coverage 55.68% 55.70% +0.02%
==========================================
Files 904 904
Lines 58340 58358 +18
Branches 4107 4114 +7
==========================================
+ Hits 32484 32510 +26
+ Misses 25751 25743 -8
Partials 105 105
🚀 New features to boost your workflow:
|
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 (2)
packages/thirdweb/src/wallets/in-app/core/authentication/guest.ts (1)
48-53
: Excellent error handling improvement, but add test coverage.The enhanced error reporting with HTTP status, status text, and response body significantly improves debugging capabilities for guest authentication failures.
Consider adding test coverage for this error path as indicated by the static analysis. Error handling scenarios are critical to test for robustness.
// Add test case like: it("should provide detailed error message on authentication failure", async () => { // Mock failed response and verify error message format });🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 49-53: packages/thirdweb/src/wallets/in-app/core/authentication/guest.ts#L49-L53
Added lines #L49 - L53 were not covered by testspackages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.test.ts (1)
12-43
: Good foundation for EIP-7702 testing, consider expanding assertions.The test correctly validates basic batch transaction functionality with EIP-7702 execution mode. The conditional execution using
TW_SECRET_KEY
is appropriate for integration tests.Consider enhancing the test with more comprehensive assertions:
const result = await sendBatchTransaction({ account, transactions: [tx1, tx2], }); expect(result.transactionHash).toBeDefined(); + expect(result.transactionHash).toMatch(/^0x[a-fA-F0-9]{64}$/); + + // Optionally verify transaction was actually mined + // const receipt = await waitForReceipt(result); + // expect(receipt.status).toBe("success");This would provide better validation of the transaction hash format and could include verification that the transaction was successfully processed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/insight/src/configure.ts
(1 hunks)packages/thirdweb/src/wallets/in-app/core/actions/get-enclave-user-status.ts
(0 hunks)packages/thirdweb/src/wallets/in-app/core/authentication/guest.ts
(1 hunks)packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.test.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- packages/thirdweb/src/wallets/in-app/core/actions/get-enclave-user-status.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.test.ts (3)
packages/engine/src/client/client.gen.ts (1)
client
(24-28)packages/thirdweb/src/exports/thirdweb.ts (1)
prepareTransaction
(102-102)packages/thirdweb/src/exports/wallets.ts (1)
generateAccount
(31-31)
🪛 GitHub Check: codecov/patch
packages/thirdweb/src/wallets/in-app/core/authentication/guest.ts
[warning] 49-53: packages/thirdweb/src/wallets/in-app/core/authentication/guest.ts#L49-L53
Added lines #L49 - L53 were not covered by tests
🔇 Additional comments (1)
packages/insight/src/configure.ts (1)
5-5
: LGTM! Good API improvement.Making
clientId
optional enhances API flexibility while maintaining backward compatibility. The existing conditional logic in theconfigure
function already handles optionalclientId
correctly.
54651ba
to
222d3e2
Compare
222d3e2
to
0831769
Compare
PR-Codex overview
This PR introduces several changes, primarily focusing on making the
clientId
optional in various configurations and enhancing the handling of large NFT collections during metadata updates. It also improves error handling in guest account generation and adds tests for batch transactions.Detailed summary
clientId
optional inEngineClientOptions
andInsightClientOptions
.x-thirdweb-client-id
.updateMetadata.test.ts
.updateMetadata.ts
to process NFT metadata in smaller batches.Summary by CodeRabbit