Skip to content

Commit

Permalink
fix: typescript compilation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
albertfolch-redeemeum committed Nov 21, 2023
1 parent 818155d commit a2590d4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/core-sdk/src/offers/mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { ITokenInfo, TokenInfoManager } from "../utils/tokenInfoManager";
import { batchTasks } from "../utils/promises";
import { ExchangesMixin } from "../exchanges/mixin";
import { EventLogsMixin } from "../event-logs/mixin";
import { MetadataMixin } from "../metadata/mixin";

export class OfferMixin extends BaseCoreSDK {
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -361,7 +360,7 @@ export class OfferMixin extends BaseCoreSDK {
*/
public async getExchangeTokenInfo(
exchangeToken: string
): Promise<ITokenInfo> {
): Promise<ITokenInfo | undefined> {
if (this._tokenInfoManager === undefined) {
this._tokenInfoManager = new TokenInfoManager(
this._chainId,
Expand Down Expand Up @@ -419,14 +418,15 @@ export class OfferMixin extends BaseCoreSDK {
if (!offer?.condition) {
return true;
}
const offerConditionId = offer.condition.id;
const getCanTokenIdBeUsedToCommit = async (): Promise<
(tokenId: string) => boolean
> => {
const conditionalCommitLogs = await (
this as unknown as EventLogsMixin
).getConditionalCommitAuthorizedEventLogs({
conditionalCommitAuthorizedLogsFilter: {
groupId: offer.condition.id, // all offers of the same product have the same condition.id
groupId: offerConditionId, // all offers of the same product have the same condition.id
buyerAddress
}
});
Expand Down Expand Up @@ -462,6 +462,9 @@ export class OfferMixin extends BaseCoreSDK {
return true;
}
const log = tokenIdToAvailableCommitsMap.get(tokenId);
if (!log) {
return true;
}
return Number(log.maxCommits) - Number(log.commitCount) > 0;
};
return canTokenIdBeUsedToCommit;
Expand All @@ -472,7 +475,7 @@ export class OfferMixin extends BaseCoreSDK {
exchangesFilter: {
buyer: buyerAddress,
offer_: {
condition: offer.condition.id
condition: offerConditionId
}
}
});
Expand Down

0 comments on commit a2590d4

Please sign in to comment.