# getQuoteRaw

## Installation

```bash
npm install @karrotcapital/spiderswap
```

## Usage

### Initialization

First, initialize the **`'Spiderswap'`** class with your API key.

```javascript
import Spiderswap from '@karrotcapital/spiderswap';
// OR
const Spiderswap = require('@karrotcapital/spiderswap');

const spiderswap = new Spiderswap(ApiKey);
```

### Method: getQuoteRaw

**Description**

The **`'getQuoteRaw'`** method retrieves a quote for a token swap by fetching raw quote data from the SpiderSwap API.

**Parameters**

* **`'fromMint'`** (string): The mint address of the token being swapped from.
* **`'toMint'`** (string): The mint address of the token being swapped to.
* **`'amount'`** (number): The amount of the **`'fromMint'`** token to swap, in lamports.
* **`'slippage'`** (number): The acceptable slippage percentage for the swap, in basis points (bps).
* **`'provider'`** (string): The liquidity provider.

#### Returns

**`'Promise<quoteMap>'`**: A promise that resolves to a **`'quoteMap'`** object containing the quote data.

#### `'quoteMap'` Type

```typescript
export type quoteMap = {
    inputMint: string;
    inAmount: any;
    outputMint: string;
    outAmount: any;
    minimumReceived: any;
    slippage: number;
    priceImpactPercent: any;
}
```

#### Example

```javascript
async function getQuote() {
    try {
        const quoteData = await spiderswap.quote.getQuoteRaw(
            'fromMintAddress',
            'toMintAddress',
            1000000000,  // Amount in lamports
            50,          // Slippage in bps
            'providerName'
        );
        console.log('Quote data:', quoteData);
    } catch (error) {
        console.error('Error fetching quote data:', error);
    }
}

getQuote();
```

**Implementation Details**

This method constructs a request body with the provided parameters and makes an API call to fetch the quote data. If the API call fails, it logs the error and throws an exception.
