Skip to content

Add TikTok as AuthProvider #154

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

0xFirekeeper
Copy link
Member

@0xFirekeeper 0xFirekeeper commented Aug 7, 2025

Introduces TikTok as a new AuthProvider across InAppWallet and EcosystemWallet, updating relevant enums, switch statements, and OAuth login link generation. Also refactors some code for consistency, fixes minor formatting, and ensures TikTok is handled in provider mappings and UI logic.


PR-Codex overview

This PR focuses on refining the codebase by adding missing commas, improving code readability, and enhancing the structure of various classes and methods across the Thirdweb project.

Detailed summary

  • Added missing commas in several enumerations and object initializations.
  • Improved formatting and readability in various class methods.
  • Introduced new authentication providers like TikTok.
  • Updated exception handling for better clarity.
  • Enhanced type safety and consistency in method parameters and return types.

The following files were skipped due to too many changes: Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Added TikTok as a new authentication provider option for In-App Wallet.
  • Style

    • Improved code formatting by adding trailing commas to object and collection initializations for consistency.
    • Cleaned up project and configuration files by removing extraneous blank lines and adjusting formatting.
  • Bug Fixes

    • Updated OAuth provider mapping to support TikTok in relevant wallet creation flows.

Introduces TikTok as a new AuthProvider across InAppWallet and EcosystemWallet, updating relevant enums, switch statements, and OAuth login link generation. Also refactors some code for consistency, fixes minor formatting, and ensures TikTok is handled in provider mappings and UI logic.
Copy link

coderabbitai bot commented Aug 7, 2025

Walkthrough

The changes across the codebase are primarily focused on formatting improvements, specifically the addition and removal of trailing commas in object, collection initializers, and enum declarations for consistency. Minor refactoring and syntax cleanups were made in some utility and wallet classes without altering logic or behavior. The AuthProvider enum was extended to include a new value TikTok, with corresponding updates in wallet creation logic and a console demo comment. No public API signatures or control flow were changed.

Changes

