The listAssets API doesn't produce expected results

Hey there!

I’ve been playing around with the listAssets API and noticed that the produced results are different from the ones I can see on immutascan.

Look at this example:

  1. I want to query all currently listed on-sale assets, similar to immutascan
  2. In order to achieve that I’m using the following query, note the sell_orders=true part. if I change it to buy_orders=true API returns internal_server_error

What I see in API response it way different from what I see on immutascan


in words: I expect to see Crimson Waste (664,341) asset in API, but instead there is Taiga Boreal (199,226) one.

what am I missing here?

1 Like

Hey Enigo,

If you’re still experiencing issues with this specific API, please submit a support ticket https://support.immutable.com/hc/en-us/requests/new. The team should be able to help clarify what is expected output.

1 Like

Hey hey,

The better API to use for this is the ‘get a list of orders’ API. The /orders endpoint will give you a list of assets that’re recently put on sale. https://api.x.immutable.com/v1/orders?order_by=updated_timestamp&direction=desc&buy_token_address=0x9e0d99b864e1ac12565125c5a82b59adea5a09cd

Immutascan only shows what’s traded(bought/sold)/transferred/deposited/minted/withdrew. I don’t think you can track the active/live orders. But if you want to get a list of trades, you can use the ‘get a list of trade’ endpoint to pull that information.

1 Like

Hey @Yaz

I’m pretty sure it can as I can see it here - it shows all the currently listed assets (there is even a Buy Now button). If immutascan can do it there must be an API for it - either not public or not documented?

The ‘get a list of orders’ API returns a view from Activity page here and that’s not what I need.

1 Like

Great catch. I wasn’t aware that people can buy NFTs on immutascan.

If I understand you correctly, you are trying to build a marketplace functionality with us, where traders/users can see all active orders and potentially buy the order live?

I just used the ‘get a list of orders’ endpoint and it matched what’s shown on immutascan for ILV land: https://api.x.immutable.com/v1/orders?status=active&sell_token_address=0x9e0d99b864e1ac12565125c5a82b59adea5a09cd

I am very sure that Immutascan is using the ‘orders’ endpoint to get a list of assets that are on sale (if you filter the status = active). The /orders end point shows who put their assets on sale, and the /trade endpoint shows who bought those active sell orders. The activity page shows more about the 'trade" activity.

1 Like

Actually, I’m thinking of building a bot to notify about potentially underpriced items :smiley:

status=active is what I was missing it seems, thanks for the help!

