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 {
|
try {
|
||||||
const response = await this.client.post('/api/v1/sessions/join', {
|
const response = await this.client.post('/api/v1/sessions/join', {
|
||||||
session_id: request.sessionId,
|
joinToken: request.joinToken,
|
||||||
party_id: request.partyId,
|
partyId: request.partyId,
|
||||||
join_token: request.joinToken,
|
deviceType: 'server', // Required field
|
||||||
|
deviceId: 'mpc-service',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Response format: { sessionId, partyIndex, status, participants }
|
||||||
return {
|
return {
|
||||||
sessionId: response.data.session_info.session_id,
|
sessionId: response.data.sessionId,
|
||||||
sessionType: response.data.session_info.session_type,
|
sessionType: 'keygen', // JoinByToken doesn't return session type, assume keygen
|
||||||
thresholdN: response.data.session_info.threshold_n,
|
thresholdN: 3, // Default 2-of-3
|
||||||
thresholdT: response.data.session_info.threshold_t,
|
thresholdT: 2,
|
||||||
participants: response.data.other_parties.map((p: any) => ({
|
participants: response.data.participants?.map((p: any) => ({
|
||||||
partyId: p.party_id,
|
partyId: p.partyId,
|
||||||
partyIndex: p.party_index,
|
partyIndex: p.partyIndex || 0,
|
||||||
})),
|
})) || [],
|
||||||
publicKey: response.data.session_info.public_key,
|
publicKey: undefined,
|
||||||
messageHash: response.data.session_info.message_hash,
|
messageHash: undefined,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = this.getErrorMessage(error);
|
const message = this.getErrorMessage(error);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue