Struct polymesh_api::polymesh::api::contracts::ContractsQueryApi
source · pub struct ContractsQueryApi<'api> { /* private fields */ }
Implementations§
source§impl<'api> ContractsQueryApi<'api>
impl<'api> ContractsQueryApi<'api>
sourcepub async fn pristine_code(&self, key_0: H256) -> Result<Option<BoundedVec<u8>>>
pub async fn pristine_code(&self, key_0: H256) -> Result<Option<BoundedVec<u8>>>
A mapping from an original code hash to the original code, untouched by instrumentation.
sourcepub async fn code_storage(
&self,
key_0: H256
) -> Result<Option<PrefabWasmModule>>
pub async fn code_storage( &self, key_0: H256 ) -> Result<Option<PrefabWasmModule>>
A mapping between an original code hash and instrumented wasm code, ready for execution.
sourcepub async fn owner_info_of(&self, key_0: H256) -> Result<Option<OwnerInfo>>
pub async fn owner_info_of(&self, key_0: H256) -> Result<Option<OwnerInfo>>
A mapping between an original code hash and its owner information.
sourcepub async fn nonce(&self) -> Result<u64>
pub async fn nonce(&self) -> Result<u64>
This is a monotonic counter incremented on contract instantiation.
This is used in order to generate unique trie ids for contracts. The trie id of a new contract is calculated from hash(account_id, nonce). The nonce is required because otherwise the following sequence would lead to a possible collision of storage:
- Create a new contract.
- Terminate the contract.
- Immediately recreate the contract with the same account_id.
This is bad because the contents of a trie are deleted lazily and there might be storage of the old instantiation still in it when the new contract is created. Please note that we can’t replace the counter by the block number because the sequence above can happen in the same block. We also can’t keep the account counter in memory only because storage is the only way to communicate across different extrinsics in the same block.
Note
Do not use it to determine the number of contracts. It won’t be decremented if a contract is destroyed.
sourcepub async fn contract_info_of(
&self,
key_0: AccountId
) -> Result<Option<ContractInfo>>
pub async fn contract_info_of( &self, key_0: AccountId ) -> Result<Option<ContractInfo>>
The code associated with a given account.
TWOX-NOTE: SAFE since AccountId
is a secure hash.
sourcepub async fn deletion_queue(&self) -> Result<BoundedVec<DeletedContract>>
pub async fn deletion_queue(&self) -> Result<BoundedVec<DeletedContract>>
Evicted contracts that await child trie deletion.
Child trie deletion is a heavy operation depending on the amount of storage items
stored in said trie. Therefore this operation is performed lazily in on_initialize
.
Trait Implementations§
source§impl<'api> Clone for ContractsQueryApi<'api>
impl<'api> Clone for ContractsQueryApi<'api>
source§fn clone(&self) -> ContractsQueryApi<'api>
fn clone(&self) -> ContractsQueryApi<'api>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<'api> !RefUnwindSafe for ContractsQueryApi<'api>
impl<'api> Send for ContractsQueryApi<'api>
impl<'api> Sync for ContractsQueryApi<'api>
impl<'api> Unpin for ContractsQueryApi<'api>
impl<'api> !UnwindSafe for ContractsQueryApi<'api>
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
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where Self: TryInto<T>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.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> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
T
. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.