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.
- package/README.md +212 -0
- package/dist/chains/index.d.mts +25 -0
- package/dist/chains/index.d.ts +25 -0
- package/dist/chains/index.js +113 -0
- package/dist/chains/index.js.map +1 -0
- package/dist/chains/index.mjs +84 -0
- package/dist/chains/index.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +881 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.mjs +858 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index-CZzgdtin.d.mts +161 -0
- package/dist/index-CZzgdtin.d.ts +161 -0
- package/dist/index.d.mts +118 -0
- package/dist/index.d.ts +118 -0
- package/dist/index.js +996 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +950 -0
- package/dist/index.mjs.map +1 -0
- package/dist/permit/index.d.mts +49 -0
- package/dist/permit/index.d.ts +49 -0
- package/dist/permit/index.js +273 -0
- package/dist/permit/index.js.map +1 -0
- package/dist/permit/index.mjs +246 -0
- package/dist/permit/index.mjs.map +1 -0
- package/dist/wallet/index.d.mts +101 -0
- package/dist/wallet/index.d.ts +101 -0
- package/dist/wallet/index.js +601 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/wallet/index.mjs +563 -0
- package/dist/wallet/index.mjs.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
// src/wallet/Wallet.ts
|
|
2
|
+
import { ethers } from "ethers";
|
|
3
|
+
|
|
4
|
+
// src/chains/index.ts
|
|
5
|
+
var CHAINS = {
|
|
6
|
+
// ============ 主网 ============
|
|
7
|
+
base: {
|
|
8
|
+
name: "Base",
|
|
9
|
+
chainId: 8453,
|
|
10
|
+
rpc: "https://mainnet.base.org",
|
|
11
|
+
usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
12
|
+
explorer: "https://basescan.org/address/",
|
|
13
|
+
explorerTx: "https://basescan.org/tx/",
|
|
14
|
+
avgBlockTime: 2
|
|
15
|
+
},
|
|
16
|
+
polygon: {
|
|
17
|
+
name: "Polygon",
|
|
18
|
+
chainId: 137,
|
|
19
|
+
rpc: "https://polygon-rpc.com",
|
|
20
|
+
usdc: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
|
21
|
+
explorer: "https://polygonscan.com/address/",
|
|
22
|
+
explorerTx: "https://polygonscan.com/tx/",
|
|
23
|
+
avgBlockTime: 2
|
|
24
|
+
},
|
|
25
|
+
ethereum: {
|
|
26
|
+
name: "Ethereum",
|
|
27
|
+
chainId: 1,
|
|
28
|
+
rpc: "https://eth.llamarpc.com",
|
|
29
|
+
usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
30
|
+
explorer: "https://etherscan.io/address/",
|
|
31
|
+
explorerTx: "https://etherscan.io/tx/",
|
|
32
|
+
avgBlockTime: 12
|
|
33
|
+
},
|
|
34
|
+
// ============ 测试网 ============
|
|
35
|
+
base_sepolia: {
|
|
36
|
+
name: "Base Sepolia",
|
|
37
|
+
chainId: 84532,
|
|
38
|
+
rpc: "https://sepolia.base.org",
|
|
39
|
+
usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
40
|
+
explorer: "https://sepolia.basescan.org/address/",
|
|
41
|
+
explorerTx: "https://sepolia.basescan.org/tx/",
|
|
42
|
+
avgBlockTime: 2
|
|
43
|
+
},
|
|
44
|
+
sepolia: {
|
|
45
|
+
name: "Sepolia",
|
|
46
|
+
chainId: 11155111,
|
|
47
|
+
rpc: "https://rpc.sepolia.org",
|
|
48
|
+
usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
|
49
|
+
explorer: "https://sepolia.etherscan.io/address/",
|
|
50
|
+
explorerTx: "https://sepolia.etherscan.io/tx/",
|
|
51
|
+
avgBlockTime: 12
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
function getChain(name) {
|
|
55
|
+
const config = CHAINS[name];
|
|
56
|
+
if (!config) {
|
|
57
|
+
throw new Error(`Unsupported chain: ${name}. Supported: ${Object.keys(CHAINS).join(", ")}`);
|
|
58
|
+
}
|
|
59
|
+
return config;
|
|
60
|
+
}
|
|
61
|
+
var ERC20_ABI = [
|
|
62
|
+
"function balanceOf(address owner) view returns (uint256)",
|
|
63
|
+
"function transfer(address to, uint256 amount) returns (bool)",
|
|
64
|
+
"function approve(address spender, uint256 amount) returns (bool)",
|
|
65
|
+
"function allowance(address owner, address spender) view returns (uint256)",
|
|
66
|
+
"function decimals() view returns (uint8)",
|
|
67
|
+
"function symbol() view returns (string)",
|
|
68
|
+
"function name() view returns (string)",
|
|
69
|
+
"function nonces(address owner) view returns (uint256)",
|
|
70
|
+
"function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)",
|
|
71
|
+
"event Transfer(address indexed from, address indexed to, uint256 value)",
|
|
72
|
+
"event Approval(address indexed owner, address indexed spender, uint256 value)"
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
// src/wallet/Wallet.ts
|
|
76
|
+
var Wallet = class {
|
|
77
|
+
chain;
|
|
78
|
+
chainConfig;
|
|
79
|
+
address;
|
|
80
|
+
wallet;
|
|
81
|
+
provider;
|
|
82
|
+
usdcContract;
|
|
83
|
+
constructor(config = {}) {
|
|
84
|
+
this.chain = config.chain || "base_sepolia";
|
|
85
|
+
this.chainConfig = getChain(this.chain);
|
|
86
|
+
const privateKey = config.privateKey || process.env.PAYMENT_AGENT_PRIVATE_KEY;
|
|
87
|
+
if (!privateKey) {
|
|
88
|
+
throw new Error("privateKey is required. Set via config or PAYMENT_AGENT_PRIVATE_KEY env var.");
|
|
89
|
+
}
|
|
90
|
+
const rpcUrl = config.rpcUrl || this.chainConfig.rpc;
|
|
91
|
+
this.provider = new ethers.JsonRpcProvider(rpcUrl);
|
|
92
|
+
this.wallet = new ethers.Wallet(privateKey, this.provider);
|
|
93
|
+
this.address = this.wallet.address;
|
|
94
|
+
this.usdcContract = new ethers.Contract(
|
|
95
|
+
this.chainConfig.usdc,
|
|
96
|
+
ERC20_ABI,
|
|
97
|
+
this.wallet
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 获取钱包余额
|
|
102
|
+
*/
|
|
103
|
+
async getBalance() {
|
|
104
|
+
const [ethBalance, usdcBalance] = await Promise.all([
|
|
105
|
+
this.provider.getBalance(this.address),
|
|
106
|
+
this.usdcContract.balanceOf(this.address)
|
|
107
|
+
]);
|
|
108
|
+
return {
|
|
109
|
+
address: this.address,
|
|
110
|
+
eth: ethers.formatEther(ethBalance),
|
|
111
|
+
usdc: (Number(usdcBalance) / 1e6).toFixed(2),
|
|
112
|
+
chain: this.chain
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* 发送 USDC 转账
|
|
117
|
+
*/
|
|
118
|
+
async transfer(to, amount) {
|
|
119
|
+
try {
|
|
120
|
+
to = ethers.getAddress(to);
|
|
121
|
+
const amountWei = BigInt(Math.floor(amount * 1e6));
|
|
122
|
+
const balance = await this.usdcContract.balanceOf(this.address);
|
|
123
|
+
if (BigInt(balance) < amountWei) {
|
|
124
|
+
return {
|
|
125
|
+
success: false,
|
|
126
|
+
error: `Insufficient USDC balance: ${Number(balance) / 1e6} < ${amount}`
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const tx = await this.usdcContract.transfer(to, amountWei);
|
|
130
|
+
const receipt = await tx.wait();
|
|
131
|
+
if (receipt.status === 1) {
|
|
132
|
+
return {
|
|
133
|
+
success: true,
|
|
134
|
+
tx_hash: tx.hash,
|
|
135
|
+
from: this.address,
|
|
136
|
+
to,
|
|
137
|
+
amount,
|
|
138
|
+
gas_used: Number(receipt.gasUsed),
|
|
139
|
+
block_number: receipt.blockNumber,
|
|
140
|
+
explorer_url: `${this.chainConfig.explorerTx}${tx.hash}`
|
|
141
|
+
};
|
|
142
|
+
} else {
|
|
143
|
+
return {
|
|
144
|
+
success: false,
|
|
145
|
+
tx_hash: tx.hash,
|
|
146
|
+
error: "Transaction reverted"
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
} catch (error) {
|
|
150
|
+
return {
|
|
151
|
+
success: false,
|
|
152
|
+
error: error.message
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 获取 ETH 余额
|
|
158
|
+
*/
|
|
159
|
+
async getEthBalance() {
|
|
160
|
+
const balance = await this.provider.getBalance(this.address);
|
|
161
|
+
return ethers.formatEther(balance);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 获取 USDC 余额
|
|
165
|
+
*/
|
|
166
|
+
async getUsdcBalance() {
|
|
167
|
+
const balance = await this.usdcContract.balanceOf(this.address);
|
|
168
|
+
return (Number(balance) / 1e6).toFixed(2);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// src/audit/AuditLog.ts
|
|
173
|
+
import * as fs from "fs";
|
|
174
|
+
import * as path from "path";
|
|
175
|
+
import * as crypto from "crypto";
|
|
176
|
+
var AuditLog = class {
|
|
177
|
+
basePath;
|
|
178
|
+
lastHash = "0000000000000000";
|
|
179
|
+
constructor(basePath) {
|
|
180
|
+
this.basePath = basePath || path.join(process.cwd(), "data", "audit");
|
|
181
|
+
this.ensureDir();
|
|
182
|
+
this.loadLastHash();
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* 记录审计日志
|
|
186
|
+
*/
|
|
187
|
+
async log(params) {
|
|
188
|
+
const now = /* @__PURE__ */ new Date();
|
|
189
|
+
const entry = {
|
|
190
|
+
timestamp: now.getTime() / 1e3,
|
|
191
|
+
datetime: now.toISOString(),
|
|
192
|
+
action: params.action,
|
|
193
|
+
request_id: params.request_id,
|
|
194
|
+
from: params.from,
|
|
195
|
+
to: params.to,
|
|
196
|
+
amount: params.amount,
|
|
197
|
+
tx_hash: params.tx_hash,
|
|
198
|
+
reason: params.reason,
|
|
199
|
+
requester: params.requester,
|
|
200
|
+
prev_hash: this.lastHash,
|
|
201
|
+
hash: "",
|
|
202
|
+
// 计算后填充
|
|
203
|
+
metadata: params.metadata
|
|
204
|
+
};
|
|
205
|
+
entry.hash = this.calculateHash(entry);
|
|
206
|
+
this.lastHash = entry.hash;
|
|
207
|
+
const filePath = this.getFilePath(now);
|
|
208
|
+
const line = JSON.stringify(entry) + "\n";
|
|
209
|
+
fs.appendFileSync(filePath, line, "utf-8");
|
|
210
|
+
return entry;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* 读取指定日期的日志
|
|
214
|
+
*/
|
|
215
|
+
read(date) {
|
|
216
|
+
const filePath = this.getFilePath(date || /* @__PURE__ */ new Date());
|
|
217
|
+
if (!fs.existsSync(filePath)) {
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
220
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
221
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
222
|
+
return lines.map((line) => JSON.parse(line));
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* 验证日志完整性
|
|
226
|
+
*/
|
|
227
|
+
verify(date) {
|
|
228
|
+
const entries = this.read(date);
|
|
229
|
+
const errors = [];
|
|
230
|
+
for (let i = 0; i < entries.length; i++) {
|
|
231
|
+
const entry = entries[i];
|
|
232
|
+
const expectedHash = this.calculateHash(entry);
|
|
233
|
+
if (entry.hash !== expectedHash) {
|
|
234
|
+
errors.push(`Entry ${i}: hash mismatch (expected ${expectedHash}, got ${entry.hash})`);
|
|
235
|
+
}
|
|
236
|
+
if (i > 0 && entry.prev_hash !== entries[i - 1].hash) {
|
|
237
|
+
errors.push(`Entry ${i}: prev_hash mismatch`);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return { valid: errors.length === 0, errors };
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* 搜索日志
|
|
244
|
+
*/
|
|
245
|
+
search(filter) {
|
|
246
|
+
const results = [];
|
|
247
|
+
const startDate = filter.startDate || new Date(Date.now() - 30 * 24 * 60 * 60 * 1e3);
|
|
248
|
+
const endDate = filter.endDate || /* @__PURE__ */ new Date();
|
|
249
|
+
const current = new Date(startDate);
|
|
250
|
+
while (current <= endDate) {
|
|
251
|
+
const entries = this.read(current);
|
|
252
|
+
for (const entry of entries) {
|
|
253
|
+
let match = true;
|
|
254
|
+
if (filter.action && entry.action !== filter.action) match = false;
|
|
255
|
+
if (filter.request_id && entry.request_id !== filter.request_id) match = false;
|
|
256
|
+
if (filter.from && entry.from?.toLowerCase() !== filter.from.toLowerCase()) match = false;
|
|
257
|
+
if (filter.to && entry.to?.toLowerCase() !== filter.to.toLowerCase()) match = false;
|
|
258
|
+
if (match) {
|
|
259
|
+
results.push(entry);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
current.setDate(current.getDate() + 1);
|
|
263
|
+
}
|
|
264
|
+
return results;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* 获取日志文件路径
|
|
268
|
+
*/
|
|
269
|
+
getFilePath(date) {
|
|
270
|
+
const dateStr = date.toISOString().slice(0, 10);
|
|
271
|
+
return path.join(this.basePath, `audit_${dateStr}.jsonl`);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* 计算条目哈希
|
|
275
|
+
*/
|
|
276
|
+
calculateHash(entry) {
|
|
277
|
+
const data = {
|
|
278
|
+
timestamp: entry.timestamp,
|
|
279
|
+
action: entry.action,
|
|
280
|
+
request_id: entry.request_id,
|
|
281
|
+
from: entry.from,
|
|
282
|
+
to: entry.to,
|
|
283
|
+
amount: entry.amount,
|
|
284
|
+
tx_hash: entry.tx_hash,
|
|
285
|
+
prev_hash: entry.prev_hash
|
|
286
|
+
};
|
|
287
|
+
const str = JSON.stringify(data);
|
|
288
|
+
return crypto.createHash("sha256").update(str).digest("hex").slice(0, 16);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* 加载最后一条日志的哈希
|
|
292
|
+
*/
|
|
293
|
+
loadLastHash() {
|
|
294
|
+
const today = /* @__PURE__ */ new Date();
|
|
295
|
+
for (let i = 0; i < 2; i++) {
|
|
296
|
+
const date = new Date(today);
|
|
297
|
+
date.setDate(date.getDate() - i);
|
|
298
|
+
const entries = this.read(date);
|
|
299
|
+
if (entries.length > 0) {
|
|
300
|
+
this.lastHash = entries[entries.length - 1].hash;
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* 确保目录存在
|
|
307
|
+
*/
|
|
308
|
+
ensureDir() {
|
|
309
|
+
if (!fs.existsSync(this.basePath)) {
|
|
310
|
+
fs.mkdirSync(this.basePath, { recursive: true });
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// src/wallet/SecureWallet.ts
|
|
316
|
+
var DEFAULT_LIMITS = {
|
|
317
|
+
singleMax: 100,
|
|
318
|
+
// 单笔最大 $100
|
|
319
|
+
dailyMax: 1e3,
|
|
320
|
+
// 日最大 $1000
|
|
321
|
+
requireWhitelist: true
|
|
322
|
+
};
|
|
323
|
+
var SecureWallet = class {
|
|
324
|
+
wallet;
|
|
325
|
+
limits;
|
|
326
|
+
whitelist;
|
|
327
|
+
auditLog;
|
|
328
|
+
dailyTotal = 0;
|
|
329
|
+
dailyDate = "";
|
|
330
|
+
pendingTransfers = /* @__PURE__ */ new Map();
|
|
331
|
+
constructor(config = {}) {
|
|
332
|
+
this.wallet = new Wallet({
|
|
333
|
+
chain: config.chain,
|
|
334
|
+
privateKey: config.privateKey
|
|
335
|
+
});
|
|
336
|
+
this.limits = { ...DEFAULT_LIMITS, ...config.limits };
|
|
337
|
+
this.whitelist = new Set((config.whitelist || []).map((a) => a.toLowerCase()));
|
|
338
|
+
this.auditLog = new AuditLog(config.auditPath);
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* 获取钱包地址
|
|
342
|
+
*/
|
|
343
|
+
get address() {
|
|
344
|
+
return this.wallet.address;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* 获取余额
|
|
348
|
+
*/
|
|
349
|
+
async getBalance() {
|
|
350
|
+
return this.wallet.getBalance();
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* 安全转账(带限额和白名单检查)
|
|
354
|
+
*/
|
|
355
|
+
async transfer(params) {
|
|
356
|
+
const { to, amount, reason, requester } = params;
|
|
357
|
+
const toAddress = to.toLowerCase();
|
|
358
|
+
const requestId = `tr_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
359
|
+
await this.auditLog.log({
|
|
360
|
+
action: "transfer_request",
|
|
361
|
+
request_id: requestId,
|
|
362
|
+
from: this.wallet.address,
|
|
363
|
+
to,
|
|
364
|
+
amount,
|
|
365
|
+
reason,
|
|
366
|
+
requester
|
|
367
|
+
});
|
|
368
|
+
if (this.limits.requireWhitelist && !this.whitelist.has(toAddress)) {
|
|
369
|
+
await this.auditLog.log({
|
|
370
|
+
action: "transfer_failed",
|
|
371
|
+
request_id: requestId,
|
|
372
|
+
metadata: { error: "Address not in whitelist" }
|
|
373
|
+
});
|
|
374
|
+
return { success: false, error: `Address not in whitelist: ${to}` };
|
|
375
|
+
}
|
|
376
|
+
if (amount > this.limits.singleMax) {
|
|
377
|
+
const pending = {
|
|
378
|
+
id: requestId,
|
|
379
|
+
to,
|
|
380
|
+
amount,
|
|
381
|
+
reason,
|
|
382
|
+
requester,
|
|
383
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
384
|
+
status: "pending"
|
|
385
|
+
};
|
|
386
|
+
this.pendingTransfers.set(requestId, pending);
|
|
387
|
+
await this.auditLog.log({
|
|
388
|
+
action: "transfer_request",
|
|
389
|
+
request_id: requestId,
|
|
390
|
+
metadata: { pending: true, reason: "Exceeds single limit" }
|
|
391
|
+
});
|
|
392
|
+
return {
|
|
393
|
+
success: false,
|
|
394
|
+
error: `Amount ${amount} exceeds single limit ${this.limits.singleMax}. Pending approval: ${requestId}`
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
this.updateDailyTotal();
|
|
398
|
+
if (this.dailyTotal + amount > this.limits.dailyMax) {
|
|
399
|
+
const pending = {
|
|
400
|
+
id: requestId,
|
|
401
|
+
to,
|
|
402
|
+
amount,
|
|
403
|
+
reason,
|
|
404
|
+
requester,
|
|
405
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
406
|
+
status: "pending"
|
|
407
|
+
};
|
|
408
|
+
this.pendingTransfers.set(requestId, pending);
|
|
409
|
+
await this.auditLog.log({
|
|
410
|
+
action: "transfer_request",
|
|
411
|
+
request_id: requestId,
|
|
412
|
+
metadata: { pending: true, reason: "Exceeds daily limit" }
|
|
413
|
+
});
|
|
414
|
+
return {
|
|
415
|
+
success: false,
|
|
416
|
+
error: `Daily limit would be exceeded (${this.dailyTotal} + ${amount} > ${this.limits.dailyMax}). Pending approval: ${requestId}`
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
const result = await this.wallet.transfer(to, amount);
|
|
420
|
+
if (result.success) {
|
|
421
|
+
this.dailyTotal += amount;
|
|
422
|
+
await this.auditLog.log({
|
|
423
|
+
action: "transfer_executed",
|
|
424
|
+
request_id: requestId,
|
|
425
|
+
from: this.wallet.address,
|
|
426
|
+
to,
|
|
427
|
+
amount,
|
|
428
|
+
tx_hash: result.tx_hash,
|
|
429
|
+
reason,
|
|
430
|
+
requester
|
|
431
|
+
});
|
|
432
|
+
} else {
|
|
433
|
+
await this.auditLog.log({
|
|
434
|
+
action: "transfer_failed",
|
|
435
|
+
request_id: requestId,
|
|
436
|
+
metadata: { error: result.error }
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
return result;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* 审批待处理转账
|
|
443
|
+
*/
|
|
444
|
+
async approve(requestId, approver) {
|
|
445
|
+
const pending = this.pendingTransfers.get(requestId);
|
|
446
|
+
if (!pending) {
|
|
447
|
+
return { success: false, error: `Pending transfer not found: ${requestId}` };
|
|
448
|
+
}
|
|
449
|
+
if (pending.status !== "pending") {
|
|
450
|
+
return { success: false, error: `Transfer already ${pending.status}` };
|
|
451
|
+
}
|
|
452
|
+
await this.auditLog.log({
|
|
453
|
+
action: "transfer_approved",
|
|
454
|
+
request_id: requestId,
|
|
455
|
+
metadata: { approver }
|
|
456
|
+
});
|
|
457
|
+
pending.status = "approved";
|
|
458
|
+
const result = await this.wallet.transfer(pending.to, pending.amount);
|
|
459
|
+
if (result.success) {
|
|
460
|
+
pending.status = "executed";
|
|
461
|
+
this.dailyTotal += pending.amount;
|
|
462
|
+
await this.auditLog.log({
|
|
463
|
+
action: "transfer_executed",
|
|
464
|
+
request_id: requestId,
|
|
465
|
+
from: this.wallet.address,
|
|
466
|
+
to: pending.to,
|
|
467
|
+
amount: pending.amount,
|
|
468
|
+
tx_hash: result.tx_hash,
|
|
469
|
+
reason: pending.reason,
|
|
470
|
+
requester: pending.requester,
|
|
471
|
+
metadata: { approved_by: approver }
|
|
472
|
+
});
|
|
473
|
+
} else {
|
|
474
|
+
await this.auditLog.log({
|
|
475
|
+
action: "transfer_failed",
|
|
476
|
+
request_id: requestId,
|
|
477
|
+
metadata: { error: result.error }
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
return result;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* 拒绝待处理转账
|
|
484
|
+
*/
|
|
485
|
+
async reject(requestId, rejecter, reason) {
|
|
486
|
+
const pending = this.pendingTransfers.get(requestId);
|
|
487
|
+
if (!pending) {
|
|
488
|
+
throw new Error(`Pending transfer not found: ${requestId}`);
|
|
489
|
+
}
|
|
490
|
+
pending.status = "rejected";
|
|
491
|
+
await this.auditLog.log({
|
|
492
|
+
action: "transfer_rejected",
|
|
493
|
+
request_id: requestId,
|
|
494
|
+
metadata: { rejected_by: rejecter, reason }
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* 添加白名单地址
|
|
499
|
+
*/
|
|
500
|
+
async addToWhitelist(address, addedBy) {
|
|
501
|
+
const addr = address.toLowerCase();
|
|
502
|
+
this.whitelist.add(addr);
|
|
503
|
+
await this.auditLog.log({
|
|
504
|
+
action: "whitelist_add",
|
|
505
|
+
request_id: `wl_${Date.now()}`,
|
|
506
|
+
to: address,
|
|
507
|
+
metadata: { added_by: addedBy }
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* 移除白名单地址
|
|
512
|
+
*/
|
|
513
|
+
async removeFromWhitelist(address, removedBy) {
|
|
514
|
+
const addr = address.toLowerCase();
|
|
515
|
+
this.whitelist.delete(addr);
|
|
516
|
+
await this.auditLog.log({
|
|
517
|
+
action: "whitelist_remove",
|
|
518
|
+
request_id: `wl_${Date.now()}`,
|
|
519
|
+
to: address,
|
|
520
|
+
metadata: { removed_by: removedBy }
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* 检查地址是否在白名单
|
|
525
|
+
*/
|
|
526
|
+
isWhitelisted(address) {
|
|
527
|
+
return this.whitelist.has(address.toLowerCase());
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* 获取待处理转账列表
|
|
531
|
+
*/
|
|
532
|
+
getPendingTransfers() {
|
|
533
|
+
return Array.from(this.pendingTransfers.values()).filter((p) => p.status === "pending");
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* 获取当前限额配置
|
|
537
|
+
*/
|
|
538
|
+
getLimits() {
|
|
539
|
+
return { ...this.limits };
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* 获取今日已用额度
|
|
543
|
+
*/
|
|
544
|
+
getDailyUsed() {
|
|
545
|
+
this.updateDailyTotal();
|
|
546
|
+
return this.dailyTotal;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* 更新日限额计数器
|
|
550
|
+
*/
|
|
551
|
+
updateDailyTotal() {
|
|
552
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
553
|
+
if (this.dailyDate !== today) {
|
|
554
|
+
this.dailyDate = today;
|
|
555
|
+
this.dailyTotal = 0;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
export {
|
|
560
|
+
SecureWallet,
|
|
561
|
+
Wallet
|
|
562
|
+
};
|
|
563
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/wallet/Wallet.ts","../../src/chains/index.ts","../../src/audit/AuditLog.ts","../../src/wallet/SecureWallet.ts"],"sourcesContent":["/**\n * Wallet - 基础托管钱包\n * \n * 功能:\n * - 查询余额\n * - 发送 USDC 转账\n */\n\nimport { ethers } from 'ethers';\nimport { getChain, ERC20_ABI } from '../chains/index.js';\nimport type {\n ChainName,\n ChainConfig,\n WalletBalance,\n TransferResult,\n} from '../types/index.js';\n\nexport interface WalletConfig {\n chain?: ChainName;\n privateKey?: string;\n rpcUrl?: string;\n}\n\nexport class Wallet {\n readonly chain: ChainName;\n readonly chainConfig: ChainConfig;\n readonly address: string;\n \n private wallet: ethers.Wallet;\n private provider: ethers.JsonRpcProvider;\n private usdcContract: ethers.Contract;\n\n constructor(config: WalletConfig = {}) {\n this.chain = config.chain || 'base_sepolia';\n this.chainConfig = getChain(this.chain);\n \n const privateKey = config.privateKey || process.env.PAYMENT_AGENT_PRIVATE_KEY;\n if (!privateKey) {\n throw new Error('privateKey is required. Set via config or PAYMENT_AGENT_PRIVATE_KEY env var.');\n }\n\n const rpcUrl = config.rpcUrl || this.chainConfig.rpc;\n this.provider = new ethers.JsonRpcProvider(rpcUrl);\n this.wallet = new ethers.Wallet(privateKey, this.provider);\n this.address = this.wallet.address;\n \n this.usdcContract = new ethers.Contract(\n this.chainConfig.usdc,\n ERC20_ABI,\n this.wallet\n );\n }\n\n /**\n * 获取钱包余额\n */\n async getBalance(): Promise<WalletBalance> {\n const [ethBalance, usdcBalance] = await Promise.all([\n this.provider.getBalance(this.address),\n this.usdcContract.balanceOf(this.address),\n ]);\n\n return {\n address: this.address,\n eth: ethers.formatEther(ethBalance),\n usdc: (Number(usdcBalance) / 1e6).toFixed(2),\n chain: this.chain,\n };\n }\n\n /**\n * 发送 USDC 转账\n */\n async transfer(to: string, amount: number): Promise<TransferResult> {\n try {\n // 验证地址\n to = ethers.getAddress(to);\n \n // 转换金额(USDC 6位小数)\n const amountWei = BigInt(Math.floor(amount * 1e6));\n\n // 检查余额\n const balance = await this.usdcContract.balanceOf(this.address);\n if (BigInt(balance) < amountWei) {\n return {\n success: false,\n error: `Insufficient USDC balance: ${Number(balance) / 1e6} < ${amount}`,\n };\n }\n\n // 发送交易\n const tx = await this.usdcContract.transfer(to, amountWei);\n const receipt = await tx.wait();\n\n if (receipt.status === 1) {\n return {\n success: true,\n tx_hash: tx.hash,\n from: this.address,\n to,\n amount,\n gas_used: Number(receipt.gasUsed),\n block_number: receipt.blockNumber,\n explorer_url: `${this.chainConfig.explorerTx}${tx.hash}`,\n };\n } else {\n return {\n success: false,\n tx_hash: tx.hash,\n error: 'Transaction reverted',\n };\n }\n } catch (error) {\n return {\n success: false,\n error: (error as Error).message,\n };\n }\n }\n\n /**\n * 获取 ETH 余额\n */\n async getEthBalance(): Promise<string> {\n const balance = await this.provider.getBalance(this.address);\n return ethers.formatEther(balance);\n }\n\n /**\n * 获取 USDC 余额\n */\n async getUsdcBalance(): Promise<string> {\n const balance = await this.usdcContract.balanceOf(this.address);\n return (Number(balance) / 1e6).toFixed(2);\n }\n}\n","/**\n * 区块链配置\n */\n\nimport type { ChainConfig, ChainName } from '../types/index.js';\n\nexport const CHAINS: Record<ChainName, ChainConfig> = {\n // ============ 主网 ============\n base: {\n name: 'Base',\n chainId: 8453,\n rpc: 'https://mainnet.base.org',\n usdc: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',\n explorer: 'https://basescan.org/address/',\n explorerTx: 'https://basescan.org/tx/',\n avgBlockTime: 2,\n },\n polygon: {\n name: 'Polygon',\n chainId: 137,\n rpc: 'https://polygon-rpc.com',\n usdc: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359',\n explorer: 'https://polygonscan.com/address/',\n explorerTx: 'https://polygonscan.com/tx/',\n avgBlockTime: 2,\n },\n ethereum: {\n name: 'Ethereum',\n chainId: 1,\n rpc: 'https://eth.llamarpc.com',\n usdc: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n explorer: 'https://etherscan.io/address/',\n explorerTx: 'https://etherscan.io/tx/',\n avgBlockTime: 12,\n },\n\n // ============ 测试网 ============\n base_sepolia: {\n name: 'Base Sepolia',\n chainId: 84532,\n rpc: 'https://sepolia.base.org',\n usdc: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',\n explorer: 'https://sepolia.basescan.org/address/',\n explorerTx: 'https://sepolia.basescan.org/tx/',\n avgBlockTime: 2,\n },\n sepolia: {\n name: 'Sepolia',\n chainId: 11155111,\n rpc: 'https://rpc.sepolia.org',\n usdc: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',\n explorer: 'https://sepolia.etherscan.io/address/',\n explorerTx: 'https://sepolia.etherscan.io/tx/',\n avgBlockTime: 12,\n },\n};\n\n/**\n * 获取链配置\n */\nexport function getChain(name: ChainName): ChainConfig {\n const config = CHAINS[name];\n if (!config) {\n throw new Error(`Unsupported chain: ${name}. Supported: ${Object.keys(CHAINS).join(', ')}`);\n }\n return config;\n}\n\n/**\n * 列出所有支持的链\n */\nexport function listChains(): ChainName[] {\n return Object.keys(CHAINS) as ChainName[];\n}\n\n/**\n * 根据 chainId 获取链配置\n */\nexport function getChainById(chainId: number): ChainConfig | undefined {\n return Object.values(CHAINS).find(c => c.chainId === chainId);\n}\n\n/**\n * ERC20 ABI(最小化,仅包含需要的方法)\n */\nexport const ERC20_ABI = [\n 'function balanceOf(address owner) view returns (uint256)',\n 'function transfer(address to, uint256 amount) returns (bool)',\n 'function approve(address spender, uint256 amount) returns (bool)',\n 'function allowance(address owner, address spender) view returns (uint256)',\n 'function decimals() view returns (uint8)',\n 'function symbol() view returns (string)',\n 'function name() view returns (string)',\n 'function nonces(address owner) view returns (uint256)',\n 'function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)',\n 'event Transfer(address indexed from, address indexed to, uint256 value)',\n 'event Approval(address indexed owner, address indexed spender, uint256 value)',\n];\n\nexport type { ChainConfig, ChainName };\n","/**\n * AuditLog - 不可篡改审计日志\n * \n * 特点:\n * - 链式哈希,任何修改都会破坏链条\n * - 按日期分文件存储\n * - JSONL 格式便于追加和解析\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as crypto from 'crypto';\nimport type { AuditEntry, AuditAction } from '../types/index.js';\n\nexport interface LogParams {\n action: AuditAction;\n request_id: string;\n from?: string;\n to?: string;\n amount?: number;\n tx_hash?: string;\n reason?: string;\n requester?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport class AuditLog {\n private basePath: string;\n private lastHash: string = '0000000000000000';\n\n constructor(basePath?: string) {\n this.basePath = basePath || path.join(process.cwd(), 'data', 'audit');\n this.ensureDir();\n this.loadLastHash();\n }\n\n /**\n * 记录审计日志\n */\n async log(params: LogParams): Promise<AuditEntry> {\n const now = new Date();\n \n const entry: AuditEntry = {\n timestamp: now.getTime() / 1000,\n datetime: now.toISOString(),\n action: params.action,\n request_id: params.request_id,\n from: params.from,\n to: params.to,\n amount: params.amount,\n tx_hash: params.tx_hash,\n reason: params.reason,\n requester: params.requester,\n prev_hash: this.lastHash,\n hash: '', // 计算后填充\n metadata: params.metadata,\n };\n\n // 计算哈希(不包含 hash 字段本身)\n entry.hash = this.calculateHash(entry);\n this.lastHash = entry.hash;\n\n // 写入文件\n const filePath = this.getFilePath(now);\n const line = JSON.stringify(entry) + '\\n';\n fs.appendFileSync(filePath, line, 'utf-8');\n\n return entry;\n }\n\n /**\n * 读取指定日期的日志\n */\n read(date?: Date): AuditEntry[] {\n const filePath = this.getFilePath(date || new Date());\n \n if (!fs.existsSync(filePath)) {\n return [];\n }\n\n const content = fs.readFileSync(filePath, 'utf-8');\n const lines = content.trim().split('\\n').filter(Boolean);\n \n return lines.map(line => JSON.parse(line) as AuditEntry);\n }\n\n /**\n * 验证日志完整性\n */\n verify(date?: Date): { valid: boolean; errors: string[] } {\n const entries = this.read(date);\n const errors: string[] = [];\n\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i];\n \n // 验证哈希\n const expectedHash = this.calculateHash(entry);\n if (entry.hash !== expectedHash) {\n errors.push(`Entry ${i}: hash mismatch (expected ${expectedHash}, got ${entry.hash})`);\n }\n\n // 验证链接\n if (i > 0 && entry.prev_hash !== entries[i - 1].hash) {\n errors.push(`Entry ${i}: prev_hash mismatch`);\n }\n }\n\n return { valid: errors.length === 0, errors };\n }\n\n /**\n * 搜索日志\n */\n search(filter: Partial<{\n action: AuditAction;\n request_id: string;\n from: string;\n to: string;\n startDate: Date;\n endDate: Date;\n }>): AuditEntry[] {\n const results: AuditEntry[] = [];\n const startDate = filter.startDate || new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);\n const endDate = filter.endDate || new Date();\n\n // 遍历日期范围\n const current = new Date(startDate);\n while (current <= endDate) {\n const entries = this.read(current);\n \n for (const entry of entries) {\n let match = true;\n\n if (filter.action && entry.action !== filter.action) match = false;\n if (filter.request_id && entry.request_id !== filter.request_id) match = false;\n if (filter.from && entry.from?.toLowerCase() !== filter.from.toLowerCase()) match = false;\n if (filter.to && entry.to?.toLowerCase() !== filter.to.toLowerCase()) match = false;\n\n if (match) {\n results.push(entry);\n }\n }\n\n current.setDate(current.getDate() + 1);\n }\n\n return results;\n }\n\n /**\n * 获取日志文件路径\n */\n private getFilePath(date: Date): string {\n const dateStr = date.toISOString().slice(0, 10);\n return path.join(this.basePath, `audit_${dateStr}.jsonl`);\n }\n\n /**\n * 计算条目哈希\n */\n private calculateHash(entry: AuditEntry): string {\n const data = {\n timestamp: entry.timestamp,\n action: entry.action,\n request_id: entry.request_id,\n from: entry.from,\n to: entry.to,\n amount: entry.amount,\n tx_hash: entry.tx_hash,\n prev_hash: entry.prev_hash,\n };\n \n const str = JSON.stringify(data);\n return crypto.createHash('sha256').update(str).digest('hex').slice(0, 16);\n }\n\n /**\n * 加载最后一条日志的哈希\n */\n private loadLastHash(): void {\n const today = new Date();\n \n // 检查今天和昨天的日志\n for (let i = 0; i < 2; i++) {\n const date = new Date(today);\n date.setDate(date.getDate() - i);\n \n const entries = this.read(date);\n if (entries.length > 0) {\n this.lastHash = entries[entries.length - 1].hash;\n return;\n }\n }\n }\n\n /**\n * 确保目录存在\n */\n private ensureDir(): void {\n if (!fs.existsSync(this.basePath)) {\n fs.mkdirSync(this.basePath, { recursive: true });\n }\n }\n}\n","/**\n * SecureWallet - 安全托管钱包\n * \n * 在基础 Wallet 之上增加:\n * - 单笔限额控制\n * - 日限额控制\n * - 白名单机制\n * - 审计日志\n * - 超限审批队列\n */\n\nimport { Wallet, type WalletConfig } from './Wallet.js';\nimport { AuditLog } from '../audit/AuditLog.js';\nimport type {\n SecurityLimits,\n SecureWalletConfig,\n TransferResult,\n TransferParams,\n PendingTransfer,\n} from '../types/index.js';\n\nconst DEFAULT_LIMITS: SecurityLimits = {\n singleMax: 100, // 单笔最大 $100\n dailyMax: 1000, // 日最大 $1000\n requireWhitelist: true,\n};\n\nexport class SecureWallet {\n private wallet: Wallet;\n private limits: SecurityLimits;\n private whitelist: Set<string>;\n private auditLog: AuditLog;\n private dailyTotal: number = 0;\n private dailyDate: string = '';\n private pendingTransfers: Map<string, PendingTransfer> = new Map();\n\n constructor(config: SecureWalletConfig = {}) {\n this.wallet = new Wallet({\n chain: config.chain,\n privateKey: config.privateKey,\n });\n\n this.limits = { ...DEFAULT_LIMITS, ...config.limits };\n this.whitelist = new Set((config.whitelist || []).map(a => a.toLowerCase()));\n this.auditLog = new AuditLog(config.auditPath);\n }\n\n /**\n * 获取钱包地址\n */\n get address(): string {\n return this.wallet.address;\n }\n\n /**\n * 获取余额\n */\n async getBalance() {\n return this.wallet.getBalance();\n }\n\n /**\n * 安全转账(带限额和白名单检查)\n */\n async transfer(params: TransferParams): Promise<TransferResult> {\n const { to, amount, reason, requester } = params;\n const toAddress = to.toLowerCase();\n const requestId = `tr_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;\n\n // 记录请求\n await this.auditLog.log({\n action: 'transfer_request',\n request_id: requestId,\n from: this.wallet.address,\n to,\n amount,\n reason,\n requester,\n });\n\n // 1. 白名单检查\n if (this.limits.requireWhitelist && !this.whitelist.has(toAddress)) {\n await this.auditLog.log({\n action: 'transfer_failed',\n request_id: requestId,\n metadata: { error: 'Address not in whitelist' },\n });\n return { success: false, error: `Address not in whitelist: ${to}` };\n }\n\n // 2. 单笔限额检查\n if (amount > this.limits.singleMax) {\n // 加入审批队列\n const pending: PendingTransfer = {\n id: requestId,\n to,\n amount,\n reason,\n requester,\n created_at: new Date().toISOString(),\n status: 'pending',\n };\n this.pendingTransfers.set(requestId, pending);\n \n await this.auditLog.log({\n action: 'transfer_request',\n request_id: requestId,\n metadata: { pending: true, reason: 'Exceeds single limit' },\n });\n \n return {\n success: false,\n error: `Amount ${amount} exceeds single limit ${this.limits.singleMax}. Pending approval: ${requestId}`,\n };\n }\n\n // 3. 日限额检查\n this.updateDailyTotal();\n if (this.dailyTotal + amount > this.limits.dailyMax) {\n const pending: PendingTransfer = {\n id: requestId,\n to,\n amount,\n reason,\n requester,\n created_at: new Date().toISOString(),\n status: 'pending',\n };\n this.pendingTransfers.set(requestId, pending);\n \n await this.auditLog.log({\n action: 'transfer_request',\n request_id: requestId,\n metadata: { pending: true, reason: 'Exceeds daily limit' },\n });\n \n return {\n success: false,\n error: `Daily limit would be exceeded (${this.dailyTotal} + ${amount} > ${this.limits.dailyMax}). Pending approval: ${requestId}`,\n };\n }\n\n // 4. 执行转账\n const result = await this.wallet.transfer(to, amount);\n\n // 5. 记录结果\n if (result.success) {\n this.dailyTotal += amount;\n await this.auditLog.log({\n action: 'transfer_executed',\n request_id: requestId,\n from: this.wallet.address,\n to,\n amount,\n tx_hash: result.tx_hash,\n reason,\n requester,\n });\n } else {\n await this.auditLog.log({\n action: 'transfer_failed',\n request_id: requestId,\n metadata: { error: result.error },\n });\n }\n\n return result;\n }\n\n /**\n * 审批待处理转账\n */\n async approve(requestId: string, approver: string): Promise<TransferResult> {\n const pending = this.pendingTransfers.get(requestId);\n if (!pending) {\n return { success: false, error: `Pending transfer not found: ${requestId}` };\n }\n\n if (pending.status !== 'pending') {\n return { success: false, error: `Transfer already ${pending.status}` };\n }\n\n await this.auditLog.log({\n action: 'transfer_approved',\n request_id: requestId,\n metadata: { approver },\n });\n\n pending.status = 'approved';\n\n // 执行转账(跳过限额检查)\n const result = await this.wallet.transfer(pending.to, pending.amount);\n\n if (result.success) {\n pending.status = 'executed';\n this.dailyTotal += pending.amount;\n \n await this.auditLog.log({\n action: 'transfer_executed',\n request_id: requestId,\n from: this.wallet.address,\n to: pending.to,\n amount: pending.amount,\n tx_hash: result.tx_hash,\n reason: pending.reason,\n requester: pending.requester,\n metadata: { approved_by: approver },\n });\n } else {\n await this.auditLog.log({\n action: 'transfer_failed',\n request_id: requestId,\n metadata: { error: result.error },\n });\n }\n\n return result;\n }\n\n /**\n * 拒绝待处理转账\n */\n async reject(requestId: string, rejecter: string, reason?: string): Promise<void> {\n const pending = this.pendingTransfers.get(requestId);\n if (!pending) {\n throw new Error(`Pending transfer not found: ${requestId}`);\n }\n\n pending.status = 'rejected';\n\n await this.auditLog.log({\n action: 'transfer_rejected',\n request_id: requestId,\n metadata: { rejected_by: rejecter, reason },\n });\n }\n\n /**\n * 添加白名单地址\n */\n async addToWhitelist(address: string, addedBy: string): Promise<void> {\n const addr = address.toLowerCase();\n this.whitelist.add(addr);\n\n await this.auditLog.log({\n action: 'whitelist_add',\n request_id: `wl_${Date.now()}`,\n to: address,\n metadata: { added_by: addedBy },\n });\n }\n\n /**\n * 移除白名单地址\n */\n async removeFromWhitelist(address: string, removedBy: string): Promise<void> {\n const addr = address.toLowerCase();\n this.whitelist.delete(addr);\n\n await this.auditLog.log({\n action: 'whitelist_remove',\n request_id: `wl_${Date.now()}`,\n to: address,\n metadata: { removed_by: removedBy },\n });\n }\n\n /**\n * 检查地址是否在白名单\n */\n isWhitelisted(address: string): boolean {\n return this.whitelist.has(address.toLowerCase());\n }\n\n /**\n * 获取待处理转账列表\n */\n getPendingTransfers(): PendingTransfer[] {\n return Array.from(this.pendingTransfers.values())\n .filter(p => p.status === 'pending');\n }\n\n /**\n * 获取当前限额配置\n */\n getLimits(): SecurityLimits {\n return { ...this.limits };\n }\n\n /**\n * 获取今日已用额度\n */\n getDailyUsed(): number {\n this.updateDailyTotal();\n return this.dailyTotal;\n }\n\n /**\n * 更新日限额计数器\n */\n private updateDailyTotal(): void {\n const today = new Date().toISOString().slice(0, 10);\n if (this.dailyDate !== today) {\n this.dailyDate = today;\n this.dailyTotal = 0;\n }\n }\n}\n"],"mappings":";AAQA,SAAS,cAAc;;;ACFhB,IAAM,SAAyC;AAAA;AAAA,EAEpD,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,KAAK;AAAA,IACL,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB;AAAA,EACA,SAAS;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,IACT,KAAK;AAAA,IACL,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,IACT,KAAK;AAAA,IACL,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB;AAAA;AAAA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