@madeonsol/plugin-madeonsol 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,24 +1,36 @@
1
1
  # @madeonsol/plugin-madeonsol
2
2
 
3
- ElizaOS plugin for [MadeOnSol](https://madeonsol.com) — Solana KOL trading intelligence and deployer analytics via x402 micropayments.
3
+ ElizaOS plugin for [MadeOnSol](https://madeonsol.com) — Solana KOL trading intelligence and deployer analytics.
4
+
5
+ ## Authentication
6
+
7
+ Three options (in priority order):
8
+
9
+ | Method | Setting | Best for |
10
+ |---|---|---|
11
+ | **MadeOnSol API key** (recommended) | `MADEONSOL_API_KEY` | Developers — [get a free key](https://madeonsol.com/developer) |
12
+ | RapidAPI key | `RAPIDAPI_KEY` | RapidAPI subscribers |
13
+ | x402 micropayments | `SVM_PRIVATE_KEY` | AI agents with Solana wallets |
4
14
 
5
15
  ## What it does
6
16
 
7
- Gives your ElizaOS agent access to MadeOnSol's x402-gated API endpoints. The agent pays per request with USDC on Solana no API keys needed.
17
+ Gives your ElizaOS agent access to MadeOnSol's Solana intelligence API.
8
18
 
9
- | Action | Endpoint | Price |
10
- |--------|----------|-------|
11
- | `GET_KOL_FEED` | Real-time KOL trade feed (946 wallets) | $0.005 USDC |
12
- | `GET_KOL_COORDINATION` | Multi-KOL convergence signals | $0.02 USDC |
13
- | `GET_KOL_LEADERBOARD` | KOL PnL/win-rate rankings | $0.005 USDC |
14
- | `GET_DEPLOYER_ALERTS` | Pump.fun elite deployer alerts | $0.01 USDC |
19
+ | Action | Endpoint |
20
+ |--------|----------|
21
+ | `GET_KOL_FEED` | Real-time KOL trade feed (946 wallets) |
22
+ | `GET_KOL_COORDINATION` | Multi-KOL convergence signals |
23
+ | `GET_KOL_LEADERBOARD` | KOL PnL/win-rate rankings |
24
+ | `GET_DEPLOYER_ALERTS` | Pump.fun elite deployer alerts |
15
25
 
16
26
  ## Install
17
27
 
18
28
  ```bash
19
- npm install @madeonsol/plugin-madeonsol @x402/fetch @x402/svm @x402/core @solana/kit @scure/base
29
+ npm install @madeonsol/plugin-madeonsol
20
30
  ```
21
31
 
32
+ > x402 peer deps (`@x402/fetch @x402/svm @x402/core @solana/kit @scure/base`) are only needed when using `SVM_PRIVATE_KEY`.
33
+
22
34
  ## Usage
23
35
 
24
36
  ```typescript
@@ -27,40 +39,31 @@ import { madeOnSolPlugin } from "@madeonsol/plugin-madeonsol";
27
39
  const agent = {
28
40
  plugins: [madeOnSolPlugin],
29
41
  settings: {
30
- // Required for automatic x402 payments:
31
- SVM_PRIVATE_KEY: "your_base58_solana_private_key",
32
- // Optional:
33
- MADEONSOL_API_URL: "https://madeonsol.com",
42
+ // Option 1: API key (simplest — get one free at madeonsol.com/developer)
43
+ MADEONSOL_API_KEY: "msk_your_api_key_here",
44
+
45
+ // Option 2: RapidAPI key
46
+ // RAPIDAPI_KEY: "your_rapidapi_key",
47
+
48
+ // Option 3: x402 micropayments (AI agents)
49
+ // SVM_PRIVATE_KEY: "your_base58_solana_private_key",
34
50
  },
35
51
  };
36
52
  ```
37
53
 
38
- The plugin's `init` function automatically:
39
- 1. Creates a Solana signer from `SVM_PRIVATE_KEY`
40
- 2. Registers the x402 payment scheme
41
- 3. Wraps fetch with automatic 402 → pay → retry handling
42
-
43
54
  Your agent can then respond to queries like:
44
55
  - "What are KOLs buying right now?"
45
56
  - "Show me the KOL leaderboard this week"
46
57
  - "What tokens are multiple KOLs accumulating?"
47
58
  - "Any new deployer alerts from Pump.fun?"
48
59
 
49
- Without `SVM_PRIVATE_KEY`, the plugin runs in read-only mode and returns payment requirement info instead of data.
50
-
51
- ## Wallet requirements
52
-
53
- The wallet needs:
54
- - ~0.01 SOL for transaction fees
55
- - USDC balance (even $0.10 covers 20+ requests)
56
-
57
60
  ## Discovery endpoint
58
61
 
59
62
  ```
60
63
  GET https://madeonsol.com/api/x402
61
64
  ```
62
65
 
63
- Returns all available endpoints, prices, and parameter docs. No payment required.
66
+ Returns all available endpoints, prices, and parameter docs. No auth required.
64
67
 
65
68
  ## Also Available
66
69
 
@@ -24,7 +24,7 @@ export const deployerAlertsAction = {
24
24
  const result = await client.getDeployerAlerts({ limit });
25
25
  if (result.error) {
26
26
  callback?.({ text: result.status === 402
27
- ? "x402 payment required but no wallet configured. Set SVM_PRIVATE_KEY to enable automatic USDC payments."
27
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
28
28
  : `Error: ${result.error}` });
29
29
  return undefined;
30
30
  }
@@ -24,7 +24,7 @@ export const kolCoordinationAction = {
24
24
  const result = await client.getKolCoordination({ period, limit: "10" });
25
25
  if (result.error) {
26
26
  callback?.({ text: result.status === 402
27
- ? "x402 payment required but no wallet configured. Set SVM_PRIVATE_KEY to enable automatic USDC payments."
27
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
28
28
  : `Error: ${result.error}` });
29
29
  return undefined;
30
30
  }
@@ -25,7 +25,7 @@ export const kolFeedAction = {
25
25
  const result = await client.getKolFeed({ limit: "10", ...(action ? { action } : {}) });
26
26
  if (result.error) {
27
27
  callback?.({ text: result.status === 402
28
- ? "x402 payment required but no wallet configured. Set SVM_PRIVATE_KEY to enable automatic USDC payments."
28
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
29
29
  : `Error: ${result.error}` });
30
30
  return undefined;
31
31
  }
@@ -24,7 +24,7 @@ export const kolLeaderboardAction = {
24
24
  const result = await client.getKolLeaderboard({ period, limit: "10" });
25
25
  if (result.error) {
26
26
  callback?.({ text: result.status === 402
27
- ? "x402 payment required but no wallet configured. Set SVM_PRIVATE_KEY to enable automatic USDC payments."
27
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
28
28
  : `Error: ${result.error}` });
29
29
  return undefined;
30
30
  }
package/dist/client.d.ts CHANGED
@@ -1,19 +1,21 @@
1
1
  /**
2
- * MadeOnSol x402 API client.
3
- * Uses @x402/fetch to automatically handle 402 sign USDC retry flow.
2
+ * MadeOnSol API client.
3
+ * Supports 3 auth modes: API key (simplest), RapidAPI key, or x402 micropayments.
4
4
  */
5
5
  export interface MadeOnSolClientOptions {
6
6
  baseUrl?: string;
7
- /**
8
- * A fetch function that handles x402 payments automatically.
9
- * Created via wrapFetchWithPayment() from @x402/fetch.
10
- * If not provided, uses plain fetch (requests will return 402).
11
- */
7
+ /** MadeOnSol API key (get one free at madeonsol.com/developer). Preferred. */
8
+ apiKey?: string;
9
+ /** RapidAPI subscription key. */
10
+ rapidApiKey?: string;
11
+ /** x402 payment-enabled fetch (for AI agents with SVM_PRIVATE_KEY). */
12
12
  fetchFn?: typeof fetch;
13
13
  }
14
14
  export declare class MadeOnSolClient {
15
15
  private baseUrl;
16
16
  private fetchFn;
17
+ private authMode;
18
+ private authHeaders;
17
19
  constructor(options?: MadeOnSolClientOptions);
18
20
  query<T = unknown>(path: string, params?: Record<string, string | undefined>): Promise<{
19
21
  data?: T;
@@ -55,4 +57,34 @@ export declare class MadeOnSolClient {
55
57
  error?: string;
56
58
  status: number;
57
59
  }>;
60
+ private restRequest;
61
+ createWebhook(params: {
62
+ url: string;
63
+ events: string[];
64
+ filters?: Record<string, unknown>;
65
+ }): Promise<{
66
+ data?: unknown;
67
+ error?: string;
68
+ status: number;
69
+ }>;
70
+ listWebhooks(): Promise<{
71
+ data?: unknown;
72
+ error?: string;
73
+ status: number;
74
+ }>;
75
+ deleteWebhook(id: number): Promise<{
76
+ data?: unknown;
77
+ error?: string;
78
+ status: number;
79
+ }>;
80
+ testWebhook(webhookId: number): Promise<{
81
+ data?: unknown;
82
+ error?: string;
83
+ status: number;
84
+ }>;
85
+ getStreamToken(): Promise<{
86
+ data?: unknown;
87
+ error?: string;
88
+ status: number;
89
+ }>;
58
90
  }
package/dist/client.js CHANGED
@@ -1,24 +1,47 @@
1
1
  /**
2
- * MadeOnSol x402 API client.
3
- * Uses @x402/fetch to automatically handle 402 sign USDC retry flow.
2
+ * MadeOnSol API client.
3
+ * Supports 3 auth modes: API key (simplest), RapidAPI key, or x402 micropayments.
4
4
  */
5
5
  const DEFAULT_BASE = "https://madeonsol.com";
6
+ const RAPIDAPI_HOST = "madeonsol-solana-kol-tracker-tools-api.p.rapidapi.com";
6
7
  export class MadeOnSolClient {
7
8
  baseUrl;
8
9
  fetchFn;
10
+ authMode;
11
+ authHeaders;
9
12
  constructor(options = {}) {
10
13
  this.baseUrl = options.baseUrl || DEFAULT_BASE;
11
14
  this.fetchFn = options.fetchFn || globalThis.fetch;
15
+ this.authHeaders = {};
16
+ if (options.apiKey) {
17
+ this.authMode = "madeonsol";
18
+ this.authHeaders = { Authorization: `Bearer ${options.apiKey}` };
19
+ }
20
+ else if (options.rapidApiKey) {
21
+ this.authMode = "rapidapi";
22
+ this.authHeaders = { "x-rapidapi-key": options.rapidApiKey, "x-rapidapi-host": RAPIDAPI_HOST };
23
+ }
24
+ else if (options.fetchFn) {
25
+ this.authMode = "x402";
26
+ }
27
+ else {
28
+ this.authMode = "none";
29
+ }
12
30
  }
13
31
  async query(path, params) {
14
- const url = new URL(path, this.baseUrl);
32
+ const apiPath = this.authMode === "x402" || this.authMode === "none"
33
+ ? path
34
+ : path.replace("/api/x402/", "/api/v1/");
35
+ const url = new URL(apiPath, this.baseUrl);
15
36
  if (params) {
16
37
  for (const [k, v] of Object.entries(params)) {
17
38
  if (v !== undefined)
18
39
  url.searchParams.set(k, v);
19
40
  }
20
41
  }
21
- const res = await this.fetchFn(url.toString(), { method: "GET" });
42
+ const res = this.authMode === "x402"
43
+ ? await this.fetchFn(url.toString(), { method: "GET" })
44
+ : await this.fetchFn(url.toString(), { method: "GET", headers: this.authHeaders });
22
45
  if (res.status === 402) {
23
46
  const body = await res.json();
24
47
  return { error: `Payment required: ${JSON.stringify(body.accepts?.[0] || body)}`, status: 402 };
@@ -42,4 +65,38 @@ export class MadeOnSolClient {
42
65
  getDeployerAlerts(params) {
43
66
  return this.query("/api/x402/deployer-hunter/alerts", params);
44
67
  }
68
+ // ── Webhook management (requires API key or RapidAPI key with Pro/Ultra) ──
69
+ async restRequest(method, path, body) {
70
+ if (this.authMode !== "madeonsol" && this.authMode !== "rapidapi") {
71
+ return { error: "API key or RapidAPI key required for webhook/streaming features. Get a free key at madeonsol.com/developer", status: 401 };
72
+ }
73
+ const res = await this.fetchFn(`${this.baseUrl}/api/v1${path}`, {
74
+ method,
75
+ headers: {
76
+ "Content-Type": "application/json",
77
+ ...this.authHeaders,
78
+ },
79
+ ...(body ? { body: JSON.stringify(body) } : {}),
80
+ });
81
+ if (!res.ok) {
82
+ const text = await res.text().catch(() => "Unknown error");
83
+ return { error: text, status: res.status };
84
+ }
85
+ return { data: await res.json(), status: res.status };
86
+ }
87
+ createWebhook(params) {
88
+ return this.restRequest("POST", "/webhooks", params);
89
+ }
90
+ listWebhooks() {
91
+ return this.restRequest("GET", "/webhooks");
92
+ }
93
+ deleteWebhook(id) {
94
+ return this.restRequest("DELETE", `/webhooks/${id}`);
95
+ }
96
+ testWebhook(webhookId) {
97
+ return this.restRequest("POST", "/webhooks/test", { webhook_id: webhookId });
98
+ }
99
+ getStreamToken() {
100
+ return this.restRequest("POST", "/stream/token");
101
+ }
45
102
  }
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { MadeOnSolClient } from "./client.js";
7
7
  export const MADEONSOL_CLIENT_KEY = "madeonsol:client";
8
8
  export const madeOnSolPlugin = {
9
9
  name: "madeonsol",
10
- description: "Query Solana KOL trading intelligence and deployer analytics from MadeOnSol via x402 micropayments. Tracks 946 KOL wallets and 4000+ Pump.fun deployers.",
10
+ description: "Query Solana KOL trading intelligence and deployer analytics from MadeOnSol. Tracks 946 KOL wallets and 4000+ Pump.fun deployers.",
11
11
  actions: [
12
12
  kolFeedAction,
13
13
  kolCoordinationAction,
@@ -15,15 +15,23 @@ export const madeOnSolPlugin = {
15
15
  deployerAlertsAction,
16
16
  ],
17
17
  /**
18
- * Initialize the x402 payment-enabled client.
19
- * Requires SVM_PRIVATE_KEY in the runtime settings for automatic payments.
20
- * Without it, the plugin still works but requests will return 402 payment info.
18
+ * Initialize the MadeOnSol client.
19
+ * Auth priority: MADEONSOL_API_KEY > RAPIDAPI_KEY > SVM_PRIVATE_KEY (x402).
20
+ * Get a free API key at madeonsol.com/developer no wallet needed.
21
21
  */
22
22
  init: async (_config, runtime) => {
23
23
  const baseUrl = String(runtime.getSetting?.("MADEONSOL_API_URL") || "https://madeonsol.com");
24
+ const apiKey = runtime.getSetting?.("MADEONSOL_API_KEY");
25
+ const rapidApiKey = runtime.getSetting?.("RAPIDAPI_KEY");
24
26
  const privateKey = runtime.getSetting?.("SVM_PRIVATE_KEY");
25
27
  let fetchFn;
26
- if (privateKey) {
28
+ if (apiKey) {
29
+ console.log("[madeonsol] Using MadeOnSol API key (Bearer auth)");
30
+ }
31
+ else if (rapidApiKey) {
32
+ console.log("[madeonsol] Using RapidAPI key");
33
+ }
34
+ else if (privateKey) {
27
35
  try {
28
36
  const { wrapFetchWithPayment } = await import("@x402/fetch");
29
37
  const { x402Client } = await import("@x402/core/client");
@@ -37,13 +45,13 @@ export const madeOnSolPlugin = {
37
45
  console.log(`[madeonsol] x402 payments enabled, wallet: ${signer.address}`);
38
46
  }
39
47
  catch (err) {
40
- console.warn("[madeonsol] x402 payment setup failed, running in read-only mode:", err);
48
+ console.warn("[madeonsol] x402 payment setup failed:", err);
41
49
  }
42
50
  }
43
51
  else {
44
- console.log("[madeonsol] No SVM_PRIVATE_KEY running in read-only mode (402 info only)");
52
+ console.log("[madeonsol] No auth configured. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY.");
45
53
  }
46
- const madeOnSolClient = new MadeOnSolClient({ baseUrl, fetchFn });
54
+ const madeOnSolClient = new MadeOnSolClient({ baseUrl, apiKey, rapidApiKey, fetchFn });
47
55
  runtime[MADEONSOL_CLIENT_KEY] = madeOnSolClient;
48
56
  },
49
57
  };
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "@madeonsol/plugin-madeonsol",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "ElizaOS plugin for MadeOnSol — Solana KOL intelligence and deployer analytics via x402 micropayments",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
- "files": ["dist", "README.md"],
9
8
  "scripts": {
10
9
  "build": "tsc",
11
- "prepublishOnly": ""
10
+ "dev": "tsc --watch"
12
11
  },
13
12
  "peerDependencies": {
14
13
  "@elizaos/core": ">=1.0.0",
@@ -0,0 +1,67 @@
1
+ import type { Action, IAgentRuntime, Memory, State, HandlerCallback } from "@elizaos/core";
2
+ import { MadeOnSolClient } from "../client.js";
3
+ import { MADEONSOL_CLIENT_KEY } from "../index.js";
4
+
5
+ function getClient(runtime: IAgentRuntime): MadeOnSolClient {
6
+ return ((runtime as unknown as Record<string, unknown>)[MADEONSOL_CLIENT_KEY] as MadeOnSolClient) ?? new MadeOnSolClient();
7
+ }
8
+
9
+ export const deployerAlertsAction: Action = {
10
+ name: "GET_DEPLOYER_ALERTS",
11
+ description:
12
+ "Get real-time Pump.fun deployer alerts from MadeOnSol. Shows new token launches from tracked elite/good deployers with stats, market cap, and KOL buy enrichment.",
13
+ similes: [
14
+ "deployer alerts",
15
+ "pump fun launches",
16
+ "new token alerts",
17
+ "deployer tracker",
18
+ "elite deployer tokens",
19
+ ],
20
+
21
+ validate: async (_runtime: IAgentRuntime, message: Memory): Promise<boolean> => {
22
+ const text = (message.content?.text || "").toLowerCase();
23
+ return /\b(deployer|pump\.?fun|launch|new token)/i.test(text) && /\b(alert|track|monitor|latest|recent)/i.test(text);
24
+ },
25
+
26
+ handler: async (
27
+ runtime: IAgentRuntime,
28
+ message: Memory,
29
+ _state?: State,
30
+ _options?: unknown,
31
+ callback?: HandlerCallback,
32
+ ) => {
33
+ const client = getClient(runtime);
34
+ const text = (message.content?.text || "").toLowerCase();
35
+ const limit = text.match(/\b(\d+)\s*(alert|token|launch)/)?.[1] || "10";
36
+
37
+ const result = await client.getDeployerAlerts({ limit });
38
+
39
+ if (result.error) {
40
+ callback?.({ text: result.status === 402
41
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
42
+ : `Error: ${result.error}` });
43
+ return undefined;
44
+ }
45
+
46
+ const data = result.data as { alerts: Array<{ title: string; token_symbol: string; priority: string; market_cap_at_alert: number | null; deployers: { tier: string; bonding_rate: number | null }; kol_buys: { count: number; kols: string[] } | null }> };
47
+ const lines = (data.alerts || []).slice(0, 10).map((a) => {
48
+ const deployer = a.deployers as unknown as { tier: string; bonding_rate: number | null };
49
+ const mc = a.market_cap_at_alert ? `$${(a.market_cap_at_alert / 1000).toFixed(1)}k` : "?";
50
+ const kols = a.kol_buys ? `${a.kol_buys.count} KOLs buying` : "";
51
+ return `[${deployer?.tier}] ${a.token_symbol || "?"} — MC: ${mc}${kols ? ` | ${kols}` : ""}`;
52
+ });
53
+
54
+ callback?.({
55
+ text: `Deployer Alerts:\n${lines.join("\n") || "No recent alerts."}`,
56
+ content: data,
57
+ });
58
+ return undefined;
59
+ },
60
+
61
+ examples: [
62
+ [
63
+ { name: "user1", content: { text: "Show me the latest deployer alerts from Pump.fun" } },
64
+ { name: "assistant", content: { text: "Here are the latest deployer alerts..." } },
65
+ ],
66
+ ] as Action["examples"],
67
+ };
@@ -0,0 +1,64 @@
1
+ import type { Action, IAgentRuntime, Memory, State, HandlerCallback } from "@elizaos/core";
2
+ import { MadeOnSolClient } from "../client.js";
3
+ import { MADEONSOL_CLIENT_KEY } from "../index.js";
4
+
5
+ function getClient(runtime: IAgentRuntime): MadeOnSolClient {
6
+ return ((runtime as unknown as Record<string, unknown>)[MADEONSOL_CLIENT_KEY] as MadeOnSolClient) ?? new MadeOnSolClient();
7
+ }
8
+
9
+ export const kolCoordinationAction: Action = {
10
+ name: "GET_KOL_COORDINATION",
11
+ description:
12
+ "Get KOL convergence signals from MadeOnSol — tokens being accumulated by multiple KOLs simultaneously. Shows which tokens smart money is converging on.",
13
+ similes: [
14
+ "kol convergence",
15
+ "what tokens are kols accumulating",
16
+ "kol coordination",
17
+ "smart money convergence",
18
+ "multiple kols buying",
19
+ ],
20
+
21
+ validate: async (_runtime: IAgentRuntime, message: Memory): Promise<boolean> => {
22
+ const text = (message.content?.text || "").toLowerCase();
23
+ return /\b(kol|smart money)\b/.test(text) && /\b(converg|coordinat|accumul|same token|multiple)/i.test(text);
24
+ },
25
+
26
+ handler: async (
27
+ runtime: IAgentRuntime,
28
+ message: Memory,
29
+ _state?: State,
30
+ _options?: unknown,
31
+ callback?: HandlerCallback,
32
+ ) => {
33
+ const client = getClient(runtime);
34
+ const text = (message.content?.text || "").toLowerCase();
35
+ const period = text.includes("1h") ? "1h" : text.includes("7d") ? "7d" : text.includes("6h") ? "6h" : "24h";
36
+
37
+ const result = await client.getKolCoordination({ period, limit: "10" });
38
+
39
+ if (result.error) {
40
+ callback?.({ text: result.status === 402
41
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
42
+ : `Error: ${result.error}` });
43
+ return undefined;
44
+ }
45
+
46
+ const data = result.data as { coordination: Array<{ token_symbol: string; kol_count: number; signal: string; net_sol_flow: number }> };
47
+ const lines = (data.coordination || []).map(
48
+ (t) => `${t.token_symbol}: ${t.kol_count} KOLs ${t.signal} (${t.net_sol_flow > 0 ? "+" : ""}${t.net_sol_flow.toFixed(2)} SOL net)`
49
+ );
50
+
51
+ callback?.({
52
+ text: `KOL convergence signals (${period}):\n${lines.join("\n") || "No coordination signals found."}`,
53
+ content: data,
54
+ });
55
+ return undefined;
56
+ },
57
+
58
+ examples: [
59
+ [
60
+ { name: "user1", content: { text: "What tokens are multiple KOLs accumulating?" } },
61
+ { name: "assistant", content: { text: "Here are the KOL convergence signals..." } },
62
+ ],
63
+ ] as Action["examples"],
64
+ };
@@ -0,0 +1,65 @@
1
+ import type { Action, IAgentRuntime, Memory, State, HandlerCallback } from "@elizaos/core";
2
+ import { MadeOnSolClient } from "../client.js";
3
+ import { MADEONSOL_CLIENT_KEY } from "../index.js";
4
+
5
+ function getClient(runtime: IAgentRuntime): MadeOnSolClient {
6
+ return ((runtime as unknown as Record<string, unknown>)[MADEONSOL_CLIENT_KEY] as MadeOnSolClient) ?? new MadeOnSolClient();
7
+ }
8
+
9
+ export const kolFeedAction: Action = {
10
+ name: "GET_KOL_FEED",
11
+ description:
12
+ "Get the real-time Solana KOL trade feed from MadeOnSol. Shows latest buys and sells from 946 tracked KOL wallets with deployer enrichment.",
13
+ similes: [
14
+ "kol trades",
15
+ "what are kols buying",
16
+ "solana kol feed",
17
+ "kol activity",
18
+ "smart money trades",
19
+ "what did kols trade",
20
+ ],
21
+
22
+ validate: async (_runtime: IAgentRuntime, message: Memory): Promise<boolean> => {
23
+ const text = (message.content?.text || "").toLowerCase();
24
+ return /\b(kol|smart money)\b/.test(text) && /\b(feed|trade|buy|sell|activit)/i.test(text);
25
+ },
26
+
27
+ handler: async (
28
+ runtime: IAgentRuntime,
29
+ message: Memory,
30
+ _state?: State,
31
+ _options?: unknown,
32
+ callback?: HandlerCallback,
33
+ ) => {
34
+ const client = getClient(runtime);
35
+ const text = (message.content?.text || "").toLowerCase();
36
+ const action = text.includes("buy") ? "buy" : text.includes("sell") ? "sell" : undefined;
37
+
38
+ const result = await client.getKolFeed({ limit: "10", ...(action ? { action } : {}) });
39
+
40
+ if (result.error) {
41
+ callback?.({ text: result.status === 402
42
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
43
+ : `Error: ${result.error}` });
44
+ return undefined;
45
+ }
46
+
47
+ const data = result.data as { trades: Array<{ kol_name: string; token_symbol: string; action: string; sol_amount: number; traded_at: string }> };
48
+ const lines = (data.trades || []).slice(0, 10).map(
49
+ (t) => `${t.kol_name || "Unknown"} ${t.action === "buy" ? "bought" : "sold"} ${t.token_symbol || "?"} for ${Number(t.sol_amount).toFixed(2)} SOL`
50
+ );
51
+
52
+ callback?.({
53
+ text: `Latest KOL trades:\n${lines.join("\n")}`,
54
+ content: data,
55
+ });
56
+ return undefined;
57
+ },
58
+
59
+ examples: [
60
+ [
61
+ { name: "user1", content: { text: "What are the latest KOL trades on Solana?" } },
62
+ { name: "assistant", content: { text: "Here are the latest KOL trades from MadeOnSol..." } },
63
+ ],
64
+ ] as Action["examples"],
65
+ };
@@ -0,0 +1,64 @@
1
+ import type { Action, IAgentRuntime, Memory, State, HandlerCallback } from "@elizaos/core";
2
+ import { MadeOnSolClient } from "../client.js";
3
+ import { MADEONSOL_CLIENT_KEY } from "../index.js";
4
+
5
+ function getClient(runtime: IAgentRuntime): MadeOnSolClient {
6
+ return ((runtime as unknown as Record<string, unknown>)[MADEONSOL_CLIENT_KEY] as MadeOnSolClient) ?? new MadeOnSolClient();
7
+ }
8
+
9
+ export const kolLeaderboardAction: Action = {
10
+ name: "GET_KOL_LEADERBOARD",
11
+ description:
12
+ "Get KOL performance rankings from MadeOnSol — top Solana KOLs ranked by PnL, volume, and win rate.",
13
+ similes: [
14
+ "kol leaderboard",
15
+ "best performing kols",
16
+ "top kol traders",
17
+ "kol rankings",
18
+ "who is the best kol",
19
+ ],
20
+
21
+ validate: async (_runtime: IAgentRuntime, message: Memory): Promise<boolean> => {
22
+ const text = (message.content?.text || "").toLowerCase();
23
+ return /\b(kol|smart money)\b/.test(text) && /\b(leaderboard|ranking|top|best|perform|pnl|win rate)/i.test(text);
24
+ },
25
+
26
+ handler: async (
27
+ runtime: IAgentRuntime,
28
+ message: Memory,
29
+ _state?: State,
30
+ _options?: unknown,
31
+ callback?: HandlerCallback,
32
+ ) => {
33
+ const client = getClient(runtime);
34
+ const text = (message.content?.text || "").toLowerCase();
35
+ const period = text.includes("today") ? "today" : text.includes("30d") || text.includes("month") ? "30d" : "7d";
36
+
37
+ const result = await client.getKolLeaderboard({ period, limit: "10" });
38
+
39
+ if (result.error) {
40
+ callback?.({ text: result.status === 402
41
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
42
+ : `Error: ${result.error}` });
43
+ return undefined;
44
+ }
45
+
46
+ const data = result.data as { leaderboard: Array<{ name: string; pnl_sol: number; buy_count: number; sell_count: number; win_rate: number | null }> };
47
+ const lines = (data.leaderboard || []).map(
48
+ (k, i) => `${i + 1}. ${k.name}: ${k.pnl_sol > 0 ? "+" : ""}${k.pnl_sol.toFixed(2)} SOL PnL (${k.buy_count}B/${k.sell_count}S${k.win_rate != null ? `, ${(k.win_rate * 100).toFixed(0)}% WR` : ""})`
49
+ );
50
+
51
+ callback?.({
52
+ text: `KOL Leaderboard (${period}):\n${lines.join("\n") || "No data for this period."}`,
53
+ content: data,
54
+ });
55
+ return undefined;
56
+ },
57
+
58
+ examples: [
59
+ [
60
+ { name: "user1", content: { text: "Show me the top performing KOLs this week" } },
61
+ { name: "assistant", content: { text: "Here are the top KOLs by PnL..." } },
62
+ ],
63
+ ] as Action["examples"],
64
+ };
package/src/client.ts ADDED
@@ -0,0 +1,130 @@
1
+ /**
2
+ * MadeOnSol API client.
3
+ * Supports 3 auth modes: API key (simplest), RapidAPI key, or x402 micropayments.
4
+ */
5
+
6
+ const DEFAULT_BASE = "https://madeonsol.com";
7
+ const RAPIDAPI_HOST = "madeonsol-solana-kol-tracker-tools-api.p.rapidapi.com";
8
+
9
+ type AuthMode = "madeonsol" | "rapidapi" | "x402" | "none";
10
+
11
+ export interface MadeOnSolClientOptions {
12
+ baseUrl?: string;
13
+ /** MadeOnSol API key (get one free at madeonsol.com/developer). Preferred. */
14
+ apiKey?: string;
15
+ /** RapidAPI subscription key. */
16
+ rapidApiKey?: string;
17
+ /** x402 payment-enabled fetch (for AI agents with SVM_PRIVATE_KEY). */
18
+ fetchFn?: typeof fetch;
19
+ }
20
+
21
+ export class MadeOnSolClient {
22
+ private baseUrl: string;
23
+ private fetchFn: typeof fetch;
24
+ private authMode: AuthMode;
25
+ private authHeaders: Record<string, string>;
26
+
27
+ constructor(options: MadeOnSolClientOptions = {}) {
28
+ this.baseUrl = options.baseUrl || DEFAULT_BASE;
29
+ this.fetchFn = options.fetchFn || globalThis.fetch;
30
+ this.authHeaders = {};
31
+
32
+ if (options.apiKey) {
33
+ this.authMode = "madeonsol";
34
+ this.authHeaders = { Authorization: `Bearer ${options.apiKey}` };
35
+ } else if (options.rapidApiKey) {
36
+ this.authMode = "rapidapi";
37
+ this.authHeaders = { "x-rapidapi-key": options.rapidApiKey, "x-rapidapi-host": RAPIDAPI_HOST };
38
+ } else if (options.fetchFn) {
39
+ this.authMode = "x402";
40
+ } else {
41
+ this.authMode = "none";
42
+ }
43
+ }
44
+
45
+ async query<T = unknown>(path: string, params?: Record<string, string | undefined>): Promise<{ data?: T; error?: string; status: number }> {
46
+ const apiPath = this.authMode === "x402" || this.authMode === "none"
47
+ ? path
48
+ : path.replace("/api/x402/", "/api/v1/");
49
+ const url = new URL(apiPath, this.baseUrl);
50
+ if (params) {
51
+ for (const [k, v] of Object.entries(params)) {
52
+ if (v !== undefined) url.searchParams.set(k, v);
53
+ }
54
+ }
55
+
56
+ const res = this.authMode === "x402"
57
+ ? await this.fetchFn(url.toString(), { method: "GET" })
58
+ : await this.fetchFn(url.toString(), { method: "GET", headers: this.authHeaders });
59
+
60
+ if (res.status === 402) {
61
+ const body = await res.json();
62
+ return { error: `Payment required: ${JSON.stringify(body.accepts?.[0] || body)}`, status: 402 };
63
+ }
64
+
65
+ if (!res.ok) {
66
+ const text = await res.text().catch(() => "Unknown error");
67
+ return { error: text, status: res.status };
68
+ }
69
+
70
+ const data = await res.json() as T;
71
+ return { data, status: res.status };
72
+ }
73
+
74
+ getKolFeed(params?: { limit?: string; action?: string; kol?: string }) {
75
+ return this.query("/api/x402/kol/feed", params);
76
+ }
77
+
78
+ getKolCoordination(params?: { period?: string; min_kols?: string; limit?: string }) {
79
+ return this.query("/api/x402/kol/coordination", params);
80
+ }
81
+
82
+ getKolLeaderboard(params?: { period?: string; limit?: string }) {
83
+ return this.query("/api/x402/kol/leaderboard", params);
84
+ }
85
+
86
+ getDeployerAlerts(params?: { since?: string; limit?: string; offset?: string }) {
87
+ return this.query("/api/x402/deployer-hunter/alerts", params);
88
+ }
89
+
90
+ // ── Webhook management (requires API key or RapidAPI key with Pro/Ultra) ──
91
+
92
+ private async restRequest<T = unknown>(method: string, path: string, body?: unknown): Promise<{ data?: T; error?: string; status: number }> {
93
+ if (this.authMode !== "madeonsol" && this.authMode !== "rapidapi") {
94
+ return { error: "API key or RapidAPI key required for webhook/streaming features. Get a free key at madeonsol.com/developer", status: 401 };
95
+ }
96
+ const res = await this.fetchFn(`${this.baseUrl}/api/v1${path}`, {
97
+ method,
98
+ headers: {
99
+ "Content-Type": "application/json",
100
+ ...this.authHeaders,
101
+ },
102
+ ...(body ? { body: JSON.stringify(body) } : {}),
103
+ });
104
+ if (!res.ok) {
105
+ const text = await res.text().catch(() => "Unknown error");
106
+ return { error: text, status: res.status };
107
+ }
108
+ return { data: await res.json() as T, status: res.status };
109
+ }
110
+
111
+ createWebhook(params: { url: string; events: string[]; filters?: Record<string, unknown> }) {
112
+ return this.restRequest("POST", "/webhooks", params);
113
+ }
114
+
115
+ listWebhooks() {
116
+ return this.restRequest("GET", "/webhooks");
117
+ }
118
+
119
+ deleteWebhook(id: number) {
120
+ return this.restRequest("DELETE", `/webhooks/${id}`);
121
+ }
122
+
123
+ testWebhook(webhookId: number) {
124
+ return this.restRequest("POST", "/webhooks/test", { webhook_id: webhookId });
125
+ }
126
+
127
+ getStreamToken() {
128
+ return this.restRequest("POST", "/stream/token");
129
+ }
130
+ }
package/src/index.ts ADDED
@@ -0,0 +1,67 @@
1
+ import type { Plugin, IAgentRuntime } from "@elizaos/core";
2
+ import { kolFeedAction } from "./actions/kol-feed.js";
3
+ import { kolCoordinationAction } from "./actions/kol-coordination.js";
4
+ import { kolLeaderboardAction } from "./actions/kol-leaderboard.js";
5
+ import { deployerAlertsAction } from "./actions/deployer-alerts.js";
6
+ import { MadeOnSolClient } from "./client.js";
7
+
8
+ /** Key used to store the initialized client on the runtime */
9
+ export const MADEONSOL_CLIENT_KEY = "madeonsol:client";
10
+
11
+ export const madeOnSolPlugin: Plugin = {
12
+ name: "madeonsol",
13
+ description:
14
+ "Query Solana KOL trading intelligence and deployer analytics from MadeOnSol. Tracks 946 KOL wallets and 4000+ Pump.fun deployers.",
15
+ actions: [
16
+ kolFeedAction,
17
+ kolCoordinationAction,
18
+ kolLeaderboardAction,
19
+ deployerAlertsAction,
20
+ ],
21
+
22
+ /**
23
+ * Initialize the MadeOnSol client.
24
+ * Auth priority: MADEONSOL_API_KEY > RAPIDAPI_KEY > SVM_PRIVATE_KEY (x402).
25
+ * Get a free API key at madeonsol.com/developer — no wallet needed.
26
+ */
27
+ init: async (_config: Record<string, string>, runtime: IAgentRuntime) => {
28
+ const baseUrl = String(runtime.getSetting?.("MADEONSOL_API_URL") || "https://madeonsol.com");
29
+ const apiKey = runtime.getSetting?.("MADEONSOL_API_KEY") as string | undefined;
30
+ const rapidApiKey = runtime.getSetting?.("RAPIDAPI_KEY") as string | undefined;
31
+ const privateKey = runtime.getSetting?.("SVM_PRIVATE_KEY") as string | undefined;
32
+
33
+ let fetchFn: typeof fetch | undefined;
34
+
35
+ if (apiKey) {
36
+ console.log("[madeonsol] Using MadeOnSol API key (Bearer auth)");
37
+ } else if (rapidApiKey) {
38
+ console.log("[madeonsol] Using RapidAPI key");
39
+ } else if (privateKey) {
40
+ try {
41
+ const { wrapFetchWithPayment } = await import("@x402/fetch");
42
+ const { x402Client } = await import("@x402/core/client");
43
+ const { ExactSvmScheme } = await import("@x402/svm/exact/client");
44
+ const { createKeyPairSignerFromBytes } = await import("@solana/kit");
45
+ const { base58 } = await import("@scure/base");
46
+
47
+ const signer = await createKeyPairSignerFromBytes(base58.decode(privateKey));
48
+ const client = new x402Client();
49
+ client.register("solana:*", new ExactSvmScheme(signer));
50
+ fetchFn = wrapFetchWithPayment(fetch, client);
51
+
52
+ console.log(`[madeonsol] x402 payments enabled, wallet: ${signer.address}`);
53
+ } catch (err) {
54
+ console.warn("[madeonsol] x402 payment setup failed:", err);
55
+ }
56
+ } else {
57
+ console.log("[madeonsol] No auth configured. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY.");
58
+ }
59
+
60
+ const madeOnSolClient = new MadeOnSolClient({ baseUrl, apiKey, rapidApiKey, fetchFn });
61
+ (runtime as unknown as Record<string, unknown>)[MADEONSOL_CLIENT_KEY] = madeOnSolClient;
62
+ },
63
+ };
64
+
65
+ export default madeOnSolPlugin;
66
+ export { MadeOnSolClient } from "./client.js";
67
+ export { kolFeedAction, kolCoordinationAction, kolLeaderboardAction, deployerAlertsAction };
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "declaration": true,
7
+ "outDir": "dist",
8
+ "rootDir": "src",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true
12
+ },
13
+ "include": ["src"]
14
+ }
package/LICENSE DELETED
@@ -1 +0,0 @@
1
- MIT License