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