solask-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

solask-sdk

The solask-sdk text module allows you to query Solana blockchain data using plain natural language inputs and get structured responses.

📦 Installation

npm install solask-sdk@latest

✨ Usage

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

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

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

Package Sidebar

Install

npm i solask-sdk

Weekly Downloads

2

Version

1.0.6

License

none

Unpacked Size

5.81 kB

Total Files

12

Last publish

Collaborators

  • susmitasanti
  • shashwat-tripathi
  • piyush_tilokani
  • atharvam4