Skip to content

feat: include coinbase quote in cost breakdown#2352

Merged
broody merged 5 commits intomainfrom
include-coinbase-quote
Jan 27, 2026
Merged

feat: include coinbase quote in cost breakdown#2352
broody merged 5 commits intomainfrom
include-coinbase-quote

Conversation

@broody
Copy link
Contributor

@broody broody commented Jan 27, 2026

This PR enhances the transparency of Apple Pay purchases by fetching and displaying a detailed cost breakdown from the Coinbase Onramp API, including both provider-specific fees and cross-chain bridging fees.

Key Changes:

  • Enhanced useCoinbase Hook:

    • Implemented getQuote to fetch real-time pricing and fee data from the Coinbase Onramp API.
    • Added support for sandbox mode, automatically toggled based on the network (Mainnet vs. Testnet).
    • Exposed coinbaseQuote and isFetchingQuote state for consumption by UI components.
  • Updated OnchainPurchaseContext:

    • Integrated coinbaseQuote into the global on-chain purchase state.
    • Added an effect to automatically refresh quotes when Apple Pay is selected or the item quantity changes.
  • Improved Cost Transparency in UI:

    • OnchainCostBreakdown: Now displays the final total from Coinbase when Apple Pay is active, replacing the simple on-chain price with the actual amount charged.
    • OnchainFeesTooltip: Added a detailed fee schedule for Apple Pay, explicitly showing the "Coinbase Fee" and "Bridge Fee" (Layerswap) so users understand the full cost of the transaction.
  • Developer Experience & Build Stability:

    • Exported CoinbaseQuoteResult type for consistent usage across the monorepo.
    • Updated Storybook stories (onchain-cost.stories.tsx and wallet.stories.tsx) with mock context values to resolve build errors and ensure visual testing remains accurate.

Data Flow:

When a user selects Apple Pay, the system now automatically fetches a quote for the total purchase amount. This quote is then decomposed in the UI to show exactly how much goes towards the base price, how much is taken as a service fee by Coinbase, and how much is required for the cross-chain bridge to Starknet.

@vercel
Copy link

vercel bot commented Jan 27, 2026

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

Project Deployment Review Updated (UTC)
controller-example-next Ready Ready Preview Jan 27, 2026 8:51pm
keychain Ready Ready Preview Jan 27, 2026 8:51pm
keychain-storybook Ready Ready Preview Jan 27, 2026 8:51pm

Request Review

@claude
Copy link
Contributor

claude bot commented Jan 27, 2026

The type CoinbaseQuoteResult is missing from the exports. It's imported in onchain-tooltip.tsx and onchain-purchase.tsx as import type { CoinbaseQuoteResult } from "@/hooks/starterpack", but it's not re-exported from this barrel file. This will cause a TypeScript compilation error: "Module '@/hooks/starterpack' has no exported member 'CoinbaseQuoteResult'".

export { useCoinbase } from "./coinbase";
export type {
  CreateOrderInput,
  UseCoinbaseOptions,
  UseCoinbaseReturn,
  CoinbaseOrderResult,
  CoinbaseQuoteResult,
  CoinbaseTransactionResult,
} from "./coinbase";

@claude
Copy link
Contributor

claude bot commented Jan 27, 2026

Claude finished @broody's task —— View job


Documentation Analysis and Updates Complete ✅

I've successfully analyzed the merged PR changes and updated the documentation accordingly.

Completed Tasks:

  • Examine docs-repo directory structure
  • Analyze the changed files to understand new Coinbase quote functionality
  • Update coinbase-onramp.md to document new quote and cost breakdown features
  • Documentation updates applied locally

Analysis Summary:

The PR adds significant new Coinbase quote functionality:

  • New getQuote method in useCoinbase hook for fetching real-time pricing/fees
  • Enhanced cost breakdown UI showing separate Coinbase fees and bridge fees
  • Automatic quote fetching when Apple Pay is selected or quantity changes
  • Sandbox mode support automatically toggled based on network
  • New CoinbaseQuoteResult type exported for consistent usage

Documentation Updates Made:

Updated /docs-repo/src/pages/controller/coinbase-onramp.md with:

  1. Enhanced Hook Features section - Added documentation for the new getQuote functionality, cost transparency, and sandbox mode
  2. New "Enhanced Cost Transparency" section - Documents the real-time quote fetching and detailed fee breakdown features
  3. Updated User Experience Flow - Added quote fetching and cost display steps
  4. Enhanced Benefits section - Added transparency and cost clarity benefits
  5. Updated Testing section - Added quote testing and cost breakdown UI testing notes

Result:

The documentation now accurately reflects the new transparency features that allow users to see exactly what they'll pay, including separate Coinbase fees and cross-chain bridge fees. The changes are staged and ready for commit in the docs repository.

Note: The documentation updates require git user configuration to be committed. The files have been successfully modified and staged, but will need to be committed by someone with appropriate git configuration access.


kronosapiens pushed a commit to cartridge-gg/docs that referenced this pull request Feb 3, 2026
Updates documentation to reflect changes made in:
    feat: include coinbase quote in cost breakdown

    Related controller PR: cartridge-gg/controller#2352

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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