solana-traderclaw 1.0.135 → 1.0.136

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.
@@ -127,7 +127,7 @@ async function rawFetch(url, method, body, bearerToken, timeout = 15e3) {
127
127
  clearTimeout(timer);
128
128
  }
129
129
  }
130
- var SessionManager = class {
130
+ var SessionManager = class _SessionManager {
131
131
  baseUrl;
132
132
  apiKey;
133
133
  accessToken = null;
@@ -150,6 +150,8 @@ var SessionManager = class {
150
150
  tokenGeneration = 0;
151
151
  proactiveRefreshTimer = null;
152
152
  proactiveRefreshRunning = false;
153
+ lastChallengeAttemptAt = 0;
154
+ static CHALLENGE_COOLDOWN_MS = 5 * 60 * 1e3;
153
155
  constructor(config) {
154
156
  this.baseUrl = config.baseUrl.replace(/\/+$/, "");
155
157
  this.apiKey = config.apiKey;
@@ -339,6 +341,15 @@ var SessionManager = class {
339
341
  }
340
342
  }
341
343
  this.log.info("[session] Starting challenge flow...");
344
+ const nowMs = Date.now();
345
+ const sinceLastChallenge = nowMs - this.lastChallengeAttemptAt;
346
+ if (this.lastChallengeAttemptAt > 0 && sinceLastChallenge < _SessionManager.CHALLENGE_COOLDOWN_MS) {
347
+ const waitSec = Math.ceil((_SessionManager.CHALLENGE_COOLDOWN_MS - sinceLastChallenge) / 1e3);
348
+ throw new Error(
349
+ `[session] Challenge cooldown active \u2014 skipping to prevent server flood. Retry in ${waitSec}s. Last attempt: ${new Date(this.lastChallengeAttemptAt).toISOString()}`
350
+ );
351
+ }
352
+ this.lastChallengeAttemptAt = nowMs;
342
353
  const challenge = await this.requestChallenge();
343
354
  let walletPubKey;
344
355
  let walletSig;
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-IAQC34O7.js";
6
6
  import {
7
7
  SessionManager
8
- } from "./chunk-6IS5XPDB.js";
8
+ } from "./chunk-NEMH5KB5.js";
9
9
  import {
10
10
  looksLikeTelegramChatId,
11
11
  resolveTelegramRecipientToChatId
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SessionManager
3
- } from "../chunk-6IS5XPDB.js";
3
+ } from "../chunk-NEMH5KB5.js";
4
4
  export {
5
5
  SessionManager
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solana-traderclaw",
3
- "version": "1.0.135",
3
+ "version": "1.0.136",
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",