pub trait ContractsBackend<E: Environment> {
type Error;
type EventLog;
// Provided methods
fn instantiate<'a, Contract: Clone, Args: Send + Clone + AbiEncodeWith<Abi> + Sync, R, Abi: Send + Sync + Clone>(
&'a mut self,
contract_name: &'a str,
caller: &'a Keypair,
constructor: &'a mut CreateBuilder<E, Contract, Set<LimitParamsV2>, Set<ExecutionInput<Args, Abi>>, Set<ReturnType<R>>>,
) -> InstantiateBuilder<'a, E, Contract, Args, R, Self, Abi>
where Self: Sized + BuilderClient<E> { ... }
fn upload<'a>(
&'a mut self,
contract_name: &'a str,
caller: &'a Keypair,
) -> UploadBuilder<'a, E, Self>
where Self: Sized + BuilderClient<E> { ... }
fn remove_code<'a>(
&'a mut self,
caller: &'a Keypair,
code_hash: H256,
) -> RemoveCodeBuilder<'a, E, Self>
where Self: Sized + BuilderClient<E> { ... }
fn call<'a, Args: Sync + AbiEncodeWith<Abi> + Clone, RetType: Send + AbiDecodeWith<Abi>, Abi: Sync + Clone>(
&'a mut self,
caller: &'a Keypair,
message: &'a CallBuilderFinal<E, Args, RetType, Abi>,
) -> CallBuilder<'a, E, Args, RetType, Self, Abi>
where Self: Sized + BuilderClient<E> { ... }
}
Expand description
Contract-specific operations.
Required Associated Types§
Provided Methods§
Sourcefn instantiate<'a, Contract: Clone, Args: Send + Clone + AbiEncodeWith<Abi> + Sync, R, Abi: Send + Sync + Clone>(
&'a mut self,
contract_name: &'a str,
caller: &'a Keypair,
constructor: &'a mut CreateBuilder<E, Contract, Set<LimitParamsV2>, Set<ExecutionInput<Args, Abi>>, Set<ReturnType<R>>>,
) -> InstantiateBuilder<'a, E, Contract, Args, R, Self, Abi>where
Self: Sized + BuilderClient<E>,
fn instantiate<'a, Contract: Clone, Args: Send + Clone + AbiEncodeWith<Abi> + Sync, R, Abi: Send + Sync + Clone>(
&'a mut self,
contract_name: &'a str,
caller: &'a Keypair,
constructor: &'a mut CreateBuilder<E, Contract, Set<LimitParamsV2>, Set<ExecutionInput<Args, Abi>>, Set<ReturnType<R>>>,
) -> InstantiateBuilder<'a, E, Contract, Args, R, Self, Abi>where
Self: Sized + BuilderClient<E>,
Start building an instantiate call using a builder pattern.
§Example
ⓘ
// Constructor method
let mut constructor = FlipperRef::new(false);
let contract = client
.instantiate("flipper", &ink_e2e::alice(), &mut constructor)
// Optional arguments
// Send 100 units with the call.
.value(100)
// Add 10% margin to the gas limit
.extra_gas_portion(10)
.storage_deposit_limit(100)
// Submit the call for on-chain execution.
.submit()
.await
.expect("instantiate failed");
Sourcefn upload<'a>(
&'a mut self,
contract_name: &'a str,
caller: &'a Keypair,
) -> UploadBuilder<'a, E, Self>where
Self: Sized + BuilderClient<E>,
fn upload<'a>(
&'a mut self,
contract_name: &'a str,
caller: &'a Keypair,
) -> UploadBuilder<'a, E, Self>where
Self: Sized + BuilderClient<E>,
Sourcefn remove_code<'a>(
&'a mut self,
caller: &'a Keypair,
code_hash: H256,
) -> RemoveCodeBuilder<'a, E, Self>where
Self: Sized + BuilderClient<E>,
fn remove_code<'a>(
&'a mut self,
caller: &'a Keypair,
code_hash: H256,
) -> RemoveCodeBuilder<'a, E, Self>where
Self: Sized + BuilderClient<E>,
Sourcefn call<'a, Args: Sync + AbiEncodeWith<Abi> + Clone, RetType: Send + AbiDecodeWith<Abi>, Abi: Sync + Clone>(
&'a mut self,
caller: &'a Keypair,
message: &'a CallBuilderFinal<E, Args, RetType, Abi>,
) -> CallBuilder<'a, E, Args, RetType, Self, Abi>where
Self: Sized + BuilderClient<E>,
fn call<'a, Args: Sync + AbiEncodeWith<Abi> + Clone, RetType: Send + AbiDecodeWith<Abi>, Abi: Sync + Clone>(
&'a mut self,
caller: &'a Keypair,
message: &'a CallBuilderFinal<E, Args, RetType, Abi>,
) -> CallBuilder<'a, E, Args, RetType, Self, Abi>where
Self: Sized + BuilderClient<E>,
Start building a call using a builder pattern.
§Example
ⓘ
// Message method
let get = call_builder.get();
let get_res = client
.call(&ink_e2e::bob(), &get)
// Optional arguments
// Send 100 units with the call.
.value(100)
// Add 10% margin to the gas limit
.extra_gas_portion(10)
.storage_deposit_limit(100)
// Submit the call for on-chain execution.
.submit()
.await
.expect("instantiate failed");