Cohort / File(s) Change Summary
Trailing commas and formatting in tests and utility code
Thirdweb.Tests/Thirdweb.Utils/Thirdweb.Utils.Tests.cs, Thirdweb/Thirdweb.Utils/Utils.cs, Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs, Thirdweb.Tests/Thirdweb.Contracts/Thirdweb.Contracts.Tests.cs, Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs, Thirdweb.Tests/Thirdweb.MarketplaceExtensions.Tests.cs, Thirdweb.Tests/Thirdweb.Http/Thirdweb.Http.Tests.cs, Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.Transactions.Tests.cs, Thirdweb.Tests/Thirdweb.ZkSmartWallet.Tests.cs, Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.PrivateKeyWallet.Tests.cs, Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.SmartWallet.Tests.cs, Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.Wallets.Tests.cs
Added or removed trailing commas in object and collection initializers for consistent formatting. Reformatted multi-line async lambda expressions in test assertions to single-line style. Minor syntax cleanups without changing any logic, control flow, or error handling.
InAppWallet enum extension and related formatting
Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWallet.Types.cs, Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs
Added TikTok to the AuthProvider enum and updated the provider mapping logic accordingly. Added trailing commas and reformatted multiple object initializers and LINQ expressions for consistency in EcosystemWallet.cs. No logic or control flow changes.
Console demo update
Thirdweb.Console/Program.cs
Updated a commented-out line to use AuthProvider.TikTok instead of AuthProvider.Github in the OAuth demo region. No functional code changes.
SmartWallet formatting and enum
Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs
Added trailing commas to dictionary and object initializers throughout the file for formatting consistency. Added a trailing comma after the last member in the TokenPaymaster enum. No logic changes.
EmbeddedWallet authentication formatting
Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs
Reformatted dictionary and object initializers to use inline style with trailing commas. Lowercased the authProvider parameter in one method. Removed unnecessary trailing commas in some object initializers. No logic or control flow changes.
Project and configuration file cleanup
.csharpierrc, .editorconfig, Directory.Build.props, Directory.Packages.props, Thirdweb.Console/Thirdweb.Console.csproj, Thirdweb.Tests/Thirdweb.Tests.csproj, Thirdweb.csproj
Removed .csharpierrc file. Updated .editorconfig to add C# and C# script file settings for line endings, indentation, and max line length. Removed extraneous blank lines and ensured newline at file ends in various project and configuration files. No functional or semantic changes.
Enum trailing commas and minor formatting
Thirdweb/Thirdweb.Bridge/ThirdwebBridge.Types.cs, Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.Types.cs, Thirdweb/Thirdweb.Extensions/ThirdwebMarketplaceExtensions.Types.cs, Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoStatus.cs, Thirdweb/Thirdweb.Pay/Types.Shared.cs, Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs, Thirdweb/Thirdweb.AI/ThirdwebNebula.cs
Added trailing commas after last enum members and default switch cases to improve formatting consistency. No logic or behavior changes.
Minor code formatting and syntax cleanups in various wallet and utility classes
Thirdweb/Thirdweb.Utils/Utils.cs, Thirdweb/Thirdweb.Wallets/EngineWallet/EngineWallet.cs, Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs, Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs, Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/BundlerClient.cs, Thirdweb/Thirdweb.Wallets/EIP712.cs, Thirdweb/Thirdweb.Wallets/EIP712Encoder.cs, Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs, Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs, Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs, Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Exceptions/VerificationException.cs, Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.AccountLinking.cs, Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs, Thirdweb/Thirdweb.Indexer/ThirdwebInsight.Extensions.cs, Thirdweb/Thirdweb.Indexer/ThirdwebInsight.cs, Thirdweb/Thirdweb.Bridge/ThirdwebBridge.cs, Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyHistory.cs, Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoQuote.cs, Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoStatus.cs, Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatCurrencies.cs, Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatQuote.cs, Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatStatus.cs, Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoQuote.cs, Thirdweb/Thirdweb.Pay/Types.GetBuyWithFiatQuote.cs
Added or removed trailing commas in object initializers and enum declarations for style consistency. Reformatted some multiline expressions into single-line expressions without changing behavior. Simplified some LINQ expressions and dictionary initializations. Changed exception throw statements to single-line. Removed or added trailing commas in arrays and anonymous objects. No logic, error handling, or control flow changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch firekeeper/tiktok-auth

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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 (3)
Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs (2)

56-98: Consider freezing the token-paymaster lookup to prevent accidental mutation

_tokenPaymasterConfig is intended to be a constant lookup table.
Declaring it as a mutable Dictionary<,> leaves the door open for run-time mutation from external code (especially because the field is private static readonly, not private static).
If immutability is desired, switch to ImmutableDictionary or expose only a read-only view with AsReadOnly() to harden defensive coding.

-private static readonly Dictionary<TokenPaymaster, TokenPaymasterConfig> _tokenPaymasterConfig = new()
+private static readonly ImmutableDictionary<TokenPaymaster, TokenPaymasterConfig> _tokenPaymasterConfig =
+    new Dictionary<TokenPaymaster, TokenPaymasterConfig>
+    {
+        // … same payload …
+    }.ToImmutableDictionary();

70-96: Gitleaks warnings are false positives – no action required

Lines containing the on-chain addresses (PaymasterAddress / TokenAddress) trigger “generic-api-key” hits from Gitleaks.
These are publicly-known contract addresses, not secrets. Documenting this once will help silence repeated security-review noise.

Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs (1)

842-846: Readable OTP pre-auth logic

The terse ternary chain hampers readability and debuggability.
An early-exit if/else block is clearer and avoids the hidden Exception side-effect inside the expression.

-        var serverRes =
-            string.IsNullOrEmpty(this.Email) && string.IsNullOrEmpty(this.PhoneNumber) ? throw new Exception("Email or Phone Number is required for OTP login")
-            : this.Email == null ? await this.EmbeddedWallet.VerifyPhoneOtpAsync(this.PhoneNumber, otp).ConfigureAwait(false)
-            : await this.EmbeddedWallet.VerifyEmailOtpAsync(this.Email, otp).ConfigureAwait(false);
+        Server.VerifyResult serverRes;
+        if (string.IsNullOrEmpty(this.Email) && string.IsNullOrEmpty(this.PhoneNumber))
+            throw new Exception("Email or Phone Number is required for OTP login");
+
+        if (this.Email == null)
+            serverRes = await this.EmbeddedWallet.VerifyPhoneOtpAsync(this.PhoneNumber, otp).ConfigureAwait(false);
+        else
+            serverRes = await this.EmbeddedWallet.VerifyEmailOtpAsync(this.Email, otp).ConfigureAwait(false);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e09479 and 1ccdc07.

