mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 15:47:58 +00:00
contracts: add events to ContractResult (#13807)
* contracts: add events to ContractResult * contracts: add encoded events to ContractResult * contracts: add generic Event to ContractResult * contracts: test bare_call events * contracts: update bare_call test name * contracts: add better comments to dry run events * contracts: fix pallet contracts primitives implementation * contracts: add EventRecord generic to ContractInstantiateResult * contracts: make event collection optional * contracts: impreved notes on `collect_events` * contracts: update benchmarking calls * contracts: change bare_call and bare_instantiate to accept enums instead of bools * contracts: add partial eq to new enums * contracts: improve comments * contracts: improve comments * contracts: fix bare_call benchmarking * contracts: fix bare call and instantiate in impl_runtime_apis * contracts: add api versioning to new ContractsApi functions * contracts: modify api versioning to new ContractsApi functions * contracts: create new contracts api trait * contracts: clean up code * contracts: remove the contract results with events * contracts: undo contracts api v3 * contracts: remove commented out code * contracts: add new test bare call result does not return events * contracts: add code review improvements * contracts: remove type imports * contracts: minor code review improvements
This commit is contained in:
@@ -1880,6 +1880,11 @@ type Migrations = (
|
||||
pallet_contracts::Migration<Runtime>,
|
||||
);
|
||||
|
||||
type EventRecord = frame_system::EventRecord<
|
||||
<Runtime as frame_system::Config>::RuntimeEvent,
|
||||
<Runtime as frame_system::Config>::Hash,
|
||||
>;
|
||||
|
||||
/// MMR helper types.
|
||||
mod mmr {
|
||||
use super::Runtime;
|
||||
@@ -2141,7 +2146,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_contracts::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash> for Runtime
|
||||
impl pallet_contracts::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash, EventRecord> for Runtime
|
||||
{
|
||||
fn call(
|
||||
origin: AccountId,
|
||||
@@ -2150,7 +2155,7 @@ impl_runtime_apis! {
|
||||
gas_limit: Option<Weight>,
|
||||
storage_deposit_limit: Option<Balance>,
|
||||
input_data: Vec<u8>,
|
||||
) -> pallet_contracts_primitives::ContractExecResult<Balance> {
|
||||
) -> pallet_contracts_primitives::ContractExecResult<Balance, EventRecord> {
|
||||
let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block);
|
||||
Contracts::bare_call(
|
||||
origin,
|
||||
@@ -2159,7 +2164,8 @@ impl_runtime_apis! {
|
||||
gas_limit,
|
||||
storage_deposit_limit,
|
||||
input_data,
|
||||
true,
|
||||
pallet_contracts::DebugInfo::UnsafeDebug,
|
||||
pallet_contracts::CollectEvents::UnsafeCollect,
|
||||
pallet_contracts::Determinism::Enforced,
|
||||
)
|
||||
}
|
||||
@@ -2172,7 +2178,7 @@ impl_runtime_apis! {
|
||||
code: pallet_contracts_primitives::Code<Hash>,
|
||||
data: Vec<u8>,
|
||||
salt: Vec<u8>,
|
||||
) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, Balance>
|
||||
) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, Balance, EventRecord>
|
||||
{
|
||||
let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block);
|
||||
Contracts::bare_instantiate(
|
||||
@@ -2183,7 +2189,8 @@ impl_runtime_apis! {
|
||||
code,
|
||||
data,
|
||||
salt,
|
||||
true
|
||||
pallet_contracts::DebugInfo::UnsafeDebug,
|
||||
pallet_contracts::CollectEvents::UnsafeCollect,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user