Skip to content

Commit

Permalink
fix(videov2): create push signer instance to get chain id in initiali…
Browse files Browse the repository at this point in the history
…ze()
  • Loading branch information
madhur-push committed Jan 8, 2024
1 parent d39592c commit 194e064
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/restapi/src/lib/pushapi/video.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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');
}
Expand All @@ -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!,
Expand Down

0 comments on commit 194e064

Please sign in to comment.