# Yamaswap SDK

A Solana SDK for creating and managing ETF tokens ( from Yamaswap ).

## Prerequisites

- Node.js 23+
- Solana wallet
- Solana RPC endpoint （localnet | devnet | mainnet）
- "@solana/web3.js": "^1.95.0" （recommended）
    
## Installation

```bash
npm install yamaswap-sdk
```

## Usage

```ts
import { DexClient } from 'yamaswap-sdk';

const client = new DexClient(connection, wallet);
```

### Create ETF

```ts
    const createETFParams = {
        name: 'Test ETF',
        symbol: 'TEST5',
        description: 'Test Description',
        url: 'https://test.com',
        constitunent: [{
            tokenAddress: ,
            weight: 
        },...]
    }

    const createETFresult = await client.createETF(createETFParams, wallet);
    console.log('Create ETF result:', createETFresult);
```

### Buy and Mint ETF Token

```ts
    const buyMintETFTokenresult = await client.purchaseETF(wallet, {
        etfAddress: new PublicKey('7NhFX8qPxqHarmHrGbk3LP8G8tgGoo8f4ErFc8RBSRHa'),
        lamports: 100000000000
    });
    console.log('Buy Mint ETF Token result:', buyMintETFTokenresult);
```

### Burn ETF

```ts
    const burnETFresult = await client.burnETF(wallet, {
        etfAddress: new PublicKey('7NhFX8qPxqHarmHrGbk3LP8G8tgGoo8f4ErFc8RBSRHa'),
        lamports: 90000000000
    });
    console.log('Burn ETF result:', burnETFresult);
```

See the examples folder for detailed use cases

