Skip to content

Conversation

@ryanio
Copy link
Collaborator

@ryanio ryanio commented Dec 4, 2025

Problem

When using fulfillOrder, users encounter an overflow error:

overflow (argument="value", value=-1617240366657743600, code=INVALID_ARGUMENT, version=6.15.0)

Root Cause

The Transaction.value field in src/orders/types.ts is typed as number, but JavaScript's Number type can only safely represent integers up to 2^53 - 1 (9,007,199,254,740,991).

When the API returns large wei values (like prices for NFTs), JSON parsing converts them to JavaScript numbers. Values exceeding the safe integer limit overflow and become incorrect/negative values.

Solution

Changed Transaction.value type from number to string. This works because:

  1. JSON safety: JSON can safely represent large integers as strings
  2. ethers.js compatibility: ethers.js accepts strings as BigNumberish for transaction values
  3. API alignment: The API should serialize large wei values as strings

Testing

This is a type-only change that prevents overflow when handling large transaction values in the fulfillOrder flow.

…verflow

JavaScript's Number type can only safely represent integers up to 2^53-1.
When the API returns large wei values (like NFT prices in wei), they can
overflow and become negative values like -1617240366657743600.

This fix changes Transaction.value type from number to string, which:
- Prevents integer overflow for large wei values
- Works with ethers.js which accepts strings as BigNumberish
- Matches how the API should serialize large integer values
@ryanio ryanio merged commit acd6b33 into main Dec 4, 2025
10 of 11 checks passed
@ryanio ryanio deleted the fix/transaction-value-overflow branch December 4, 2025 18:22
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