Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement 08-wasm client types #1031

Merged
merged 15 commits into from
Jan 12, 2024
Merged
21 changes: 21 additions & 0 deletions ibc-clients/ics08-wasm/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,29 @@ pub mod msgs;
#[cfg(feature = "cosmwasm")]
pub mod serializer;

use core::str::FromStr;

use ibc_core_host_types::identifiers::ClientType;
use ibc_primitives::prelude::Vec;
pub type Bytes = Vec<u8>;

pub static SUBJECT_PREFIX: &[u8] = b"subject/";
pub static SUBSTITUTE_PREFIX: &[u8] = b"substitute/";

pub const WASM_CLIENT_TYPE: &str = "08-wasm";

/// Returns the wasm `ClientType`
pub fn client_type() -> ClientType {
ClientType::from_str(WASM_CLIENT_TYPE).expect("Never fails because it's valid")
}

#[cfg(test)]
mod tests {
use super::*;

// Ensures that the validation in `ClientType::from_str` doesn't fail for the wasm client type
#[test]
pub fn test_wasm_client_type() {
let _ = ClientType::from_str(WASM_CLIENT_TYPE).unwrap();
}
}