📒 Files selected for processing (8)
  • Thirdweb.Console/Program.cs (1 hunks)
  • Thirdweb.Tests/Thirdweb.Utils/Thirdweb.Utils.Tests.cs (9 hunks)
  • Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs (1 hunks)
  • Thirdweb/Thirdweb.Utils/Utils.cs (4 hunks)
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs (15 hunks)
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs (5 hunks)
  • Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWallet.Types.cs (1 hunks)
  • Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs (15 hunks)
🧰 Additional context used
🪛 Gitleaks (8.27.2)
Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs

74-74: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


84-84: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


94-94: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-test-cov
🔇 Additional comments (15)
Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs (1)

120-120: LGTM! Good formatting consistency.

The trailing comma addition improves code maintainability and follows modern C# formatting conventions.

Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWallet.Types.cs (1)

23-23: TikTok provider integration verified

All necessary references for the new TikTok provider are present:

  • Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWallet.Types.cs
    TikTok enum value added.
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs
    authProvider switch maps Thirdweb.AuthProvider.TikTok => "TikTok".
    case "TikTok": branch handles parsing of incoming provider strings.
    LoginWithOauth uses the mapped "TikTok" string against the generic OAuth endpoint.

No additional provider-specific URLs or dictionaries are required—the generic login flow covers TikTok. Everything is wired up correctly.

Thirdweb.Console/Program.cs (1)

745-745: LGTM! Example code updated to demonstrate TikTok usage.

The commented example code now shows how to use the new TikTok authentication provider, which serves as helpful documentation for developers.

Thirdweb.Tests/Thirdweb.Utils/Thirdweb.Utils.Tests.cs (1)

232-232: LGTM! Consistent formatting improvements.

The trailing comma additions throughout the test methods improve code consistency and maintainability. This aligns with modern C# formatting conventions and makes future diffs cleaner.

Also applies to: 255-255, 276-276, 303-303, 320-320, 337-337, 354-354, 371-371, 388-388

Thirdweb/Thirdweb.Utils/Utils.cs (4)

715-715: LGTM - Formatting improvement for consistency.

Adding the trailing comma in the list initialization improves code consistency and makes future additions easier.


1159-1159: LGTM - Formatting improvement for consistency.

Adding the trailing comma in the object initializer improves code consistency and makes future additions easier.


1189-1189: LGTM - Formatting improvement for consistency.

Adding the trailing comma in the object initializer improves code consistency and makes future additions easier.


1224-1224: LGTM - Formatting improvement for consistency.

Adding the trailing comma in the anonymous object improves code consistency and makes future additions easier.

Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs (5)

111-116: LGTM - Formatting improvement for consistency.

The dictionary initialization with trailing commas improves code consistency and readability.


391-391: LGTM - Formatting improvement for consistency.

Removing the trailing comma in the UriBuilder object initializer improves formatting consistency.


402-402: LGTM - Formatting improvement for consistency.

Removing the trailing comma in the UriBuilder object initializer improves formatting consistency.


420-420: LGTM - Formatting improvement for consistency.

Removing the trailing comma in the JsonSerializer object initializer improves formatting consistency.


203-203: Lowercase conversion for authProvider is consistent and safe

All existing OAuth‐link URLs in both EmbeddedWallet and EcosystemWallet already normalize the provider name to lowercase before sending to the server (e.g. FetchHeadlessOauthLoginLinkAsync, GenerateExternalLoginLink). Session resumption and storage still use the original casing for comparison, so this change only affects URL paths—matching the server’s lowercase routes—and will not break any existing providers. Proceed with approval.

Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs (2)

140-143: Double-check server support for the new TikTok provider string

