OmniLockConfig

Struct OmniLockConfig 

Source
pub struct OmniLockConfig { /* private fields */ }
Expand description

OmniLock configuration The lock argument has the following data structure:

  1. 21 byte auth
  2. 1 byte Omnilock flags
  3. 32 byte RC cell type ID, optional
  4. 2 bytes minimum ckb/udt in ACP, optional
  5. 8 bytes since for time lock, optional
  6. 32 bytes type script hash for supply, optional

Implementations§

Source§

impl OmniLockConfig

Source

pub fn new_pubkey_hash(lock_arg: H160) -> Self

Create a pubkey hash algorithm omnilock with proper argument

§Arguments
  • lock_arg blake160 hash of a public key.
Source

pub fn new_multisig(multisig_config: MultisigConfig) -> Self

Source

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);
Source

pub fn new_ownerlock(script_hash: H160) -> Self

Create an ownerlock omnilock with according script hash.

§Arguments
  • script_hash the proper blake160 hash of according ownerlock script.
Source

pub fn new(flag: IdentityFlag, auth_content: H160) -> Self

Create a new OmniLockConfig

Source

pub fn set_admin_config(&mut self, admin_config: AdminConfig)

Set the admin cofiguration, and set the OmniLockFlags::ADMIN flag.

§Arguments
  • admin_config The new admin config.
Source

pub fn clear_admin_config(&mut self)

Remove the admin configuration, set it to None, and clear the OmniLockFlags::ADMIN flag.

Source

pub fn set_acp_config(&mut self, acp_config: OmniLockAcpConfig)

Set the acp configuration, and set the OmniLockFlags::ACP flag.

Source

pub fn clear_acp_config(&mut self)

Remove the acp config, set it to None, and clear the OmniLockFlags::ACP flag.

Source

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.

Source

pub fn clear_time_lock_config(&mut self)

Remove the time lock config, set it to None, and clear the OmniLockFlags::TIME_LOCK flag.

Source

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.

Source

pub fn clear_info_cell(&mut self)

Clear the info cell to None, and clear OmniLockFlags::SUPPLY from omni_lock_flags.

Source

pub fn id(&self) -> &Identity

Source

pub fn multisig_config(&self) -> Option<&MultisigConfig>

Return the reference content of the multisig config. If the multisig config is None, it will panic.

Source

pub fn omni_lock_flags(&self) -> &OmniLockFlags

Source

pub fn use_rc(&self) -> bool

Source

pub fn build_args(&self) -> Bytes

Build lock script arguments

Source

pub fn get_admin_config(&self) -> Option<&AdminConfig>

return the internal reference of admin_config

Source

pub fn get_info_cell(&self) -> Option<&H256>

Source

pub fn get_args_len(&self) -> usize

Calculate script args length

Source

pub fn get_since_source(&self) -> SinceSource

Get the since source from args.

Source

pub fn is_pubkey_hash(&self) -> bool

Indicate whether is a sighash type.

Source

pub fn is_ethereum(&self) -> bool

Indicate whether is a ethereum type.

Source

pub fn is_multisig(&self) -> bool

Check if it is a mutlisig flag.

Source

pub fn is_ownerlock(&self) -> bool

Check if it is a ownerlock flag.

Source

pub fn placeholder_witness_lock( &self, unlock_mode: OmniUnlockMode, ) -> Result<Bytes, ConfigError>

Source

pub fn zero_lock( &self, unlock_mode: OmniUnlockMode, ) -> Result<Bytes, ConfigError>

Build zero lock content for signature

Source

pub fn placeholder_witness( &self, unlock_mode: OmniUnlockMode, ) -> Result<WitnessArgs, ConfigError>

Create a zero lock witness placeholder

Trait Implementations§

Source§

impl Clone for OmniLockConfig

Source§

fn clone(&self) -> OmniLockConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OmniLockConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OmniLockConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for OmniLockConfig

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for OmniLockConfig

Source§

fn eq(&self, other: &OmniLockConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for OmniLockConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for OmniLockConfig

Source§

impl StructuralPartialEq for OmniLockConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Cast to trait Any
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CallHasher for T
where T: Hash + ?Sized,

Source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Type2Any for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> MaybeSend for T
where T: Send,