Skip to content

getOrderByHash handle os2 order response#1839

Merged
ryanio merged 3 commits intomainfrom
tpetrychyn/getOrderByHash-fix
Dec 9, 2025
Merged

getOrderByHash handle os2 order response#1839
ryanio merged 3 commits intomainfrom
tpetrychyn/getOrderByHash-fix

Conversation

@tpetrychyn
Copy link
Contributor

@tpetrychyn tpetrychyn commented Dec 7, 2025

Motivation

npx ts-node -e "
  const { OpenSeaSDK } = require('./src/sdk');
  const { JsonRpcProvider } = require('ethers');

  (async () => {
    const sdk = new OpenSeaSDK(new JsonRpcProvider('https://cloudflare-eth.com'), { chain: 'ethereum', apiKey: process.env.OPENSEA_API_KEY });
    const order = await sdk.api.getOrderByHash('0x143be64aaf5d170c61e56ceb37dff0f8494e2630a7eae3eb24c8edbef09af9d5', '0x0000000000000068f116a894984e2db1123eb395');
    console.log(JSON.stringify(order, null, 2));
  })();
  "
/app/node_modules/opensea-js/src/utils/converters.ts:97
    address: account.address,
                     ^

TypeError: Cannot read properties of undefined (reading 'address')
    at accountFromJSON (/app/node_modules/opensea-js/src/utils/converters.ts:97:22)
    at deserializeOrder (/app/node_modules/opensea-js/src/orders/utils.ts:221:27)
    at OrdersAPI.getOrderByHash (/app/node_modules/opensea-js/src/api/orders.ts:84:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)

Solution

Update the return type of getOrderByHash to a new type of type GetOrderByHashResponse = Offer | Listing;

@tpetrychyn tpetrychyn requested a review from ryanio December 7, 2025 04:40
@tpetrychyn tpetrychyn force-pushed the tpetrychyn/getOrderByHash-fix branch from 56c35c3 to 66ef830 Compare December 8, 2025 03:17
@ryanio ryanio merged commit 7cdfb9e into main Dec 9, 2025
13 checks passed
@ryanio ryanio deleted the tpetrychyn/getOrderByHash-fix branch December 9, 2025 19:20
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