> For the complete documentation index, see [llms.txt](https://docs.ferra.ag/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ferra.ag/integration/dlmm/typescript-sdk/add-liquidity/add-to-new-position.md).

# Add to New Position

Create a position NFT and add liquidity in a single transaction. This is the most efficient way to start providing liquidity in DLMM pools.

### Prerequisites

* Connected wallet with both tokens
* Selected distribution strategy (SPOT, CURVE, etc.)
* Calculated token amounts needed
* Sufficient gas for transaction

### Basic Usage

```typescript
const pair = await sdk.Pair.getPair(pairAddress);

// Create position and add liquidity together
const tx = await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: 1000000000n,  // 1 token X
  amountY: 2000000000n,  // 2 token Y
  ids: [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],
  distributionX: [0, 0, 0, 0, 0, 50, 50, 0, 0, 0, 0],
  distributionY: [0, 0, 0, 0, 0, 50, 50, 0, 0, 0, 0]
});

await sdk.fullClient.signAndExecuteTransaction({
  transaction: tx,
  signer: keypair
});
```

### Method Parameters

```typescript
interface AddLiquidityParams {
  amountX: bigint;           // Max token X to deposit
  amountY: bigint;           // Max token Y to deposit
  ids: number[];        // Relative bin IDs from active
  distributionX: number[];   // X distribution (sums to 100)
  distributionY: number[];   // Y distribution (sums to 100)
  minAmountX?: bigint;
  minAmountY?: bigint;
}
```

### Quick Examples

#### Concentrated Liquidity (±5 bins)

```typescript
await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: 1000000n,
  amountY: 1000000n,
  ids: [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],
  distributionX: [0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0],
  distributionY: [0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0]
});
```

#### Wide Range (±20 bins)

```typescript
const binCount = 41; // -20 to +20
const ids = Array.from({length: binCount}, (_, i) => i - 20);
const uniformDist = Array(binCount).fill(100 / binCount);

await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: 10000000n,
  amountY: 10000000n,
  ids,
  distributionX: uniformDist,
  distributionY: uniformDist
});
```

### Using Distribution Helpers

```typescript
import { DistributionUtils } from '@ferra/dlmm-sdk';

// SPOT distribution
const spotParams = DistributionUtils.createParams(
  DistributionUtils.SPOT,
  {
    activeId: pair.parameters.active_id,
    binRange: [activeId - 10, activeId + 10],
    parsedAmounts: [amountX, amountY]
  }
);

await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX,
  amountY,
  ...spotParams
});
```

### What Happens

* Creates new position NFT
* Deposits tokens into selected bins
* Transfers position NFT to your wallet
* Returns transaction hash

### Common Patterns

#### Add Around Current Price

```typescript
const activeId = pair.parameters.active_id;
const range = 10; // ±10 bins

await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: amount,
  amountY: amount,
  ids: Array.from({length: range * 2 + 1}, (_, i) => i - range),
  distributionX: [/* your distribution */],
  distributionY: [/* your distribution */]
});
```

#### Single Bin Liquidity

```typescript
// Add to active bin only
await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: amount,
  amountY: amount,
  ids: [0],  // Just active bin
  distributionX: [100],
  distributionY: [100]
});
```

### Related Topics

* [SPOT Distribution](/integration/dlmm/typescript-sdk/add-liquidity/spot-distribution.md) - Uniform liquidity spread
* [CURVE Distribution](/integration/dlmm/typescript-sdk/add-liquidity/curve-distribution.md) - Concentrated liquidity
* [Calculate Token Amounts](/integration/dlmm/typescript-sdk/add-liquidity/calculate-token-amounts.md) - Required tokens
* [Add to Existing Position](/integration/dlmm/typescript-sdk/add-liquidity/add-to-existing-position.md) - Increase liquidity
