pub struct ContractKey { /* private fields */ }Expand description
A complete key specification, that represents a cryptographic hash that identifies the contract.
This type always contains both the instance ID and the code hash.
Use ContractInstanceId for operations that only need to identify the contract
(routing, client requests), and ContractKey for operations that need the full
specification (storage, execution).
Implementations§
Source§impl ContractKey
impl ContractKey
pub fn from_params_and_code<'a>( params: impl Borrow<Parameters<'a>>, wasm_code: impl Borrow<ContractCode<'a>>, ) -> ContractKey
Sourcepub fn encoded_code_hash(&self) -> String
pub fn encoded_code_hash(&self) -> String
Returns the encoded hash of the contract code.
Sourcepub fn from_params(
code_hash: impl Into<String>,
parameters: Parameters<'_>,
) -> Result<ContractKey, Error>
pub fn from_params( code_hash: impl Into<String>, parameters: Parameters<'_>, ) -> Result<ContractKey, Error>
Returns the contract key from the encoded hash of the contract code and the given parameters.
Sourcepub fn encoded_contract_id(&self) -> String
pub fn encoded_contract_id(&self) -> String
Returns the Base58 encoded string of the ContractInstanceId.
pub fn id(&self) -> &ContractInstanceId
Sourcepub fn from_id_and_code(
instance_id: ContractInstanceId,
code_hash: CodeHash,
) -> ContractKey
pub fn from_id_and_code( instance_id: ContractInstanceId, code_hash: CodeHash, ) -> ContractKey
Constructs a ContractKey from a pre-computed instance ID and code hash.
This is useful when the node needs to reconstruct a key from stored index data. Callers must ensure the instance_id was correctly derived from the code_hash and parameters, as this constructor does not verify consistency.
Trait Implementations§
Source§impl Clone for ContractKey
impl Clone for ContractKey
Source§fn clone(&self) -> ContractKey
fn clone(&self) -> ContractKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more