-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support decoding signed extensions #1209
Changes from 1 commit
c0226dc
ffec0b1
b0fb96a
c87f165
4ed554d
460bfaf
ea59e6c
3dad997
fe708e7
0eabab9
58fd654
1dd8f53
64b5c90
7d8447e
fe1db8c
d354b1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -346,11 +346,7 @@ where | |
.map(|e| &self.bytes[e.address_start_idx..e.address_end_idx]) | ||
} | ||
|
||
/// Return only the bytes of the signature for this signed extrinsic. | ||
/// | ||
/// # Note | ||
/// | ||
/// Returns `None` if the extrinsic is not signed. | ||
/// Returns Some(signature_bytes) if the extrinsic was signed otherwise None is returned. | ||
pub fn signature_bytes(&self) -> Option<&[u8]> { | ||
self.signed_details | ||
.as_ref() | ||
|
@@ -657,8 +653,10 @@ impl<'a> ExtrinsicSignedExtensions<'a> { | |
}) | ||
} | ||
|
||
/// The tip of an extrinsic, extracted from the `ChargeTransactionPayment` or | ||
/// `ChargeAssetTxPayment` signed extension, depending on which is present. | ||
/// The tip of an extrinsic, extracted from the ChargeTransactionPayment or ChargeAssetTxPayment | ||
/// signed extension, depending on which is present. | ||
/// | ||
/// Returns `None` if `tip` was not found or decoding failed. | ||
pub fn tip(&self) -> Option<u128> { | ||
jsdw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let tip = self.iter().find_map(|e| { | ||
e.ok().filter(|e| { | ||
|
@@ -672,8 +670,9 @@ impl<'a> ExtrinsicSignedExtensions<'a> { | |
Some(tip) | ||
} | ||
|
||
/// The nonce of the account that submitted the extrinsic, extracted from the | ||
/// CheckNonce signed extension. | ||
/// The nonce of the account that submitted the extrinsic, extracted from the CheckNonce signed extension. | ||
/// | ||
/// Returns `None` if `nonce` was not found or decoding failed. | ||
pub fn nonce(&self) -> Option<u64> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may fail on certain runtimes if the Might worth a comment for it and advise to use the dynamic API then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be nice to have for the general usecase... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it's just for a common case that will most likely work, and should fail gracefully and return |
||
let nonce = self | ||
.iter() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just because this is an example, I wonder whether we could make this a bit less ugly, ie removing the
else
branch and moving it after the otherprintln
's or something?