diff --git a/ckb-auth-rs/src/ckb_auth.rs b/ckb-auth-rs/src/ckb_auth.rs index 0aa7bcb..24bae0d 100644 --- a/ckb-auth-rs/src/ckb_auth.rs +++ b/ckb-auth-rs/src/ckb_auth.rs @@ -1,6 +1,6 @@ extern crate alloc; -use crate::{CkbAuthError, CkbAuthType, EntryCategoryType}; +use crate::{CkbAuthError, CkbAuthType, CkbEntryType, EntryCategoryType}; use alloc::collections::BTreeMap; use alloc::ffi::CString; use alloc::format; @@ -15,12 +15,6 @@ use core::mem::size_of_val; use hex::encode; use log::info; -pub struct CkbEntryType { - pub code_hash: [u8; 32], - pub hash_type: ScriptHashType, - pub entry_category: EntryCategoryType, -} - pub fn ckb_auth( entry: &CkbEntryType, id: &CkbAuthType, diff --git a/ckb-auth-rs/src/lib.rs b/ckb-auth-rs/src/lib.rs index 51e9bd8..b34d262 100644 --- a/ckb-auth-rs/src/lib.rs +++ b/ckb-auth-rs/src/lib.rs @@ -3,7 +3,10 @@ extern crate alloc; use core::mem::transmute; #[cfg(target_arch = "riscv64")] -pub mod ckb_auth; +mod ckb_auth; + +#[cfg(target_arch = "riscv64")] +pub use ckb_auth::ckb_auth; #[cfg(target_arch = "riscv64")] mod generate_sighash_all; @@ -17,7 +20,7 @@ use alloc::ffi::NulError; use log::info; #[cfg(target_arch = "riscv64")] -use ckb_std::error::SysError; +use ckb_std::{ckb_types::core::ScriptHashType, error::SysError}; #[cfg(not(target_arch = "riscv64"))] type SysError = u64; @@ -116,3 +119,9 @@ pub struct CkbAuthType { pub algorithm_id: AuthAlgorithmIdType, pub pubkey_hash: [u8; 20], } + +pub struct CkbEntryType { + pub code_hash: [u8; 32], + pub hash_type: ScriptHashType, + pub entry_category: EntryCategoryType, +} diff --git a/examples/auth-rust-demo/contracts/auth-rust-demo/src/entry.rs b/examples/auth-rust-demo/contracts/auth-rust-demo/src/entry.rs index 027e1c4..a0bc146 100644 --- a/examples/auth-rust-demo/contracts/auth-rust-demo/src/entry.rs +++ b/examples/auth-rust-demo/contracts/auth-rust-demo/src/entry.rs @@ -13,8 +13,8 @@ use core::result::Result; use crate::error::Error; use ckb_auth_rs::{ - ckb_auth::{ckb_auth, CkbEntryType}, - generate_sighash_all, AuthAlgorithmIdType, CkbAuthError, CkbAuthType, EntryCategoryType, + ckb_auth, generate_sighash_all, AuthAlgorithmIdType, CkbAuthError, CkbAuthType, CkbEntryType, + EntryCategoryType, }; use ckb_std::{ ckb_constants::Source,