Skip to content

feat: introduce marketplace api fetcher and fallback mechanism#411

Open
juanmahidalgo wants to merge 3 commits intomainfrom
feat/marketplace-api
Open

feat: introduce marketplace api fetcher and fallback mechanism#411
juanmahidalgo wants to merge 3 commits intomainfrom
feat/marketplace-api

Conversation

@juanmahidalgo
Copy link
Contributor

Marketplace API Integration

Key Changes

Architecture

  • Maintained existing interfaces: wearablesFetcher, emotesFetcher, and namesFetcher remain unchanged
  • Internal fallback implementation: Components now use marketplace API as primary source with TheGraph as fallback
  • Zero breaking changes: All existing handlers and components work without modification

New Components

  • MarketplaceApiFetcher: Primary data source for user assets
  • fetchAllWearablesWithFallback(): Marketplace API → TheGraph fallback for wearables
  • fetchAllEmotesWithFallback(): Marketplace API → TheGraph fallback for emotes
  • fetchAllNamesWithFallback(): Marketplace API → TheGraph fallback for names

Benefits

  • Improved reliability: Automatic fallback if marketplace API is unavailable
  • Better performance: Marketplace API provides faster response times
  • Maintainable: Clean separation of concerns with unchanged public interfaces
  • Backward compatible: Existing code continues to work without changes

Testing

  • All existing tests pass without modification
  • New fallback behavior covered with comprehensive test cases
  • Integration tests verify end-to-end functionality
  • Refactored test files follow DCL testing standards

Migration Impact

  • No API changes: External consumers unaffected

@juanmahidalgo juanmahidalgo requested a review from aleortega July 9, 2025 09:02
@coveralls
Copy link

coveralls commented Jul 9, 2025

Coverage Status

coverage: 82.307% (+0.7%) from 81.572%
when pulling 0180abb on feat/marketplace-api
into 3a57288 on main.

Copy link
Member

@aleortega aleortega left a comment

Choose a reason for hiding this comment

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

LGTM!

getOwnedNamesOnly(address: string, first?: number, skip?: number): Promise<{ data: string[]; total: number }>
}

export interface MarketplaceApiResponse<T> {
Copy link
Member

Choose a reason for hiding this comment

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

NIT:

Suggested change
export interface MarketplaceApiResponse<T> {
export type MarketplaceApiResponse<T> {

const result: MarketplaceApiResponse<T> = await response.json()

if (!result.ok) {
throw new Error(result.message || 'API request failed')
Copy link
Member

Choose a reason for hiding this comment

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

NIT:

Suggested change
throw new Error(result.message || 'API request failed')
throw new Error(result.message || 'Marketplace API request failed')

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.

3 participants