> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# DLMM Program Instructions

> Explore DLMM lb_clmm instructions for pool creation, swaps, liquidity, positions, rewards, operators, and limit orders.

The `lb_clmm` IDL exposes many instructions. Integrators can choose to either use the TypeScript SDK for transaction construction or build through CPI.

## Pool Creation

| Instruction                                       | Use                                                                                     |
| ------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `initialize_lb_pair`                              | Legacy permissionless SPL Token pool creation.                                          |
| `initialize_lb_pair2`                             | Current permissionless v2 pool creation with Token-2022 support and `PresetParameter2`. |
| `initialize_permission_lb_pair`                   | Operator-controlled pool creation for permissioned launches.                            |
| `initialize_customizable_permissionless_lb_pair`  | Legacy customizable permissionless pool creation for SPL Token pools.                   |
| `initialize_customizable_permissionless_lb_pair2` | Current customizable permissionless pool creation with Token-2022 support.              |

## Bin Arrays

| Instruction                             | Use                                                     |
| --------------------------------------- | ------------------------------------------------------- |
| `initialize_bin_array`                  | Creates a bin array and initializes bin prices.         |
| `initialize_bin_array_bitmap_extension` | Creates the bitmap extension for far bin array indexes. |
| `close_bin_array`                       | Closes an empty bin array.                              |

`initialize_bin_array` is compute-heavy. If you construct it manually, add a compute budget instruction.

## Positions

| Instruction                                                    | Use                                               |
| -------------------------------------------------------------- | ------------------------------------------------- |
| `initialize_position`                                          | Legacy position initialization.                   |
| `initialize_position2`                                         | Current idempotent `PositionV2` initialization.   |
| `initialize_position_pda`                                      | Initializes a position PDA.                       |
| `initialize_position_by_operator`                              | Operator-driven position initialization.          |
| `increase_position_length` / `increase_position_length2`       | Expands a dynamic position.                       |
| `decrease_position_length`                                     | Shrinks a dynamic position.                       |
| `update_position_operator`                                     | Changes the operator authority.                   |
| `set_permissionless_operation_bits`                            | Enables selected permissionless position actions. |
| `close_position`, `close_position2`, `close_position_if_empty` | Close position accounts when eligible.            |

## Liquidity

| Instruction family    | Use                                                                                 |
| --------------------- | ----------------------------------------------------------------------------------- |
| `add_liquidity*`      | Adds liquidity by explicit bin amounts, strategy, weights, or one-sided parameters. |
| `add_liquidity*2`     | v2 liquidity flows with Token-2022 and dynamic-position support.                    |
| `remove_liquidity*`   | Removes liquidity by bin amounts, range, or all liquidity.                          |
| `rebalance_liquidity` | Combines add, remove, claim, resize, and shrink behavior in one flow.               |

## Swaps

| Instruction                                          | Use                                                    |
| ---------------------------------------------------- | ------------------------------------------------------ |
| `swap`                                               | Legacy exact-in swap.                                  |
| `swap2`                                              | Current exact-in swap with Token-2022 account support. |
| `swap_exact_out` / `swap_exact_out2`                 | Exact-out swap flows.                                  |
| `swap_with_price_impact` / `swap_with_price_impact2` | Swap with price-impact controls.                       |

## Fees And Rewards

| Instruction                      | Use                                                   |
| -------------------------------- | ----------------------------------------------------- |
| `claim_fee` / `claim_fee2`       | Claims swap fees for a position.                      |
| `claim_reward` / `claim_reward2` | Claims one reward index for a position.               |
| `initialize_reward`              | Initializes a reward mint for liquidity mining pools. |
| `fund_reward`                    | Funds reward emissions.                               |
| `update_reward_duration`         | Updates reward duration.                              |
| `update_reward_funder`           | Updates reward funder.                                |
| `withdraw_ineligible_reward`     | Withdraws undistributable rewards.                    |

## Limit Orders

| Instruction                  | Use                                                |
| ---------------------------- | -------------------------------------------------- |
| `place_limit_order`          | Places an order at one or more bins.               |
| `cancel_limit_order`         | Cancels an existing order.                         |
| `close_limit_order_if_empty` | Closes the account after all order bins are empty. |
