solana-traderclaw 1.0.88 → 1.0.89
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/dist/{chunk-Q5AWKXY3.js → chunk-4G64IVJO.js} +7 -1
- package/dist/{chunk-PIZZXNMQ.js → chunk-NDPVVAV7.js} +4 -1
- package/dist/index.js +23 -2
- package/dist/src/http-client.js +1 -1
- package/dist/src/tool-envelope.js +1 -1
- package/package.json +1 -1
- package/skills/solana-trader/SKILL.md +19 -1
- package/skills/solana-trader/refs/api-reference.md +2 -0
- package/skills/solana-trader/workspace/TOOLS.md +7 -1
|
@@ -13,7 +13,13 @@ var ERROR_CLASSIFICATION = {
|
|
|
13
13
|
"404": { retryable: false, code: "NOT_FOUND" },
|
|
14
14
|
"500": { retryable: true, code: "SERVER_ERROR" },
|
|
15
15
|
"502": { retryable: true, code: "SERVER_ERROR" },
|
|
16
|
-
"503": { retryable: true, code: "SERVER_ERROR" }
|
|
16
|
+
"503": { retryable: true, code: "SERVER_ERROR" },
|
|
17
|
+
// Referral-specific codes (sent as "CODE: message" by http-client after extraction)
|
|
18
|
+
"REFERRAL_CODE_TAKEN": { retryable: false, code: "REFERRAL_CODE_TAKEN" },
|
|
19
|
+
"referral code already taken": { retryable: false, code: "REFERRAL_CODE_TAKEN" },
|
|
20
|
+
"REFERRAL_CODE_INVALID": { retryable: false, code: "REFERRAL_CODE_INVALID" },
|
|
21
|
+
"REFERRAL_CODE_ERROR": { retryable: false, code: "REFERRAL_CODE_ERROR" },
|
|
22
|
+
"alphanumeric": { retryable: false, code: "VALIDATION_ERROR" }
|
|
17
23
|
};
|
|
18
24
|
function generateTraceId() {
|
|
19
25
|
const ts = Date.now().toString(36);
|
|
@@ -49,7 +49,10 @@ async function doRequest(opts, isRetry = false) {
|
|
|
49
49
|
return doRequest({ ...opts, accessToken: newToken }, true);
|
|
50
50
|
}
|
|
51
51
|
if (!res.ok) {
|
|
52
|
-
const
|
|
52
|
+
const errBody = data && typeof data === "object" && !Array.isArray(data) ? data : null;
|
|
53
|
+
const errCode = typeof errBody?.code === "string" ? errBody.code : null;
|
|
54
|
+
const errText = typeof errBody?.message === "string" ? errBody.message : typeof errBody?.error === "string" ? errBody.error : `HTTP ${res.status}: ${text.slice(0, 200)}`;
|
|
55
|
+
const errMsg = errCode ? `${errCode}: ${errText}` : errText;
|
|
53
56
|
throw new Error(errMsg);
|
|
54
57
|
}
|
|
55
58
|
return data;
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
normalizeToolError,
|
|
10
10
|
normalizeToolSuccess,
|
|
11
11
|
renderToolEnvelope
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4G64IVJO.js";
|
|
13
13
|
import {
|
|
14
14
|
AlphaBuffer
|
|
15
15
|
} from "./chunk-3UQIQJPQ.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "./chunk-3YPZOXWE.js";
|
|
19
19
|
import {
|
|
20
20
|
orchestratorRequest
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-NDPVVAV7.js";
|
|
22
22
|
import {
|
|
23
23
|
IntelligenceLab
|
|
24
24
|
} from "./chunk-FBS5FGW2.js";
|
|
@@ -2073,6 +2073,27 @@ ${notes}
|
|
|
2073
2073
|
})
|
|
2074
2074
|
)
|
|
2075
2075
|
});
|
|
2076
|
+
api.registerTool({
|
|
2077
|
+
name: "solana_referral_profile",
|
|
2078
|
+
description: "Read your TraderClaw referral profile: your current referral code (null if not set), access window, tier, and earnings metadata. Call this when the user asks about their referral code, when ACCESS_LIMIT_REACHED is received, or to check whether a code has already been created. This endpoint remains accessible even after the runtime access window has expired \u2014 use it to help the user set up a referral code so they can regain access by referring others. If referralCode is null, prompt the user to choose a custom 4\u201316 alphanumeric code and call solana_referral_set_code with their input.",
|
|
2079
|
+
parameters: Type.Object({}),
|
|
2080
|
+
execute: wrapExecute("solana_referral_profile", async () => get("/api/referral/me"))
|
|
2081
|
+
});
|
|
2082
|
+
api.registerTool({
|
|
2083
|
+
name: "solana_referral_set_code",
|
|
2084
|
+
description: "Set or update your custom TraderClaw referral code. The code must be 4\u201316 alphanumeric characters; it is stored normalized to UPPERCASE. IMPORTANT: You must ask the user to provide the code \u2014 never invent or guess one. Suggest that the code be memorable (e.g. their username, brand, or handle). Once set, anyone who signs up using this code grants you +8 hours of access per active referral. This endpoint remains accessible even after the runtime access window has expired, so the user can always create or update their referral code. After setting the code, confirm the saved value from the response and share it with the user so they can start referring others. Expected errors (check ok=false + errorCode): REFERRAL_CODE_TAKEN \u2014 that exact code is already used by another account; ask the user to choose a different one. VALIDATION_ERROR \u2014 code does not meet the 4\u201316 alphanumeric rule; tell the user which constraint was violated. AUTH_ERROR \u2014 session expired; user must re-authenticate before setting the code.",
|
|
2085
|
+
parameters: Type.Object({
|
|
2086
|
+
referralCode: Type.String({
|
|
2087
|
+
description: "Custom referral code chosen by the user. Must be 4\u201316 alphanumeric characters (letters and digits only). Will be stored as UPPERCASE.",
|
|
2088
|
+
minLength: 4,
|
|
2089
|
+
maxLength: 16
|
|
2090
|
+
})
|
|
2091
|
+
}),
|
|
2092
|
+
execute: wrapExecute(
|
|
2093
|
+
"solana_referral_set_code",
|
|
2094
|
+
async (_id, params) => put("/api/referral/code", { referralCode: String(params.referralCode).trim().toUpperCase() })
|
|
2095
|
+
)
|
|
2096
|
+
});
|
|
2076
2097
|
api.registerTool({
|
|
2077
2098
|
name: "solana_bitquery_templates",
|
|
2078
2099
|
description: "List all available pre-built Bitquery query templates with descriptions and required variables. Call this first to discover what templates are available before using solana_bitquery_catalog. Returns 50+ templates organized by category covering Pump.fun, PumpSwap, Raydium, Jupiter, BonkSwap, and generic DEX analytics.",
|
package/dist/src/http-client.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solana-traderclaw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.89",
|
|
4
4
|
"description": "TraderClaw V1-Upgraded — Solana trading for OpenClaw with intelligence lab, tool envelopes, prompt scrubbing, read-only X social intel, and split skill docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,7 +19,7 @@ You interact with the orchestrator **exclusively through plugin tools** (e.g. `s
|
|
|
19
19
|
**Critical rules:**
|
|
20
20
|
- **You do NOT have direct HTTP/API access.** Never attempt to call REST endpoints, use curl/fetch, or construct API URLs.
|
|
21
21
|
- **You do NOT manage authentication.** Bearer tokens, access tokens, API keys, and session credentials are handled automatically by the plugin runtime.
|
|
22
|
-
- **You never sign up, register, or change API keys or wallet keys.** Account creation and credential updates happen only when the **human** runs `traderclaw signup` or `traderclaw setup` / `traderclaw setup --signup` on their machine.
|
|
22
|
+
- **You never sign up, register, or change API keys or wallet keys.** Account creation and credential updates happen only when the **human** runs `traderclaw signup` or `traderclaw setup` / `traderclaw setup --signup` on their machine. The only exception is `solana_referral_set_code`, which lets the user choose a custom referral code — you must always ask the user for the code, never generate one yourself.
|
|
23
23
|
- **Never try to independently verify endpoints.** If you want to check system health, call `solana_system_status`.
|
|
24
24
|
- **Tool errors ARE your diagnostics.** If a tool call returns an error, that error message is the definitive answer. Report the tool error and suggest the user run `traderclaw status` from their terminal.
|
|
25
25
|
- **The CLI handles raw API access.** Users can run `traderclaw status`, `traderclaw config show`, and `traderclaw login` from their terminal.
|
|
@@ -121,6 +121,24 @@ Alpha signals are **curated trading calls from real humans** in Telegram and Dis
|
|
|
121
121
|
|
|
122
122
|
---
|
|
123
123
|
|
|
124
|
+
## Access Limit and Referral Codes
|
|
125
|
+
|
|
126
|
+
When any tool returns an `ACCESS_LIMIT_REACHED` error, the user's runtime access window has expired. They can restore access by staking $TCLAW or by referring other users. Each active referral (someone who completes at least one trade) adds +8 hours.
|
|
127
|
+
|
|
128
|
+
**Your protocol when ACCESS_LIMIT_REACHED appears:**
|
|
129
|
+
|
|
130
|
+
1. Call `solana_referral_profile` to read the user's current referral code.
|
|
131
|
+
2. If `referralCode` is non-null, share it with the user as their active code they can give to others.
|
|
132
|
+
3. If `referralCode` is null, explain that they have not set a referral code yet and ask them to choose one:
|
|
133
|
+
- It must be 4–16 alphanumeric characters (letters and digits only).
|
|
134
|
+
- Suggest something memorable — their username, brand name, or a short phrase.
|
|
135
|
+
- **Never invent or guess a code** — always wait for the user's input.
|
|
136
|
+
- Once the user provides a code, call `solana_referral_set_code({ referralCode: "THEIRCODE" })`.
|
|
137
|
+
4. Both `solana_referral_profile` and `solana_referral_set_code` remain accessible even when the runtime window has expired, so the user can always manage their code regardless of access status.
|
|
138
|
+
5. Never show a placeholder like `(yourcode)` in user-facing text — always use the real code from `solana_referral_profile`, or explicitly guide the user to create one.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
124
142
|
## ⚠️ MANDATORY STARTUP SEQUENCE — Run This EVERY Session
|
|
125
143
|
|
|
126
144
|
**Exception:** If the incoming message starts with `CRON_JOB:`, skip startup and go directly to cron job handling.
|
|
@@ -73,6 +73,8 @@ All authenticated endpoints use `Authorization: Bearer <accessToken>`.
|
|
|
73
73
|
| `POST` | `/api/wallet/token-balance` | `walletId`, `tokenAddress` | On-chain SPL `uiAmount` (source of truth) for a specific mint in wallet. Use to verify actual holdings. |
|
|
74
74
|
| `POST` | `/api/wallet/sweep-dead-tokens` | `walletId` | Sells **100%** of each **open** position with `unrealizedReturnPct ≤ -maxLossPct`. Optional: `maxLossPct` (default **80**), `slippageBps`, `dryRun`. **`trade:execute` scope.** |
|
|
75
75
|
| `GET` | `/api/system/status` | — | System health and connectivity |
|
|
76
|
+
| `GET` | `/api/referral/me` | — | Read referral profile: `referralCode`, `accessUntil`, tier, earnings. **Runtime-gate exempt** — accessible even after access window expires. |
|
|
77
|
+
| `PUT` | `/api/referral/code` | `referralCode` (body) | Set or update custom referral code. Must be 4–16 alphanumeric characters; stored as UPPERCASE. **Runtime-gate exempt** — accessible even after access window expires. |
|
|
76
78
|
|
|
77
79
|
## Key Contract Notes
|
|
78
80
|
|
|
@@ -13,7 +13,7 @@ Things like:
|
|
|
13
13
|
- Rate limit observations
|
|
14
14
|
- Anything environment-specific
|
|
15
15
|
|
|
16
|
-
## Tool Inventory (
|
|
16
|
+
## Tool Inventory (103 tools — 100 Solana + 3 X read-only)
|
|
17
17
|
|
|
18
18
|
Every tool has a mandatory trigger — when the trigger condition is met, you MUST call the tool. "Cron-only" tools are called during cron jobs, not the heartbeat fast loop.
|
|
19
19
|
|
|
@@ -92,6 +92,12 @@ Every tool has a mandatory trigger — when the trigger condition is met, you MU
|
|
|
92
92
|
| `solana_entitlement_purchase` | Buy a plan | When user explicitly requests purchase |
|
|
93
93
|
| `solana_entitlement_upgrade` | Upgrade account tier | When user explicitly requests upgrade |
|
|
94
94
|
|
|
95
|
+
### Referral (2)
|
|
96
|
+
| Tool | Purpose | When to Call |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| `solana_referral_profile` | Read referral code and access window | On ACCESS_LIMIT_REACHED; when user asks about their referral code or access status |
|
|
99
|
+
| `solana_referral_set_code` | Set or update custom referral code (user must supply the code) | When referral code is null and user wants to start referring others; when user asks to create or change their code |
|
|
100
|
+
|
|
95
101
|
### Alpha Signals (5)
|
|
96
102
|
| Tool | Purpose | When to Call |
|
|
97
103
|
|---|---|---|
|