Better devX for attested messages in app contracts (#55)
This commit is contained in:
parent
3509edfe3d
commit
99f2974869
3 changed files with 47 additions and 2 deletions
|
@ -5,7 +5,8 @@ use crate::{
|
|||
error::Error,
|
||||
handler::Handler,
|
||||
msg::execute::attested::{
|
||||
Attestation, Attested, EpidAttestation, HasUserData, MockAttestation,
|
||||
Attestation, Attested, AttestedMsgSansHandler, EpidAttestation, HasUserData,
|
||||
MockAttestation,
|
||||
},
|
||||
state::CONFIG,
|
||||
};
|
||||
|
@ -71,3 +72,14 @@ where
|
|||
Handler::handle(attestation, deps, env, info)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Handler for AttestedMsgSansHandler<T> {
|
||||
fn handle(
|
||||
self,
|
||||
_deps: DepsMut<'_>,
|
||||
_env: &Env,
|
||||
_info: &MessageInfo,
|
||||
) -> Result<Response, Error> {
|
||||
Ok(Response::default())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,3 +171,36 @@ impl Attestation for MockAttestation {
|
|||
unimplemented!("MockAttestation handler is a noop")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct AttestedMsgSansHandler<T>(pub T);
|
||||
|
||||
#[cw_serde]
|
||||
pub struct RawAttestedMsgSansHandler<T>(pub T);
|
||||
|
||||
impl<T> HasDomainType for RawAttestedMsgSansHandler<T> {
|
||||
type DomainType = AttestedMsgSansHandler<T>;
|
||||
}
|
||||
|
||||
impl<T> HasUserData for AttestedMsgSansHandler<T>
|
||||
where
|
||||
T: HasUserData,
|
||||
{
|
||||
fn user_data(&self) -> UserData {
|
||||
self.0.user_data()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> TryFrom<RawAttestedMsgSansHandler<T>> for AttestedMsgSansHandler<T> {
|
||||
type Error = StdError;
|
||||
|
||||
fn try_from(value: RawAttestedMsgSansHandler<T>) -> Result<Self, Self::Error> {
|
||||
Ok(Self(value.0))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<AttestedMsgSansHandler<T>> for RawAttestedMsgSansHandler<T> {
|
||||
fn from(value: AttestedMsgSansHandler<T>) -> Self {
|
||||
Self(value.0)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ clap.workspace = true
|
|||
ecies.workspace = true
|
||||
hex.workspace = true
|
||||
k256.workspace = true
|
||||
rand.workspace = true
|
||||
rand = { workspace = true, default-features = true }
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
sha2.workspace = true
|
||||
|
|
Loading…
Reference in a new issue