ABI: stateMachinesV1

Source module: packages/dclutch-sdk/lib/generated/stateMachinesV1.ts, whose own header reads:

@generated by scripts/generate-state-machines-v1.mjs; do not edit.
Regenerate with: npm run abi:state-machines

Machine labels and admission types: tools/gauntlet/census/src/phases.rs.
direct-root: crates/dclutch-trading/src/{successor,generated_successor}.rs
dealer-root: crates/dclutch-trading/src/dealer/{lib,generated_dealer_liquidity,generated_dealer_trading_profile}.rs
projected-custody: crates/dclutch-custody/src/{projected,generated_projected_state_v2}.rs
series-root: crates/dclutch-trading/src/series/{replay,generated,generated_series_state_v3}.rs
series-ticket: crates/dclutch-trading/src/series/{replay,generated,generated_ticket_state_v3}.rs
funding-ledger: crates/dclutch-market/src/capability_manifest/{funding,generated_abi}.rs
source: crates/dclutch-source/src/{lib,generated_source_resolution_state_v2}.rs

Functions (see the source module)

Unrendered exports (verbatim)

The renderer did not recognize these statement shapes, so they are shown verbatim rather than dropped.

export type StateMachineV1 =
  | 'direct-root'
  | 'dealer-root'
  | 'projected-custody'
  | 'series-root'
  | 'series-ticket'
  | 'funding-ledger'
  | 'source';

/** One state of one machine, and the byte its own decoder admits it from. */
export interface StateMachineStateV1 {
  readonly state: string;
  readonly tag: number;
}

/**
 * Where one machine keeps its discriminant, and what the bytes mean.
 *
 * `header` is the list of `[offset, value]` u16 words the record pins --
 * a schema version, and for the ticket state a profile beside it. `bytes` is
 * the exact record width, or `null` for the one machine that has none:
 * the funding ledger holds a slot per selected manifest entry, so its tag
 * sits at `headerBytes + rowBytes * row + tagOffset` and the record width is
 * a function of how many entries were selected.
 *
 * `bytes` is the width of the RECORD, which for the Direct root is the
 * 24-byte mutable tail and not the account: that tail follows the composite
 * capability-root header, whose width is `directInlineV3.ts`'s own generated
 * `CAPABILITY_ROOT_HEADER_BYTES_V1`. Slicing the tail out is the caller's,
 * because the header is that module's fact and not this one's.
 */
