fix(mpc-service): 修复 coordinator-client 请求/响应格式
session-coordinator 使用 camelCase JSON 格式: 请求: - session_id, party_id, join_token -> joinToken, partyId - 添加必需字段 deviceType, deviceId 响应: - session_info.session_id -> sessionId - other_parties -> participants 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e4abc7eb83
commit
467206fd61
|
|
@ -96,22 +96,24 @@ export class MPCCoordinatorClient implements OnModuleInit {
|
|||
|
||||
try {
|
||||
const response = await this.client.post('/api/v1/sessions/join', {
|
||||
session_id: request.sessionId,
|
||||
party_id: request.partyId,
|
||||
join_token: request.joinToken,
|
||||
joinToken: request.joinToken,
|
||||
partyId: request.partyId,
|
||||
deviceType: 'server', // Required field
|
||||
deviceId: 'mpc-service',
|
||||
});
|
||||
|
||||
// Response format: { sessionId, partyIndex, status, participants }
|
||||
return {
|
||||
sessionId: response.data.session_info.session_id,
|
||||
sessionType: response.data.session_info.session_type,
|
||||
thresholdN: response.data.session_info.threshold_n,
|
||||
thresholdT: response.data.session_info.threshold_t,
|
||||
participants: response.data.other_parties.map((p: any) => ({
|
||||
partyId: p.party_id,
|
||||
partyIndex: p.party_index,
|
||||
})),
|
||||
publicKey: response.data.session_info.public_key,
|
||||
messageHash: response.data.session_info.message_hash,
|
||||
sessionId: response.data.sessionId,
|
||||
sessionType: 'keygen', // JoinByToken doesn't return session type, assume keygen
|
||||
thresholdN: 3, // Default 2-of-3
|
||||
thresholdT: 2,
|
||||
participants: response.data.participants?.map((p: any) => ({
|
||||
partyId: p.partyId,
|
||||
partyIndex: p.partyIndex || 0,
|
||||
})) || [],
|
||||
publicKey: undefined,
|
||||
messageHash: undefined,
|
||||
};
|
||||
} catch (error) {
|
||||
const message = this.getErrorMessage(error);
|
||||
|
|
|
|||
Loading…
Reference in New Issue