mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 07:31:02 +00:00
DecodeAsEvent and DecodeAsExtrinsic; make easier to implement by removing consts
This commit is contained in:
@@ -4,13 +4,6 @@ use scale_decode::DecodeAsFields;
|
||||
/// This adds information to the type about which event it is, which enforces that
|
||||
/// only the correct event can be decoded into it.
|
||||
pub trait DecodeAsEvent: DecodeAsFields {
|
||||
/// Pallet name.
|
||||
const PALLET_NAME: &'static str;
|
||||
/// Event name.
|
||||
const EVENT_NAME: &'static str;
|
||||
|
||||
/// Returns true if the given pallet and event names match this event.
|
||||
fn is_event(pallet: &str, event: &str) -> bool {
|
||||
Self::PALLET_NAME == pallet && Self::EVENT_NAME == event
|
||||
}
|
||||
fn is_event(pallet: &str, event: &str) -> bool;
|
||||
}
|
||||
|
||||
@@ -4,13 +4,6 @@ use scale_decode::DecodeAsFields;
|
||||
/// This adds information to the type about which extrinsic it is, which enforces that
|
||||
/// only the correct extrinsic can be decoded into it.
|
||||
pub trait DecodeAsExtrinsic: DecodeAsFields {
|
||||
/// Pallet name.
|
||||
const PALLET_NAME: &'static str;
|
||||
/// Call name.
|
||||
const CALL_NAME: &'static str;
|
||||
|
||||
/// Returns true if the given pallet and call names match this extrinsic.
|
||||
fn is_extrinsic(pallet: &str, call: &str) -> bool {
|
||||
Self::PALLET_NAME == pallet && Self::CALL_NAME == call
|
||||
}
|
||||
fn is_extrinsic(pallet: &str, call: &str) -> bool;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user