From 194e06481400893e8d7e21e25a201c037592a257 Mon Sep 17 00:00:00 2001 From: Madhur Gupta Date: Mon, 8 Jan 2024 15:19:55 +0530 Subject: [PATCH] fix(videov2): create push signer instance to get chain id in initialize() --- packages/restapi/src/lib/pushapi/video.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/restapi/src/lib/pushapi/video.ts b/packages/restapi/src/lib/pushapi/video.ts index 11aaddd8d..5051cf052 100644 --- a/packages/restapi/src/lib/pushapi/video.ts +++ b/packages/restapi/src/lib/pushapi/video.ts @@ -1,6 +1,7 @@ import { ENV } from '../constants'; import CONSTANTS from '../constantsV2'; import { SignerType, VideoCallData } from '../types'; +import { Signer as PushSigner } from '../helpers'; import { Video as VideoV1 } from '../video/Video'; import { VideoV2 } from '../video/VideoV2'; @@ -21,12 +22,6 @@ export class Video { ) { const { socketStream, media, stream } = options; - const chainId = await this.signer?.getChainId(); - - if (!chainId) { - throw new Error('Chain Id not retrievable from signer'); - } - if (!this.signer) { throw new Error('Signer is required for push video'); } @@ -37,6 +32,12 @@ export class Video { ); } + const chainId = await new PushSigner(this.signer).getChainId(); + + if (!chainId) { + throw new Error('Chain Id not retrievable from signer'); + } + // Initialize the video instance with the provided options const videoV1Instance = new VideoV1({ signer: this.signer!,