Remove getUpdateProposals

This commit is contained in:
Sosthene 2024-12-17 12:08:47 +01:00
parent 3cb52b6ebb
commit 93c2ea1d23

View File

@ -266,20 +266,6 @@ export default class Services {
}
}
public getUpdateProposals(commitmentOutpoint: string) {
try {
const proposals: any = this.sdkClient.get_update_proposals(commitmentOutpoint);
if (proposals.decrypted_pcds && proposals.decrypted_pcds.length != 0) {
this.currentProcess = commitmentOutpoint;
this.pendingUpdates = proposals;
} else {
throw new Error('No pending proposals');
}
} catch (e) {
throw new Error(`Failed to get proposal updates for process ${commitmentOutpoint}: ${e}`);
}
}
public async handleApiReturn(apiReturn: ApiReturn) {
if (apiReturn.new_tx_to_send && apiReturn.new_tx_to_send.transaction.length != 0) {
await this.sendNewTxMessage(JSON.stringify(apiReturn.new_tx_to_send));
@ -492,7 +478,7 @@ export default class Services {
}
}
public async saveProcess(commitedIn: string, process: any) {
public async saveProcess(commitedIn: string, process: Process) {
const db = await Database.getInstance();
try {
await db.addObject({
@ -503,6 +489,23 @@ export default class Services {
} catch (e) {
throw new Error(`Failed to save process: ${e}`)
}
// We check how many copies in storage nodes
// We check the storage nodes in the process itself
// this.sdkClient.get_storages(commitedIn);
const storages = [storageUrl];
for (const state of process.states) {
if (state.merkle_root === "") {
continue;
}
for (const [field, hash] of Object.entries(state.pcd_commitment)) {
// get the encrypted value with the field name
const value = state.encrypted_pcd[field];
await storeData(storages, hash, value, null);
}
}
}
public async saveDiffs(diffs: UserDiff[]) {
const db = await Database.getInstance();
@ -511,7 +514,7 @@ export default class Services {
await db.addObject({
storeName: 'diffs',
object: diff,
key: diff.value_commitment,
key: null,
});
}
} catch (e) {