Skip to content

Conversation

0xtygra
Copy link

@0xtygra 0xtygra commented Sep 25, 2025

Motivation

For a personal project I needed to generate the calldata for (but not actually fulfill) a listed NFT. The SDK has an internal api.ts that supports this but from my brief searching it looks like it isn't exposed.

Solution

image

I ended up forking the repo and using it locally. In doing so, i found that the JSDoc for api.getOrder and api.getOrders had an options.limit that was in fact omitted in the typescript. Additionally, passing an orderBy: "eth_price" to api.getOrder throws an error, so I also removed that as a configurable option.

A couple of other things i noticed:

  • a .env.example would be great, as well as updating the contributing.md to call out the need for a .env to run the tests. In addition, unless it's already done so, exposing the calldata generation functions from api.ts on the exported OpenSeaSDK object would be great!

serializeOrdersQueryOptions({
limit: 1,
orderBy,
orderBy: "created_date",
Copy link
Author

Choose a reason for hiding this comment

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

image

ran into this error when trying to pass "eth_price"

@ryanio
Copy link
Collaborator

ryanio commented Sep 30, 2025

here is what the docs say, maybe we should just update the typedoc to include this?

The order in which to sort the results. Default: created_date NOTE: If eth_price is used, asset_contract_address and token_id are required.
https://docs.opensea.io/reference/get_listings

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