@madeonsol/plugin-madeonsol 0.2.1 → 0.3.1

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,44 +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
- ### RapidAPI Features (optional)
52
-
53
- With `RAPIDAPI_KEY` set, the plugin also provides webhook management and WebSocket streaming tokens. Ultra subscribers get access to the **DEX Trade Stream** — a real-time feed of every Solana DEX trade via `wss://madeonsol.com/ws/v1/dex-stream`.
54
-
55
- ## Wallet requirements
56
-
57
- The wallet needs:
58
- - ~0.01 SOL for transaction fees
59
- - USDC balance (even $0.10 covers 20+ requests)
60
-
61
60
  ## Discovery endpoint
62
61
 
63
62
  ```
64
63
  GET https://madeonsol.com/api/x402
65
64
  ```
66
65
 
67
- Returns all available endpoints, prices, and parameter docs. No payment required.
66
+ Returns all available endpoints, prices, and parameter docs. No auth required.
68
67
 
69
68
  ## Also Available
70
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,8 +57,36 @@ export declare class MadeOnSolClient {
55
57
  error?: string;
56
58
  status: number;
57
59
  }>;
58
- private rapidApiKey?;
59
- setRapidApiKey(key: string): void;
60
+ getKolPairs(params?: {
61
+ period?: string;
62
+ min_shared?: string;
63
+ limit?: string;
64
+ }): Promise<{
65
+ data?: unknown;
66
+ error?: string;
67
+ status: number;
68
+ }>;
69
+ getKolHotTokens(params?: {
70
+ period?: string;
71
+ min_kols?: string;
72
+ limit?: string;
73
+ }): Promise<{
74
+ data?: unknown;
75
+ error?: string;
76
+ status: number;
77
+ }>;
78
+ getKolTiming(wallet: string, params?: {
79
+ period?: string;
80
+ }): Promise<{
81
+ data?: unknown;
82
+ error?: string;
83
+ status: number;
84
+ }>;
85
+ getDeployerTrajectory(wallet: string): Promise<{
86
+ data?: unknown;
87
+ error?: string;
88
+ status: number;
89
+ }>;
60
90
  private restRequest;
