Trait ckb_sdk::unlock::ScriptUnlocker
source · pub trait ScriptUnlocker {
fn match_args(&self, args: &[u8]) -> bool;
fn unlock(
&self,
tx: &TransactionView,
script_group: &ScriptGroup,
tx_dep_provider: &dyn TransactionDependencyProvider
) -> Result<TransactionView, UnlockError>;
fn fill_placeholder_witness(
&self,
tx: &TransactionView,
script_group: &ScriptGroup,
tx_dep_provider: &dyn TransactionDependencyProvider
) -> Result<TransactionView, UnlockError>;
fn is_unlocked(
&self,
_tx: &TransactionView,
_script_group: &ScriptGroup,
_tx_dep_provider: &dyn TransactionDependencyProvider
) -> Result<bool, UnlockError> { ... }
fn clear_placeholder_witness(
&self,
tx: &TransactionView,
_script_group: &ScriptGroup
) -> Result<TransactionView, UnlockError> { ... }
}Expand description
Script unlock logic:
- Parse the script.args
- Sign the transaction
- Put extra unlock information into transaction (e.g. SMT proof in omni-lock case)
Required Methods§
fn match_args(&self, args: &[u8]) -> bool
sourcefn unlock(
&self,
tx: &TransactionView,
script_group: &ScriptGroup,
tx_dep_provider: &dyn TransactionDependencyProvider
) -> Result<TransactionView, UnlockError>
fn unlock(
&self,
tx: &TransactionView,
script_group: &ScriptGroup,
tx_dep_provider: &dyn TransactionDependencyProvider
) -> Result<TransactionView, UnlockError>
Add signature or other information to witnesses, when the script is already unlocked should reset the witness instead.
sourcefn fill_placeholder_witness(
&self,
tx: &TransactionView,
script_group: &ScriptGroup,
tx_dep_provider: &dyn TransactionDependencyProvider
) -> Result<TransactionView, UnlockError>
fn fill_placeholder_witness(
&self,
tx: &TransactionView,
script_group: &ScriptGroup,
tx_dep_provider: &dyn TransactionDependencyProvider
) -> Result<TransactionView, UnlockError>
Fill a placehodler witness before balance the transaction capacity
Provided Methods§
sourcefn is_unlocked(
&self,
_tx: &TransactionView,
_script_group: &ScriptGroup,
_tx_dep_provider: &dyn TransactionDependencyProvider
) -> Result<bool, UnlockError>
fn is_unlocked(
&self,
_tx: &TransactionView,
_script_group: &ScriptGroup,
_tx_dep_provider: &dyn TransactionDependencyProvider
) -> Result<bool, UnlockError>
Check if the script group is already unlocked