contracts: Add RPC that allows instantiating of a contract (#8451)

* contracts: Add RPC that allows instantiating of a contract

* Encode `debug_message` as bytes because usage of `String` is forbidden

* Remove erroneous derive attribute

* Fix rpc tests for new `debug_message` encoding

* Fix typo

Co-authored-by: Andrew Jones <ascjones@gmail.com>

Co-authored-by: Andrew Jones <ascjones@gmail.com>
This commit is contained in:
Alexander Theißen
2021-04-13 13:26:52 +02:00
committed by GitHub
parent 24311eee3e
commit f854194139
16 changed files with 471 additions and 191 deletions
+15 -1
View File
@@ -1340,7 +1340,9 @@ impl_runtime_apis! {
}
}
impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber>
impl pallet_contracts_rpc_runtime_api::ContractsApi<
Block, AccountId, Balance, BlockNumber, Hash,
>
for Runtime
{
fn call(
@@ -1353,6 +1355,18 @@ impl_runtime_apis! {
Contracts::bare_call(origin, dest, value, gas_limit, input_data)
}
fn instantiate(
origin: AccountId,
endowment: Balance,
gas_limit: u64,
code: pallet_contracts_primitives::Code<Hash>,
data: Vec<u8>,
salt: Vec<u8>,
) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>
{
Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true)
}
fn get_storage(
address: AccountId,
key: [u8; 32],