"TikTok" is now surfaced in the AuthProvider mapping, but the backend must also:

  1. Accept the exact case-sensitive string "TikTok" in /oauth endpoints.
  2. Return "TikTok" in user-status payloads, otherwise linking/unlinking will fail the switch-case comparisons later in this file.

Please confirm with the auth service before shipping, or guard with a fallback / error message.


748-751: Keep the OAuth switch-case in sync with the mapping above

The LinkAccount dispatcher already adds the TikTok case – good.
Just ensure any future provider additions are updated in both places (mapping + dispatcher) to avoid unreachable code paths.

Updated the EIP-155 detection logic to first check if the Arachnid contract is deployed before sending a pre-155 transaction. Also added missing trailing commas in several object initializations for consistency.
@codecov-commenter
Copy link

codecov-commenter commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 54.41176% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.72%. Comparing base (8e09479) to head (7abd38f).

Files with missing lines Patch % Lines
Thirdweb/Thirdweb.Utils/Utils.cs 12.12% 28 Missing and 1 partial ⚠️
...dweb/Thirdweb.Wallets/EngineWallet/EngineWallet.cs 0.00% 12 Missing ⚠️
Thirdweb/Thirdweb.Bridge/ThirdwebBridge.cs 0.00% 6 Missing ⚠️
Thirdweb/Thirdweb.Bridge/ThirdwebBridge.Types.cs 0.00% 2 Missing ⚠️
Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs 81.81% 1 Missing and 1 partial ⚠️
...web/Thirdweb.Indexer/ThirdwebInsight.Extensions.cs 0.00% 2 Missing ⚠️
Thirdweb/Thirdweb.Indexer/ThirdwebInsight.cs 0.00% 2 Missing ⚠️
Thirdweb/Thirdweb.Wallets/EIP712Encoder.cs 0.00% 2 Missing ⚠️
...rdweb/Thirdweb.Transactions/ThirdwebTransaction.cs 80.00% 0 Missing and 1 partial ⚠️
...rdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs 50.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #154      +/-   ##
==========================================
- Coverage   58.15%   57.72%   -0.43%     
==========================================
  Files          43       43              
  Lines        6875     6872       -3     
  Branches      875      876       +1     
==========================================
- Hits         3998     3967      -31     
- Misses       2691     2718      +27     
- Partials      186      187       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (4)
Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs (1)

138-140: Include x-amz-security-token in SigV4 canonical/signed headers

Temporary AWS credentials (Cognito-issued/session tokens) require the x-amz-security-token header to be part of both the canonical request and the SignedHeaders. Omitting it will cause AWS to reject the signature.

• File: Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs
Lines 138–140: build canonicalHeaders and signedHeaders to conditionally include x-amz-security-token when credentials.SessionToken is non-empty.

Apply this diff:

--- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs
+++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs
@@ -135,7 +135,18 @@
         var amzDate = dateTimeNow.ToString(amzDateFormat);
         var dateStamp = dateTimeNow.ToString("yyyyMMdd");
 
-        var canonicalHeaders = $"host:{new Uri(endpoint).Host}\n" + $"x-amz-date:{amzDate}\n";
-        var signedHeaders = "host;x-amz-date";
+        var canonicalHeadersBuilder = new StringBuilder();
+        canonicalHeadersBuilder.Append($"host:{new Uri(endpoint).Host}\n");
+        canonicalHeadersBuilder.Append($"x-amz-date:{amzDate}\n");
+        if (!string.IsNullOrEmpty(credentials.SessionToken))
+        {
+            canonicalHeadersBuilder.Append($"x-amz-security-token:{credentials.SessionToken}\n");
+        }
+        var canonicalHeaders = canonicalHeadersBuilder.ToString();
+        var signedHeaders = string.IsNullOrEmpty(credentials.SessionToken)
+            ? "host;x-amz-date"
+            : "host;x-amz-date;x-amz-security-token";
 
         // ...
 
@@ -163,7 +174,8 @@
         client.AddHeader("x-amz-date", amzDate);
         client.AddHeader("Authorization", authorizationHeader);
