# Quickstart

Get up and running with **Lixer SDK** in under 5 minutes!

**NPM Registry:** [@lixersdk/sdk](https://www.npmjs.com/package/@lixersdk/sdk)

***

### 1. Install the SDK

```bash
npm install @lixersdk/sdk
```

or with Yarn:

```bash
yarn add @lixersdk/sdk
```

CDN (Browser):

```html
<script src="https://unpkg.com/@lixer/sdk@latest/dist/lixer.min.js"></script>
<script>
  const lixer = new LixerSDK();
</script>
```

***

### 2. Initialize the SDK

```javascript
const LixerSDK = require('@lixersdk/sdk');

// No configuration needed
const lixer = new LixerSDK();
```

***

### 3. Fetch Swaps

```javascript
// Get recent swaps
const swaps = await lixer.swaps().getAll({ limit: 10 });
console.log('Recent swaps:', swaps);

// Get a swap by ID
const swap = await lixer.swaps().getById(swaps[0].id);
console.log('Single swap:', swap);
```

***

### 4. Work with Pools

```javascript
// Get all pools
const pools = await lixer.pools().getAll();
console.log('All pools:', pools);

// Get swaps for a specific pool
const poolSwaps = await lixer.pools().getSwaps(pools[0].id, { limit: 5 });
console.log('Pool swaps:', poolSwaps);

// Get time series data for a pool
const ts = await lixer.pools().getTimeSeries(pools[0].id, { interval: '1h', limit: 24 });
console.log('Pool time series:', ts);
```

***

### 5. Get Stats

```javascript
// Global stats
const globalStats = await lixer.stats().getGlobal();
console.log('Global stats:', globalStats);

// Stats for a specific pool
const poolStats = await lixer.stats().getPool(pools[0].id);
console.log('Pool stats:', poolStats);
```

***

### 6. Query Timeseries

```javascript
// Volume data across all pools
const volumeData = await lixer.timeseries().getVolume({ interval: '1d', limit: 7 });
console.log('Volume timeseries:', volumeData);
```

***

### 7. Check SDK Health

```javascript
const health = await lixer.health().check();
console.log('SDK Health:', health);
```

***

### 8. Use WebSockets (Real-time Events)

```javascript
// Subscribe to live swap events
const ws = await lixer.websocket().connect();

ws.on('message', (data) => {
  const swapEvent = JSON.parse(data);
  console.log('New swap event:', swapEvent);
});
```

Or with event listeners (if supported):

```javascript
lixer.websocket().on('swap', (swap) => {
  console.log('Swap event:', swap);
});
```

***

### 9. Token Metadata

```javascript
// Get all tokens
const tokens = await lixer.tokens().getAll();
console.log('All tokens:', tokens);

// Get a specific token
const token = await lixer.tokens().getByAddress(tokens[0].address);
console.log('Token details:', token);
```

***

### 10. Block Data

```javascript
// Get latest block
const latestBlock = await lixer.blocks().latest();
console.log('Latest block:', latestBlock);

// Get block by number
const block = await lixer.blocks().getByNumber(latestBlock.number - 10);
console.log('Block by number:', block);

// Get block by timestamp
const blockAtTime = await lixer.blocks().getByTimestamp(1700000000);
console.log('Block by timestamp:', blockAtTime);
```

***

## Summary

With **Lixer SDK**, you can easily access:

* Swaps
* Pools
* Stats
* Timeseries
* Health
* WebSockets (real-time events)
* Tokens
* Blocks

## Example:&#x20;

<https://github.com/Haxry/Lixer/blob/master/monorepo/src/api/dashboard.tsx>&#x20;


---

# 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://ironjams-organization.gitbook.io/lixer-docs/getting-started/quickstart.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.
