moltspay 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,118 @@
1
+ import { C as ChainName, a as ChainConfig, P as PaymentAgentConfig, b as CreateInvoiceParams, I as Invoice, V as VerifyOptions, c as VerifyResult, W as WalletBalance, A as AuditAction, d as AuditEntry } from './index-CZzgdtin.js';
2
+ export { E as EIP712TypedData, e as PendingTransfer, f as PermitExecuteResult, g as PermitRequest, h as PermitSignature, S as SecureWalletConfig, i as SecurityLimits, T as TransferParams, j as TransferResult } from './index-CZzgdtin.js';
3
+ export { SecureWallet, Wallet } from './wallet/index.js';
4
+ export { PermitPayment } from './permit/index.js';
5
+ export { CHAINS, ERC20_ABI, getChain, getChainById, listChains } from './chains/index.js';
6
+
7
+ /**
8
+ * PaymentAgent - 核心支付代理
9
+ *
10
+ * 功能:
11
+ * - 生成 Invoice(支付请求)
12
+ * - 验证链上支付
13
+ * - 生成钱包深度链接
14
+ */
15
+
16
+ declare class PaymentAgent {
17
+ readonly chain: ChainName;
18
+ readonly chainConfig: ChainConfig;
19
+ readonly walletAddress: string;
20
+ private provider;
21
+ private usdcContract;
22
+ static readonly PROTOCOL_VERSION = "1.0";
23
+ constructor(config?: PaymentAgentConfig);
24
+ /**
25
+ * 生成支付请求(Invoice)
26
+ */
27
+ createInvoice(params: CreateInvoiceParams): Invoice;
28
+ /**
29
+ * 生成钱包深度链接(支持 MetaMask 等)
30
+ */
31
+ generateDeepLink(amount: number, memo: string): string;
32
+ /**
33
+ * 验证链上支付
34
+ */
35
+ verifyPayment(txHash: string, options?: VerifyOptions): Promise<VerifyResult>;
36
+ /**
37
+ * 扫描最近转账(按金额匹配)
38
+ */
39
+ scanRecentTransfers(expectedAmount: number, timeoutMinutes?: number): Promise<VerifyResult>;
40
+ /**
41
+ * 获取钱包余额
42
+ */
43
+ getBalance(address?: string): Promise<WalletBalance>;
44
+ /**
45
+ * 格式化 Invoice 为人类可读消息
46
+ */
47
+ formatInvoiceMessage(invoice: Invoice, includeJson?: boolean): string;
48
+ }
49
+
50
+ /**
51
+ * AuditLog - 不可篡改审计日志
52
+ *
53
+ * 特点:
54
+ * - 链式哈希,任何修改都会破坏链条
55
+ * - 按日期分文件存储
56
+ * - JSONL 格式便于追加和解析
57
+ */
58
+
59
+ interface LogParams {
60
+ action: AuditAction;
61
+ request_id: string;
62
+ from?: string;
63
+ to?: string;
64
+ amount?: number;
65
+ tx_hash?: string;
66
+ reason?: string;
67
+ requester?: string;
68
+ metadata?: Record<string, unknown>;
69
+ }
70
+ declare class AuditLog {
71
+ private basePath;
72
+ private lastHash;
73
+ constructor(basePath?: string);
74
+ /**
75
+ * 记录审计日志
76
+ */
77
+ log(params: LogParams): Promise<AuditEntry>;
78
+ /**
79
+ * 读取指定日期的日志
80
+ */
81
+ read(date?: Date): AuditEntry[];
82
+ /**
83
+ * 验证日志完整性
84
+ */
85
+ verify(date?: Date): {
86
+ valid: boolean;
87
+ errors: string[];
88
+ };
89
+ /**
90
+ * 搜索日志
91
+ */
92
+ search(filter: Partial<{
93
+ action: AuditAction;
94
+ request_id: string;
95
+ from: string;
96
+ to: string;
97
+ startDate: Date;
98
+ endDate: Date;
99
+ }>): AuditEntry[];
100
+ /**
101
+ * 获取日志文件路径
102
+ */
103
+ private getFilePath;
104
+ /**
105
+ * 计算条目哈希
106
+ */
107
+ private calculateHash;
108
+ /**
109
+ * 加载最后一条日志的哈希
110
+ */
111
+ private loadLastHash;
112
+ /**
113
+ * 确保目录存在
114
+ */
115
+ private ensureDir;
116
+ }
117
+
118
+ export { AuditAction, AuditEntry, AuditLog, ChainConfig, ChainName, CreateInvoiceParams, Invoice, PaymentAgent, PaymentAgentConfig, VerifyOptions, VerifyResult, WalletBalance };