Skip to content

🔧 server: add base art - #1111

Merged
cruzdanilo merged 1 commit into
mainfrom
nicolas
Jun 24, 2026
Merged

🔧 server: add base art#1111
cruzdanilo merged 1 commit into
mainfrom
nicolas

Conversation

@nfmelendez

@nfmelendez nfmelendez commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Card issuance now selects the correct product based on the network being used, including support for Base cards.
    • Card responses now include the issued product type, making the result clearer for end-users.
  • Bug Fixes

    • Fixed card creation so the right card style is chosen for different network and credential combinations.
    • Updated card artwork selection to match the issued product.

@nfmelendez
nfmelendez requested a review from cruzdanilo as a code owner June 24, 2026 18:07
@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 23ba566

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@exactly/server Patch

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

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Introduces a new BASE_PRODUCT_ID constant ("408") in common/panda.ts, extends the panda utility's createCard function and CreateCardRequest schema to accept it, adds chain-based product selection logic in the card creation API endpoint (chain.id and credential.source determine whether BASE_PRODUCT_ID or SIGNATURE_PRODUCT_ID is issued), and adds test coverage for the new selection behavior.

Changes

Base chain card product support

Layer / File(s) Summary
BASE_PRODUCT_ID constant and panda utility support
common/panda.ts, server/utils/panda.ts
Exports BASE_PRODUCT_ID = "408" from common/panda.ts. In server/utils/panda.ts, imports it, expands createCard's productId parameter type to include it, adds a virtualCardArt map entry, and extends the CreateCardRequest schema picklist.
Card API schema and product selection logic
server/api/card.ts
Imports base chain and BASE_PRODUCT_ID. Extends CardResponse and CreatedCardResponse schemas. Adds logic computing productId from chain.id and credential.source (base with a source override → SIGNATURE_PRODUCT_ID; base without → BASE_PRODUCT_ID; other chains → SIGNATURE_PRODUCT_ID). Threads computed productId into createCard, row insertion, analytics emission, and the 200 response.
Product-selection tests and changeset
server/test/api/card.test.ts, .changeset/swift-melons-collab.md
Updates test imports for base/optimism chains and BASE_PRODUCT_ID/SIGNATURE_PRODUCT_ID. Adds describe("product selection by chain") seeding credentials per chain, resetting chain.id after each test, and asserting panda.createCard arguments and persisted cards.productId for all three scenarios. Adds patch changeset for @exactly/server.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant CardAPI as card.ts (POST /)
    participant PandaUtil as server/utils/panda.ts
    participant PandaAPI as Panda External API
    participant DB as cards table

    Client->>CardAPI: POST /card (chain.id, credential.source)
    CardAPI->>CardAPI: compute productId<br/>(chain.id === base.id && source → SIGNATURE)<br/>(chain.id === base.id → BASE)<br/>(other → SIGNATURE)
    CardAPI->>PandaUtil: createCard(pandaId, productId)
    PandaUtil->>PandaUtil: look up virtualCardArt[productId]
    PandaUtil->>PandaAPI: POST create card with productId + artId
    PandaAPI-->>PandaUtil: cardId
    PandaUtil-->>CardAPI: cardId
    CardAPI->>DB: INSERT cards (productId, ...)
    CardAPI->>CardAPI: emit CardIssued(productId)
    CardAPI-->>Client: 200 { productId, ... }
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • exactly/exa#948: Modifies the same server/api/card.ts card creation flow and server/utils/panda.ts around product ID handling.
  • exactly/exa#1048: Introduces chain-based virtualCardArt selection and productId constraints in the same card issuance files that this PR further extends with BASE_PRODUCT_ID.
  • exactly/exa#1082: Updates server/api/card.ts POST card creation flow and its server/test/api/card.test.ts coverage around panda.createCard invocation and persistence.

Suggested reviewers

  • cruzdanilo
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and relevant, summarizing the main server-side addition of base art support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nicolas
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch nicolas

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for a new Base product card (product ID "408") alongside the existing Platinum and Signature cards. The card creation logic is updated to dynamically select the product ID based on the blockchain network, defaulting to the Base card on the Base chain (unless an override source is matched) and the Signature card on other chains. Corresponding updates are made to the schemas, utility functions, and test suite. Feedback highlights a critical bug where users upgrading from a Platinum card on the Base chain would incorrectly receive a Base card instead of a Signature card.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread server/api/card.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: caac351b-773a-43d1-8eee-fc88aacf378b

📥 Commits

Reviewing files that changed from the base of the PR and between 149d39f and 23ba566.

📒 Files selected for processing (5)
  • .changeset/swift-melons-collab.md
  • common/panda.ts
  • server/api/card.ts
  • server/test/api/card.test.ts
  • server/utils/panda.ts

Comment thread server/api/card.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23ba566d6a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread server/api/card.ts
Comment thread server/api/card.ts
Comment thread server/api/card.ts
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.99%. Comparing base (149d39f) to head (23ba566).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1111      +/-   ##
==========================================
- Coverage   76.02%   75.99%   -0.03%     
==========================================
  Files         245      245              
  Lines       12044    12010      -34     
  Branches     4284     4299      +15     
==========================================
- Hits         9156     9127      -29     
+ Misses       2572     2570       -2     
+ Partials      316      313       -3     
Flag Coverage Δ
e2e 75.76% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cruzdanilo
cruzdanilo merged commit 23ba566 into main Jun 24, 2026
12 of 14 checks passed
@cruzdanilo
cruzdanilo deleted the nicolas branch June 24, 2026 18:46
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.

2 participants