-        if (!string.IsNullOrEmpty(credentials.SessionToken))
+        // still add the header for the request itself
+        if (!string.IsNullOrEmpty(credentials.SessionToken))
         {
             client.AddHeader("x-amz-security-token", credentials.SessionToken);
         }
Thirdweb/Thirdweb.Bridge/ThirdwebBridge.Types.cs (1)

399-404: Map missing statuses in StatusData.StatusType

Currently, "PROCESSING" and "CREATED" resolve to UNKNOWN, which is inconsistent with the enum and with OnrampStatusData. Add explicit mappings.

         this.Status switch
         {
             "FAILED" => StatusType.FAILED,
             "PENDING" => StatusType.PENDING,
             "COMPLETED" => StatusType.COMPLETED,
             "NOT_FOUND" => StatusType.NOT_FOUND,
+            "PROCESSING" => StatusType.PROCESSING,
+            "CREATED" => StatusType.CREATED,
             _ => StatusType.UNKNOWN,
         };

Optional: add unit tests to cover all string-to-enum mappings for both StatusData and OnrampStatusData.

Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs (1)

1783-1785: Bug: Wrong method invoked for ERC721 claim condition by ID.

DropERC721_GetActiveClaimCondition returns ERC20 claim condition data instead of ERC721. This is a functional mismatch and will return the wrong schema/type.

-        var activeClaimConditionId = await contract.DropERC721_GetActiveClaimConditionId();
-        return await contract.DropERC20_GetClaimConditionById(activeClaimConditionId);
+        var activeClaimConditionId = await contract.DropERC721_GetActiveClaimConditionId();
+        return await contract.DropERC721_GetClaimConditionById(activeClaimConditionId);

Consider adding a small test to catch this in the future (ensuring ERC721 path does not call ERC20 helpers).

Thirdweb/Thirdweb.Indexer/ThirdwebInsight.Extensions.cs (1)

14-21: Fix potential NullReference in switch default arm

Line 20 references token.Contract.Type without null-propagation while the switch input is token.Contract?.Type. If Contract is null, constructing the exception message will throw. Make it null-safe.

Apply this minimal diff:

-                _ => throw new Exception($"Unknown NFT type: {token.Contract.Type}"),
+                _ => throw new Exception($"Unknown NFT type: {token.Contract?.Type ?? "null"}"),
🧹 Nitpick comments (8)
.editorconfig (1)

48-49: Collection initializer/expressions preferences set to false

Confirm this is intentional to prefer expanded add-calls and avoid C# 12 collection expressions. If so, consider also setting IDE0028/IDE0263 severities to avoid conflicting analyzer suggestions.

Example (only if you want to suppress these suggestions):

# Use collection initializers
dotnet_diagnostic.IDE0028.severity = none
# Use collection expression
dotnet_diagnostic.IDE0263.severity = none
Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs (1)

110-116: PBKDF2 derivation block unchanged; OK

Indentation-only change. No issues spotted. Optional: consider Rfc2898DeriveBytes.Pbkdf2 (built-in) if you ever want to remove the BouncyCastle dependency here.

Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.Wallets.Tests.cs (1)

105-105: Trailing comma in object initializer

Style-only; no effect on tests. LGTM.

To align with the PR goal (TikTok AuthProvider) and Codecov feedback, consider adding tests covering TikTok provider mapping and OAuth login link generation paths.

Thirdweb/Thirdweb.AI/ThirdwebNebula.cs (1)

100-108: Nit: Typo in variable name contextFiler

Use contextFilter to match the method name and property, improving readability and searchability.

-        var contextFiler = await this.PrepareContextFilter(wallet, context);
+        var contextFilter = await this.PrepareContextFilter(wallet, context);
 ...
-                ContextFilter = contextFiler,
+                ContextFilter = contextFilter,

Apply the same rename in all four methods where this local is used.

Also applies to: 123-131, 151-159, 185-193

Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs (2)

718-739: Simplify Assert.ThrowsAsync lambdas and keep style consistent

Use () => task instead of async () => await task to reduce noise and align with the rest of the file.

Example diffs (apply the same pattern to the other cases in these ranges):

