From fd531818cecfd1bc73b223f234135eace901361d Mon Sep 17 00:00:00 2001 From: enrique Date: Wed, 11 Dec 2024 09:58:25 +0100 Subject: [PATCH] fix: missed logs --- package.json | 2 +- src/api/nvm-backend.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9ac6380..9abd492 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nevermined-io/payments", - "version": "0.7.4", + "version": "0.7.5", "description": "Typescript SDK to interact with the Nevermined Payments Protocol", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/src/api/nvm-backend.ts b/src/api/nvm-backend.ts index b2db87a..ae76708 100644 --- a/src/api/nvm-backend.ts +++ b/src/api/nvm-backend.ts @@ -2,9 +2,9 @@ import axios from 'axios' import { decodeJwt } from 'jose' import { io } from 'socket.io-client' import { sleep } from '../common/helper' -import { AgentExecutionStatus, TaskLogMessage, TaskCallback } from '../common/types' -import { isEthereumAddress } from '../utils' import { PaymentsError } from '../common/payments.error' +import { AgentExecutionStatus, TaskCallback, TaskLogMessage } from '../common/types' +import { isEthereumAddress } from '../utils' export interface BackendApiOptions { /** @@ -214,7 +214,9 @@ export class NVMBackendApi { }) await this.socketClient.emit('_join-tasks', JSON.stringify({ tasks, history })) - await this.socketClient.on('task-log', this.handleTaskLog.bind(this, tasks)) + this.socketClient.on('_join-tasks_', async () => { + this.socketClient.on('task-log', this.handleTaskLog.bind(this, tasks)) + }) } catch (error) { throw new PaymentsError( `Unable to initialize websocket client: ${this.opts.webSocketHost} - ${(error as Error).message}`,