Skip to content

feat(ramps-controller): add unified getOrder to RampsService#7934

Draft
amitabh94 wants to merge 3 commits intomainfrom
feat/ramps-unified-getorder
Draft

feat(ramps-controller): add unified getOrder to RampsService#7934
amitabh94 wants to merge 3 commits intomainfrom
feat/ramps-unified-getorder

Conversation

@amitabh94
Copy link
Contributor

Explanation

Add a getOrder method to RampsService that calls the V2 unified order endpoint (GET /v2/providers/:providerCode/orders/:orderCode). This endpoint returns a normalized RampsOrder (DepositOrder shape) for all provider types, enabling mobile to use a single order processor instead of separate aggregator and deposit processors.

This is the core-side prerequisite for unifying order processing in metamask-mobile and eventually removing both @consensys/on-ramp-sdk and @consensys/native-ramps-sdk for order polling.

Changes

  • RampsService.ts: Add RampsOrder type and related types (RampsOrderStatus, RampsOrderNetwork, RampsOrderCryptoCurrency, RampsOrderPaymentMethod). Add getOrder(providerCode, orderCode, wallet) method.
  • RampsService-method-action-types.ts: Add RampsServiceGetOrderAction type.
  • RampsController.ts: Add getOrder wrapper method. Wire RampsService:getOrder into allowed actions.
  • index.ts: Export all new types.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared a draft changelog entry if needed

Made with Cursor

amitabh94 and others added 3 commits February 13, 2026 11:24
Add a getOrder method to RampsService that calls the V2 unified order
endpoint (GET /v2/providers/:providerCode/orders/:orderCode). This
endpoint returns a normalized RampsOrder (DepositOrder shape) for all
provider types, enabling mobile to use a single order processor instead
of separate aggregator and deposit processors.

Changes:
- Add RampsOrder type and related types (RampsOrderStatus, etc.)
- Add getOrder method to RampsService
- Add RampsServiceGetOrderAction type
- Wire getOrder into RampsController as a passthrough method
- Export new types from index.ts

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add getOrderFromCallback method to extract orders from provider callback URLs
  - Sends callback URL to V2 backend for provider-specific parsing
  - Backend extracts order ID using provider logic
  - Returns full RampsOrder (same pattern as aggregator SDK)
- Rename getWidgetUrl to getBuyWidget to return full BuyWidget object
  - Returns url, browser type, and orderId (for custom order tracking)
  - Mobile needs orderId for pre-order tracking like aggregator flow
- Wire new action through messenger and export types

This enables the V2 unified checkout to handle provider callbacks the same way
the aggregator SDK does, with server-side URL parsing instead of client-side guessing.
The V2 API embeds the widget information directly in quote responses (url,
browser type, orderId) instead of requiring a separate getBuyWidgetUrl call.
Add buyWidget field to Quote type to match the actual API response.
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