# Cancel Order

## Cancel Given Order

### Example JS Code

```js
await niftyConnectExchangeInst.cancelOrder_(
    [   // address[9] addrs,
        NiftyConnectExchange.address,                       // exchange address
        nftOwner,                                           // maker address
        "0x0000000000000000000000000000000000000000",       // taker address
        makerRelayerFeeRecipient,                           // maker relayer fee recipient
        TestERC721.address,                                 // nft contract address
        "0x0000000000000000000000000000000000000000",       // staticTarget
        TestERC20.address,                                  // paymentToken
        nftOwner,                                           // from
        "0x0000000000000000000000000000000000000000"        // to
    ],
    [   // uint[9] uints,
        exchangePrice,          // uint basePrice
        web3.utils.toBN(0),     // uint extra
        listtime,               // uint listingTime
        expireTime,             // uint expirationTime
        web3.utils.toBN(salt),  // uint salt
        ERC721TransferSelector, // uint merkleValidatorSelector
        tokenId,                // uint tokenId
        ERC721_AMOUNT,          // uint amount
        0,                      // uint totalLeaf
    ],
    1,                      // side (0 buy,1 sell)
    0,                      // Kind of sale (0 fixPrice buy/sell, 1 Auction) 
    sellReplacementPattern, // replacementPattern
    [],                     // staticExtradata
    [
        "0x0000000000000000000000000000000000000000000000000000000000000000", // merkle root hash, for trait-based order
        "0x0000000000000000000000000000000000000000000000000000000000000000"  // ipfs hash which contain the metadata of merkle proof, for trait-based order
    ],                      // merkleData
    {from: nftOwner}
);
```

### Parameter Details

| name               | type        | description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| addrs              | address\[9] | <p>addrs\[0]: Exchange address<br>addrs\[1]: Order maker address<br>addrs\[2]: Order taker address<br>addrs\[3]: Maker relayer fee recipient<br>addrs\[4]: NFT contract address<br>addrs\[5]: StaticTarget address<br>addrs\[6]: Payment token<br>addrs\[7]: NFT owner address<br>addrs\[8]: NFT recipient address</p>                                                                                                                                                                                                                      |
| uints              | uint\[9]    | <p>uints\[0]: BasePrice<br>uints\[1]: EndPrice in the Dutch Auction<br>uints\[2]: Order listing time<br>uints\[3]: Order expire time<br>uints\[4]: Salt, random number<br>uints\[5]: NFT Transfer selector, refer to <a href="/pages/BNGiHMgGcJoRCLvDeiEj">nft transfer selector</a><br>uints\[6]: NFT asset token id<br>uints\[7]: For ERC721, the amount must be 1. For ERC1155, its value should be no more than the nftOwner balance<br>uints\[8]: The nft array length, only useful in trait-based order, for others leave it to 0</p> |
| side               | uint8       | 0 buy, 1 sell                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| kind               | uint8       | Kind of sale (0 fixPrice buy/sell, 1 Auction)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| replacementPattern | bytes       | Refer to [replacement pattern guide](/niftyconnect-protocol-document/docs/replacement-pattern-guide.md)                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| staticExtradata    | bytes       | Calldata of staticTarget contract                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| merkleData         | bytes32\[2] | <p>merkleData\[0]: merkle root hash, only used in trait-based order, leave it to zero for other scenarios<br>merkleData\[1]: ipfs hash which contain the metadata of merkle proof. Only used in trait-based order, leave it to empty for other scenarios<br>Refer to <a href="/pages/vD2KrsLOyJn1tLBDvJIt">merkle proof guide</a></p>                                                                                                                                                                                                       |

## Cancel All History Orders

Users can call `incrementNonce` to invalidate all history orders.

```js
await niftyConnectExchangeInst.incrementNonce({from: userAccount})
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.niftyconnect.org/niftyconnect-protocol-document/docs/cancel-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
