InstructionTrace

type InstructionTrace = 
  | Readonly<{
  index: number;
  kind: "outer";
}>
  | Readonly<{
  innerIndex: number;
  kind: "inner";
  outerIndex: number;
  stackHeight?: number;
}>;

The location of an instruction within a transaction.

  • kind: 'outer' — a top-level instruction in the transaction message. index is its position in the compiled message's instructions.
  • kind: 'inner' — an instruction emitted via cross-program invocation. outerIndex is the index of the outer instruction that triggered the CPI chain; innerIndex is the position within that outer instruction's inner-instruction group.

Example

function describe(trace: InstructionTrace): string {
    return trace.kind === 'outer'
        ? `outer[${trace.index}]`
        : `inner[outer=${trace.outerIndex}, idx=${trace.innerIndex}]`;
}

On this page