export interface StateMachineRecordV1 {
  readonly machine: StateMachineV1;
  /** The Rust admission type whose sets the census reads for this machine. */
  readonly admission: string;
  /** The Rust enum that owns the wire tags. */
  readonly discriminant: string;
  /** The Rust record that persists the discriminant. */
  readonly record: string;
  readonly magic: string;
  readonly bytes: number | null;
  readonly header: ReadonlyArray<readonly [offset: number, value: number]>;
  readonly tagOffset: number;
  readonly headerBytes: number | null;
  readonly rowBytes: number | null;
  /**
   * The PDA seed domain of the account, when a reader can derive it.
   *
   * `null` for seven of the eight, and that is a fact about SEED SHAPE
   * rather than about reach. The Source state is the one addressed by a
   * single domain -- `[domain, market, generation]` under the Resolution
   * program -- so it is the one this table can carry. Two of the other
   * seven are composite derivations over a capability manifest entry and
   * are perfectly reachable from a Market; `capabilityManifest.ts` owns
   * those, and reading a `null` here as "no client can find this account"
   * is what left a Direct root unread for as long as it was.
   */
  readonly pdaDomain: string | null;
  /** Other u64 lifecycle counters the record carries beside its tag. */
  readonly counters: ReadonlyArray<{ readonly field: string; readonly offset: number }>;
  readonly states: ReadonlyArray<StateMachineStateV1>;
  readonly authority: string;
}
export const STATE_MACHINE_RECORDS_V1: ReadonlyArray<StateMachineRecordV1> = [
  {
    machine: 'direct-root',
    admission: 'DirectRootAdmissionV1',
    discriminant: 'DirectRootPhaseV1',
    record: 'DirectRootStateV1',
    magic: 'DCLTDRT1',
    bytes: 24,
    header: [[8, 1]],
    tagOffset: 10,
    headerBytes: null,
    rowBytes: null,
    pdaDomain: null,
    counters: [{ field: 'openMakerRootCount', offset: 16 }],
    states: [{ state: 'Open', tag: 0 }, { state: 'Retiring', tag: 1 }],
    authority: 'crates/dclutch-trading/src/{successor,generated_successor}.rs',
  },
  {
    machine: 'dealer-root',
    admission: 'DealerRootAdmissionV1',
    discriminant: 'DealerRootPhaseV1',
    record: 'RootTail',
    magic: 'DCDTAIL1',
    bytes: 384,
    header: [[8, 1]],
    tagOffset: 10,
    headerBytes: null,
    rowBytes: null,
    pdaDomain: null,
    counters: [],
    states: [{ state: 'Open', tag: 0 }, { state: 'Terminal', tag: 1 }, { state: 'Retired', tag: 2 }],
    authority: 'crates/dclutch-trading/src/dealer/{lib,generated_dealer_liquidity,generated_dealer_trading_profile}.rs',
  },
  {
    machine: 'projected-custody',
    admission: 'ProjectedCustodyAdmissionV1',
    discriminant: 'ProjectedCustodyPhaseV1',
    record: 'ProjectedCustodyStateV2',
    magic: 'DCLPCS02',
    bytes: 808,
    header: [[8, 2]],
    tagOffset: 10,
    headerBytes: null,
    rowBytes: null,
    pdaDomain: null,
    counters: [],
    states: [{ state: 'Initialized', tag: 1 }, { state: 'HoardOpen', tag: 2 }, { state: 'HoardLocked', tag: 3 }, { state: 'SourceFunded', tag: 4 }],
    authority: 'crates/dclutch-custody/src/{projected,generated_projected_state_v2}.rs',
  },
  {
    machine: 'series-root',
    admission: 'SeriesRootAdmissionV1',
    discriminant: 'SeriesPhaseV3',
    record: 'SeriesStateV3',
    magic: 'DCLTSSV3',
    bytes: 64,
    header: [[8, 3], [10, 1]],
    tagOffset: 12,
    headerBytes: null,
    rowBytes: null,
    pdaDomain: null,
    counters: [{ field: 'revision', offset: 24 }, { field: 'closeRentRemaining', offset: 32 }],
    states: [{ state: 'Active', tag: 0 }, { state: 'Terminal', tag: 1 }],
    authority: 'crates/dclutch-trading/src/series/{replay,generated,generated_series_state_v3}.rs',
  },
  {
    machine: 'series-ticket',
    admission: 'SeriesTicketAdmissionV1',
    discriminant: 'TicketPhaseV3',
    record: 'TicketStateV3',
    magic: 'DCLTTSV3',
    bytes: 64,
    header: [[8, 3], [10, 1]],
    tagOffset: 12,
    headerBytes: null,
    rowBytes: null,
    pdaDomain: null,
    counters: [],
    states: [{ state: 'Prepared', tag: 0 }, { state: 'Consumed', tag: 1 }, { state: 'Expired', tag: 2 }],
    authority: 'crates/dclutch-trading/src/series/{replay,generated,generated_ticket_state_v3}.rs',
  },
  {
    machine: 'funding-ledger',
    admission: 'FundingLedgerAdmissionV2',
    discriminant: 'FundingLedgerStatusV2',
    record: 'FundingLedgerV2',
    magic: 'DCLTFL02',
    bytes: null,
    header: [[8, 2]],
    tagOffset: 0,
    headerBytes: 48,
    rowBytes: 72,
    pdaDomain: null,
    counters: [],
    states: [{ state: 'Pending', tag: 0 }, { state: 'Active', tag: 1 }, { state: 'Closed', tag: 2 }],
    authority: 'crates/dclutch-market/src/capability_manifest/{funding,generated_abi}.rs',
  },
  {
    machine: 'source',
    admission: 'SourceAdmissionV1',
    discriminant: 'SourceResolutionPhaseV1',
    record: 'SourceResolutionStateV2',
    magic: 'DCLTSRS2',
    bytes: 224,
    header: [[8, 2]],
    tagOffset: 10,
    headerBytes: null,
    rowBytes: null,
    pdaDomain: 'dclutch/source-state/v2',
    counters: [],
    states: [{ state: 'Primary', tag: 0 }, { state: 'Recovery', tag: 1 }, { state: 'Resolved', tag: 2 }, { state: 'Exhausted', tag: 3 }, { state: 'FailureCommitted', tag: 4 }, { state: 'Retired', tag: 5 }],
    authority: 'crates/dclutch-source/src/{lib,generated_source_resolution_state_v2}.rs',
  },
];

/** The record for one machine, or `null` when the name is not a machine. */