pub trait ScriptTemplateUnlock {
// Required methods
fn sign(&self, preimage: &[u8]) -> Result<UnlockingScript, ScriptError>;
fn estimate_length(&self) -> Result<usize, ScriptError>;
}Expand description
Trait for creating unlocking scripts (analogous to TS SDK ScriptTemplateUnlock).
Implementors produce an UnlockingScript and can estimate its byte length for fee calculation purposes.
Required Methods§
Sourcefn sign(&self, preimage: &[u8]) -> Result<UnlockingScript, ScriptError>
fn sign(&self, preimage: &[u8]) -> Result<UnlockingScript, ScriptError>
Sign a transaction input and produce an unlocking script.
The preimage is the sighash preimage bytes that the caller computes
from the transaction context. The template signs this directly.
Sourcefn estimate_length(&self) -> Result<usize, ScriptError>
fn estimate_length(&self) -> Result<usize, ScriptError>
Estimate the byte length of the unlocking script (for fee calculation).