Skip to content

SDK — API Reference ​

Primary Classes & Functions ​

PreFlightInterceptor ​

  • constructor(options: PreFlightInterceptorOptions)
  • check(call: ContractCall): Promise<PreFlightDecision> — Returns admissible | blocked | undetermined without broadcasting.
  • assertAllowed(call: ContractCall): Promise<AdmissibleDecision> — Asserts call is allowed or throws GuardBlockedError.

CostPreChecker ​

  • constructor(options: CostPreCheckerOptions)
  • check(call: ContractCall): Promise<CostPreCheckResult> — Evaluates cost against ceilings without broadcasting.

GuardTelemetryListener ​

  • constructor(options: GuardTelemetryListenerOptions)
  • watch(signal?: AbortSignal): AsyncIterable<GuardEventPage> — Tails live diagnostic and ledger events.

Utility Exports ​

  • policyToScVal(policy: GuardPolicy): xdr.ScVal — Serializes policy draft into Soroban ScVal struct.
  • decodeCheckResult(val: xdr.ScVal): CheckResult — Decodes Allowed or Blocked(reason).
  • explainReason(reason: string | number): string — Converts contract reason codes to human explanations.
  • isDeadManFrozen(status: AccountStatus | null, policy: GuardPolicy | null): boolean — Evaluates heartbeat expiry status.