-        _ = await Assert.ThrowsAsync<ArgumentNullException>(async () =>
-            await contract.ERC1155_SafeBatchTransferFrom(null, null, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData)
-        );
+        _ = await Assert.ThrowsAsync<ArgumentNullException>(() =>
+            contract.ERC1155_SafeBatchTransferFrom(null, null, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData)
+        );

-        _ = await Assert.ThrowsAsync<ArgumentException>(async () =>
-            await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, null, new BigInteger[] { validAmount }, validData)
-        );
+        _ = await Assert.ThrowsAsync<ArgumentException>(() =>
+            contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, null, new BigInteger[] { validAmount }, validData)
+        );

Optional minor style tweak in these lines: prefer type inference for small inline arrays for brevity:

-            contract.ERC1155_SafeBatchTransferFrom(..., new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, ...)
+            contract.ERC1155_SafeBatchTransferFrom(..., new[] { validTokenId }, new[] { validAmount }, ...)

Also applies to: 752-754, 764-766, 1657-1662


1425-1425: MintRequest inline initializations — LGTM; optional Uri nullness note

Edits look good. If the goal is to test default-filling more explicitly, consider using Uri = null rather than "". Not required; current assertions still validate defaults properly.

Also applies to: 1533-1533, 1701-1701

Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs (1)

110-112: Prefer guard clauses over nested ternaries; add null checks to avoid NREs.

Current form is terse but harder to read and will NRE if nft or nft.Metadata is null. Recommend explicit checks and a null-conditional on Image for safer behavior.

-        return client == null ? throw new ArgumentNullException(nameof(client))
-            : string.IsNullOrEmpty(nft.Metadata.Image) ? Array.Empty<byte>()
-            : await ThirdwebStorage.Download<byte[]>(client, nft.Metadata.Image).ConfigureAwait(false);
+        if (client == null) throw new ArgumentNullException(nameof(client));
+        if (nft == null) throw new ArgumentNullException(nameof(nft));
+
+        var image = nft.Metadata?.Image;
+        if (string.IsNullOrEmpty(image))
+            return Array.Empty<byte>();
+
+        return await ThirdwebStorage.Download<byte[]>(client, image).ConfigureAwait(false);
Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs (1)

361-362: Trailing commas in RLP list initializers: OK

No behavior change; improves diff stability.

If you want to boost coverage, I can add a test that ensures a transaction with AuthorizationList produces a type 0x04 prefixed raw tx (and 0x02 otherwise).

Also applies to: 470-471

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b16be3f and 7abd38f.

📒 Files selected for processing (48)
  • .csharpierrc (0 hunks)
  • .editorconfig (1 hunks)
  • Directory.Build.props (1 hunks)
  • Directory.Packages.props (1 hunks)
  • Thirdweb.Console/Thirdweb.Console.csproj (1 hunks)
  • Thirdweb.Tests/Thirdweb.Contracts/Thirdweb.Contracts.Tests.cs (4 hunks)
  • Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs (10 hunks)
  • Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.MarketplaceExtensions.Tests.cs (4 hunks)
  • Thirdweb.Tests/Thirdweb.Http/Thirdweb.Http.Tests.cs (3 hunks)
  • Thirdweb.Tests/Thirdweb.Tests.csproj (1 hunks)
  • Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.Transactions.Tests.cs (4 hunks)
  • Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.ZkSmartWallet.Tests.cs (3 hunks)
  • Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.PrivateKeyWallet.Tests.cs (2 hunks)
  • Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.SmartWallet.Tests.cs (5 hunks)
  • Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.Wallets.Tests.cs (2 hunks)
  • Thirdweb/Thirdweb.AI/ThirdwebNebula.cs (3 hunks)
  • Thirdweb/Thirdweb.Bridge/ThirdwebBridge.Types.cs (4 hunks)
  • Thirdweb/Thirdweb.Bridge/ThirdwebBridge.cs (6 hunks)
  • Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.Types.cs (1 hunks)
  • Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs (9 hunks)
  • Thirdweb/Thirdweb.Extensions/ThirdwebMarketplaceExtensions.Types.cs (2 hunks)
  • Thirdweb/Thirdweb.Indexer/ThirdwebInsight.Extensions.cs (2 hunks)
  • Thirdweb/Thirdweb.Indexer/ThirdwebInsight.cs (2 hunks)
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyHistory.cs (2 hunks)
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoQuote.cs (1 hunks)
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoStatus.cs (1 hunks)
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatCurrencies.cs (1 hunks)
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatQuote.cs (1 hunks)
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatStatus.cs (1 hunks)
  • Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoQuote.cs (1 hunks)
  • Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoStatus.cs (2 hunks)
  • Thirdweb/Thirdweb.Pay/Types.GetBuyWithFiatQuote.cs (1 hunks)
  • Thirdweb/Thirdweb.Pay/Types.Shared.cs (1 hunks)
  • Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs (2 hunks)
  • Thirdweb/Thirdweb.Utils/Utils.Types.cs (1 hunks)
  • Thirdweb/Thirdweb.Wallets/EIP712.cs (1 hunks)
  • Thirdweb/Thirdweb.Wallets/EIP712Encoder.cs (2 hunks)
  • Thirdweb/Thirdweb.Wallets/EngineWallet/EngineWallet.cs (3 hunks)
  • Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs (1 hunks)
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs (1 hunks)
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs (2 hunks)
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs (3 hunks)
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Exceptions/VerificationException.cs (1 hunks)
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.AccountLinking.cs (1 hunks)
  • Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs (2 hunks)
  • Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs (1 hunks)
  • Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/BundlerClient.cs (1 hunks)
  • Thirdweb/Thirdweb.csproj (1 hunks)
