# Fill a limit order

{% tabs %}
{% tab title="Typescript" %}
In order to fill an order, a [SwappableNFTOrder](https://github.com/paraswap/paraswap-sdk/blob/b56d23fab8bd9d849fef3a037839c005e5dde9ef/src/methods/swap/transaction.ts#L33-L38) data is required as an input.&#x20;

It can be [retrieved from API](/api/augustusrfq/api-references/nft/get-nft-orders-by-maker.md) web service or [composed by maker](/api/augustusrfq/api-references/nft/create-an-order.md).

**Parameters**

```typescript
const orderWithSignature: SwappableNFTOrder = {
  expiry: 1665645962,
  nonceAndMeta: '1490585846052014974250870934243084527261268076495',
  maker: '0x7ba594df3161729bf2e68a9d0a11dceb57a2e306',
  taker: '0xdef171fe48cf0115b1d80b88dc8eab59176fee57',
  makerAsset: '0x2953399124f0cbb46d2cbacd8a89cf0599974963',
  makerAssetId:
    '7772759950848685723459796247330971791008072228632493699501910275462086524929',
  makerAssetType: 1,
  takerAsset: '0x6b175474e89094c44da98b954eedeac495271d0f',
  takerAssetId: '0',
  takerAssetType: 0,
  makerAmount: '1',
  takerAmount: '8000000000000000000',
  signature:
    '0x9247734939b4354ce6f99178ad95cbc19635e2ba86395370e29a8ac6a95cf5054203df0ba607717af1541a30d9df00962f16ada5273ef39633f304cc88faac0d1c',
};
```

This data can then be supplemented by additional required params and sent to ParaSwap web API to generate [Augustus Swapper route](/augustus-swapper.md) for the fulfilment transaction:

```typescript
const txData = await sdk.buildLimitOrderTx(
  {
    srcDecimals: 18,
    userAddress: taker.address,
    orders: [orderWithSignature],
  })
```

The returned transaction params can be used to send a transaction.&#x20;

**Example**

```typescript
/* eslint-disable @typescript-eslint/no-unused-vars */
import * as dotenv from 'dotenv';
import axios from 'axios';
import { ethers } from 'ethers';
import BigNumber from 'bignumber.js';
import {
  constructPartialSDK,
  constructEthersContractCaller,
  constructAxiosFetcher,
  constructBuildNFTOrderTx,
  SwappableNFTOrder,
} from '..';

dotenv.config();

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

const taker = new ethers.Wallet(process.env.PK || pk).connect(
  ethers.getDefaultProvider(137)
);

const fetcher = constructAxiosFetcher(axios);

// provider must have write access to account
// this would usually be wallet provider (Metamask)
const provider = taker;
const contractCaller = constructEthersContractCaller(
  {
    ethersProviderOrSigner: provider,
    EthersContract: ethers.Contract,
  },
  taker.address
);

const takerSDK = constructPartialSDK(
  {
    chainId: 137,
    contractCaller,
    fetcher,
  },
  constructBuildNFTOrderTx
);

const orderWithSignature: SwappableNFTOrder = {
  expiry: 1665645962,
  nonceAndMeta: '1490585846052014974250870934243084527261268076495',
  maker: '0x7ba594df3161729bf2e68a9d0a11dceb57a2e306',
  taker: '0xdef171fe48cf0115b1d80b88dc8eab59176fee57',
  makerAsset: '0x2953399124f0cbb46d2cbacd8a89cf0599974963',
  makerAssetId:
    '7772759950848685723459796247330971791008072228632493699501910275462086524929',
  makerAssetType: 1,
  takerAsset: '0x6b175474e89094c44da98b954eedeac495271d0f',
  takerAssetId: '0',
  takerAssetType: 0,
  makerAmount: '1',
  takerAmount: '8000000000000000000',
  signature:
    '0x9247734939b4354ce6f99178ad95cbc19635e2ba86395370e29a8ac6a95cf5054203df0ba607717af1541a30d9df00962f16ada5273ef39633f304cc88faac0d1c',
};

async function run() {
  // build calldata for order fulfilling transaction
  const txData = await takerSDK.buildNFTOrderTx(
    {
      srcDecimals: 18,
      userAddress: taker.address,
      orders: [orderWithSignature],
    },
    { ignoreChecks: true }
  );

  const { gas: payloadGas, ...LOPayloadTxParams } = txData;

  // compose ethers transaction out of provided params
  const transaction: ethers.providers.TransactionRequest = {
    ...LOPayloadTxParams,
    gasPrice: '0x' + new BigNumber(LOPayloadTxParams.gasPrice).toString(16),
    gasLimit: '0x' + new BigNumber(payloadGas || 5000000).toString(16),
    value: '0x' + new BigNumber(LOPayloadTxParams.value).toString(16),
  };

  // send
  const takerFillsNFTOrderTx: ethers.providers.TransactionResponse =
    await taker.sendTransaction(transaction);

  console.log('takerFillsNFTOrderTx', takerFillsNFTOrderTx);
}

run();
```

{% endtab %}
{% endtabs %}


---

# 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/fill-a-limit-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.
