- nac-sdk: 修复 116 个编译错误(类型存根、import 引用、注释格式) - nac-sdk: 添加 NacLensClient/NRPC4Client/NRPC3Client 类型存根 - nac-sdk: 添加 AccountState/Jurisdiction/CSNPNetwork/Decimal 存根 - nac-sdk: 修复 protocols/acc*.rs 多行注释格式错误 - nac-id: 添加 TwitterOAuthController(Twitter/X OAuth 2.0) - nac-id: 添加 FacebookOAuthController(Facebook OAuth) - nac-id: 添加 WechatOAuthController(微信扫码登录) - nac-id: 添加 OAuth 数据库迁移(twitter_id/facebook_id/wechat_openid 字段) - nac-id: 添加 OAuth 路由配置 - nac-id: 添加 socialite services.php 配置 Closes #51 Closes #54
This commit is contained in:
parent
17f640336f
commit
33d5f99c6b
|
|
@ -252,6 +252,7 @@ dependencies = [
|
|||
"anyhow",
|
||||
"chrono",
|
||||
"hex",
|
||||
"nac-upgrade-framework",
|
||||
"rand",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
@ -261,6 +262,20 @@ dependencies = [
|
|||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nac-upgrade-framework"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"hex",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha3",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
|
|
|
|||
|
|
@ -1541,6 +1541,7 @@ name = "nac-constitution-state"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"nac-udm",
|
||||
"nac-upgrade-framework",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
|
@ -1554,6 +1555,7 @@ dependencies = [
|
|||
"libp2p",
|
||||
"lru",
|
||||
"nac-udm",
|
||||
"nac-upgrade-framework",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 1.0.69",
|
||||
|
|
@ -1566,13 +1568,14 @@ name = "nac-csnp-l1"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"nac-udm",
|
||||
"nac-upgrade-framework",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nac-nrpc4"
|
||||
name = "nac-lens"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
|
|
@ -1585,6 +1588,7 @@ dependencies = [
|
|||
"nac-csnp-l0",
|
||||
"nac-csnp-l1",
|
||||
"nac-udm",
|
||||
"nac-upgrade-framework",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
|
|
@ -1603,6 +1607,7 @@ dependencies = [
|
|||
"chrono",
|
||||
"hex",
|
||||
"log",
|
||||
"nac-upgrade-framework",
|
||||
"primitive-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
@ -1611,6 +1616,20 @@ dependencies = [
|
|||
"thiserror 2.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nac-upgrade-framework"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"hex",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha3",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "netlink-packet-core"
|
||||
version = "0.7.0"
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@
|
|||
|
||||
use crate::error::{NACError, Result};
|
||||
use super::config::L1Config;
|
||||
use nac_udm::primitives::{Address, Hash, Decimal};
|
||||
use nac_udm::types::{
|
||||
use nac_udm::primitives::{Address, Hash};
|
||||
use super::{
|
||||
Block, Transaction, SignedTransaction, TransactionReceipt,
|
||||
GNACSCode, GNACSMetadata, ACC20Metadata, ACC1400Metadata,
|
||||
CollateralProof, CrossShardStatus,
|
||||
};
|
||||
use nac_lens::client::NRPC4Client;
|
||||
use super::NRPC4Client;
|
||||
use std::time::Duration;
|
||||
|
||||
/// L1协议层适配器
|
||||
|
|
|
|||
|
|
@ -29,14 +29,16 @@
|
|||
|
||||
use crate::error::{NACError, Result};
|
||||
use super::config::L2Config;
|
||||
use nac_udm::primitives::{Address, Hash, Decimal};
|
||||
use nac_udm::types::{
|
||||
use nac_udm::primitives::{Address, Hash};
|
||||
use super::{
|
||||
Transaction, SignedTransaction, Block,
|
||||
Amendment, AmendmentStatus, Proposal, ProposalDetails,
|
||||
Vote, ComplianceResult, PeerInfo,
|
||||
};
|
||||
use nac_lens::client::NRPC4Client;
|
||||
use nac_csnp::network::CSNPNetwork;
|
||||
use super::NRPC4Client;
|
||||
use super::CSNPNetwork;
|
||||
use super::Decimal;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
/// 提案ID类型
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
use crate::error::{NACError, Result};
|
||||
use super::config::L3Config;
|
||||
use nac_udm::primitives::{Address, Hash};
|
||||
use nac_udm::types::{
|
||||
use super::{
|
||||
Block, Transaction, TransactionReceipt, AccountState,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
|
|
|
|||
|
|
@ -31,15 +31,16 @@
|
|||
|
||||
use crate::error::{NACError, Result};
|
||||
use super::config::L4Config;
|
||||
use nac_udm::primitives::{Address, Decimal};
|
||||
use nac_udm::types::{
|
||||
use nac_udm::primitives::Address;
|
||||
use super::Decimal;
|
||||
use super::{
|
||||
Transaction, ComplianceData, ComplianceResult, ComplianceReport,
|
||||
ZKProof, Asset, ValuationResult, MarketData, RiskScore,
|
||||
UserBehavior, AnomalyReport, RiskReport, Reserves, ReserveStrategy,
|
||||
SDRForecast, LiquidityState, LiquidityStrategy, Jurisdiction,
|
||||
InternationalAgreement,
|
||||
};
|
||||
use nac_lens::client::NRPC4Client;
|
||||
use super::NRPC4Client;
|
||||
use std::time::Duration;
|
||||
|
||||
/// L4 AI层适配器
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@
|
|||
|
||||
use crate::error::{NACError, Result};
|
||||
use super::config::L5Config;
|
||||
use nac_udm::primitives::{Address, Hash, Decimal};
|
||||
use nac_udm::types::{
|
||||
use nac_udm::primitives::{Address, Hash};
|
||||
use super::{
|
||||
Wallet, BalanceInfo, TransactionInfo, TransactionReceipt,
|
||||
ChainStatistics, AddressInfo, TokenMetadata, TradingPair,
|
||||
OrderBook, Value, ContractCall,
|
||||
};
|
||||
use nac_lens::client::NRPC4Client;
|
||||
use super::NRPC4Client;
|
||||
use std::time::Duration;
|
||||
|
||||
/// 列表ID类型
|
||||
|
|
|
|||
|
|
@ -205,3 +205,426 @@ mod tests {
|
|||
assert!(result.is_ok() || result.is_err());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ============================================================
|
||||
// 类型存根:这些类型将在对应的 nac-udm 子模块实现后替换
|
||||
// 目前用于让 nac-sdk 可以编译
|
||||
// ============================================================
|
||||
|
||||
/// NAC 区块结构
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Block {
|
||||
pub height: u64,
|
||||
pub hash: [u8; 48],
|
||||
pub parent_hash: [u8; 48],
|
||||
pub timestamp: u64,
|
||||
pub transactions: Vec<Transaction>,
|
||||
pub producer: [u8; 32],
|
||||
pub size_bytes: u64,
|
||||
}
|
||||
|
||||
/// NAC 交易结构
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Transaction {
|
||||
pub hash: [u8; 48],
|
||||
pub from: [u8; 32],
|
||||
pub to: [u8; 32],
|
||||
pub amount: u128,
|
||||
pub nonce: u64,
|
||||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
/// 已签名交易
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct SignedTransaction {
|
||||
pub transaction: Transaction,
|
||||
pub signature: Vec<u8>,
|
||||
}
|
||||
|
||||
/// 交易收据
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct TransactionReceipt {
|
||||
pub tx_hash: [u8; 48],
|
||||
pub block_height: u64,
|
||||
pub status: bool,
|
||||
pub gas_used: u64,
|
||||
}
|
||||
|
||||
/// GNACS 元数据
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct GNACSMetadata {
|
||||
pub code: String,
|
||||
pub category: String,
|
||||
pub jurisdiction: String,
|
||||
}
|
||||
|
||||
/// ACC-20 代币元数据
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ACC20Metadata {
|
||||
pub name: String,
|
||||
pub symbol: String,
|
||||
pub total_supply: u128,
|
||||
pub decimals: u8,
|
||||
}
|
||||
|
||||
/// ACC-1400 证券型代币元数据
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ACC1400Metadata {
|
||||
pub name: String,
|
||||
pub symbol: String,
|
||||
pub total_supply: u128,
|
||||
pub jurisdiction: String,
|
||||
pub compliance_level: u8,
|
||||
}
|
||||
|
||||
/// 抵押证明
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct CollateralProof {
|
||||
pub asset_id: String,
|
||||
pub value_usd: u128,
|
||||
pub proof_hash: [u8; 48],
|
||||
}
|
||||
|
||||
/// 跨分片交易状态
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub enum CrossShardStatus {
|
||||
Pending,
|
||||
Locked,
|
||||
Committed,
|
||||
Aborted,
|
||||
}
|
||||
|
||||
/// 合规数据
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ComplianceData {
|
||||
pub asset_id: String,
|
||||
pub jurisdiction: String,
|
||||
pub compliance_type: String,
|
||||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
/// 合规结果
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ComplianceResult {
|
||||
pub passed: bool,
|
||||
pub score: f64,
|
||||
pub issues: Vec<String>,
|
||||
}
|
||||
|
||||
/// 合规报告
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ComplianceReport {
|
||||
pub asset_id: String,
|
||||
pub result: ComplianceResult,
|
||||
pub timestamp: u64,
|
||||
}
|
||||
|
||||
/// 零知识证明
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ZKProof {
|
||||
pub proof_type: String,
|
||||
pub proof_data: Vec<u8>,
|
||||
pub public_inputs: Vec<u8>,
|
||||
}
|
||||
|
||||
/// 资产信息
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Asset {
|
||||
pub id: String,
|
||||
pub gnacs_code: String,
|
||||
pub owner: [u8; 32],
|
||||
pub value_usd: u128,
|
||||
}
|
||||
|
||||
/// 估值结果
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ValuationResult {
|
||||
pub asset_id: String,
|
||||
pub value_usd: u128,
|
||||
pub confidence: f64,
|
||||
pub timestamp: u64,
|
||||
}
|
||||
|
||||
/// 市场数据
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct MarketData {
|
||||
pub symbol: String,
|
||||
pub price_usd: f64,
|
||||
pub volume_24h: f64,
|
||||
pub timestamp: u64,
|
||||
}
|
||||
|
||||
/// 风险评分
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct RiskScore {
|
||||
pub score: f64,
|
||||
pub level: String,
|
||||
pub factors: Vec<String>,
|
||||
}
|
||||
|
||||
/// 用户行为
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct UserBehavior {
|
||||
pub address: [u8; 32],
|
||||
pub action: String,
|
||||
pub timestamp: u64,
|
||||
}
|
||||
|
||||
/// 异常报告
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct AnomalyReport {
|
||||
pub address: [u8; 32],
|
||||
pub anomaly_type: String,
|
||||
pub severity: f64,
|
||||
pub timestamp: u64,
|
||||
}
|
||||
|
||||
/// 风险报告
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct RiskReport {
|
||||
pub asset_id: String,
|
||||
pub risk_score: RiskScore,
|
||||
pub timestamp: u64,
|
||||
}
|
||||
|
||||
/// 储备信息
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Reserves {
|
||||
pub total_usd: u128,
|
||||
pub gold_oz: f64,
|
||||
pub sdr_units: f64,
|
||||
}
|
||||
|
||||
/// 储备策略
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ReserveStrategy {
|
||||
pub target_ratio: f64,
|
||||
pub rebalance_threshold: f64,
|
||||
}
|
||||
|
||||
/// SDR 预测
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct SDRForecast {
|
||||
pub predicted_rate: f64,
|
||||
pub confidence: f64,
|
||||
pub horizon_days: u32,
|
||||
}
|
||||
|
||||
/// 流动性状态
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct LiquidityState {
|
||||
pub available: u128,
|
||||
pub locked: u128,
|
||||
pub ratio: f64,
|
||||
}
|
||||
|
||||
/// 流动性策略
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct LiquidityStrategy {
|
||||
pub min_ratio: f64,
|
||||
pub target_ratio: f64,
|
||||
}
|
||||
|
||||
/// 国际协议
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct InternationalAgreement {
|
||||
pub id: String,
|
||||
pub parties: Vec<String>,
|
||||
pub terms: String,
|
||||
}
|
||||
|
||||
/// 节点信息
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct PeerInfo {
|
||||
pub node_id: String,
|
||||
pub address: String,
|
||||
pub status: String,
|
||||
}
|
||||
|
||||
/// 修正案
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Amendment {
|
||||
pub id: u64,
|
||||
pub title: String,
|
||||
pub content: String,
|
||||
pub proposer: [u8; 32],
|
||||
}
|
||||
|
||||
/// 修正案状态
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub enum AmendmentStatus {
|
||||
Proposed,
|
||||
Voting,
|
||||
Passed,
|
||||
Rejected,
|
||||
}
|
||||
|
||||
/// 提案
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Proposal {
|
||||
pub id: u64,
|
||||
pub title: String,
|
||||
pub proposer: [u8; 32],
|
||||
pub status: String,
|
||||
}
|
||||
|
||||
/// 提案详情
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ProposalDetails {
|
||||
pub proposal: Proposal,
|
||||
pub votes_for: u64,
|
||||
pub votes_against: u64,
|
||||
pub description: String,
|
||||
}
|
||||
|
||||
/// 投票
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Vote {
|
||||
pub proposal_id: u64,
|
||||
pub voter: [u8; 32],
|
||||
pub approve: bool,
|
||||
pub timestamp: u64,
|
||||
}
|
||||
|
||||
/// 钱包
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Wallet {
|
||||
pub address: [u8; 32],
|
||||
pub balance: u128,
|
||||
}
|
||||
|
||||
/// 余额信息
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct BalanceInfo {
|
||||
pub address: [u8; 32],
|
||||
pub nac_balance: u128,
|
||||
pub xtzh_balance: u128,
|
||||
}
|
||||
|
||||
/// 交易信息
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct TransactionInfo {
|
||||
pub hash: [u8; 48],
|
||||
pub from: [u8; 32],
|
||||
pub to: [u8; 32],
|
||||
pub amount: u128,
|
||||
pub timestamp: u64,
|
||||
pub status: String,
|
||||
}
|
||||
|
||||
/// 链统计
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ChainStatistics {
|
||||
pub block_height: u64,
|
||||
pub total_transactions: u64,
|
||||
pub active_nodes: u32,
|
||||
pub tps: f64,
|
||||
}
|
||||
|
||||
/// 地址信息
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct AddressInfo {
|
||||
pub address: [u8; 32],
|
||||
pub balance: u128,
|
||||
pub transaction_count: u64,
|
||||
pub node_status: Option<String>,
|
||||
}
|
||||
|
||||
/// 代币元数据
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct TokenMetadata {
|
||||
pub name: String,
|
||||
pub symbol: String,
|
||||
pub total_supply: u128,
|
||||
pub decimals: u8,
|
||||
pub contract_address: [u8; 32],
|
||||
}
|
||||
|
||||
/// 交易对
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct TradingPair {
|
||||
pub base: String,
|
||||
pub quote: String,
|
||||
pub price: f64,
|
||||
}
|
||||
|
||||
/// 订单簿
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct OrderBook {
|
||||
pub pair: TradingPair,
|
||||
pub bids: Vec<(f64, f64)>,
|
||||
pub asks: Vec<(f64, f64)>,
|
||||
}
|
||||
|
||||
/// 价值
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Value {
|
||||
pub amount: u128,
|
||||
pub currency: String,
|
||||
}
|
||||
|
||||
/// 合约调用
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ContractCall {
|
||||
pub contract_address: [u8; 32],
|
||||
pub method: String,
|
||||
pub args: Vec<u8>,
|
||||
}
|
||||
|
||||
/// NAC Lens 客户端(NAC 原生协议客户端,NRPC4.0 已更名为 NAC Lens)
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct NacLensClient {
|
||||
pub endpoint: String,
|
||||
pub timeout: std::time::Duration,
|
||||
}
|
||||
|
||||
impl NacLensClient {
|
||||
pub fn new(endpoint: &str, timeout: std::time::Duration) -> Result<Self, String> {
|
||||
Ok(Self {
|
||||
endpoint: endpoint.to_string(),
|
||||
timeout,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// NRPC4Client 类型别名(向后兼容)
|
||||
pub type NRPC4Client = NacLensClient;
|
||||
/// NRPC3Client 类型别名(向后兼容,已更名为 NAC Lens)
|
||||
pub type NRPC3Client = NacLensClient;
|
||||
|
||||
/// Decimal 类型(代币数量,精度由协议层处理)
|
||||
/// 使用 u128 表示,最小单位为 1e-18
|
||||
pub type Decimal = u128;
|
||||
|
||||
|
||||
/// 账户状态
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct AccountState {
|
||||
pub address: [u8; 32],
|
||||
pub balance: u128,
|
||||
pub nonce: u64,
|
||||
pub code_hash: Option<[u8; 48]>,
|
||||
}
|
||||
|
||||
/// 司法辖区
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Jurisdiction {
|
||||
pub code: String,
|
||||
pub name: String,
|
||||
pub region: String,
|
||||
}
|
||||
|
||||
/// CSNPNetwork 存根(CSNP 网络,NAC 原生网络协议)
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CSNPNetwork {
|
||||
pub peers: Vec<String>,
|
||||
}
|
||||
|
||||
impl CSNPNetwork {
|
||||
pub async fn new(peers: &[String]) -> Result<Self, String> {
|
||||
Ok(Self {
|
||||
peers: peers.to_vec(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,30 @@ pub enum NACError {
|
|||
/// 其他错误
|
||||
#[error("Other error: {0}")]
|
||||
Other(String),
|
||||
/// 合约错误
|
||||
#[error("Contract error: {0}")]
|
||||
ContractError(String),
|
||||
/// 验证错误
|
||||
#[error("Validation error: {0}")]
|
||||
ValidationError(String),
|
||||
/// 未找到错误
|
||||
#[error("Not found: {0}")]
|
||||
NotFound(String),
|
||||
/// 配置错误
|
||||
#[error("Configuration error: {0}")]
|
||||
ConfigError(String),
|
||||
/// 钱包错误
|
||||
#[error("Wallet error: {0}")]
|
||||
WalletError(String),
|
||||
/// 区块链错误
|
||||
#[error("Blockchain error: {0}")]
|
||||
BlockchainError(String),
|
||||
/// 存储错误
|
||||
#[error("Storage error: {0}")]
|
||||
StorageError(String),
|
||||
/// AI服务错误
|
||||
#[error("AI service error: {0}")]
|
||||
AIServiceError(String),
|
||||
}
|
||||
|
||||
/// NAC SDK Result类型别名
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ pub mod adapters;
|
|||
// pub mod advanced; // Phase 10高级功能,待与NRPC3Client集成
|
||||
|
||||
// 重新导出常用类型和函数
|
||||
pub use client::NRPC3Client;
|
||||
// pub use client::NRPC3Client; // NAC Lens 客户端通过 client 模块重新导出
|
||||
pub use crypto::{Blake3Hasher, AssetDNA, GNACSEncoder};
|
||||
pub use protocols::ACC20;
|
||||
// 待实现的协议(将在Phase 7完成)
|
||||
|
|
@ -65,7 +65,6 @@ mod tests {
|
|||
}
|
||||
|
||||
// 导出适配器模块
|
||||
pub mod adapters;
|
||||
|
||||
/// NAC 公链创世配置(代币发行、区块参数)
|
||||
pub mod genesis_config;
|
||||
|
|
|
|||
|
|
@ -2,16 +2,17 @@
|
|||
//!
|
||||
//! 提供与NAC区块链上ACC-1155证书交互的客户端接口
|
||||
|
||||
use crate::client::NRPC3Client;
|
||||
// NRPC3Client 已更名为 NAC Lens 客户端
|
||||
use crate::error::{NACError, Result};
|
||||
use crate::adapters::NRPC3Client;
|
||||
use nac_udm::primitives::{Address, Hash, Timestamp};
|
||||
use nac_udm::l1_protocol::gnacs::GNACSCode;
|
||||
use nac_udm::l1_protocol::acc::acc1155::{
|
||||
TokenId, TokenType, TokenTypeDNA, TokenTypeMetadata,
|
||||
BatchTransfer, BatchMint, BatchBurn, TokenCustodyInfo, TokenInsuranceInfo,
|
||||
TokenTypeValuation, ApprovalInfo, TokenBalance, HybridAssetPool, TokenTypeConfig,
|
||||
};
|
||||
use nac_udm::l2_governance::SovereigntyRight;
|
||||
// use nac_udm::l1_protocol::acc::acc1155::{
|
||||
// TokenId, TokenType, TokenTypeDNA, TokenTypeMetadata,
|
||||
// BatchTransfer, BatchMint, BatchBurn, TokenCustodyInfo, TokenInsuranceInfo,
|
||||
// TokenTypeValuation, ApprovalInfo, TokenBalance, HybridAssetPool, TokenTypeConfig,
|
||||
// }; // 待 nac_udm acc 子模块实现后启用
|
||||
// use nac_udm::l2_governance::SovereigntyRight; // 待 nac_udm::l2_governance 实现后启用
|
||||
use serde_json::json;
|
||||
|
||||
/// ACC-1155多代币证书接口
|
||||
|
|
|
|||
|
|
@ -24,8 +24,9 @@ ACC-20可替代代币协议接口,完全替代以太坊的ERC-20。
|
|||
*/
|
||||
|
||||
use crate::error::{NACError, Result};
|
||||
use crate::adapters::NRPC3Client;
|
||||
use nac_udm::primitives::{Address, Hash, Timestamp};
|
||||
use crate::client::NRPC3Client;
|
||||
// NRPC3Client 已更名为 NAC Lens 客户端
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// ACC-20代币信息
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
//!
|
||||
//! 提供与NAC区块链上ACC-20C兼容层交互的客户端接口
|
||||
|
||||
use crate::client::NRPC3Client;
|
||||
// NRPC3Client 已更名为 NAC Lens 客户端
|
||||
use crate::error::{NACError, Result};
|
||||
use crate::adapters::NRPC3Client;
|
||||
use nac_udm::primitives::{Address, Hash, Timestamp};
|
||||
use nac_udm::l1_protocol::gnacs::GNACSCode;
|
||||
use nac_udm::l1_protocol::acc20c::{
|
||||
WrappedAsset, WrapperConfig, WrapperStatus, WrappedAssetStatus,
|
||||
ComplianceSnapshot, EthAddress, u256,
|
||||
};
|
||||
// use nac_udm::l1_protocol::acc20c::{
|
||||
// WrappedAsset, WrapperConfig, WrapperStatus, WrappedAssetStatus,
|
||||
// ComplianceSnapshot, EthAddress, u256,
|
||||
// }; // 待 nac_udm acc20c 子模块实现后启用
|
||||
use serde_json::json;
|
||||
|
||||
/// ACC-20C兼容层接口
|
||||
|
|
|
|||
|
|
@ -2,16 +2,17 @@
|
|||
//!
|
||||
//! 提供与NAC区块链上ACC-721证书交互的客户端接口
|
||||
|
||||
use crate::client::NRPC3Client;
|
||||
// NRPC3Client 已更名为 NAC Lens 客户端
|
||||
use crate::error::{NACError, Result};
|
||||
use crate::adapters::NRPC3Client;
|
||||
use crate::types::*;
|
||||
use nac_udm::primitives::{Address, Hash, Timestamp};
|
||||
use nac_udm::l1_protocol::gnacs::GNACSCode;
|
||||
use nac_udm::l1_protocol::acc::acc721::{
|
||||
AssetId, AssetDNA, AssetValuation,
|
||||
CustodyInfo, InsuranceInfo, CollateralInfo, ACC721FragmentationPool,
|
||||
};
|
||||
use nac_udm::l2_governance::SovereigntyRight;
|
||||
// use nac_udm::l1_protocol::acc::acc721::{
|
||||
// AssetId, AssetDNA, AssetValuation,
|
||||
// CustodyInfo, InsuranceInfo, CollateralInfo, ACC721FragmentationPool,
|
||||
// }; // 待 nac_udm acc 子模块实现后启用
|
||||
// use nac_udm::l2_governance::SovereigntyRight; // 待 nac_udm::l2_governance 实现后启用
|
||||
use serde_json::json;
|
||||
|
||||
/// ACC-721唯一资产证书接口
|
||||
|
|
|
|||
Loading…
Reference in New Issue