minor fixes

This commit is contained in:
NicolasCantu 2025-02-06 12:12:35 +01:00
parent 2a1bf902a5
commit eb4a120204

View File

@ -210,7 +210,7 @@ export default class Services {
} }
private async ensureSufficientAmount(): Promise<void> { private async ensureSufficientAmount(): Promise<void> {
let availableAmt = this.getAmount(); const availableAmt = this.getAmount();
const target: BigInt = DEFAULTAMOUNT * BigInt(2); const target: BigInt = DEFAULTAMOUNT * BigInt(2);
if (availableAmt < target) { if (availableAmt < target) {
@ -573,7 +573,7 @@ export default class Services {
} else { } else {
// We should have it in db if it came from the wasm, but just in case // We should have it in db if it came from the wasm, but just in case
try { try {
await this.saveDiffsToDb(diff); await this.saveDiffsToDb([diff]);
} catch (e) { } catch (e) {
console.error(`Failed to save diff to db: ${e}`); console.error(`Failed to save diff to db: ${e}`);
} }
@ -676,8 +676,8 @@ export default class Services {
} }
if (updatedProcess.modified_state) { if (updatedProcess.validated_state) {
const responsePrdReturn = this.sdkClient.create_response_prd(processId, updatedProcess.modified_state); const responsePrdReturn = this.sdkClient.create_response_prd(processId, updatedProcess.validated_state);
await this.handleApiReturn(responsePrdReturn); await this.handleApiReturn(responsePrdReturn);
} }
} }
@ -918,7 +918,7 @@ export default class Services {
const storages = [storageUrl]; const storages = [storageUrl];
try { try {
await storeData(storages, hash, value, ttl); await storeData(storages, hash, data, ttl);
} catch (e) { } catch (e) {
console.error(`Failed to store data with hash ${hash}: ${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<string | null> { async getDescription(processId: string, process: Process): Promise<string | null> {
const service = await Services.getInstance();
// Get the `commited_in` value of the last state and remove it from the array // Get the `commited_in` value of the last state and remove it from the array
const currentCommitedIn = process.states.at(-1)?.commited_in; 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 // Take the description out of the state, if any
const description = lastDifferentState!.pcd_commitment['description']; const description = lastDifferentState!.pcd_commitment['description'];
if (description) { if (description) {
const userDiff = await service.getDiffByValue(description); const userDiff = await this.getDiffByValue(description);
if (userDiff) { if (userDiff) {
return userDiff.new_value; return userDiff.new_value;
} }