//! AccCompliance 协议客户端接口 //! NAC 原生 SDK - 通过 NRPC4.0 与链交互 use crate::error::{NACError, Result}; use crate::adapters::NacLensClient; use nac_udm::primitives::{Address, Hash}; use serde_json::{json, Value}; /// AccCompliance 协议客户端 pub struct AccComplianceClient { pub client: NacLensClient, pub contract_address: Address, } impl AccComplianceClient { pub fn new(client: NacLensClient, contract_address: Address) -> Self { Self { client, contract_address } } /// 七层合规验证 pub async fn verify(&self, params: Value) -> Result { let mut p = params; p["contract"] = json!(self.contract_address.to_hex()); self.client.call("acc_compliance.verify", p).await } /// 查询合规记录 pub async fn get_record(&self, params: Value) -> Result { let mut p = params; p["contract"] = json!(self.contract_address.to_hex()); self.client.call("acc_compliance.get_record", p).await } /// 更新合规记录 pub async fn update_record(&self, params: Value) -> Result { let mut p = params; p["contract"] = json!(self.contract_address.to_hex()); self.client.call("acc_compliance.update_record", p).await } /// 查询司法管辖区规则 pub async fn get_jurisdiction_rules(&self, params: Value) -> Result { let mut p = params; p["contract"] = json!(self.contract_address.to_hex()); self.client.call("acc_compliance.get_jurisdiction_rules", p).await } }