Skip to main content

Fill orders

This page demonstrates how an order can be filled. For fulfillment to occur, the user must have sufficient funds to cover the asking price of the order.


💡Listing vs Order

Immutable provides two distinct types of orders:

  1. Listings: These are orders initiated by an NFT owner who intends to sell their asset on a marketplace. Listings are considered sell orders.
  2. Bids: Representing a prospective buyer's intention to acquire an asset, bids allow users to express their interest in purchasing a specific asset. Users can place a bid on the order book, anticipating a match with a seller. Bids are considered buy orders.
It is important to note that while bids are not currently available on the zkEVM platform. However, their integration is a key part of Immutable's future development roadmap.

Get, sign and send transactions for fulfillment

This call returns actions that are required to fulfill an order. For fulfillment all actions are transaction actions and include a type and builder method that can be used to generate the raw transaction for submission. The purpose of these transactions are as follows:

  • APPROVAL - An approval transaction is required to be submitted before the fulfillment transaction if spending an ERC20 token and the seaport contract does not yet have the required allowance.
  • FULFILL_ORDER - The fulfillment transaction to be submitted to fulfill the order.

The taker below is any ethers compatible Signer or Wallet instance for the user creating the listing.

When a marketplace submits a fulfill order request, they could include a takerFees field as demonstrated in the code block below. This fee should be represented as the net amount that the marketplace wishes to receive for the services provided, and it should be quoted in the same ERC20 (or native) token in which the order is listed.

The fulfillOrder call also returns the expiry for the transactions (if an user submits a transaction after the expiration it will fail on chain) and the order entity with confirmed fee information.

💡Fees
Read more about fees here
💡Approval
If the taker has purchased NFTs in the currency before, or if the listing is in the native token, no approval will be required and there will be only one fulfillment transaction in the list of actions.
note

Please be advised that all fees and quantities within our system are denoted in the smallest unit of the respective currency, and decimal representations are not supported.

For instance, IMX, which has 18 decimal places, will have a fee of 0.000000000000000001 IMX represented as "1".

Similarly, 1 IMX is represented as "1000000000000000000" in our system.

Select the tabs below to learn about filling ERC721 and ERC1155 listings:

Fill ERC721 ListingView on GitHub
// Fulfill ERC721 listing
const fulfillERC721Listing = async (listingID: string) => {
const { actions } = await orderbookSDK.fulfillOrder(
listingID,
accountsState[0],
takerEcosystemFeeRecipient != "" ? [{
recipientAddress: takerEcosystemFeeRecipient, // Replace address with your own marketplace address
amount: takerEcosystemFeeAmount, // Insert taker ecosystem/marketplace fee here
}] : [],
);

for (const action of actions) {
if (action.type === orderbook.ActionType.TRANSACTION) {
const builtTx = await action.buildTransaction();
await (await signer.sendTransaction(builtTx)).wait(1);
}
}
};

The fulfillment transaction is now processed. You can poll Get orders for the off-chain representation of the order.

The order will asynchronously transition to FILLED once on-chain events have been registered by Immutable services.

As shown below, the fill_status field in the response of the Get orders endpoint will have the numerator and denominator values equal to 1 to indicate that the order has been fully filled.

{
"fill_status":{
"numerator": "1",
"denominator": "1"
}
note

For further details on order fill status, see the following product guide