miden-ntx-builder 0.16.0

Miden network transaction builder
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Inserts a note script (idempotent via INSERT OR IGNORE).

use miden_node_db::DatabaseError;
use miden_node_db::sqlite::WriteTx;
use miden_protocol::Word;
use miden_protocol::note::NoteScript;

const SQL: &str = include_str!("insert_note_script.sql");

/// Inserts a note script (idempotent via INSERT OR IGNORE).
pub fn insert_note_script(
    tx: &WriteTx<'_>,
    script_root: &Word,
    script: &NoteScript,
) -> Result<(), DatabaseError> {
    tx.execute(SQL, &[script_root, script])?;
    Ok(())
}