From b0e3daa2683da579603ac37794af35d1a64d42ab Mon Sep 17 00:00:00 2001 From: pociej Date: Fri, 14 Jun 2024 07:38:04 +0200 Subject: [PATCH] fix: dont use getAgreement from executor #62 --- backend/src/services/yagna/service.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/backend/src/services/yagna/service.ts b/backend/src/services/yagna/service.ts index bcc16d4..3b361d0 100644 --- a/backend/src/services/yagna/service.ts +++ b/backend/src/services/yagna/service.ts @@ -98,7 +98,17 @@ export class Yagna { //which is HARDCODED in yagna we make worker which under the hood makes activity // which prevents agreement from closing const worker = await this.getUserWorker(userId); - const agreement = await executor.getAgreement(); + + const agreement = await worker.context?.activity.agreement; + + if (!agreement) { + throw new Error({ + code: ErrorCode.AGREEMENT_NOT_FOUND, + payload: { + agreementId: "", + }, + }); + } container.cradle.userService.setCurrentAgreementId(userId, agreement.id); agreement.events.on("terminated", (e: any) => { this.agreementEvents.next({