_ => panic!(),
}
.parse::
>()
.unwrap()
.assume_checked()
}
pub(crate) fn tx_in(previous_output: OutPoint) -> TxIn {
TxIn {
previous_output,
script_sig: ScriptBuf::new(),
sequence: Sequence::ENABLE_RBF_NO_LOCKTIME,
witness: Witness::new(),
}
}
pub(crate) fn tx_out(value: u64, address: Address) -> TxOut {
TxOut {
value,
script_pubkey: address.script_pubkey(),
}
}
pub(crate) struct InscriptionTemplate {
pub(crate) parent: Option,
}
impl From for Inscription {
fn from(template: InscriptionTemplate) -> Self {
Self {
parent: template.parent.map(|id| id.parent_value()),
..Default::default()
}
}
}
pub(crate) fn inscription(content_type: &str, body: impl AsRef<[u8]>) -> Inscription {
Inscription::new(Some(content_type.into()), Some(body.as_ref().into()))
}
pub(crate) fn inscription_id(n: u32) -> InscriptionId {
let hex = format!("{n:x}");
if hex.is_empty() || hex.len() > 1 {