fix(service-party-app): use API response for co-sign session status display
- Use API's participants field instead of parties - Use API's threshold_t and threshold_n instead of activeCoSignSession - Show participant status from API response - Update GetSignSessionStatusResponse interface 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c1e749e532
commit
4089b9da6c
|
|
@ -1810,6 +1810,8 @@ function setupIpcHandlers() {
|
|||
ipcMain.handle('cosign:getSessionStatus', async (_event, { sessionId }) => {
|
||||
try {
|
||||
const result = await accountClient?.getSignSessionStatus(sessionId);
|
||||
// API 返回的是 participants 字段
|
||||
const apiParticipants = (result as { participants?: Array<{ party_id: string; party_index: number; status: string }> })?.participants || [];
|
||||
return {
|
||||
success: true,
|
||||
session: {
|
||||
|
|
@ -1817,15 +1819,15 @@ function setupIpcHandlers() {
|
|||
status: result?.status,
|
||||
joinedCount: result?.joined_count,
|
||||
threshold: {
|
||||
t: activeCoSignSession?.threshold?.t || 0,
|
||||
n: activeCoSignSession?.threshold?.n || 0,
|
||||
t: result?.threshold_t || activeCoSignSession?.threshold?.t || 0,
|
||||
n: result?.threshold_n || activeCoSignSession?.threshold?.n || 0,
|
||||
},
|
||||
participants: result?.parties?.map((p: { party_id: string; party_index: number }, idx: number) => ({
|
||||
participants: apiParticipants.map((p, idx) => ({
|
||||
partyId: p.party_id,
|
||||
partyIndex: p.party_index,
|
||||
name: activeCoSignSession?.participants?.find(ap => ap.partyId === p.party_id)?.name || `参与方 ${idx + 1}`,
|
||||
status: 'ready',
|
||||
})) || [],
|
||||
status: p.status || 'waiting',
|
||||
})),
|
||||
messageHash: activeCoSignSession?.messageHash || '',
|
||||
walletName: activeCoSignSession?.walletName || '',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -144,9 +144,14 @@ export interface GetSignSessionByInviteCodeResponse {
|
|||
export interface GetSignSessionStatusResponse {
|
||||
session_id: string;
|
||||
status: string;
|
||||
session_type: string;
|
||||
threshold_t: number;
|
||||
joined_count: number;
|
||||
parties: SignPartyInfo[];
|
||||
threshold_n: number;
|
||||
completed_parties: number;
|
||||
total_parties: number;
|
||||
joined_count?: number;
|
||||
parties?: SignPartyInfo[];
|
||||
participants?: Array<{ party_id: string; party_index: number; status: string }>;
|
||||
message_hash?: string;
|
||||
signature?: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue