@solana/instruction-plans 6.3.0 → 6.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.
@@ -656,7 +656,7 @@ function createFailedToSendTransactionError(result, abortReason) {
656
656
  preflightData = unwrapped.preflightData;
657
657
  cause = unwrapped.unwrappedError;
658
658
  const indicator = getFailedIndicator(!!preflightData, result.context.signature);
659
- causeMessage = `${indicator}: ${cause.message}`;
659
+ causeMessage = `${indicator}: ${cause.message}${formatLogSnippet(logs)}`;
660
660
  } else {
661
661
  cause = abortReason;
662
662
  causeMessage = abortReason != null ? `. Canceled with abort reason: ${String(abortReason)}` : ": Canceled";
@@ -698,7 +698,8 @@ function createFailedToSendTransactionsError(result, abortReason) {
698
698
  return `
699
699
  [Tx #${index + 1}${indicator}] ${error.message}`;
700
700
  });
701
- causeMessages = `.${failureLines.join("")}`;
701
+ const logSnippet = failedTransactions.length === 1 ? formatLogSnippet(failedTransactions[0].logs) : "";
702
+ causeMessages = `.${failureLines.join("")}${logSnippet}`;
702
703
  } else {
703
704
  cause = abortReason;
704
705
  causeMessages = abortReason != null ? `. Canceled with abort reason: ${String(abortReason)}` : ": Canceled";
@@ -756,6 +757,16 @@ function findErrorFromTransactionPlanResult(result) {
756
757
  }
757
758
  }
758
759
  }
760
+ function formatLogSnippet(logs) {
761
+ if (!logs || logs.length === 0) return "";
762
+ const maxLines = 8;
763
+ const lastLines = logs.slice(-maxLines);
764
+ const header = logs.length > maxLines ? `
765
+
766
+ Logs (last ${maxLines} of ${logs.length}):` : "\n\nLogs:";
767
+ return `${header}
768
+ ${lastLines.map((line) => ` > ${line}`).join("\n")}`;
769
+ }
759
770
  function getFailedIndicator(isPreflight, signature) {
760
771
  if (isPreflight) return " (preflight)";
761
772
  if (signature) return ` (${signature})`;