Skip to content

allow all moments#181

Merged
techeng322 merged 2 commits intomainfrom
techengme/myc-4642-api-transfers-api-allow-all-moments
Apr 17, 2026
Merged

allow all moments#181
techeng322 merged 2 commits intomainfrom
techengme/myc-4642-api-transfers-api-allow-all-moments

Conversation

@techeng322
Copy link
Copy Markdown
Collaborator

@techeng322 techeng322 commented Apr 17, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved transfer request handling with enhanced automatic chain detection. The system now intelligently identifies and applies the correct blockchain network based on your environment and application settings, reducing the need to manually specify chain information during transfers. This creates a more seamless transfer experience.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
in-process-api Ready Ready Preview Apr 17, 2026 4:27pm

Request Review

@supabase
Copy link
Copy Markdown

supabase bot commented Apr 17, 2026

This pull request has been ignored for the connected project zzgteesackezhtnuqfyw because there are no changes detected in src/lib/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2026

Warning

Rate limit exceeded

@techeng322 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 59 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 36 minutes and 59 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f184c794-9950-4769-99f2-9b3da5bb9b75

📥 Commits

Reviewing files that changed from the base of the PR and between bbddf41 and 459698b.

📒 Files selected for processing (1)
  • src/lib/transfers/__tests__/validateTransfersQuery.test.ts
📝 Walkthrough

Walkthrough

A single schema file was modified to remove the chainIdSchema validation dependency. The chainId query parameter is now optional and coerced to a number, with a conditional transform that automatically defaults it to baseSepolia.id or base.id based on testnet conditions when the type is absent.

Changes

Cohort / File(s) Summary
Query Schema Update
src/lib/schema/transfersQuerySchema.ts
Removed chainIdSchema dependency; made chainId optional with z.coerce.number(). Added conditional transform that defaults chainId to baseSepolia.id when IS_TESTNET is true and type is absent, otherwise defaults to base.id. Updated TransfersQueryParams type to reflect number | undefined for chainId.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 No chain ID bound so tight,
Optional now, coerced to light,
Transform defaults by testnet's choice—
Sepolia or Base, the schema's voice!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'allow all moments' is vague and does not clearly relate to the actual changes, which involve modifications to transfer query schema and chainId handling. Use a more descriptive title that explains the actual change, such as 'Update transfersQuerySchema to auto-fill chainId based on testnet status' or 'Make chainId optional with automatic testnet-based defaults'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch techengme/myc-4642-api-transfers-api-allow-all-moments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/lib/schema/transfersQuerySchema.ts`:
- Around line 26-37: Update the test expectations to match the new transform
behavior: when validateTransfersQuery(makeRequest()) is run in prod (IS_TESTNET
=== false) and no type is provided, assert that chainId is undefined (because
the transform's isProdTransfer branch leaves chainId unset), and add a separate
test case calling validateTransfersQuery(makeRequest({ type: 'some' })) that
asserts the default chainId is injected as base.id (or baseSepolia.id when
IS_TESTNET is true). Also add a short comment next to the isProdTransfer
calculation in the transform to explain the intent ("skip chainId default so all
chains are returned when no type filter is applied in prod") or consider
renaming isProdTransfer to something like noTypeInProd for clarity; reference
the transform block, IS_TESTNET, base.id/baseSepolia.id, and
validateTransfersQuery/makeRequest to locate the changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 45f26d25-90a5-4880-b449-559c768a2485

📥 Commits

Reviewing files that changed from the base of the PR and between 5addec6 and bbddf41.

📒 Files selected for processing (1)
  • src/lib/schema/transfersQuerySchema.ts

Comment on lines +26 to 37
.transform((data) => {
const isProdTransfer = !data.type && !IS_TESTNET;

if (isProdTransfer || data.chainId) {
return data;
}

return {
...data,
chainId: IS_TESTNET ? baseSepolia.id : base.id,
};
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Existing test for default chainId will break in prod env.

The new branch where !data.type && !IS_TESTNET (i.e., production + no type filter) intentionally leaves chainId undefined to "allow all moments" across chains. However, src/lib/transfers/__tests__/validateTransfersQuery.test.ts has:

it('defaults chainId to the env chain id', () => {
  const result = validateTransfersQuery(makeRequest());
  expect(typeof (result as any).chainId).toBe('number');
});

When VERCEL_ENV is neither preview nor development in CI, IS_TESTNET is false, so isProdTransfer is true and chainId remains undefined — causing this assertion to fail (typeof undefined === 'undefined'). Please update the test to reflect the new intent (e.g., assert chainId is undefined when no type is provided in prod, and add a separate case with type set to verify the default still injects base.id).

Also, isProdTransfer is a slightly misleading name — it's really "prod env AND no type filter". A brief comment explaining the intent ("skip chainId default so all chains are returned when no type filter is applied in prod") would help future readers.

💡 Suggested clarification
   .transform((data) => {
-    const isProdTransfer = !data.type && !IS_TESTNET;
-
-    if (isProdTransfer || data.chainId) {
+    // In prod, when no `type` filter is supplied, leave `chainId` undefined so
+    // transfers across all chains are returned. Otherwise, default to the env chain.
+    const skipChainIdDefault = !data.type && !IS_TESTNET;
+
+    if (skipChainIdDefault || data.chainId) {
       return data;
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.transform((data) => {
const isProdTransfer = !data.type && !IS_TESTNET;
if (isProdTransfer || data.chainId) {
return data;
}
return {
...data,
chainId: IS_TESTNET ? baseSepolia.id : base.id,
};
});
.transform((data) => {
// In prod, when no `type` filter is supplied, leave `chainId` undefined so
// transfers across all chains are returned. Otherwise, default to the env chain.
const skipChainIdDefault = !data.type && !IS_TESTNET;
if (skipChainIdDefault || data.chainId) {
return data;
}
return {
...data,
chainId: IS_TESTNET ? baseSepolia.id : base.id,
};
});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/schema/transfersQuerySchema.ts` around lines 26 - 37, Update the test
expectations to match the new transform behavior: when
validateTransfersQuery(makeRequest()) is run in prod (IS_TESTNET === false) and
no type is provided, assert that chainId is undefined (because the transform's
isProdTransfer branch leaves chainId unset), and add a separate test case
calling validateTransfersQuery(makeRequest({ type: 'some' })) that asserts the
default chainId is injected as base.id (or baseSepolia.id when IS_TESTNET is
true). Also add a short comment next to the isProdTransfer calculation in the
transform to explain the intent ("skip chainId default so all chains are
returned when no type filter is applied in prod") or consider renaming
isProdTransfer to something like noTypeInProd for clarity; reference the
transform block, IS_TESTNET, base.id/baseSepolia.id, and
validateTransfersQuery/makeRequest to locate the changes.

@techeng322 techeng322 merged commit 7ff5f21 into main Apr 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant