opensea-js icon indicating copy to clipboard operation
opensea-js copied to clipboard

getOrders returns []

Open scxr opened this issue 3 years ago • 4 comments

Whenever I use seaport.api.getOrders({...}) it returns [] however using the v1 api endpoint it returns valid orders

Code for opensea:

async function main() {
    // create fresh wallet
    let [privKey, pubKey] = createNewWallet()
    const provider = new WalletProvider({
        privateKeys : [privKey],
        providerOrUrl: infuraUrl,
        addressIndex: 0
    })


    // initialise seaport with our hdwallet 
    const seaport = new opensea.OpenSeaPort(provider, {
        networkName: opensea.Network.Main,
        apiKey: "redacted"
    })
    //
    const {orders, count} = await seaport.api.getOrders({
        assetContractAddress: "0x231d3559aa848bf10366fb9868590f01d34bf240",
        tokenIds: ["1743"],
        side: "bid",
    })
    console.log(orders, count)

Response: [] undefined

Code using v1

import requests
from pprint import pprint
import json
url = "https://api.opensea.io/api/v1/asset/0x231d3559aa848bf10366fb9868590f01d34bf240/1743/offers"

headers = {
    "accept": "application/json",
    "X-API-KEY": "redacted"
}

response = requests.get(url, headers=headers)
with open("offers.json", "w") as f:
    json.dump(response.json(), f, indent=4)
print(([int(i["protocol_data"]["parameters"]["offer"][0]["endAmount"]) / 10 ** 18 for i in response.json()["seaport_offers"]]))

Response: [0.7019, 0.80001, 0.52, 0.657, 0.8, 0.625, 0.0778, 0.07777, 0.7952, 0.61, 0.6, 0.75, 0.79, 0.1, 0.646, 0.69, 0.7171, 0.795, 0.75, 0.699, 0.4655875, 0.688358, 0.04, 0.7366, 0.01]

I have tried this with many different assets and all the same results, using the docs page also returns []

scxr avatar Dec 17 '22 22:12 scxr

Running into a similar issue. Noticing that collection offers are showing on opensea but don’t show when I query them use the seaport API. For example 0xb88749711ddac8ace7fe858e1f6ae6648394926a has several collection offers showing on opensea:

Screen-Shot-2023-02-16-at-12 16 58-PM

But when I query the opensea api for bid orders, no orders are returned: Screen-Shot-2023-02-16-at-12 18 57-PM

itsdiay avatar Feb 16 '23 20:02 itsdiay

@deiay the workaround i had for this was to use v1 endpoint, i tried everything with the v2 and it just wouldnt work sadly, hopefully theres a better fix soon

scxr avatar Feb 17 '23 23:02 scxr

@scxr I see. Which endpoint did you use to fetch offers? The only one I see that related is the retrieve asset events endpoint. But this one returns offers that are no longer active and I just want active offers

itsdiay avatar Feb 21 '23 20:02 itsdiay

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

github-actions[bot] avatar May 09 '23 00:05 github-actions[bot]