# Create a p2p order

You can notice the difference between p2p and normal limit orders by looking at the path.

### **POST /nft/p2p/:chainId/**

#### **Examples**

{% tabs %}
{% tab title="curl" %}
The process of composing the order and the payload to POST to API endpoint is pretty much the [same as with usual non-p2p orders](/api/augustusrfq/api-references/nft/create-an-order.md).

The only differences are:

* slightly different route (`/nft/p2p/...` instead of `/nft/orders/...` )
* taker should contain [Augustus Swapper](/augustus-swapper/smart-contracts.md) address
* the intended order taker is [encoded in the nonceAndMeta](/api/augustusrfq/data-structure-in-our-centralized-system.md) field\`\`\`\`

```bash
curl -X POST \
  'https://api.paraswap.io/nft/p2p/137' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "nonceAndMeta": "1490585846052014974250870934243084527261268076495",
  "expiry": 1665643036,
  "makerAsset": "1697426235576502185006439320944601702126017005923",
  "takerAsset": "611382286831621467233887798921843936019654057231",
  "maker": "0x7BA594DF3161729BF2E68A9d0A11dceB57A2e306",
  "taker": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",
  "makerAmount": "1",
  "takerAmount": "8000000000000000000",
  "makerAssetId": "7772759950848685723459796247330971791008072228632493699501910275462086524929",
  "takerAssetId": "0",
  "signature": "0x292e484328f98ea5e59b0d57b8d0fc41ac67fc275146f43c0d005c1422d639014bd69dcd447eb583315dc578f7b087f0ad60711237b9fc4b518f22a0d09fc9341c"
}'
```

{% endtab %}

{% tab title="Typescript" %}

```typescript
/* eslint-disable @typescript-eslint/no-unused-vars */
import * as dotenv from 'dotenv';
import axios from 'axios';
import { ethers } from 'ethers';

import {
  constructPartialSDK,
  constructEthersContractCaller,
  constructAxiosFetcher,
  constructBuildNFTOrder,
  constructSignNFTOrder,
  constructPostNFTOrder,
  BuildNFTOrderInput,
  SignableNFTOrderData,
  NFTOrderToSend,
  AssetType,
} from '..';
dotenv.config();

const randomPK = ethers.Wallet.createRandom().privateKey;

const wallet = new ethers.Wallet(process.env.PK || randomPK);

const fetcher = constructAxiosFetcher(axios);

const provider = wallet.connect(ethers.getDefaultProvider(137));
const contractCaller = constructEthersContractCaller(
  {
    ethersProviderOrSigner: provider,
    EthersContract: ethers.Contract,
  },
  wallet.address
);

const paraSwapLimitOrderSDK = constructPartialSDK(
  {
    chainId: 137,
    fetcher,
    contractCaller,
  },
  constructBuildNFTOrder,
  constructSignNFTOrder,
  constructPostNFTOrder
);

const DAI = '0x6B175474E89094C44Da98b954EedeAC495271d0F';
const NFT = '0x2953399124f0cbb46d2cbacd8a89cf0599974963';
const NFT_ID =
  '7772759950848685723459796247330971791008072228632493699501910275462086524929';

const orderInput: BuildNFTOrderInput = {
  nonce: 1,
  expiry: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 7, // week from now, in sec
  makerAsset: NFT,
  makerAssetType: AssetType.ERC1155,
  makerAssetId: NFT_ID,
  takerAssetType: AssetType.ERC20,
  takerAsset: DAI,
  makerAmount: (1).toString(10),
  takerAmount: (8e18).toString(10),
  maker: wallet.address,
  taker: '0x05182E579FDfCf69E4390c3411D8FeA1fb6467cf',
};

async function run() {
  const signableOrderData: SignableNFTOrderData =
    await paraSwapLimitOrderSDK.buildNFTOrder(orderInput);

  const signature: string = await paraSwapLimitOrderSDK.signNFTOrder(
    signableOrderData
  );

  const orderToPostToApi: NFTOrderToSend = {
    ...signableOrderData.data,
    signature,
  };

  const newOrder = await paraSwapLimitOrderSDK.postNFTP2POrder(
    orderToPostToApi
  );
  console.log(newOrder);
}

run();

```

{% endtab %}
{% endtabs %}

#### Query parameters:

* `chainId:`network id (Ethereum Mainnet = 1)

#### Body parameters

```json
{
	"nonceAndMeta": "6696393496368457207383969069655254624825140823245405670718046208",
	"expiry": 1664716033,
	"makerAsset": "4094980474276800865989028098863468306593436022900",
	"makerAssetId": "1027",
	"takerAsset": "990092240248101882666250324982272499898038834061",
	"takerAssetId": "0",
	"maker": "0x05182E579FDfCf69E4390c3411D8FeA1fb6467cf",
	"taker": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",
	"makerAmount": "1",
	"takerAmount": "50",
	"signature": "0x762dd1eb9447d10a24adff2c16dd2a6a4f6abdeff2e51fc1df0428129e4b7c1a00100a35f936e591956a5c86d3d502ecb591134bc8c0f32f12fd7533c199975e1c"
}
```

* `nonceAndMeta`: needs to include the actual taker as described here:

{% content-ref url="/pages/7EU4hKrvjbDV4PuKGPpS" %}
[Data structure in our centralized system](/api/augustusrfq/data-structure-in-our-centralized-system.md)
{% endcontent-ref %}

* `makerAsset` and `takerAsset` needs to be encode as packed field containing address of an ERC20/721/1155 token that maker want to sell to the taker (between  `0-19 bits`). Token type encoded as show above on `20-21 bits`.

Example encoding in JavaScript:

```javascript
const ERC20 = 0;
const ERC721 = 2;
const ERC1155 = 1;

const encodeAddress = (address, assetType) => BigInt(address) | (BigInt(assetType) << BigInt(160));
encodedAddress = encodeAddress('0xcd494673999194365033d7a287af9f0a3b163874', ERC721);
```

#### Response&#x20;

Understand the response by checking our dedicated page:

{% content-ref url="/pages/7EU4hKrvjbDV4PuKGPpS" %}
[Data structure in our centralized system](/api/augustusrfq/data-structure-in-our-centralized-system.md)
{% endcontent-ref %}

```json
{
	"order": {
		"expiry": 1664717831,
		"createdAt": 1663853865,
		"transactionHash": null,
		"chainId": 137,
		"nonceAndMeta": "5849534550391847890058685755479665482115680361250527628888286063",
		"maker": "0x05182e579fdfcf69e4390c3411d8fea1fb6467cf",
		"taker": "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
		"takerFromMeta": "0x6dac5cac7bbcce4db3c1cc5c8fe39dcdde52a36f",
		"makerAsset": "0xcd494673999194365033d7a287af9f0a3b163874",
		"makerAssetId": "1027",
		"makerAssetType": 2,
		"takerAsset": "0xad6d458402f60fd3bd25163575031acdce07538d",
		"takerAssetId": "0",
		"takerAssetType": 0,
		"makerAmount": "1",
		"fillableBalance": "1",
		"takerAmount": "50",
		"signature": "0xdb265004d19c79b2284ae327c586725c7f3535eeb1693d166a727d62efd521304874b658d106ca552f09352effa34be72826e2abdf6c6b09591318199eeb16081b",
		"orderHash": "0x33c5ca652106ef8340673b01e2ab8a713837bf42c2b3bef67143b65f9b89934c",
		"permitMakerAsset": null,
		"type": "P2P",
		"state": "PENDING"
	}
}
```


---

# 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://developers.velora.xyz/api/augustusrfq/api-references/nft/create-a-p2p-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.
