Skip to content

Conversation

@tpetrychyn
Copy link

@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
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