pub struct TransferWithAuthorization {
pub from: [u8; 20],
pub to: [u8; 20],
pub value: [u8; 32],
pub valid_after: u64,
pub valid_before: u64,
pub nonce: [u8; 32],
}Expand description
EIP-3009 TransferWithAuthorization for gasless token transfers.
Used by USDC and other compliant tokens. The token holder signs a typed message authorizing a relayer to execute the transfer on their behalf.
Fields§
§from: [u8; 20]Token holder (sender).
to: [u8; 20]Recipient address.
value: [u8; 32]Transfer amount (32-byte big-endian uint256).
valid_after: u64Earliest valid timestamp.
valid_before: u64Latest valid timestamp.
nonce: [u8; 32]Unique nonce (32 bytes, chosen by the authorizer).
Implementations§
Source§impl TransferWithAuthorization
impl TransferWithAuthorization
Sourcepub fn type_hash() -> [u8; 32]
pub fn type_hash() -> [u8; 32]
The EIP-712 typehash for TransferWithAuthorization.
keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
Sourcepub fn struct_hash(&self) -> [u8; 32]
pub fn struct_hash(&self) -> [u8; 32]
Compute the struct hash.
Sourcepub fn signing_hash(&self, domain_separator: &[u8; 32]) -> [u8; 32]
pub fn signing_hash(&self, domain_separator: &[u8; 32]) -> [u8; 32]
Compute the EIP-712 signing hash.
Sourcepub fn sign(
&self,
signer: &EthereumSigner,
domain_separator: &[u8; 32],
) -> Result<EthereumSignature, SignerError>
pub fn sign( &self, signer: &EthereumSigner, domain_separator: &[u8; 32], ) -> Result<EthereumSignature, SignerError>
Sign this authorization.
Trait Implementations§
Source§impl Clone for TransferWithAuthorization
impl Clone for TransferWithAuthorization
Source§fn clone(&self) -> TransferWithAuthorization
fn clone(&self) -> TransferWithAuthorization
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 moreAuto Trait Implementations§
impl Freeze for TransferWithAuthorization
impl RefUnwindSafe for TransferWithAuthorization
impl Send for TransferWithAuthorization
impl Sync for TransferWithAuthorization
impl Unpin for TransferWithAuthorization
impl UnsafeUnpin for TransferWithAuthorization
impl UnwindSafe for TransferWithAuthorization
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