# Getting Started

### Installation

Install Ferra DAMM SDK:

```bash
npm install @ferra-labs/damm
```

Optional:

```bash
npm install @mysten/sui
```

### Initialize SDK

Initialize the Ferra DAMM SDK with default values using the Sui mainnet RPC:

```typescript
import { dammMainnet, initFerraSDK } from "@ferra-labs/damm"

const useFerraSDK = (address: string) => {
  return useMemo(
    () =>
      initFerraSDK({
        network: 'beta', // can be 'mainnet' or 'testnet', 'beta'
        fullNodeUrl: 'YOUR_RPC_FULL_NODE',
        wallet: 'YOUR_WALLET_ADDRESS',
      }),
    [address]
  );
};
```

### Get Coin Assets & Balances

Query wallet coin data directly from the SDK instance.

#### Get Coin Assets

Returns detailed coin objects (object IDs, balances) for a wallet:

```typescript
// All coins
const allAssets = await sdk.getOwnerCoinAssets('0xYourAddress')

// Specific coin type
const suiAssets = await sdk.getOwnerCoinAssets(
  '0xYourAddress',
  '0x2::sui::SUI'
)

// Force refresh (skip cache)
const freshAssets = await sdk.getOwnerCoinAssets('0xYourAddress', null, true)

allAssets.forEach(asset => {
  console.log({
    coinType: asset.coinAddress,
    objectId: asset.coinObjectId,
    balance: asset.balance.toString()
  })
})
```

#### Get Coin Balances

Returns aggregated balances (lighter than `getOwnerCoinAssets`):

```typescript
// All coin balances
const balances = await sdk.getOwnerCoinBalances('0xYourAddress')

// Single coin balance
const suiBalance = await sdk.getOwnerCoinBalances(
  '0xYourAddress',
  '0x2::sui::SUI'
)

balances.forEach(b => {
  console.log(`${b.coinType}: ${b.totalBalance}`)
})
```


---

# 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://docs.ferra.ag/integration/damm/typescript-sdk/getting-started.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.
