diff --git a/sdk/src/driftClient.ts b/sdk/src/driftClient.ts index 54a6c636b7..2ecbf79bf2 100644 --- a/sdk/src/driftClient.ts +++ b/sdk/src/driftClient.ts @@ -696,7 +696,8 @@ export class DriftClient { public getSpotMarketAccount( marketIndex: number ): SpotMarketAccount | undefined { - return this.accountSubscriber.getSpotMarketAccountAndSlot(marketIndex).data; + return this.accountSubscriber.getSpotMarketAccountAndSlot(marketIndex) + ?.data; } /** @@ -707,7 +708,8 @@ export class DriftClient { marketIndex: number ): Promise { await this.accountSubscriber.fetch(); - return this.accountSubscriber.getSpotMarketAccountAndSlot(marketIndex).data; + return this.accountSubscriber.getSpotMarketAccountAndSlot(marketIndex) + ?.data; } public getSpotMarketAccounts(): SpotMarketAccount[] {