pub struct OmniLockConfig { /* private fields */ }Expand description
OmniLock configuration The lock argument has the following data structure:
- 21 byte auth
- 1 byte Omnilock flags
- 32 byte RC cell type ID, optional
- 2 bytes minimum ckb/udt in ACP, optional
- 8 bytes since for time lock, optional
- 32 bytes type script hash for supply, optional
Implementations§
Source§impl OmniLockConfig
impl OmniLockConfig
Sourcepub fn new_pubkey_hash(lock_arg: H160) -> Self
pub fn new_pubkey_hash(lock_arg: H160) -> Self
Create a pubkey hash algorithm omnilock with proper argument
§Arguments
lock_argblake160 hash of a public key.
pub fn new_multisig(multisig_config: MultisigConfig) -> Self
Sourcepub fn new_ethereum(pubkey_hash: H160) -> Self
pub fn new_ethereum(pubkey_hash: H160) -> Self
Create an ethereum algorithm omnilock with pubkey
§Arguments
pubkey_hash- a ehtereum address of an account.
// pubkey is a public ethereum address
use ckb_sdk::unlock::OmniLockConfig;
use ckb_sdk::util::keccak160;
use ckb_crypto::secp::Pubkey;
let pubkey = Pubkey::from([0u8; 64]);
let pubkey_hash = keccak160(pubkey.as_ref());
let config = OmniLockConfig::new_ethereum(pubkey_hash);Sourcepub fn new_ownerlock(script_hash: H160) -> Self
pub fn new_ownerlock(script_hash: H160) -> Self
Create an ownerlock omnilock with according script hash.
§Arguments
script_hashthe proper blake160 hash of according ownerlock script.
Sourcepub fn new(flag: IdentityFlag, auth_content: H160) -> Self
pub fn new(flag: IdentityFlag, auth_content: H160) -> Self
Create a new OmniLockConfig
Sourcepub fn set_admin_config(&mut self, admin_config: AdminConfig)
pub fn set_admin_config(&mut self, admin_config: AdminConfig)
Set the admin cofiguration, and set the OmniLockFlags::ADMIN flag.
§Arguments
admin_configThe new admin config.
Sourcepub fn clear_admin_config(&mut self)
pub fn clear_admin_config(&mut self)
Remove the admin configuration, set it to None, and clear the OmniLockFlags::ADMIN flag.
Sourcepub fn set_acp_config(&mut self, acp_config: OmniLockAcpConfig)
pub fn set_acp_config(&mut self, acp_config: OmniLockAcpConfig)
Set the acp configuration, and set the OmniLockFlags::ACP flag.
Sourcepub fn clear_acp_config(&mut self)
pub fn clear_acp_config(&mut self)
Remove the acp config, set it to None, and clear the OmniLockFlags::ACP flag.
Sourcepub fn set_time_lock_config(&mut self, since: u64)
pub fn set_time_lock_config(&mut self, since: u64)
Set the time lock config with raw since value, and set the OmniLockFlags::TIME_LOCK flag.
Sourcepub fn clear_time_lock_config(&mut self)
pub fn clear_time_lock_config(&mut self)
Remove the time lock config, set it to None, and clear the OmniLockFlags::TIME_LOCK flag.
Sourcepub fn set_info_cell(&mut self, type_script_hash: H256)
pub fn set_info_cell(&mut self, type_script_hash: H256)
Set the info cell to the configuration, and set the OmniLockFlags::SUPPLY to omni_lock_flags.
Sourcepub fn clear_info_cell(&mut self)
pub fn clear_info_cell(&mut self)
Clear the info cell to None, and clear OmniLockFlags::SUPPLY from omni_lock_flags.
pub fn id(&self) -> &Identity
Sourcepub fn multisig_config(&self) -> Option<&MultisigConfig>
pub fn multisig_config(&self) -> Option<&MultisigConfig>
Return the reference content of the multisig config. If the multisig config is None, it will panic.
pub fn omni_lock_flags(&self) -> &OmniLockFlags
pub fn use_rc(&self) -> bool
Sourcepub fn build_args(&self) -> Bytes
pub fn build_args(&self) -> Bytes
Build lock script arguments
Sourcepub fn get_admin_config(&self) -> Option<&AdminConfig>
pub fn get_admin_config(&self) -> Option<&AdminConfig>
return the internal reference of admin_config
pub fn get_info_cell(&self) -> Option<&H256>
Sourcepub fn get_args_len(&self) -> usize
pub fn get_args_len(&self) -> usize
Calculate script args length
Sourcepub fn get_since_source(&self) -> SinceSource
pub fn get_since_source(&self) -> SinceSource
Get the since source from args.
Sourcepub fn is_pubkey_hash(&self) -> bool
pub fn is_pubkey_hash(&self) -> bool
Indicate whether is a sighash type.
Sourcepub fn is_ethereum(&self) -> bool
pub fn is_ethereum(&self) -> bool
Indicate whether is a ethereum type.
Sourcepub fn is_multisig(&self) -> bool
pub fn is_multisig(&self) -> bool
Check if it is a mutlisig flag.
Sourcepub fn is_ownerlock(&self) -> bool
pub fn is_ownerlock(&self) -> bool
Check if it is a ownerlock flag.
pub fn placeholder_witness_lock( &self, unlock_mode: OmniUnlockMode, ) -> Result<Bytes, ConfigError>
Sourcepub fn zero_lock(
&self,
unlock_mode: OmniUnlockMode,
) -> Result<Bytes, ConfigError>
pub fn zero_lock( &self, unlock_mode: OmniUnlockMode, ) -> Result<Bytes, ConfigError>
Build zero lock content for signature
Sourcepub fn placeholder_witness(
&self,
unlock_mode: OmniUnlockMode,
) -> Result<WitnessArgs, ConfigError>
pub fn placeholder_witness( &self, unlock_mode: OmniUnlockMode, ) -> Result<WitnessArgs, ConfigError>
Create a zero lock witness placeholder
Trait Implementations§
Source§impl Clone for OmniLockConfig
impl Clone for OmniLockConfig
Source§fn clone(&self) -> OmniLockConfig
fn clone(&self) -> OmniLockConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OmniLockConfig
impl Debug for OmniLockConfig
Source§impl<'de> Deserialize<'de> for OmniLockConfig
impl<'de> Deserialize<'de> for OmniLockConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for OmniLockConfig
impl Hash for OmniLockConfig
Source§impl PartialEq for OmniLockConfig
impl PartialEq for OmniLockConfig
Source§impl Serialize for OmniLockConfig
impl Serialize for OmniLockConfig
impl Eq for OmniLockConfig
impl StructuralPartialEq for OmniLockConfig
Auto Trait Implementations§
impl !Freeze for OmniLockConfig
impl RefUnwindSafe for OmniLockConfig
impl Send for OmniLockConfig
impl Sync for OmniLockConfig
impl Unpin for OmniLockConfig
impl UnwindSafe for OmniLockConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more