💤 Files with no reviewable changes (1)
  • .csharpierrc
✅ Files skipped from review due to trivial changes (32)
  • Thirdweb/Thirdweb.Pay/Types.Shared.cs
  • Directory.Build.props
  • Directory.Packages.props
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoStatus.cs
  • Thirdweb.Tests/Thirdweb.Http/Thirdweb.Http.Tests.cs
  • Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoQuote.cs
  • Thirdweb.Console/Thirdweb.Console.csproj
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.AccountLinking.cs
  • Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyHistory.cs
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoQuote.cs
  • Thirdweb/Thirdweb.Utils/Utils.Types.cs
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatQuote.cs
  • Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/BundlerClient.cs
  • Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.MarketplaceExtensions.Tests.cs
  • Thirdweb/Thirdweb.csproj
  • Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.ZkSmartWallet.Tests.cs
  • Thirdweb.Tests/Thirdweb.Contracts/Thirdweb.Contracts.Tests.cs
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatStatus.cs
  • Thirdweb/Thirdweb.Pay/Types.GetBuyWithFiatQuote.cs
  • Thirdweb/Thirdweb.Wallets/EIP712Encoder.cs
  • Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatCurrencies.cs
  • Thirdweb/Thirdweb.Extensions/ThirdwebMarketplaceExtensions.Types.cs
  • Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.Types.cs
  • Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs
  • Thirdweb/Thirdweb.Wallets/EngineWallet/EngineWallet.cs
  • Thirdweb/Thirdweb.Indexer/ThirdwebInsight.cs
  • Thirdweb.Tests/Thirdweb.Tests.csproj
  • Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.SmartWallet.Tests.cs
  • Thirdweb/Thirdweb.Bridge/ThirdwebBridge.cs
  • Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoStatus.cs
  • Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Exceptions/VerificationException.cs
🧰 Additional context used
🧬 Code Graph Analysis (3)
Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs (1)
Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs (1)
  • GetBytes (36-40)
Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs (1)
Thirdweb/Thirdweb.Utils/Utils.cs (3)
  • HexToBytes (131-134)
  • TrimZeroes (1095-1112)
  • ToByteArrayForRLPEncoding (1201-1209)
Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs (1)
Thirdweb/Thirdweb.Storage/ThirdwebStorage.cs (1)
  • ThirdwebStorage (8-106)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-test-cov
🔇 Additional comments (28)
Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs (1)

49-53: LGTM: trailing comma is harmless and improves diff stability

No functional change; consistent with the PR’s formatting cleanups.

.editorconfig (4)

2-2: Header comment tweak is fine

No functional impact.