do you know why the price in the response is different compared to the price on immutascan?
e.g. Brightland Steppes (566,335) #79609 costs 7.9929 on immutascan but API returns

      "buy": {
        "type": "ETH",
        "data": {
          "token_address": "",
          "decimals": 18,
          "quantity": "7918200000000000000",
          "quantity_with_fees": "7918200000000000000"
        }

The difference is 0.747ETH, quite high

1 Like

Hey! Glad the status thing helped :slight_smile:

I couldn’t find the transaction for #79609 that costs 7.9929ETH. The only thing I found on Immutascan for this particular asset is: Immutascan - Immutable X Blockchain Explorer
It was traded for 3900 USDC.

You can find the 3900 USDC under quantities in this orders API: https://api.x.immutable.com/v1/orders?buy_token_id=79609&buy_token_address=0x9e0d99b864e1ac12565125c5a82b59adea5a09cd

It would help if you share a link of the immutascan transaction you are looking at and the API url.

1 Like

Long time no see :slight_smile:
Here comes another example - API returns 0.9975 ETH

{
  "order_id": 258922572,
  "status": "active",
  "user": "0x6769e890a47d26262378301e869afbd30b890f65",
  "sell": {
    "type": "ERC721",
    "data": {
      "token_id": "90297",
      "id": "0x7f1a1166667152ab896c06c05f18055e33f5e07f8e04782fe480a950167bf79e",
      "token_address": "0x9e0d99b864e1ac12565125c5a82b59adea5a09cd",
      "quantity": "1",
      "quantity_with_fees": "",
      "properties": {
        "name": "Halcyon Sea (579,500)",
        "image_url": "https://assets.illuvium-game.io/illuvidex/land/land-90297.svg",
        "collection": {
          "name": "Illuvium Land",
          "icon_url": "https://assets.illuvium-game.io/illuvidex/imx/land/icon.png"
        }
      }
    }
  },
  "buy": {
    "type": "ETH",
    "data": {
      "token_address": "",
      "decimals": 18,
      "quantity": "997500000000000000",
      "quantity_with_fees": "997500000000000000"
    }
  },
  "amount_sold": null,
  "expiration_timestamp": "2122-01-19T02:00:00Z",
  "timestamp": "2023-01-19T02:21:16.137358Z",
  "updated_timestamp": "2023-01-19T02:21:16.137358Z"
}

But on immutascan it has a price of 1.007 ETH
My assumption is that the quantity_with_fees is not returning a correct result - as the number is the same as quantity
Screenshot from 2023-01-19 10-41-27

1 Like

Hey Enigo, long time no see :smile:

I think the API is showing the right result for this particular order. I understand you are a bit confused, because quantity and quantity with fees represent different things in active vs filled orders.

If you scroll down all active orders on our platform, you’ll see quantity = quantity with fees. However if you filter for filled orders only, you will see quantity with fees != quantity anymore.

In active orders, quantity and quantity with fees both represents “sell price + already known fees (seller marketplace fee + royalty fee + protocol fee)”. In filled orders, quantity is the base price (what the seller would get) and quantity with fees = base price + all fees (royalty + protocol + seller marketplace + buyer marketplace).

In your example, since the order is still active, both quantity and quantity + fees are the same. It’s different to what’s shown on the marketplace because the price on the marketplace also includes buyer marketplace fee. On immutable x marketplace, the buyer marketplace fee = 1%. The way to calculate is probably not intuitive as you’ll need to calculate the base price from the quantity first:

  • Base price = 0.9975 (from API) / 1.06 (protocol fee 2% + royalty fee 3% + seller marketplace fee 1%) = 0.941037735849 ETH
  • Then use this base price to calculate price buyer needs to pay to get this item = base price * 1.07 (protocol fee + royalty fee + seller marketplace fee + buyer marketplace fee 1%) = 1.007 ETH
1 Like

I must say I find this API behaviour very inconsistent. It is the same endpoint /orders but it behaves differently based on the status query param. Plus it is not even documented in the specs.
And I do believe that the logic of the “final” price (aka quantity with fees) of the given asset should reside in your backend. Since all those fees and the way you apply them can change on your end it doesn’t make much sense to force this calculation on your API users.
Do you think it is realistic to expect this kinda API change from your side? :upside_down_face:

1 Like

I can submit a feature request. But this is a big ask that I am not sure if you’d see a change any time soon even if the product team accepted the feature request :sweat_smile:

Will submit a feature request nonetheless. Can I clarify with you what you meant by “Final price should reside in our backend”? Do you mean that we shouldn’t show the final price at all? and instead, the API should only show listing price?

1 Like

Thank you for that!
Since API is stable now I’d imagine that you would rather introduce a new field instead of changing the logic for the existing one, but that’s up to your product team ofc :slight_smile:

I said “the logic of the “final” price” calculation should reside in your backend, so basically this quote of yours

In your example, since the order is still active, both quantity and quantity + fees are the same. It’s different to what’s shown on the marketplace because the price on the marketplace also includes buyer marketplace fee. On immutable x marketplace, the buyer marketplace fee = 1%. The way to calculate is probably not intuitive as you’ll need to calculate the base price from the quantity first:

  • Base price = 0.9975 (from API) / 1.06 (protocol fee 2% + royalty fee 3% + seller marketplace fee 1%) = 0.941037735849 ETH
  • Then use this base price to calculate price buyer needs to pay to get this item = base price * 1.07 (protocol fee + royalty fee + seller marketplace fee + buyer marketplace fee 1%) = 1.007 ETH

As a user of your API I expect to it to return a price I see on immutascan, as it is what a potential buyer of the given asset would pay. Currently I cannot get this price at all and have to calculate it based on this very forum thread discussion :slight_smile:

1 Like

Gotcha. Will get this feature ask in our system :slight_smile:

Thanks for raising this with us!

1 Like