pub struct ContractPackage { /* private fields */ }
Expand description

Contract definition, metadata, and security container.

Implementations§

source§

impl ContractPackage

source

pub fn new( access_key: URef, versions: ContractVersions, disabled_versions: DisabledVersions, groups: Groups, lock_status: ContractPackageStatus ) -> Self

Create new ContractPackage (with no versions) from given access key.

source

pub fn access_key(&self) -> URef

Get the access key for this contract.

source

pub fn groups_mut(&mut self) -> &mut Groups

Get the mutable group definitions for this contract.

source

pub fn groups(&self) -> &Groups

Get the group definitions for this contract.

source

pub fn add_group(&mut self, group: Group, urefs: BTreeSet<URef>)

Adds new group to this contract.

source

pub fn lookup_contract_hash( &self, contract_version_key: ContractVersionKey ) -> Option<&ContractHash>

Lookup the contract hash for a given contract version (if present)

source

pub fn is_version_enabled( &self, contract_version_key: ContractVersionKey ) -> bool

Returns true if the given contract version exists and is enabled.

source

pub fn is_contract_enabled(&self, contract_hash: &ContractHash) -> bool

Returns true if the given contract hash exists and is enabled.

source

pub fn insert_contract_version( &mut self, protocol_version_major: ProtocolVersionMajor, contract_hash: ContractHash ) -> ContractVersionKey

Insert a new contract version; the next sequential version number will be issued.

source

pub fn disable_contract_version( &mut self, contract_hash: ContractHash ) -> Result<(), Error>

Disable the contract version corresponding to the given hash (if it exists).

source

pub fn enable_contract_version( &mut self, contract_hash: ContractHash ) -> Result<(), Error>

Enable the contract version corresponding to the given hash (if it exists).

source

pub fn versions(&self) -> &ContractVersions

Returns reference to all of this contract’s versions.

source

pub fn enabled_versions(&self) -> ContractVersions

Returns all of this contract’s enabled contract versions.

source

pub fn versions_mut(&mut self) -> &mut ContractVersions

Returns mutable reference to all of this contract’s versions (enabled and disabled).

source

pub fn take_versions(self) -> ContractVersions

Consumes the object and returns all of this contract’s versions (enabled and disabled).

source

pub fn disabled_versions(&self) -> &DisabledVersions

Returns all of this contract’s disabled versions.

source

pub fn disabled_versions_mut(&mut self) -> &mut DisabledVersions

Returns mut reference to all of this contract’s disabled versions.

source

pub fn remove_group(&mut self, group: &Group) -> bool

Removes a group from this contract (if it exists).

source

pub fn current_contract_version(&self) -> Option<ContractVersionKey>

Return the contract version key for the newest enabled contract version.

source

pub fn current_contract_hash(&self) -> Option<ContractHash>

Return the contract hash for the newest enabled contract version.

source

pub fn is_locked(&self) -> bool

Return the lock status of the contract package.

source

pub fn get_lock_status(&self) -> ContractPackageStatus

Return the package status itself

Trait Implementations§

source§

impl CLTyped for ContractPackage

source§

fn cl_type() -> CLType

The CLType of Self.
source§

impl Clone for ContractPackage

source§

fn clone(&self) -> ContractPackage

Returns a copy 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 ContractPackage

source§

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

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

impl Default for ContractPackage

source§

fn default() -> ContractPackage

Returns the “default value” for a type. Read more
source§

impl From<ContractPackage> for StoredValue

source§

fn from(value: ContractPackage) -> StoredValue

Converts to this type from the input type.
source§

impl FromBytes for ContractPackage

source§

fn from_bytes(bytes: &[u8]) -> Result<(Self, &[u8]), Error>

Deserializes the slice into Self.
source§

fn from_vec(bytes: Vec<u8>) -> Result<(Self, Vec<u8>), Error>

Deserializes the Vec<u8> into Self.
source§

impl PartialEq for ContractPackage

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for ContractPackage

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 ToBytes for ContractPackage

source§

fn to_bytes(&self) -> Result<Vec<u8>, Error>

Serializes &self to a Vec<u8>.
source§

fn serialized_length(&self) -> usize

Returns the length of the Vec<u8> which would be returned from a successful call to to_bytes() or into_bytes(). The data is not actually serialized, so this call is relatively cheap.
source§

fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), Error>

Writes &self into a mutable writer.
source§

fn into_bytes(self) -> Result<Vec<u8>, Error>where Self: Sized,

Consumes self and serializes to a Vec<u8>.
source§

impl TryFrom<StoredValue> for ContractPackage

§

type Error = TypeMismatch

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

fn try_from(stored_value: StoredValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for ContractPackage

source§

impl StructuralEq for ContractPackage

source§

impl StructuralPartialEq for ContractPackage

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.