# solask-sdk


The `solask-sdk` text module allows you to query Solana blockchain data using plain natural language inputs and get structured responses.


## 📦 Installation


```bash
npm install solask-sdk@latest
```


## ✨ Usage


```typescript
import { ask } from 'solask-sdk';


async function query() {
  const result = await ask("What is the current SOL price?");
  console.log(result);
};


query();
```


## 🔧 Using it in React Vite App
```typescript
import { useState } from "react";
import { ask } from "solask-sdk";


const SolaskTextDemo = () => {
  const [text, setText] = useState("");
  const [response, setResponse] = useState<string | null>(null);
  const [loading, setLoading] = useState(false);


  const handleAsk = async () => {
    if (!text.trim()) {
      alert("Please enter a question.");
      return;
    }


    setLoading(true);
    setResponse(null);


    try {
      const answer = await ask(text);
      setResponse(answer);
    } catch (error) {
      console.error("Error:", error);
      alert("Failed to get response.");
    } finally {
      setLoading(false);
    }
  };


  return (
    <div>
      <h2>Solask SDK - Text Input Demo</h2>
      <input
        type="text"
        placeholder="Ask something..."
        value={text}
        onChange={(e) => setText(e.target.value)}
        disabled={loading}
      />
      <button onClick={handleAsk} disabled={loading}>
        {loading ? "Loading..." : "Submit"}
      </button>


      {response && (
        <div>
          <strong>Response:</strong>
          <p>{response}</p>
        </div>
      )}
    </div>
  );
};


export default SolaskTextDemo;
```


## 🌐 Examples


```typescript
await ask("How many NFTs are minted today?");
await ask("List top 5 tokens on Solana by volume");
```


## 🧠 How does it work?
This module internally uses:
- Natural language parsing (LLM backed)
- Indexed Solana data endpoints
- Entity detection & aggregation logic

