拆分 AccountCenter:提取支付与钱包逻辑至 useAccountPayment hook,主组件从 2917 行减至 1280 行

This commit is contained in:
2569718930@qq.com
2026-05-25 02:38:20 +08:00
parent 22872f26e7
commit 7f8dca2066
5 changed files with 2723 additions and 1946 deletions
@@ -44,12 +44,26 @@ export function runTests() {
);
const accountCenterSource = fs.readFileSync(accountCenterPath, "utf8");
const hookPath = path.join(
projectRoot,
"components",
"account",
"useAccountPayment.ts",
);
const hookSource = fs.existsSync(hookPath)
? fs.readFileSync(hookPath, "utf8")
: "";
// The receiver validation now lives in the extracted hook file (called
// from createManualPaymentIntent and createIntentAndPay).
assert(
accountCenterSource.includes("assertExpectedPaymentReceiver"),
accountCenterSource.includes("assertExpectedPaymentReceiver") ||
hookSource.includes("assertExpectedPaymentReceiver"),
"AccountCenter must validate backend-returned manual payment receiver before displaying it",
);
assert(
accountCenterSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS"),
accountCenterSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS") ||
hookSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS"),
"AccountCenter must show the pinned payment receiver address in its payment guard",
);