fix(service-party-app): 补全 getSessionStatus 返回的 threshold 和 participants
问题: - Session.tsx 期望 session 对象有 threshold 和 participants 字段 - 但 grpc:getSessionStatus 只返回了基础字段 - 导致前端显示 参与方 (0 / 0) 修复: - 从 activeKeygenSession 获取 threshold 信息 - 从 API 返回的 participants 构建完整的参与者列表 - 添加 walletName, currentRound, totalRounds 字段 Generated with Claude Code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c94f3e4d83
commit
422d7007b1
|
|
@ -859,15 +859,30 @@ function setupIpcHandlers() {
|
||||||
ipcMain.handle('grpc:getSessionStatus', async (_event, { sessionId }) => {
|
ipcMain.handle('grpc:getSessionStatus', async (_event, { sessionId }) => {
|
||||||
try {
|
try {
|
||||||
const result = await accountClient?.getSessionStatus(sessionId);
|
const result = await accountClient?.getSessionStatus(sessionId);
|
||||||
|
// 从 activeKeygenSession 获取更完整的信息
|
||||||
|
const threshold = activeKeygenSession?.threshold || { t: 0, n: result?.total_parties || 0 };
|
||||||
|
const participants = result?.participants?.map((p, idx) => ({
|
||||||
|
partyId: p.party_id,
|
||||||
|
partyIndex: p.party_index,
|
||||||
|
name: activeKeygenSession?.participants?.find(ap => ap.partyId === p.party_id)?.name || `参与方 ${idx + 1}`,
|
||||||
|
status: p.status,
|
||||||
|
joinedAt: new Date().toISOString(),
|
||||||
|
})) || [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
session: {
|
session: {
|
||||||
sessionId: result?.session_id,
|
sessionId: result?.session_id,
|
||||||
|
walletName: activeKeygenSession?.walletName || '',
|
||||||
status: result?.status,
|
status: result?.status,
|
||||||
completedParties: result?.completed_parties,
|
completedParties: result?.completed_parties,
|
||||||
totalParties: result?.total_parties,
|
totalParties: result?.total_parties,
|
||||||
sessionType: result?.session_type,
|
sessionType: result?.session_type,
|
||||||
publicKey: result?.public_key,
|
publicKey: result?.public_key,
|
||||||
|
threshold: threshold,
|
||||||
|
participants: participants,
|
||||||
|
currentRound: 0,
|
||||||
|
totalRounds: 4,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue