pub struct DelegateAction {
pub sender_id: AccountId,
pub receiver_id: AccountId,
pub actions: Vec<NonDelegateAction>,
pub nonce: u64,
pub max_block_height: u64,
pub public_key: PublicKey,
}Expand description
Delegate action for meta-transactions.
Fields§
§sender_id: AccountIdSender of the delegate action.
receiver_id: AccountIdReceiver of the delegate action.
actions: Vec<NonDelegateAction>Actions to delegate.
nonce: u64Nonce for replay protection.
max_block_height: u64Maximum block height for the action.
public_key: PublicKeyPublic key authorizing the delegate.
Implementations§
Source§impl DelegateAction
impl DelegateAction
Sourcepub fn serialize_for_signing(&self) -> Vec<u8> ⓘ
pub fn serialize_for_signing(&self) -> Vec<u8> ⓘ
Serialize the delegate action for signing.
Per NEP-461, this prepends a u32 prefix (2^30 + 366) before the delegate action, ensuring signed delegate actions are never identical to signed transactions.
§Example
ⓘ
let bytes = delegate_action.serialize_for_signing();
let hash = CryptoHash::hash(&bytes);
let signature = signer.sign(hash.as_bytes()).await?;Sourcepub fn get_hash(&self) -> CryptoHash
pub fn get_hash(&self) -> CryptoHash
Get the hash of this delegate action (for signing).
Sourcepub fn sign(self, signature: Signature) -> SignedDelegateAction
pub fn sign(self, signature: Signature) -> SignedDelegateAction
Sign this delegate action and return a SignedDelegateAction.
Trait Implementations§
Source§impl BorshDeserialize for DelegateAction
impl BorshDeserialize for DelegateAction
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for DelegateAction
impl BorshSerialize for DelegateAction
Source§impl Clone for DelegateAction
impl Clone for DelegateAction
Source§fn clone(&self) -> DelegateAction
fn clone(&self) -> DelegateAction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DelegateAction
impl Debug for DelegateAction
Source§impl PartialEq for DelegateAction
impl PartialEq for DelegateAction
impl Eq for DelegateAction
impl StructuralPartialEq for DelegateAction
Auto Trait Implementations§
impl Freeze for DelegateAction
impl RefUnwindSafe for DelegateAction
impl Send for DelegateAction
impl Sync for DelegateAction
impl Unpin for DelegateAction
impl UnsafeUnpin for DelegateAction
impl UnwindSafe for DelegateAction
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.