Skip to main content

encode_statement

Function encode_statement 

Source
pub fn encode_statement(
    now_secs: u64,
    decryption_key: Option<&Topic>,
    channel: Option<&Topic>,
    priority: u32,
    topics: &[Topic],
    data: &[u8],
    sr25519_pubkey: &[u8; 32],
    sr25519_sign: &dyn Fn(&[u8]) -> [u8; 64],
) -> Result<Vec<u8>, String>
Expand description

Encode a statement into the sp-statement-store SCALE binary format.

Convenience wrapper that calls build_signing_payload then signs and assembles in one step. For FFI or two-phase workflows where the signing closure is unavailable, use the split API instead.

§Parameters

  • now_secs: current Unix timestamp in seconds. Used to compute a 1-hour expiry. Callers must supply this to keep the function pure and WASM-safe.
  • topics: at most 4 topics; returns Err if more are supplied.