pub enum SigningScheme {
Eip712,
EthSign,
Eip1271,
PreSign,
}Expand description
Signing scheme for a CoW Protocol order.
Determines how the order signature is verified:
Eip712— standard EIP-712 typed-data signature (most wallets).EthSign— legacyeth_signwith EIP-191 prefix.Eip1271— smart-contract signature viaisValidSignature.PreSign— on-chain pre-approval viasetPreSignature.
§Example
use cow_types::SigningScheme;
let scheme = SigningScheme::Eip712;
assert_eq!(scheme.as_str(), "eip712");
assert!(scheme.is_eip712());Variants§
Eip712
Standard EIP-712 typed-data signature.
EthSign
Legacy eth_sign (EIP-191) signature.
Eip1271
EIP-1271 smart-contract signature.
PreSign
On-chain pre-signature via setPreSignature.
Implementations§
Source§impl SigningScheme
impl SigningScheme
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Returns the lowercase string used by the CoW Protocol API.
§Returns
"eip712", "ethsign", "eip1271", or "presign".
Sourcepub const fn is_eip712(self) -> bool
pub const fn is_eip712(self) -> bool
Returns true if the EIP-712 typed-data signing scheme is used.
This is the most common scheme for EOA wallets.
Sourcepub const fn is_eth_sign(self) -> bool
pub const fn is_eth_sign(self) -> bool
Returns true if the legacy EIP-191 (eth_sign) scheme is used.
Some older wallets or hardware signers only support this method.
Sourcepub const fn is_eip1271(self) -> bool
pub const fn is_eip1271(self) -> bool
Returns true if the EIP-1271 smart-contract signature scheme is
used.
The signature is verified on-chain by calling isValidSignature
on the signing contract.
Sourcepub const fn is_presign(self) -> bool
pub const fn is_presign(self) -> bool
Returns true if the on-chain pre-sign scheme is used.
The order owner calls setPreSignature on the settlement contract
before the order can be filled.
Trait Implementations§
Source§impl Clone for SigningScheme
impl Clone for SigningScheme
Source§fn clone(&self) -> SigningScheme
fn clone(&self) -> SigningScheme
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SigningScheme
impl Debug for SigningScheme
Source§impl<'de> Deserialize<'de> for SigningScheme
impl<'de> Deserialize<'de> for SigningScheme
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SigningScheme
impl Display for SigningScheme
Source§impl From<EcdsaSigningScheme> for SigningScheme
impl From<EcdsaSigningScheme> for SigningScheme
Source§fn from(s: EcdsaSigningScheme) -> Self
fn from(s: EcdsaSigningScheme) -> Self
Widen an ECDSA-only scheme to the full SigningScheme enum.
This is the Rust equivalent of SIGN_SCHEME_MAP from the
TypeScript SDK.
Source§impl PartialEq for SigningScheme
impl PartialEq for SigningScheme
Source§impl Serialize for SigningScheme
impl Serialize for SigningScheme
Source§impl TryFrom<&str> for SigningScheme
impl TryFrom<&str> for SigningScheme
impl Copy for SigningScheme
impl Eq for SigningScheme
impl StructuralPartialEq for SigningScheme
Auto Trait Implementations§
impl Freeze for SigningScheme
impl RefUnwindSafe for SigningScheme
impl Send for SigningScheme
impl Sync for SigningScheme
impl Unpin for SigningScheme
impl UnsafeUnpin for SigningScheme
impl UnwindSafe for SigningScheme
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
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.