Skip to main content

rpc/
host_prelude.rs

1//! Host-dependent nomiscript prelude (ADR-0029).
2//!
3//! These helpers call RPC host fns (`list-splits-by-transaction`, …) that only
4//! exist after `register_host_fns`, so — unlike the universal prelude baked
5//! into `SymbolTable::with_builtins` — they load only on the rpc Session path.
6//! Exposed here so `Session::new` and the Metro compile test share one source.
7
8use nomiscript::SymbolTable;
9
10/// The host-prelude nomiscript source (DEFUN-only).
11pub const SOURCE: &str = include_str!("host_prelude.nms");
12
13/// Registers the host-prelude defuns into `symbols`. Must be called AFTER
14/// `register_host_fns` so the natives the helper bodies reference are present.
15pub fn load(symbols: &mut SymbolTable) {
16    symbols.load_nomiscript_defuns(SOURCE, "rpc host prelude");
17}