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

# Hadron Quickstart

Install the Hadron package

```mdx theme={null}
npm i @hadron-fi/sdk-v2 @solana/web3.js @solana/spl-token
```

## Initializing a pool

Initialising a hadron pool gives you your own propAMM instance.

```typescript theme={null}
import { Hadron, Q32_ONE } from "@hadron-fi/sdk-v2";

const { instructions, poolAddress, seed } = Hadron.initialize(payer.publicKey, {
  //Mandatory params
  mintX,
  mintY,
  authority: payer.publicKey,
  initialMidpriceQ32: Q32_ONE, // midprice = 1.0 m
  //Optional params
  seed: "",
  tokenProgramX: "", //pick between token2022 and SPL tokens
  tokenProgramY: "", //SPL 20 Default for X and Y
  maxPrefabSlots: "1-16", // this decides how many strategy presets you store. Cannot be changed (2 by default)
  maxCurvePoints: "", // 16 by default
});

//// Send the instructions (group into transactions as needed)
// ...
```

<Info>
  With default parameters the CurvePrefabs account is \~15 KB, so two allocate instructions are returned (Solana’s single-instruction realloc limit is 10 KB). Send the allocates first, then the initialize.
</Info>

## **setPoolState**

<Tip>
  Pools are initialised by default as Reject Swaps. This is done to deposit funds to prevent indexing from aggregators
</Tip>

```typescript theme={null}
pool.setPoolState(authority, { newState: PoolState.Paused });

//// Send the instructions
```

| **Param**            | **Description**                                                |
| :------------------- | :------------------------------------------------------------- |
| `params.Initialized` | Pool is live and will be indexed by aggregators                |
| `params.Paused`      | All operations are paused in the pool                          |
| `params.RejectSwaps` | Swaps are rejected, but the user can perform all other actions |

## **Depositing Funds**

```typescript theme={null}
Build a deposit instruction.

const ix = pool.deposit(user, {
  amountX: 1_000_000n,
  amountY: 2_000_000n,
  expiration: 418052063, //optional parameter
});
```

| **Param**            | **Type**    | **Description**                         |
| :------------------- | :---------- | :-------------------------------------- |
| `user`               | `PublicKey` | The user’s wallet                       |
| `params.amountX`     | `bigint`    | Amount of token X to deposit (in atoms) |
| `params.amountY`     | `bigint`    | Amount of token Y to deposit (in atoms) |
| `params.expiration?` | `number`    | Optional slot expiration                |

## **Withdraw**

Build a withdraw instruction.

```typescript theme={null}
const ix = pool.withdraw(user, {
  amountX: 500_000n,
  amountY: 1_000_000n,
  expiration: 418052063, //optional parameter
});
```
