Slight refactoring and cleanup
This commit is contained in:
parent
2601418aaf
commit
3f42cb27a7
@ -529,8 +529,11 @@ export default class Services {
|
||||
}
|
||||
}
|
||||
|
||||
// Create prd update for current process and update
|
||||
public createPrdUpdate(processId: string, stateId: string): ApiReturn {
|
||||
public async createPrdUpdate(processId: string, stateId: string): Promise<ApiReturn> {
|
||||
const process = await this.getProcess(processId);
|
||||
if (!process) {
|
||||
throw new Error('Unknown process');
|
||||
}
|
||||
try {
|
||||
return this.sdkClient.create_update_message(process, stateId, this.getAllMembers());
|
||||
} catch (e) {
|
||||
@ -538,15 +541,15 @@ export default class Services {
|
||||
}
|
||||
}
|
||||
|
||||
public createPrdResponse(pcdMerkleRoot: string): ApiReturn {
|
||||
if (!this.currentProcess) {
|
||||
throw new Error('No current process defined');
|
||||
public async createPrdResponse(processId: string, stateId: string): Promise<ApiReturn> {
|
||||
const process = await this.getProcess(processId);
|
||||
if (!process) {
|
||||
throw new Error('Unknown process');
|
||||
}
|
||||
|
||||
try {
|
||||
return this.sdkClient.create_response_prd(process, pcdMerkleRoot, this.getAllMembers());
|
||||
} catch (e) {
|
||||
throw e;
|
||||
throw new Error(`Failed to create response prd: ${e}`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -686,8 +689,8 @@ export default class Services {
|
||||
|
||||
if (updatedProcess.encrypted_data && Object.keys(updatedProcess.encrypted_data).length != 0) {
|
||||
for (const [hash, cipher] of Object.entries(updatedProcess.encrypted_data)) {
|
||||
console.log(hash);
|
||||
console.log(cipher);
|
||||
// console.log(hash);
|
||||
// console.log(cipher);
|
||||
const blob = this.hexToBlob(cipher);
|
||||
try {
|
||||
await this.saveBlobToDb(hash, blob);
|
||||
@ -730,9 +733,14 @@ export default class Services {
|
||||
}
|
||||
}
|
||||
|
||||
public async openPairingConfirmationModal(firstState: ProcessState) {
|
||||
public async openPairingConfirmationModal(processId: string) {
|
||||
const process = await this.getProcess(processId);
|
||||
if (!process) {
|
||||
console.error('Failed to find pairing process');
|
||||
return;
|
||||
}
|
||||
const firstState = process.states[0];
|
||||
const roles = firstState.roles;
|
||||
const processId = firstState.commited_in;
|
||||
const stateId = firstState.state_id;
|
||||
try {
|
||||
await this.routingInstance.openPairingConfirmationModal(roles, processId, stateId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user