Marketplace
Cometh ConnectCometh MarketplaceCometh checkout
  • Demo
  • API reference doc
  • SDK reference doc
  • 🚀Quickstart
    • Getting started
    • Core concepts
    • API cheatsheet
    • Third party helpers
  • 🛠️Core features
    • Get collection data
    • Assets search engine
    • Creating an order
    • Searching orders
    • Filling an order
    • Cancelling an order
  • ⚗️Advanced features
    • Tracking indexing
    • Get asset transfers
    • Admin routes
    • Refreshing metadata
    • Webhooks
  • 📖Resources
    • Why Cometh Marketplace
    • Order flow
    • Preparing for transactions
    • Sponsoring transactions
Powered by GitBook
On this page
  1. Core features

Filling an order

Before a user can send a transaction to fill an order, they need to have proper tokens. This is explained in more detail in Preparing for transactions.

Before starting this tutorial, make sure you've installed Third party helpers.

To fill an opened order, you only need to pass the correct field you received from Searching ordersto send the transaction.

const orderFees = order.fees.map((fee) => {
    return {
      amount: fee.amount,
      recipient: fee.recipient,
      feeData: fee.feeData || '0x'
    }
})

const fillTx = await nftSwapSdk.fillSignedOrder({
    direction: order.direction,
    maker: order.maker,
    taker: order.taker,
    // Convert to seconds
    expiry: new Date(order.expiry).getTime() / 1000,
    nonce: order.nonce,
    erc20Token: order.erc20Token,
    erc20TokenAmount: order.erc20TokenAmount,
    fees: orderFees,
    erc721Token: MY_COLLECTION_ADDRESS,
    erc721TokenId: order.tokenId,
    erc721TokenProperties: [],
    signature: order.signature
})

Last updated 1 year ago

Ultimately, the NFT swap SDK calls either the or the function from 0x.

🛠️
sellERC721
buyERC721