Calculating the Sale Price

The amount that is returned from the Link SDK's client.getOrders() method or the /v1/orders api is fee-inclusive.

This means the royalty-fee and maker-marketplace-fee is included within this amount. To show the full amount including the taker-marketplace and protocol fee, the marketplace has to add their cut (see charging fees guide) and a 2% protocol fee. We highly recommend using the link client method calculateTotalAmountWithTakerFee, which will do this for you.

Note: Maker and taker marketplace fees have yet to be implemented. Support will be coming shortly.

{
  "result": [
    {
      "order_id": 488,
      "status": "active",
      "user": "",
      "sell": {
        "type": "ERC721",
        "data": {
          "id": "",
          "token_address": "",
          "quantity": "1",
          "properties": {
            "name": "",
            "image_url": "",
            "collection": {
              "name": "Gods Unchained",
              "icon_url": null
            }
          }
        }
      },
      "buy": {
        "type": "ETH",
        "data": {
          "decimals": 18,
          "quantity": "1000000000000000"
        }
      },
      "fees": [
        {
          "type": "royalty",
          "address": "",
          "amount": "200000000000000",
          "token": {
            "type": "ETH/ERC20",
            "data": {
              "decimals": 18,
              "contract_address": ""
            }
          }
        }
      ],
      "amount_sold": null,
      "expiration_timestamp": "2120-08-25T04:00:00Z",
      "timestamp": "2021-08-25T04:33:19.85441Z",
      "updated_timestamp": "2021-08-25T04:33:19.85441Z"
    }
  ],
  "cursor": "...",
  "remaining": 0
}

Note: values are only used for indicating format

Fee Breakdown

To display the fee breakdown, you must either upgrade to the latest version of the Link SDK that is greater than 1.1.0, which supports fees or specify ?fees=true to the /v1/orders endpoint.

Fee Exclusive Amount

In order to get the fee-exclusive amount, subtract the fees from the buy.data.quantity manually or use the helper method client.getFeeExclusiveAmount(order: Order).

Using Helper Methods

The helper methods in the @imtbl/imx-sdk library will make the calculation process much simpler. See the examples below.

// These methods will be coming soon.
const exclusivePrice = getFeeExclusiveAmount(order: Order)

// order - inclusive of (royalty / maker) fees
// order.fees + takerFee + protocolFee = total price
const total = calculateTotalAmountWithTakerFee(
  order: Order, 
  takerFees: [
    {
      recipient: ``,
      percentage: 2.5, // 2.50%
    }  
  ]
)

Note: values are only used for indicating format
Note: methods above are currently not implemented, but will be coming soon.


Did this page help you?