> ## Documentation Index
> Fetch the complete documentation index at: https://docs.li.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Guards catalog

> compose manifest 中注册的每一个 guard。

export const ComposeGuards = () => {
  const DEDICATED_GUARDS = new Set(['slippage', 'core.numericInvariant']);
  const [state, setState] = useState({
    data: null,
    error: null
  });
  useEffect(() => {
    let cancelled = false;
    setState({
      data: null,
      error: null
    });
    const run = async () => {
      try {
        const response = await fetch('https://composer.li.quest/compose/manifest');
        if (!response.ok) throw new Error(`HTTP ${response.status} ${response.statusText}`);
        const body = await response.json();
        if (!body || body.success !== true) {
          throw new Error(body?.error?.message ?? 'Unexpected response shape');
        }
        if (!cancelled) setState({
          data: body.data,
          error: null
        });
      } catch (err) {
        if (!cancelled) setState({
          data: null,
          error: err.message ?? String(err)
        });
      }
    };
    run();
    return () => {
      cancelled = true;
    };
  }, []);
  const slugify = s => String(s).replace(/\./g, '-').replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/_/g, '-').toLowerCase();
  const renderBody = () => {
    if (state.error) {
      return <div style={{
        padding: '0.75rem 1rem',
        border: '1px solid #f5c6cb',
        background: '#f8d7da',
        color: '#721c24',
        borderRadius: '6px'
      }}>
        <strong>Failed to load guards.</strong>
        <div style={{
        fontFamily: 'monospace',
        marginTop: '0.25rem',
        fontSize: '0.9em'
      }}>{state.error}</div>
      </div>;
    }
    if (!state.data) return <div>Loading guards…</div>;
    const manifest = state.data;
    const guards = [...manifest.guards ?? []].sort((a, b) => a.kind.localeCompare(b.kind));
    return <>
      <div style={{
      marginBottom: '0.5rem',
      fontSize: '0.9em',
      opacity: 0.75
    }}>
        Manifest version <code>{manifest.manifestVersion}</code> · <code>{guards.length}</code> guards
      </div>
      <table>
        <thead>
          <tr>
            <th className="text-left"><strong>Guard</strong></th>
            <th className="text-left"><strong>Description</strong></th>
            <th className="text-left"><strong>Selectors</strong></th>
          </tr>
        </thead>
        <tbody>
          {guards.map(g => <tr key={g.kind}>
              <td>
                {DEDICATED_GUARDS.has(g.kind) ? <a href={`/composer/guards/${slugify(g.kind)}`}><code>{g.kind}</code></a> : <code>{g.kind}</code>}
              </td>
              <td>{g.description ?? ''}</td>
              <td>{g.compatibility?.selectors?.length ?? 0}</td>
            </tr>)}
        </tbody>
      </table>
    </>;
  };
  return renderBody();
};

本页列出 compose manifest 中注册的每一个 guard。关于 guard 的定义以及 guard 断言如何变成链上不变量，参见 [Guards](/composer/composer-api/concepts/simulation-and-guards)。关于如何将 guards 附加到 op 调用，参见 [Build a Flow](/composer/composer-api/guides/build-a-flow#guards-invariants-during-execution)。

下方列表是从 compose manifest 实时渲染的。每一条都链接到一个逐 guard 的页面，包含其 selectors、config schema 和示例。

<ComposeGuards />
