solask-sdk
Version:
Lightweight SDK to interact with Solana via REST
26 lines (25 loc) • 977 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ask = ask;
exports.getSNS = getSNS;
const client_1 = require("./client");
async function ask(query) {
var _a, _b;
try {
const res = await client_1.apiClient.post("/ask", { query });
return res.data.answer;
}
catch (err) {
throw new Error(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || "Failed to fetch response");
}
}
async function getSNS(query) {
var _a, _b;
try {
const res = await client_1.apiClient.post("/getSNS", { query });
return res.data.answer;
}
catch (err) {
throw new Error(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || "Failed to fetch SNS data");
}
}