solana-traderclaw 1.0.102 → 1.0.103

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.
@@ -163,7 +163,7 @@ var AlphaStreamManager = class {
163
163
  this.log("info", `Connecting to alpha stream: ${this.config.wsUrl}`);
164
164
  return new Promise((resolve, reject) => {
165
165
  try {
166
- this.ws = new WebSocket(url);
166
+ this.ws = new WebSocket(url, { perMessageDeflate: false, handshakeTimeout: 1e4 });
167
167
  } catch (err) {
168
168
  reject(err);
169
169
  return;
@@ -346,7 +346,7 @@ var SessionManager = class {
346
346
  const walletPrivateKey = (await this.walletPrivateKeyProvider?.())?.trim();
347
347
  if (!walletPrivateKey) {
348
348
  throw new Error(
349
- `Wallet proof required but no walletPrivateKey configured. This account already has a wallet \u2014 set TRADERCLAW_WALLET_PRIVATE_KEY in the OpenClaw gateway process environment (e.g. systemd), not only in an SSH shell, then restart the gateway. The key is used only for local signing and is never sent to the orchestrator. Do not store private keys in openclaw.json. Troubleshooting: ${TRADERCLAW_SESSION_TROUBLESHOOTING}`
349
+ `Wallet proof required but the gateway cannot sign interactively \u2014 no wallet key is wired into this process. This account already has a wallet. On the host that runs OpenClaw (with a normal terminal / TTY), run: traderclaw login \u2014 complete wallet proof when prompted \u2014 then openclaw gateway restart. That persists new session tokens without putting a private key in the gateway configuration. Do not paste private keys into openclaw.json. Troubleshooting: ${TRADERCLAW_SESSION_TROUBLESHOOTING}`
350
350
  );
351
351
  }
352
352
  walletPubKey = challenge.walletPublicKey || this.walletPublicKey || void 0;
@@ -376,7 +376,7 @@ var SessionManager = class {
376
376
  await this.unifiedRefresh();
377
377
  if (!this.accessToken) {
378
378
  throw new Error(
379
- `Session expired and could not be refreshed. Re-authentication required. Troubleshooting: ${TRADERCLAW_SESSION_TROUBLESHOOTING}`
379
+ `Session expired and could not be refreshed. Re-authentication required. On the gateway host try: traderclaw login \u2014 then openclaw gateway restart. Troubleshooting: ${TRADERCLAW_SESSION_TROUBLESHOOTING}`
380
380
  );
381
381
  }
382
382
  return this.accessToken;
@@ -387,7 +387,7 @@ var SessionManager = class {
387
387
  await this.unifiedRefresh();
388
388
  if (!this.accessToken) {
389
389
  throw new Error(
390
- `Session expired and could not be refreshed. Re-authentication required. Troubleshooting: ${TRADERCLAW_SESSION_TROUBLESHOOTING}`
390
+ `Session expired and could not be refreshed. Re-authentication required. On the gateway host try: traderclaw login \u2014 then openclaw gateway restart. Troubleshooting: ${TRADERCLAW_SESSION_TROUBLESHOOTING}`
391
391
  );
392
392
  }
393
393
  return this.accessToken;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-SBYHSJLU.js";
4
4
  import {
5
5
  SessionManager
6
- } from "./chunk-VVEKPKW3.js";
6
+ } from "./chunk-OXQX7Y2B.js";
7
7
  import {
8
8
  looksLikeTelegramChatId,
9
9
  resolveTelegramRecipientToChatId
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-3UQIQJPQ.js";
19
19
  import {
20
20
  AlphaStreamManager
21
- } from "./chunk-JVQNXWBW.js";
21
+ } from "./chunk-KNJVODJC.js";
22
22
  import {
23
23
  BitqueryStreamManager
24
24
  } from "./chunk-S2DLZKMQ.js";
@@ -771,6 +771,18 @@ function registerWebFetchTool(api, Type2, logPrefix, options) {
771
771
  }
772
772
 
773
773
  // index.ts
774
+ var TRADERCLAW_WALLET_PRIVATE_KEY_ENV = "TRADERCLAW_WALLET_PRIVATE_KEY";
775
+ function walletPrivateKeyFromPluginConfigRecord(obj) {
776
+ const w = typeof obj.walletPrivateKey === "string" ? obj.walletPrivateKey.trim() : "";
777
+ return w.length > 0 ? w : void 0;
778
+ }
779
+ function resolveEffectiveWalletPrivateKey(walletPrivateKeyFromPluginConfig) {
780
+ if (walletPrivateKeyFromPluginConfig && walletPrivateKeyFromPluginConfig.trim().length > 0) {
781
+ return walletPrivateKeyFromPluginConfig.trim();
782
+ }
783
+ const fromEnv = process.env[TRADERCLAW_WALLET_PRIVATE_KEY_ENV]?.trim();
784
+ return fromEnv && fromEnv.length > 0 ? fromEnv : void 0;
785
+ }
774
786
  function parseConfig(raw) {
775
787
  const obj = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
776
788
  const orchestratorUrl = typeof obj.orchestratorUrl === "string" ? obj.orchestratorUrl : "";
@@ -779,7 +791,7 @@ function parseConfig(raw) {
779
791
  const externalUserId = typeof obj.externalUserId === "string" ? obj.externalUserId : void 0;
780
792
  const refreshToken = typeof obj.refreshToken === "string" ? obj.refreshToken : void 0;
781
793
  const walletPublicKey = typeof obj.walletPublicKey === "string" ? obj.walletPublicKey : void 0;
782
- const walletPrivateKey = typeof obj.walletPrivateKey === "string" ? obj.walletPrivateKey : void 0;
794
+ const walletPrivateKey = resolveEffectiveWalletPrivateKey(walletPrivateKeyFromPluginConfigRecord(obj));
783
795
  const apiTimeout = typeof obj.apiTimeout === "number" ? obj.apiTimeout : 12e4;
784
796
  const agentId = typeof obj.agentId === "string" ? obj.agentId : void 0;
785
797
  const gatewayBaseUrl = typeof obj.gatewayBaseUrl === "string" ? obj.gatewayBaseUrl : void 0;
@@ -903,6 +915,8 @@ var solanaTraderPlugin = {
903
915
  name: "Solana Trader",
904
916
  description: "Autonomous Solana memecoin trading agent \u2014 V1-Upgraded with intelligence lab, tool envelopes, prompt scrubbing, and split skill architecture",
905
917
  register(api) {
918
+ const pluginConfigRaw = api.pluginConfig && typeof api.pluginConfig === "object" && !Array.isArray(api.pluginConfig) ? api.pluginConfig : {};
919
+ const walletPrivateKeyFromPluginJsonOnly = walletPrivateKeyFromPluginConfigRecord(pluginConfigRaw);
906
920
  const config = parseConfig(api.pluginConfig);
907
921
  const { orchestratorUrl, walletId, apiKey, apiTimeout } = config;
908
922
  if (!orchestratorUrl) {
@@ -954,18 +968,16 @@ var solanaTraderPlugin = {
954
968
  initialAccessToken = sidecar.accessToken;
955
969
  initialAccessTokenExpiresAt = sidecar.accessTokenExpiresAt;
956
970
  }
971
+ const walletProofKeySource = config.walletPrivateKey && walletPrivateKeyFromPluginJsonOnly ? "plugin_json" : config.walletPrivateKey ? "env" : "absent";
957
972
  api.logger.info(
958
- `[solana-trader] Session: sidecar=${sidecar ? "yes" : "no"}, refreshToken=${effectiveRefreshToken ? "present (" + effectiveRefreshToken.slice(0, 8) + "...)" : "MISSING"}, apiKey=${apiKey ? "present" : "MISSING"}, walletPublicKey=${effectiveWalletPublicKey ? "present" : "MISSING"}`
973
+ `[solana-trader] Session: sidecar=${sidecar ? "yes" : "no"}, refreshToken=${effectiveRefreshToken ? "present (" + effectiveRefreshToken.slice(0, 8) + "...)" : "MISSING"}, apiKey=${apiKey ? "present" : "MISSING"}, walletPublicKey=${effectiveWalletPublicKey ? "present" : "MISSING"}, walletProofSigningKey=${walletProofKeySource}`
959
974
  );
960
975
  const sessionManager = new SessionManager({
961
976
  baseUrl: orchestratorUrl,
962
977
  apiKey: apiKey || "",
963
978
  refreshToken: effectiveRefreshToken,
964
979
  walletPublicKey: effectiveWalletPublicKey,
965
- walletPrivateKeyProvider: () => {
966
- const k = config.walletPrivateKey;
967
- return typeof k === "string" && k.trim() ? k.trim() : void 0;
968
- },
980
+ walletPrivateKeyProvider: () => resolveEffectiveWalletPrivateKey(walletPrivateKeyFromPluginJsonOnly),
969
981
  recoverySecretProvider: async () => {
970
982
  const sidecarData = readSessionSidecar();
971
983
  const fromSidecar = sidecarData?.recoverySecret;
@@ -2,7 +2,7 @@ import {
2
2
  ALPHA_INGESTION_STALE_MS,
3
3
  ALPHA_STALE_GRACE_AFTER_CONNECT_MS,
4
4
  AlphaStreamManager
5
- } from "../chunk-JVQNXWBW.js";
5
+ } from "../chunk-KNJVODJC.js";
6
6
  export {
7
7
  ALPHA_INGESTION_STALE_MS,
8
8
  ALPHA_STALE_GRACE_AFTER_CONNECT_MS,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SessionManager
3
- } from "../chunk-VVEKPKW3.js";
3
+ } from "../chunk-OXQX7Y2B.js";
4
4
  export {
5
5
  SessionManager
6
6
  };
@@ -40,7 +40,7 @@
40
40
  "walletPrivateKey": {
41
41
  "type": "string",
42
42
  "deprecated": true,
43
- "description": "DEPRECATED use env TRADERCLAW_WALLET_PRIVATE_KEY or --wallet-private-key arg. Never store private keys in config files."
43
+ "description": "Optional base58 signing key when the server requires wallet proof. Prefer TRADERCLAW_WALLET_PRIVATE_KEY in OpenClaw/gateway merged env or systemd EnvironmentFile instead of plaintext JSON (never commit)."
44
44
  },
45
45
  "apiTimeout": {
46
46
  "type": "integer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solana-traderclaw",
3
- "version": "1.0.102",
3
+ "version": "1.0.103",
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",
@@ -26,15 +26,15 @@ You interact with the orchestrator **exclusively through plugin tools** (e.g. `s
26
26
 
27
27
  ### Official TraderClaw documentation — use before improvising fixes
28
28
 
29
- **Whenever** the user hits auth/session/wallet-proof errors, your **first** actionable step is to direct them to:
29
+ **Whenever** the user hits auth/session/wallet-proof errors, your **first** actionable steps on the **machine that runs OpenClaw** (interactive terminal / TTY) are: run **`traderclaw login`** (complete wallet proof when prompted), then **`openclaw gateway restart`**. Then point them to:
30
30
 
31
31
  https://docs.traderclaw.ai/docs/installation#troubleshooting-session-expired-auth-errors-or-the-agent-logged-out
32
32
 
33
33
  ### Wallet proof vs signup — do not conflate these
34
34
 
35
35
  - **Wallet proof** is NOT account signup. It is a cryptographic step proving wallet control.
36
- - **`traderclaw login`** reuses the saved refresh token when valid.
37
- - **OpenClaw gateway ≠ your SSH shell.** Exporting env vars in SSH does NOT inject them into the gateway service process.
36
+ - **`traderclaw login`** refreshes the session when possible and runs the challenge flow when needed; the gateway process itself cannot prompt for a signing key.
37
+ - **OpenClaw gateway ≠ your SSH shell.** The human must re-auth on the gateway host and restart the gateway so new tokens are loaded.
38
38
  - **Plugin id vs npm name:** `solana-traderclaw` is the npm package name, while `solana-trader` is the OpenClaw plugin id used in `plugins.entries` and `plugins.allow`.
39
39
 
40
40
  ---