[][src]Trait pallet_contracts_rpc::ContractsApi

pub trait ContractsApi<BlockHash, BlockNumber, AccountId, Balance>: Sized + Send + Sync + 'static {
    fn call(
        &self,
        call_request: CallRequest<AccountId, Balance>,
        at: Option<BlockHash>
    ) -> Result<RpcContractExecResult>;
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 + DeserializeOwned,
        Balance: Send + Sync + 'static + DeserializeOwned
, { ... } }

Contracts RPC methods.

Required methods

fn call(
    &self,
    call_request: CallRequest<AccountId, Balance>,
    at: Option<BlockHash>
) -> Result<RpcContractExecResult>

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.

fn get_storage(
    &self,
    address: AccountId,
    key: H256,
    at: Option<BlockHash>
) -> Result<Option<Bytes>>

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

fn rent_projection(
    &self,
    address: AccountId,
    at: Option<BlockHash>
) -> Result<Option<BlockNumber>>

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.

Loading content...

Provided methods

fn to_delegate<M: Metadata>(self) -> IoDelegate<Self, M> where
    BlockHash: Send + Sync + 'static + DeserializeOwned,
    BlockNumber: Send + Sync + 'static + Serialize,
    AccountId: Send + Sync + 'static + DeserializeOwned,
    Balance: Send + Sync + 'static + DeserializeOwned

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

Loading content...

Implementors

impl<C, Block, AccountId, Balance> ContractsApi<<Block as Block>::Hash, <<Block as Block>::Header as Header>::Number, AccountId, Balance> for Contracts<C, Block> where
    Block: BlockT,
    C: Send + Sync + 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
    C::Api: ContractsRuntimeApi<Block, AccountId, Balance, <<Block as BlockT>::Header as HeaderT>::Number>,
    AccountId: Codec,
    Balance: Codec
[src]

Loading content...