mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-09 12:58:05 +00:00
BREAKING: Rename Origin (#12258)
* BREAKING: Rename Origin * more renaming * a bit more renaming * fix * more fixing * fix in frame_support * even more fixes * fix * small fix * ... * update .stderr * docs * update docs * update docs * docs
This commit is contained in:
@@ -162,12 +162,12 @@ pub fn expand_outer_dispatch(
|
||||
}
|
||||
}
|
||||
impl #scrate::dispatch::Dispatchable for RuntimeCall {
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Config = RuntimeCall;
|
||||
type Info = #scrate::dispatch::DispatchInfo;
|
||||
type PostInfo = #scrate::dispatch::PostDispatchInfo;
|
||||
fn dispatch(self, origin: Origin) -> #scrate::dispatch::DispatchResultWithPostInfo {
|
||||
if !<Self::Origin as #scrate::traits::OriginTrait>::filter_call(&origin, &self) {
|
||||
fn dispatch(self, origin: RuntimeOrigin) -> #scrate::dispatch::DispatchResultWithPostInfo {
|
||||
if !<Self::RuntimeOrigin as #scrate::traits::OriginTrait>::filter_call(&origin, &self) {
|
||||
return #scrate::sp_std::result::Result::Err(
|
||||
#system_path::Error::<#runtime>::CallFiltered.into()
|
||||
);
|
||||
@@ -177,8 +177,8 @@ pub fn expand_outer_dispatch(
|
||||
}
|
||||
}
|
||||
impl #scrate::traits::UnfilteredDispatchable for RuntimeCall {
|
||||
type Origin = Origin;
|
||||
fn dispatch_bypass_filter(self, origin: Origin) -> #scrate::dispatch::DispatchResultWithPostInfo {
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
fn dispatch_bypass_filter(self, origin: RuntimeOrigin) -> #scrate::dispatch::DispatchResultWithPostInfo {
|
||||
match self {
|
||||
#(
|
||||
#pallet_attrs
|
||||
|
||||
@@ -103,13 +103,13 @@ pub fn expand_outer_origin(
|
||||
///
|
||||
#[doc = #doc_string]
|
||||
#[derive(Clone)]
|
||||
pub struct Origin {
|
||||
pub struct RuntimeOrigin {
|
||||
caller: OriginCaller,
|
||||
filter: #scrate::sp_std::rc::Rc<Box<dyn Fn(&<#runtime as #system_path::Config>::RuntimeCall) -> bool>>,
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl #scrate::sp_std::fmt::Debug for Origin {
|
||||
impl #scrate::sp_std::fmt::Debug for RuntimeOrigin {
|
||||
fn fmt(
|
||||
&self,
|
||||
fmt: &mut #scrate::sp_std::fmt::Formatter,
|
||||
@@ -119,7 +119,7 @@ pub fn expand_outer_origin(
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl #scrate::sp_std::fmt::Debug for Origin {
|
||||
impl #scrate::sp_std::fmt::Debug for RuntimeOrigin {
|
||||
fn fmt(
|
||||
&self,
|
||||
fmt: &mut #scrate::sp_std::fmt::Formatter,
|
||||
@@ -131,7 +131,7 @@ pub fn expand_outer_origin(
|
||||
}
|
||||
}
|
||||
|
||||
impl #scrate::traits::OriginTrait for Origin {
|
||||
impl #scrate::traits::OriginTrait for RuntimeOrigin {
|
||||
type Call = <#runtime as #system_path::Config>::RuntimeCall;
|
||||
type PalletsOrigin = OriginCaller;
|
||||
type AccountId = <#runtime as #system_path::Config>::AccountId;
|
||||
@@ -214,21 +214,21 @@ pub fn expand_outer_origin(
|
||||
|
||||
// For backwards compatibility and ease of accessing these functions.
|
||||
#[allow(dead_code)]
|
||||
impl Origin {
|
||||
impl RuntimeOrigin {
|
||||
|
||||
#[doc = #doc_string_none_origin]
|
||||
pub fn none() -> Self {
|
||||
<Origin as #scrate::traits::OriginTrait>::none()
|
||||
<RuntimeOrigin as #scrate::traits::OriginTrait>::none()
|
||||
}
|
||||
|
||||
#[doc = #doc_string_root_origin]
|
||||
pub fn root() -> Self {
|
||||
<Origin as #scrate::traits::OriginTrait>::root()
|
||||
<RuntimeOrigin as #scrate::traits::OriginTrait>::root()
|
||||
}
|
||||
|
||||
#[doc = #doc_string_signed_origin]
|
||||
pub fn signed(by: <#runtime as #system_path::Config>::AccountId) -> Self {
|
||||
<Origin as #scrate::traits::OriginTrait>::signed(by)
|
||||
<RuntimeOrigin as #scrate::traits::OriginTrait>::signed(by)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ pub fn expand_outer_origin(
|
||||
}
|
||||
}
|
||||
|
||||
impl From<#system_path::Origin<#runtime>> for Origin {
|
||||
impl From<#system_path::Origin<#runtime>> for RuntimeOrigin {
|
||||
|
||||
#[doc = #doc_string_runtime_origin]
|
||||
fn from(x: #system_path::Origin<#runtime>) -> Self {
|
||||
@@ -260,9 +260,9 @@ pub fn expand_outer_origin(
|
||||
}
|
||||
}
|
||||
|
||||
impl From<OriginCaller> for Origin {
|
||||
impl From<OriginCaller> for RuntimeOrigin {
|
||||
fn from(x: OriginCaller) -> Self {
|
||||
let mut o = Origin {
|
||||
let mut o = RuntimeOrigin {
|
||||
caller: x,
|
||||
filter: #scrate::sp_std::rc::Rc::new(Box::new(|_| true)),
|
||||
};
|
||||
@@ -273,9 +273,9 @@ pub fn expand_outer_origin(
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Origin> for #scrate::sp_std::result::Result<#system_path::Origin<#runtime>, Origin> {
|
||||
impl From<RuntimeOrigin> for #scrate::sp_std::result::Result<#system_path::Origin<#runtime>, RuntimeOrigin> {
|
||||
/// NOTE: converting to pallet origin loses the origin filter information.
|
||||
fn from(val: Origin) -> Self {
|
||||
fn from(val: RuntimeOrigin) -> Self {
|
||||
if let OriginCaller::system(l) = val.caller {
|
||||
Ok(l)
|
||||
} else {
|
||||
@@ -283,7 +283,7 @@ pub fn expand_outer_origin(
|
||||
}
|
||||
}
|
||||
}
|
||||
impl From<Option<<#runtime as #system_path::Config>::AccountId>> for Origin {
|
||||
impl From<Option<<#runtime as #system_path::Config>::AccountId>> for RuntimeOrigin {
|
||||
#[doc = #doc_string_runtime_origin_with_caller]
|
||||
fn from(x: Option<<#runtime as #system_path::Config>::AccountId>) -> Self {
|
||||
<#system_path::Origin<#runtime>>::from(x).into()
|
||||
@@ -374,7 +374,7 @@ fn expand_origin_pallet_conversions(
|
||||
}
|
||||
|
||||
#attr
|
||||
impl From<#pallet_origin> for Origin {
|
||||
impl From<#pallet_origin> for RuntimeOrigin {
|
||||
#[doc = #doc_string]
|
||||
fn from(x: #pallet_origin) -> Self {
|
||||
let x: OriginCaller = x.into();
|
||||
@@ -383,9 +383,9 @@ fn expand_origin_pallet_conversions(
|
||||
}
|
||||
|
||||
#attr
|
||||
impl From<Origin> for #scrate::sp_std::result::Result<#pallet_origin, Origin> {
|
||||
impl From<RuntimeOrigin> for #scrate::sp_std::result::Result<#pallet_origin, RuntimeOrigin> {
|
||||
/// NOTE: converting to pallet origin loses the origin filter information.
|
||||
fn from(val: Origin) -> Self {
|
||||
fn from(val: RuntimeOrigin) -> Self {
|
||||
if let OriginCaller::#variant_name(l) = val.caller {
|
||||
Ok(l)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user