use alloc::vec::Vec;
use codec::{Decode, Encode};
use frame_support::pallet_prelude::{DispatchResultWithPostInfo, TypeInfo};
use xcm::prelude::*;
#[derive(Encode, Decode, Debug, TypeInfo)]
pub struct CallDryRunEffects<Event> {
pub execution_result: DispatchResultWithPostInfo,
pub emitted_events: Vec<Event>,
pub local_xcm: Option<VersionedXcm<()>>,
pub forwarded_xcms: Vec<(VersionedLocation, Vec<VersionedXcm<()>>)>,
}
#[derive(Encode, Decode, Debug, TypeInfo)]
pub struct XcmDryRunEffects<Event> {
pub execution_result: Outcome,
pub emitted_events: Vec<Event>,
pub forwarded_xcms: Vec<(VersionedLocation, Vec<VersionedXcm<()>>)>,
}
sp_api::decl_runtime_apis! {
#[api_version(2)]
pub trait DryRunApi<Call, Event, OriginCaller>
where
Call: Encode,
Event: Decode,
OriginCaller: Encode
{
fn dry_run_call(origin: OriginCaller, call: Call, result_xcms_version: XcmVersion) -> Result<CallDryRunEffects<Event>, Error>;
#[changed_in(2)]
fn dry_run_call(origin: OriginCaller, call: Call) -> Result<CallDryRunEffects<Event>, Error>;
fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<Call>) -> Result<XcmDryRunEffects<Event>, Error>;
}
}
#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, Debug, TypeInfo)]
pub enum Error {
#[codec(index = 0)]
Unimplemented,
#[codec(index = 1)]
VersionedConversionFailed,
}