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<Vec<u8>>>
pub async fn pristine_code(&self, key_0: H256) -> Result<Option<Vec<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<Vec<DeletedContract>>
pub async fn deletion_queue(&self) -> Result<Vec<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> Freeze for ContractsQueryApi<'api>
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
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
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 moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.