pub struct SignedAction<'a, M: ModuleData> { /* private fields */ }Expand description
A self-custodial action ready to be sent to the venue once signed.
The struct binds the EIP-712 action context to the module-specific payload
and tracks the resulting 65-byte signature. Compose it via SignedAction::new,
then call SignedAction::sign with the session-key signer.
Implementations§
Source§impl<'a, M: ModuleData> SignedAction<'a, M>
impl<'a, M: ModuleData> SignedAction<'a, M>
Sourcepub fn new(
ctx: ActionContext,
module_data: &'a M,
domain_separator: B256,
action_typehash: B256,
) -> Self
pub fn new( ctx: ActionContext, module_data: &'a M, domain_separator: B256, action_typehash: B256, ) -> Self
Constructs a new unsigned action.
Sourcepub fn sign(
&mut self,
signer: &PrivateKeySigner,
) -> Result<[u8; 65], TypedDataError>
pub fn sign( &mut self, signer: &PrivateKeySigner, ) -> Result<[u8; 65], TypedDataError>
Signs the action using the supplied secp256k1 session-key signer.
Validates signature_expiry_sec against MIN_SIGNATURE_TTL before
hashing; the adapter conservatively requires five minutes in the future.
§Errors
Returns an error if the configured expiry is closer to now than the venue minimum, if the
system clock is invalid, if the per-module ABI encoder rejects the payload, or if the
underlying secp256k1 signer errors.
Sourcepub fn signature_hex(&self) -> String
pub fn signature_hex(&self) -> String
Returns the signature as a 0x-prefixed 130-character hex string.
Panics if SignedAction::sign has not yet been called.
§Panics
Panics if SignedAction::sign has not been called.
Sourcepub const fn subaccount_id(&self) -> u64
pub const fn subaccount_id(&self) -> u64
Returns the signed action’s subaccount id.
Sourcepub const fn signer_address(&self) -> Address
pub const fn signer_address(&self) -> Address
Returns the signed action’s session-key signer address.
Sourcepub const fn signature_expiry_sec(&self) -> i64
pub const fn signature_expiry_sec(&self) -> i64
Returns the signed action’s signature expiry in UNIX seconds.
Trait Implementations§
Source§impl<M> Debug for SignedAction<'_, M>where
M: ModuleData + Debug,
impl<M> Debug for SignedAction<'_, M>where
M: ModuleData + Debug,
Source§impl<M: ModuleData> Drop for SignedAction<'_, M>
impl<M: ModuleData> Drop for SignedAction<'_, M>
Source§impl<M: ModuleData> Zeroize for SignedAction<'_, M>
impl<M: ModuleData> Zeroize for SignedAction<'_, M>
impl<M: ModuleData> ZeroizeOnDrop for SignedAction<'_, M>
Auto Trait Implementations§
impl<'a, M> Freeze for SignedAction<'a, M>
impl<'a, M> RefUnwindSafe for SignedAction<'a, M>where
&'a M: RefUnwindSafe,
impl<'a, M> Send for SignedAction<'a, M>
impl<'a, M> Sync for SignedAction<'a, M>
impl<'a, M> Unpin for SignedAction<'a, M>
impl<'a, M> UnsafeUnpin for SignedAction<'a, M>where
&'a M: UnsafeUnpin,
impl<'a, M> UnwindSafe for SignedAction<'a, M>where
&'a M: UnwindSafe,
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more