61
91
  createWebhook(params: {
62
92
  url: string;
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,21 +65,29 @@ export class MadeOnSolClient {
42
65
  getDeployerAlerts(params) {
43
66
  return this.query("/api/x402/deployer-hunter/alerts", params);
44
67
  }
45
- // ── Webhook management (requires RAPIDAPI_KEY) ──
46
- rapidApiKey;
47
- setRapidApiKey(key) {
48
- this.rapidApiKey = key;
68
+ getKolPairs(params) {
69
+ return this.query("/api/x402/kol/pairs", params);
70
+ }
71
+ getKolHotTokens(params) {
72
+ return this.query("/api/x402/kol/tokens/hot", params);
73
+ }
74
+ getKolTiming(wallet, params) {
75
+ const qs = params?.period ? `?period=${params.period}` : "";
76
+ return this.restRequest("GET", `/kol/${wallet}/timing${qs}`);
77
+ }
78
+ getDeployerTrajectory(wallet) {
79
+ return this.restRequest("GET", `/deployer-hunter/${wallet}/trajectory`);
49
80
  }
81
+ // ── Webhook management (requires API key or RapidAPI key with Pro/Ultra) ──
50
82
  async restRequest(method, path, body) {
51
- if (!this.rapidApiKey) {
52
- return { error: "RAPIDAPI_KEY required for webhook/streaming features", status: 401 };
83
+ if (this.authMode !== "madeonsol" && this.authMode !== "rapidapi") {
84
+ return { error: "API key or RapidAPI key required for webhook/streaming features. Get a free key at madeonsol.com/developer", status: 401 };
53
85
  }
54
86
  const res = await this.fetchFn(`${this.baseUrl}/api/v1${path}`, {
55
87
  method,
56
88
  headers: {
57
89
  "Content-Type": "application/json",
58
- "x-rapidapi-key": this.rapidApiKey,
59
- "x-rapidapi-host": "madeonsol-solana-kol-tracker-tools-api.p.rapidapi.com",
90
+ ...this.authHeaders,
60
91
  },
61
92
  ...(body ? { body: JSON.stringify(body) } : {}),
62
93
  });
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,19 +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)");
45
- }
46
- const madeOnSolClient = new MadeOnSolClient({ baseUrl, fetchFn });
47
- // Enable webhook/streaming features if RAPIDAPI_KEY is provided
48
- const rapidApiKey = runtime.getSetting?.("RAPIDAPI_KEY");
49
- if (rapidApiKey) {
50
- madeOnSolClient.setRapidApiKey(rapidApiKey);
51
- console.log("[madeonsol] Webhook & streaming features enabled (RAPIDAPI_KEY set)");
52
+ console.log("[madeonsol] No auth configured. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY.");
52
53
  }
54
+ const madeOnSolClient = new MadeOnSolClient({ baseUrl, apiKey, rapidApiKey, fetchFn });
53
55
  runtime[MADEONSOL_CLIENT_KEY] = madeOnSolClient;
54
56
  },
55
57
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madeonsol/plugin-madeonsol",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
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",
@@ -38,7 +38,7 @@ export const deployerAlertsAction: Action = {
38
38
 
39
39
  if (result.error) {
40
40
  callback?.({ text: result.status === 402
41
- ? "x402 payment required but no wallet configured. Set SVM_PRIVATE_KEY to enable automatic USDC payments."
41
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
42
42
  : `Error: ${result.error}` });
43
43
  return undefined;
44
44
  }
@@ -38,7 +38,7 @@ export const kolCoordinationAction: Action = {
38
38
 
39
39
  if (result.error) {
40
40
  callback?.({ text: result.status === 402
41
- ? "x402 payment required but no wallet configured. Set SVM_PRIVATE_KEY to enable automatic USDC payments."
41
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
42
42
  : `Error: ${result.error}` });
43
43
  return undefined;
44
44
  }
@@ -39,7 +39,7 @@ export const kolFeedAction: Action = {
39
39
 
40
40
  if (result.error) {
41
41
  callback?.({ text: result.status === 402
42
- ? "x402 payment required but no wallet configured. Set SVM_PRIVATE_KEY to enable automatic USDC payments."
42
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
43
43
  : `Error: ${result.error}` });
44
44
  return undefined;
45
45
  }
@@ -38,7 +38,7 @@ export const kolLeaderboardAction: Action = {
38
38
 
39
39
  if (result.error) {
40
40
  callback?.({ text: result.status === 402
41
- ? "x402 payment required but no wallet configured. Set SVM_PRIVATE_KEY to enable automatic USDC payments."
41
+ ? "Authentication required. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY."
42
42
  : `Error: ${result.error}` });
43
43
  return undefined;
44
44
  }
package/src/client.ts CHANGED
@@ -1,38 +1,61 @@
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
 
6
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";
7
10
 
8
11
  export interface MadeOnSolClientOptions {
9
12
  baseUrl?: string;
10
- /**
11
- * A fetch function that handles x402 payments automatically.
12
- * Created via wrapFetchWithPayment() from @x402/fetch.
13
- * If not provided, uses plain fetch (requests will return 402).
14
- */
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). */
15
18
  fetchFn?: typeof fetch;
16
19
  }
17
20
 
18
21
  export class MadeOnSolClient {
19
22
  private baseUrl: string;
20
23
  private fetchFn: typeof fetch;
24
+ private authMode: AuthMode;
25
+ private authHeaders: Record<string, string>;
21
26
 
22
27
  constructor(options: MadeOnSolClientOptions = {}) {
23
28
  this.baseUrl = options.baseUrl || DEFAULT_BASE;
24
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
+ }
25
43
  }
26
44
 
27
45
  async query<T = unknown>(path: string, params?: Record<string, string | undefined>): Promise<{ data?: T; error?: string; status: number }> {
28
- const url = new URL(path, this.baseUrl);
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);
29
50
  if (params) {
30
51
  for (const [k, v] of Object.entries(params)) {
31
52
  if (v !== undefined) url.searchParams.set(k, v);
32
53
  }
33
54
  }
34
55
 
35
- const res = await this.fetchFn(url.toString(), { method: "GET" });
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 });
36
59
 
37
60
  if (res.status === 402) {
38
61
  const body = await res.json();
@@ -64,24 +87,34 @@ export class MadeOnSolClient {
64
87
  return this.query("/api/x402/deployer-hunter/alerts", params);
65
88
  }
66
89
 
67
- // ── Webhook management (requires RAPIDAPI_KEY) ──
90
+ getKolPairs(params?: { period?: string; min_shared?: string; limit?: string }) {
91
+ return this.query("/api/x402/kol/pairs", params);
92
+ }
68
93
 
69
- private rapidApiKey?: string;
94
+ getKolHotTokens(params?: { period?: string; min_kols?: string; limit?: string }) {
95
+ return this.query("/api/x402/kol/tokens/hot", params);
96
+ }
70
97
 
71
- setRapidApiKey(key: string) {
72
- this.rapidApiKey = key;
98
+ getKolTiming(wallet: string, params?: { period?: string }) {
99
+ const qs = params?.period ? `?period=${params.period}` : "";
100
+ return this.restRequest("GET", `/kol/${wallet}/timing${qs}`);
73
101
  }
74
102
 
103
+ getDeployerTrajectory(wallet: string) {
104
+ return this.restRequest("GET", `/deployer-hunter/${wallet}/trajectory`);
105
+ }
106
+
107
+ // ── Webhook management (requires API key or RapidAPI key with Pro/Ultra) ──
108
+
75
109
  private async restRequest<T = unknown>(method: string, path: string, body?: unknown): Promise<{ data?: T; error?: string; status: number }> {
76
- if (!this.rapidApiKey) {
77
- return { error: "RAPIDAPI_KEY required for webhook/streaming features", status: 401 };
110
+ if (this.authMode !== "madeonsol" && this.authMode !== "rapidapi") {
111
+ return { error: "API key or RapidAPI key required for webhook/streaming features. Get a free key at madeonsol.com/developer", status: 401 };
78
112
  }
79
113
  const res = await this.fetchFn(`${this.baseUrl}/api/v1${path}`, {
80
114
  method,
81
115
  headers: {
82
116
  "Content-Type": "application/json",
83
- "x-rapidapi-key": this.rapidApiKey,
84
- "x-rapidapi-host": "madeonsol-solana-kol-tracker-tools-api.p.rapidapi.com",
117
+ ...this.authHeaders,
85
118
  },
86
119
  ...(body ? { body: JSON.stringify(body) } : {}),
87
120
  });
package/src/index.ts CHANGED
@@ -11,7 +11,7 @@ export const MADEONSOL_CLIENT_KEY = "madeonsol:client";
11
11
  export const madeOnSolPlugin: Plugin = {
12
12
  name: "madeonsol",
13
13
  description:
14
- "Query Solana KOL trading intelligence and deployer analytics from MadeOnSol via x402 micropayments. Tracks 946 KOL wallets and 4000+ Pump.fun deployers.",
14
+ "Query Solana KOL trading intelligence and deployer analytics from MadeOnSol. Tracks 946 KOL wallets and 4000+ Pump.fun deployers.",
15
15
  actions: [
16
16
  kolFeedAction,
17
17
  kolCoordinationAction,
@@ -20,17 +20,23 @@ export const madeOnSolPlugin: Plugin = {
20
20
  ],
21
21
 
22
22
  /**
23
- * Initialize the x402 payment-enabled client.
24
- * Requires SVM_PRIVATE_KEY in the runtime settings for automatic payments.
25
- * Without it, the plugin still works but requests will return 402 payment info.
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
26
  */
27
27
  init: async (_config: Record<string, string>, runtime: IAgentRuntime) => {
28
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;
29
31
  const privateKey = runtime.getSetting?.("SVM_PRIVATE_KEY") as string | undefined;
30
32
 
31
33
  let fetchFn: typeof fetch | undefined;
32
34
 
33
- if (privateKey) {
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) {
34
40
  try {
35
41
  const { wrapFetchWithPayment } = await import("@x402/fetch");
36
42
  const { x402Client } = await import("@x402/core/client");
@@ -45,21 +51,13 @@ export const madeOnSolPlugin: Plugin = {
45
51
 
46
52
  console.log(`[madeonsol] x402 payments enabled, wallet: ${signer.address}`);
47
53
  } catch (err) {
48
- console.warn("[madeonsol] x402 payment setup failed, running in read-only mode:", err);
54
+ console.warn("[madeonsol] x402 payment setup failed:", err);
49
55
  }
50
56
  } else {
51
- console.log("[madeonsol] No SVM_PRIVATE_KEY running in read-only mode (402 info only)");
52
- }
53
-
54
- const madeOnSolClient = new MadeOnSolClient({ baseUrl, fetchFn });
55
-
56
- // Enable webhook/streaming features if RAPIDAPI_KEY is provided
57
- const rapidApiKey = runtime.getSetting?.("RAPIDAPI_KEY") as string | undefined;
58
- if (rapidApiKey) {
59
- madeOnSolClient.setRapidApiKey(rapidApiKey);
60
- console.log("[madeonsol] Webhook & streaming features enabled (RAPIDAPI_KEY set)");
57
+ console.log("[madeonsol] No auth configured. Set MADEONSOL_API_KEY (free at madeonsol.com/developer), RAPIDAPI_KEY, or SVM_PRIVATE_KEY.");
61
58
  }
62
59
 
60
+ const madeOnSolClient = new MadeOnSolClient({ baseUrl, apiKey, rapidApiKey, fetchFn });
63
61
  (runtime as unknown as Record<string, unknown>)[MADEONSOL_CLIENT_KEY] = madeOnSolClient;
64
62
  },
65
63
  };