8-9: Section header clarity is fine

Consistent with the rest of the file; no issues.


18-18: .NET Coding Conventions header formatting

Looks good; matches surrounding style.


11-16: Cross-platform EOL normalization confirmed in .gitattributes

The repository’s .gitattributes already includes:

* text=auto

which instructs Git to normalize all text files (including C#) to LF in the repo and convert to the platform’s native EOL on checkout. This satisfies the cross-platform line ending workflow and prevents CRLF churn across contributors.

Thirdweb/Thirdweb.Wallets/EIP712.cs (1)

489-491: Trailing comma is harmless; behavior unchanged

RLP empty list 0xc0 remains intact. No functional impact in SerializeEip712.

Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs (2)

14-14: Formatting-only change to _nybbles

No behavior change. LGTM.


454-454: PrimitivePolynomialCoefficients formatting

Trailing-comma removal only; constants unchanged. LGTM.

Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.Wallets.Tests.cs (1)

224-230: Assert formatting approved & TikTok integration verified

  • Assert formatting remains concise and readable—no behavior changes.
  • TikTok is included in AuthProvider (InAppWallet.Types.cs), mapped to "TikTok" in EcosystemWallet (string mappings and switch cases), and correctly handled by FetchHeadlessOauthLoginLinkAsync (EmbeddedWallet.Authentication/Server.cs).

All required wiring is present. No further changes needed.

Thirdweb/Thirdweb.AI/ThirdwebNebula.cs (3)

9-9: Trailing comma in enum member — OK

No behavioral change; improves diff-friendliness.


85-86: Trailing comma in object initializer — OK

Purely stylistic; no runtime impact.


224-229: Trailing comma in object initializer — OK

Consistent with project-wide formatting changes.

Thirdweb/Thirdweb.Bridge/ThirdwebBridge.Types.cs (3)

384-385: Trailing comma in enum StatusType — OK

Style-only change; no effect on enums.


499-500: Trailing comma in enum OnrampProvider — OK

No functional change.


588-589: Trailing comma in switch expression — OK

Keeps diffs minimal for future arms.

Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs (1)

1378-1378: Trailing commas in multiline initializers — LGTM

These commas improve future diffs and maintain consistency in the test suite.

Also applies to: 1480-1480, 1640-1640

Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs (8)

1239-1240: LGTM: initializer trailing comma and defaults.

Setting QuantityOwned = 1 for ERC721 and adding a trailing comma are fine for clarity and stable diffs.


1273-1273: LGTM: trailing comma in with-expression.

No logic change; consistent with repo formatting standardization.


1589-1596: LGTM: trailing comma in fnArgs array (DropERC20_Claim).

Purely stylistic; no behavior change.


1726-1734: LGTM: trailing comma in fnArgs array (DropERC721_Claim).

Consistent formatting; no functional impact.


1890-1898: LGTM: trailing comma in fnArgs array (DropERC1155_Claim).

Style-only change; looks good.


2080-2090: LGTM: trailing comma in TokenERC20_MintRequest initializer.

Keeps diffs cleaner; no logic change.


2325-2337: LGTM: trailing comma in TokenERC721_MintRequest initializer.

Formatting-only; all good.


2670-2684: LGTM: trailing comma in TokenERC1155_MintRequest initializer.

Consistent with the rest of the PR’s formatting sweep.

Thirdweb/Thirdweb.Indexer/ThirdwebInsight.Extensions.cs (1)

34-35: Stylistic trailing comma is fine

The trailing comma in the object initializer improves diffs and consistency. No functional change.

Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.PrivateKeyWallet.Tests.cs (1)

273-274: Trailing commas in object initializers are OK

Formatting-only change. Valid in C#, no behavior impact.

Also applies to: 291-293

Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.Transactions.Tests.cs (1)

14-14: LGTM: initializer comma cleanups

Pure formatting for consistency; no functional change.

Also applies to: 168-168, 332-332, 369-369

Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs (1)

265-268: Style-only changes acknowledged

  • Divider ternary formatting: same logic, clearer layout.
  • Trailing comma in zkSync transaction initializer: fine.

Also applies to: 493-494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants