@blockrun/clawrouter 0.12.26 → 0.12.27

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/cli.js CHANGED
@@ -5135,6 +5135,58 @@ function transformPaymentError(errorBody) {
5135
5135
  }
5136
5136
  }
5137
5137
  }
5138
+ if (parsed.error === "Payment verification failed" && parsed.code === "PAYMENT_INVALID" && parsed.debug) {
5139
+ const debugLower = parsed.debug.toLowerCase();
5140
+ const wallet = parsed.payer || "unknown";
5141
+ const shortWallet = wallet.length > 12 ? `${wallet.slice(0, 6)}...${wallet.slice(-4)}` : wallet;
5142
+ if (debugLower.includes("insufficient")) {
5143
+ return JSON.stringify({
5144
+ error: {
5145
+ message: "Insufficient Solana USDC balance.",
5146
+ type: "insufficient_funds",
5147
+ wallet,
5148
+ help: `Fund wallet ${shortWallet} with USDC on Solana, or switch to Base: /wallet base`
5149
+ }
5150
+ });
5151
+ }
5152
+ if (debugLower.includes("transaction_simulation_failed") || debugLower.includes("simulation")) {
5153
+ console.error(`[ClawRouter] Solana transaction simulation failed: ${parsed.debug}`);
5154
+ return JSON.stringify({
5155
+ error: {
5156
+ message: "Solana payment simulation failed. Retrying with a different model.",
5157
+ type: "transaction_simulation_failed",
5158
+ help: "This is usually temporary. If it persists, try: /model free"
5159
+ }
5160
+ });
5161
+ }
5162
+ if (debugLower.includes("invalid signature") || debugLower.includes("invalid_signature")) {
5163
+ return JSON.stringify({
5164
+ error: {
5165
+ message: "Solana payment signature invalid.",
5166
+ type: "invalid_payload",
5167
+ help: "Try again. If this persists, reinstall ClawRouter: curl -fsSL https://blockrun.ai/ClawRouter-update | bash"
5168
+ }
5169
+ });
5170
+ }
5171
+ if (debugLower.includes("expired")) {
5172
+ return JSON.stringify({
5173
+ error: {
5174
+ message: "Solana payment expired. Retrying.",
5175
+ type: "expired",
5176
+ help: "This is usually temporary."
5177
+ }
5178
+ });
5179
+ }
5180
+ console.error(`[ClawRouter] Solana payment verification failed: ${parsed.debug} payer=${wallet}`);
5181
+ return JSON.stringify({
5182
+ error: {
5183
+ message: `Solana payment verification failed: ${parsed.debug}`,
5184
+ type: "payment_invalid",
5185
+ wallet,
5186
+ help: "Try again or switch to Base: /wallet base"
5187
+ }
5188
+ });
5189
+ }
5138
5190
  if (parsed.error === "Settlement failed" || parsed.error === "Payment settlement failed" || parsed.details?.includes("Settlement failed") || parsed.details?.includes("transaction_simulation_failed")) {
5139
5191
  const details = parsed.details || "";
5140
5192
  const gasError = details.includes("unable to estimate gas");