From eb4a120204451fa99abb269c77226ab88f4dc2a8 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Thu, 6 Feb 2025 12:12:35 +0100 Subject: [PATCH] minor fixes --- src/services/service.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/services/service.ts b/src/services/service.ts index 40157de..918da12 100755 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -210,7 +210,7 @@ export default class Services { } private async ensureSufficientAmount(): Promise { - let availableAmt = this.getAmount(); + const availableAmt = this.getAmount(); const target: BigInt = DEFAULTAMOUNT * BigInt(2); if (availableAmt < target) { @@ -573,7 +573,7 @@ export default class Services { } else { // We should have it in db if it came from the wasm, but just in case try { - await this.saveDiffsToDb(diff); + await this.saveDiffsToDb([diff]); } catch (e) { console.error(`Failed to save diff to db: ${e}`); } @@ -676,8 +676,8 @@ export default class Services { } - if (updatedProcess.modified_state) { - const responsePrdReturn = this.sdkClient.create_response_prd(processId, updatedProcess.modified_state); + if (updatedProcess.validated_state) { + const responsePrdReturn = this.sdkClient.create_response_prd(processId, updatedProcess.validated_state); await this.handleApiReturn(responsePrdReturn); } } @@ -918,7 +918,7 @@ export default class Services { const storages = [storageUrl]; try { - await storeData(storages, hash, value, ttl); + await storeData(storages, hash, data, ttl); } catch (e) { console.error(`Failed to store data with hash ${hash}: ${e}`); } @@ -1070,7 +1070,6 @@ export default class Services { } async getDescription(processId: string, process: Process): Promise { - const service = await Services.getInstance(); // Get the `commited_in` value of the last state and remove it from the array const currentCommitedIn = process.states.at(-1)?.commited_in; @@ -1096,7 +1095,7 @@ export default class Services { // Take the description out of the state, if any const description = lastDifferentState!.pcd_commitment['description']; if (description) { - const userDiff = await service.getDiffByValue(description); + const userDiff = await this.getDiffByValue(description); if (userDiff) { return userDiff.new_value; }