Skip to content

fix(handle): missing maker/taker fee arrays in order deserialization#1952

Merged
ryanio merged 1 commit intoProjectOpenSea:mainfrom
jrootcache:fix/deserialize-order-missing-fees
Mar 23, 2026
Merged

fix(handle): missing maker/taker fee arrays in order deserialization#1952
ryanio merged 1 commit intoProjectOpenSea:mainfrom
jrootcache:fix/deserialize-order-missing-fees

Conversation

@jrootcache
Copy link
Contributor

Summary

Fixes a runtime edge case in order deserialization when fee arrays are missing from API responses.

Problem

deserializeOrder assumed maker_fees and taker_fees always exist and called .map() directly.
If either field is missing, SDK throws at runtime.

Fix

  • Added null-safe fallbacks:
    • makerFees: (order.maker_fees ?? []).map(...)
    • takerFees: (order.taker_fees ?? []).map(...)

Tests

Added a unit test in test/orders/utils.spec.ts to verify missing fee arrays deserialize to empty arrays instead of throwing.

Copy link
Collaborator

@ryanio ryanio left a comment

Choose a reason for hiding this comment

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

LGTM. The ?? [] fallback for maker_fees and taker_fees is a solid defensive fix — the API response could omit these even though the type declares them as required. Test coverage is clean.

@ryanio ryanio merged commit 3e57246 into ProjectOpenSea:main Mar 23, 2026
2 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.

2 participants