getOrders method has missing parameters in the endpoint
Update
Converting the params to camelCase and use the tokenIds param instead of the tokenId solved my issue.
const order = await openSea.api.getOrder({
side: 'ask',
protocol: 'seaport',
assetContractAddress: contractAddress,
tokenIds: [tokenId]
})
Description
When we use the getOrder method
await openSeaSDK.api.getOrder({
side: 'ask',
protocol: 'seaport',
asset_contract_address: 'abc',
token_id: 123
})
We are making a http request to this endpoint https://api.opensea.io/v2/orders/ethereum/seaport/listings?limit=1&order_by=created_date&order_direction=desc
but it should be this: https://api.opensea.io/v2/orders/ethereum/seaport/listings?limit=1&order_by=created_date&order_direction=desc&asset_contract_address=abc&token_ids=123
asset_contract_address and token_ids parameters are missing and we need to add them to the endpoint.
Temp Solution
A temporary solution to complete the purchase is to obtain the order directly from the api and then use the deserializeOrder function to convert the response to camel case
eg:
import { deserializeOrder } from 'opensea-js/lib/orders/utils'
const listings = await fetcher(
`https://api.opensea.io/v2/orders/ethereum/seaport/listings?limit=1&order_by=created_date&order_direction=desc&asset_contract_address=${contractAddress}&token_ids=${tokenId}`,
{
method: 'GET',
headers: {
Accept: 'application/json',
'X-API-KEY': 'secret'
}
}
)
const order = deserializeOrder(listings?.orders?.[0])
const accountAddress = await getMetaMaskAddress()
const fulfillOrder = await openSeaSDK.fulfillOrder({
order,
accountAddress
})
Try use camelCase params with assetContractAddress and tokenIds params goodluck!
But i run into another issues
how to use this PARAM to get over two ids? can you tell me?
tokenIds:idsArr but not work