Trait pallet_contracts_rpc::ContractsApi[][src]

pub trait ContractsApi<BlockHash, BlockNumber, AccountId, Balance, Hash>: Sized + Send + Sync + 'static {
    fn call(
        &self,
        call_request: CallRequest<AccountId>,
        at: Option<BlockHash>
    ) -> Result<ContractExecResult>;
fn instantiate(
        &self,
        instantiate_request: InstantiateRequest<AccountId, Hash>,
        at: Option<BlockHash>
    ) -> Result<ContractInstantiateResult<AccountId, BlockNumber>>;
fn get_storage(
        &self,
        address: AccountId,
        key: H256,
        at: Option<BlockHash>
    ) -> Result<Option<Bytes>>;
fn rent_projection(
        &self,
        address: AccountId,
        at: Option<BlockHash>
    ) -> Result<Option<BlockNumber>>; fn to_delegate<M: Metadata>(self) -> IoDelegate<Self, M>
    where
        BlockHash: Send + Sync + 'static + DeserializeOwned,
        BlockNumber: Send + Sync + 'static + Serialize,
        AccountId: Send + Sync + 'static + Serialize + DeserializeOwned,
        Balance: Send + Sync + 'static,
        Hash: Send + Sync + 'static + DeserializeOwned
, { ... } }
Expand description

Contracts RPC methods.

Required methods

Executes a call to a contract.

This call is performed locally without submitting any transactions. Thus executing this won’t change any state. Nonetheless, the calling state-changing contracts is still possible.

This method is useful for calling getter-like methods on contracts.

Instantiate a new contract.

This call is performed locally without submitting any transactions. Thus the contract is not actually created.

This method is useful for UIs to dry-run contract instantiations.

Returns the value under a specified storage key in a contract given by address param, or None if it is not set.

Returns the projected time a given contract will be able to sustain paying its rent.

The returned projection is relevant for the given block, i.e. it is as if the contract was accessed at the beginning of that block.

Returns None if the contract is exempted from rent.

Provided methods

Create an IoDelegate, wiring rpc calls to the trait methods.

Implementors