@bosonprotocol/core-sdk 1.32.0 → 1.33.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/event-logs/mixin.d.ts +6 -0
- package/dist/cjs/event-logs/mixin.d.ts.map +1 -1
- package/dist/cjs/event-logs/mixin.js +10 -0
- package/dist/cjs/event-logs/mixin.js.map +1 -1
- package/dist/cjs/event-logs/subgraph.d.ts +2 -1
- package/dist/cjs/event-logs/subgraph.d.ts.map +1 -1
- package/dist/cjs/event-logs/subgraph.js +9 -1
- package/dist/cjs/event-logs/subgraph.js.map +1 -1
- package/dist/cjs/offers/mixin.d.ts +1 -1
- package/dist/cjs/offers/mixin.d.ts.map +1 -1
- package/dist/cjs/offers/mixin.js +216 -25
- package/dist/cjs/offers/mixin.js.map +1 -1
- package/dist/cjs/subgraph.d.ts +237 -0
- package/dist/cjs/subgraph.d.ts.map +1 -1
- package/dist/cjs/subgraph.js +56 -3
- package/dist/cjs/subgraph.js.map +1 -1
- package/dist/cjs/utils/graphql.d.ts +7 -0
- package/dist/cjs/utils/graphql.d.ts.map +1 -1
- package/dist/cjs/utils/promises.d.ts +2 -0
- package/dist/cjs/utils/promises.d.ts.map +1 -0
- package/dist/cjs/utils/promises.js +32 -0
- package/dist/cjs/utils/promises.js.map +1 -0
- package/dist/esm/event-logs/mixin.d.ts +6 -0
- package/dist/esm/event-logs/mixin.d.ts.map +1 -1
- package/dist/esm/event-logs/mixin.js +9 -1
- package/dist/esm/event-logs/mixin.js.map +1 -1
- package/dist/esm/event-logs/subgraph.d.ts +2 -1
- package/dist/esm/event-logs/subgraph.d.ts.map +1 -1
- package/dist/esm/event-logs/subgraph.js +5 -0
- package/dist/esm/event-logs/subgraph.js.map +1 -1
- package/dist/esm/offers/mixin.d.ts +1 -1
- package/dist/esm/offers/mixin.d.ts.map +1 -1
- package/dist/esm/offers/mixin.js +158 -26
- package/dist/esm/offers/mixin.js.map +1 -1
- package/dist/esm/subgraph.d.ts +237 -0
- package/dist/esm/subgraph.d.ts.map +1 -1
- package/dist/esm/subgraph.js +53 -0
- package/dist/esm/subgraph.js.map +1 -1
- package/dist/esm/utils/graphql.d.ts +7 -0
- package/dist/esm/utils/graphql.d.ts.map +1 -1
- package/dist/esm/utils/promises.d.ts +2 -0
- package/dist/esm/utils/promises.d.ts.map +1 -0
- package/dist/esm/utils/promises.js +14 -0
- package/dist/esm/utils/promises.js.map +1 -0
- package/package.json +3 -3
- package/src/accounts/queries.graphql +32 -0
- package/src/event-logs/mixin.ts +17 -1
- package/src/event-logs/subgraph.ts +13 -1
- package/src/offers/mixin.ts +212 -28
- package/src/subgraph.ts +294 -0
- package/src/utils/promises.ts +18 -0
package/src/offers/mixin.ts
CHANGED
|
@@ -11,11 +11,17 @@ import {
|
|
|
11
11
|
TransactionResponse,
|
|
12
12
|
Log,
|
|
13
13
|
TokenType,
|
|
14
|
-
EvaluationMethod
|
|
14
|
+
EvaluationMethod,
|
|
15
|
+
GatingType
|
|
15
16
|
} from "@bosonprotocol/common";
|
|
17
|
+
import groupBy from "lodash/groupBy";
|
|
16
18
|
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
|
17
19
|
import { getValueFromLogs, getValuesFromLogs } from "../utils/logs";
|
|
18
20
|
import { ITokenInfo, TokenInfoManager } from "../utils/tokenInfoManager";
|
|
21
|
+
import { batchTasks } from "../utils/promises";
|
|
22
|
+
import { ExchangesMixin } from "../exchanges/mixin";
|
|
23
|
+
import { EventLogsMixin } from "../event-logs/mixin";
|
|
24
|
+
import { MetadataMixin } from "../metadata/mixin";
|
|
19
25
|
|
|
20
26
|
export class OfferMixin extends BaseCoreSDK {
|
|
21
27
|
/* -------------------------------------------------------------------------- */
|
|
@@ -405,53 +411,231 @@ export class OfferMixin extends BaseCoreSDK {
|
|
|
405
411
|
}
|
|
406
412
|
|
|
407
413
|
public async checkTokenGatedCondition(
|
|
408
|
-
|
|
414
|
+
offerId: subgraph.OfferFieldsFragment["id"],
|
|
409
415
|
buyerAddress: string
|
|
410
416
|
): Promise<boolean> {
|
|
417
|
+
const offer = await this.getOfferById(offerId);
|
|
418
|
+
|
|
419
|
+
if (!offer?.condition) {
|
|
420
|
+
return true;
|
|
421
|
+
}
|
|
422
|
+
const getCanTokenIdBeUsedToCommit = async (): Promise<
|
|
423
|
+
(tokenId: string) => boolean
|
|
424
|
+
> => {
|
|
425
|
+
const conditionalCommitLogs = await (
|
|
426
|
+
this as unknown as EventLogsMixin
|
|
427
|
+
).getConditionalCommitAuthorizedEventLogs({
|
|
428
|
+
conditionalCommitAuthorizedLogsFilter: {
|
|
429
|
+
groupId: offer.condition.id, // all offers of the same product have the same condition.id
|
|
430
|
+
buyerAddress
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
const tokenIdMapWithMultipleEntries = groupBy(
|
|
435
|
+
conditionalCommitLogs,
|
|
436
|
+
(log) => log.tokenId
|
|
437
|
+
);
|
|
438
|
+
type TokenId = string;
|
|
439
|
+
// build a map of tokenId -> log with the min available commits (or the most recent log) in all the logs
|
|
440
|
+
const tokenIdToAvailableCommitsMap = new Map<
|
|
441
|
+
TokenId,
|
|
442
|
+
subgraph.BaseConditionalCommitAuthorizedEventLogsFieldsFragment
|
|
443
|
+
>();
|
|
444
|
+
Object.entries(tokenIdMapWithMultipleEntries).forEach(
|
|
445
|
+
([tokenId, logs]) => {
|
|
446
|
+
let logWithMinAvailableCommits = logs[0];
|
|
447
|
+
for (const log of logs) {
|
|
448
|
+
const currentAvailableCommits =
|
|
449
|
+
Number(log.maxCommits) - Number(log.commitCount);
|
|
450
|
+
const savedAvailableCommits =
|
|
451
|
+
Number(logWithMinAvailableCommits.maxCommits) -
|
|
452
|
+
Number(logWithMinAvailableCommits.commitCount);
|
|
453
|
+
if (currentAvailableCommits < savedAvailableCommits) {
|
|
454
|
+
logWithMinAvailableCommits = log;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
tokenIdToAvailableCommitsMap.set(tokenId, logWithMinAvailableCommits);
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
const canTokenIdBeUsedToCommit = (tokenId: TokenId): boolean => {
|
|
461
|
+
if (!tokenIdToAvailableCommitsMap.has(tokenId)) {
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
const log = tokenIdToAvailableCommitsMap.get(tokenId);
|
|
465
|
+
return Number(log.maxCommits) - Number(log.commitCount) > 0;
|
|
466
|
+
};
|
|
467
|
+
return canTokenIdBeUsedToCommit;
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
const getCurrentCommits = async (): Promise<number> => {
|
|
471
|
+
const exchanges = await (this as unknown as ExchangesMixin).getExchanges({
|
|
472
|
+
exchangesFilter: {
|
|
473
|
+
buyer: buyerAddress,
|
|
474
|
+
offer_: {
|
|
475
|
+
condition: offer.condition.id
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
const currentCommits = exchanges.length;
|
|
481
|
+
return currentCommits;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
const concurrencyLimit = 5;
|
|
411
485
|
const {
|
|
412
|
-
minTokenId:
|
|
486
|
+
minTokenId: _minTokenId,
|
|
487
|
+
maxTokenId: _maxTokenId,
|
|
413
488
|
tokenType,
|
|
414
489
|
threshold,
|
|
415
490
|
method,
|
|
416
|
-
tokenAddress
|
|
417
|
-
|
|
491
|
+
tokenAddress,
|
|
492
|
+
gatingType,
|
|
493
|
+
maxCommits: _maxCommits
|
|
494
|
+
} = offer.condition;
|
|
495
|
+
const maxCommits = Number(_maxCommits);
|
|
496
|
+
|
|
418
497
|
if (tokenType === TokenType.FungibleToken) {
|
|
419
498
|
const balance: string = await erc20.handler.balanceOf({
|
|
420
499
|
contractAddress: tokenAddress,
|
|
421
500
|
owner: buyerAddress,
|
|
422
501
|
web3Lib: this._web3Lib
|
|
423
502
|
});
|
|
424
|
-
|
|
503
|
+
if (!BigNumber.from(balance).gte(threshold)) {
|
|
504
|
+
return false;
|
|
505
|
+
}
|
|
506
|
+
const currentCommits = await getCurrentCommits();
|
|
507
|
+
return currentCommits < maxCommits;
|
|
425
508
|
}
|
|
509
|
+
|
|
510
|
+
const minTokenId = Number(_minTokenId);
|
|
511
|
+
const maxTokenId = Number(_maxTokenId);
|
|
512
|
+
|
|
426
513
|
if (tokenType === TokenType.NonFungibleToken) {
|
|
427
|
-
if (
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
514
|
+
if (gatingType === GatingType.PerAddress) {
|
|
515
|
+
if (method === EvaluationMethod.Threshold) {
|
|
516
|
+
const balance: string = await erc721.handler.balanceOf({
|
|
517
|
+
contractAddress: tokenAddress,
|
|
518
|
+
owner: buyerAddress,
|
|
519
|
+
web3Lib: this._web3Lib
|
|
520
|
+
});
|
|
521
|
+
if (!BigNumber.from(balance).gte(threshold)) {
|
|
522
|
+
return false;
|
|
523
|
+
}
|
|
524
|
+
const currentCommits = await getCurrentCommits();
|
|
525
|
+
return currentCommits < maxCommits;
|
|
526
|
+
}
|
|
527
|
+
if (method === EvaluationMethod.TokenRange) {
|
|
528
|
+
const promises: (() => Promise<string>)[] = [];
|
|
529
|
+
for (let i = minTokenId; i <= maxTokenId; i++) {
|
|
530
|
+
const tokenId = i;
|
|
531
|
+
promises.push(() =>
|
|
532
|
+
erc721.handler.ownerOf({
|
|
533
|
+
contractAddress: tokenAddress,
|
|
534
|
+
tokenId,
|
|
535
|
+
web3Lib: this._web3Lib
|
|
536
|
+
})
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
const currentCommits = await getCurrentCommits();
|
|
540
|
+
for await (const owners of batchTasks(promises, concurrencyLimit)) {
|
|
541
|
+
if (owners.some((owner) => owner === buyerAddress)) {
|
|
542
|
+
return currentCommits < maxCommits;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
throw new Error(
|
|
548
|
+
`Unsupported method=${method} for this tokenType=${tokenType} and gatingType=${gatingType}`
|
|
549
|
+
);
|
|
434
550
|
}
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
551
|
+
if (gatingType === GatingType.PerTokenId) {
|
|
552
|
+
if (method === EvaluationMethod.TokenRange) {
|
|
553
|
+
const canTokenIdBeUsedToCommit = await getCanTokenIdBeUsedToCommit();
|
|
554
|
+
const promises: (() => Promise<string>)[] = [];
|
|
555
|
+
for (let i = minTokenId; i <= maxTokenId; i++) {
|
|
556
|
+
const tokenId = i;
|
|
557
|
+
promises.push(() =>
|
|
558
|
+
erc721.handler.ownerOf({
|
|
559
|
+
contractAddress: tokenAddress,
|
|
560
|
+
tokenId,
|
|
561
|
+
web3Lib: this._web3Lib
|
|
562
|
+
})
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
let tokenId = minTokenId;
|
|
566
|
+
for await (const owners of batchTasks(promises, concurrencyLimit)) {
|
|
567
|
+
if (
|
|
568
|
+
owners.some((owner) => owner === buyerAddress) &&
|
|
569
|
+
canTokenIdBeUsedToCommit(tokenId.toString())
|
|
570
|
+
) {
|
|
571
|
+
return true;
|
|
572
|
+
}
|
|
573
|
+
tokenId++;
|
|
574
|
+
}
|
|
575
|
+
return false;
|
|
576
|
+
}
|
|
577
|
+
throw new Error(
|
|
578
|
+
`Unsupported method=${method} for this tokenType=${tokenType} and gatingType=${gatingType}`
|
|
579
|
+
);
|
|
442
580
|
}
|
|
443
581
|
throw new Error(
|
|
444
|
-
`Unsupported
|
|
582
|
+
`Unsupported gatingType=${gatingType} for this tokenType=${tokenType}`
|
|
445
583
|
);
|
|
446
584
|
}
|
|
447
585
|
if (tokenType === TokenType.MultiToken) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
586
|
+
if (gatingType === GatingType.PerAddress) {
|
|
587
|
+
const promises: (() => Promise<string>)[] = [];
|
|
588
|
+
for (let i = minTokenId; i <= maxTokenId; i++) {
|
|
589
|
+
const tokenId = i;
|
|
590
|
+
promises.push(() =>
|
|
591
|
+
erc1155.handler.balanceOf({
|
|
592
|
+
contractAddress: tokenAddress,
|
|
593
|
+
tokenId,
|
|
594
|
+
owner: buyerAddress,
|
|
595
|
+
web3Lib: this._web3Lib
|
|
596
|
+
})
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
for await (const balances of batchTasks(promises, concurrencyLimit)) {
|
|
600
|
+
if (
|
|
601
|
+
balances.some((balance) => BigNumber.from(balance).gte(threshold))
|
|
602
|
+
) {
|
|
603
|
+
return true;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
if (gatingType === GatingType.PerTokenId) {
|
|
609
|
+
const canTokenIdBeUsedToCommit = await getCanTokenIdBeUsedToCommit();
|
|
610
|
+
const promises: (() => Promise<string>)[] = [];
|
|
611
|
+
for (let i = minTokenId; i <= maxTokenId; i++) {
|
|
612
|
+
const tokenId = i;
|
|
613
|
+
promises.push(() =>
|
|
614
|
+
erc1155.handler.balanceOf({
|
|
615
|
+
contractAddress: tokenAddress,
|
|
616
|
+
tokenId,
|
|
617
|
+
owner: buyerAddress,
|
|
618
|
+
web3Lib: this._web3Lib
|
|
619
|
+
})
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
let tokenId = minTokenId;
|
|
623
|
+
for await (const balances of batchTasks(promises, concurrencyLimit)) {
|
|
624
|
+
if (
|
|
625
|
+
balances.some((balance) =>
|
|
626
|
+
BigNumber.from(balance).gte(threshold)
|
|
627
|
+
) &&
|
|
628
|
+
canTokenIdBeUsedToCommit(tokenId.toString())
|
|
629
|
+
) {
|
|
630
|
+
return true;
|
|
631
|
+
}
|
|
632
|
+
tokenId++;
|
|
633
|
+
}
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
throw new Error(
|
|
637
|
+
`Unsupported gatingType=${gatingType} for this tokenType=${tokenType}`
|
|
638
|
+
);
|
|
455
639
|
}
|
|
456
640
|
throw new Error(`Unsupported tokenType=${tokenType}`);
|
|
457
641
|
}
|
package/src/subgraph.ts
CHANGED
|
@@ -806,6 +806,172 @@ export enum ConditionEntity_OrderBy {
|
|
|
806
806
|
TokenType = "tokenType"
|
|
807
807
|
}
|
|
808
808
|
|
|
809
|
+
export type ConditionalCommitAuthorizedEventLog = {
|
|
810
|
+
__typename?: "ConditionalCommitAuthorizedEventLog";
|
|
811
|
+
buyerAddress: Scalars["String"];
|
|
812
|
+
commitCount: Scalars["BigInt"];
|
|
813
|
+
gating: Scalars["Int"];
|
|
814
|
+
groupId: Scalars["String"];
|
|
815
|
+
hash: Scalars["String"];
|
|
816
|
+
id: Scalars["ID"];
|
|
817
|
+
maxCommits: Scalars["BigInt"];
|
|
818
|
+
offerId: Scalars["String"];
|
|
819
|
+
timestamp: Scalars["BigInt"];
|
|
820
|
+
tokenId: Scalars["BigInt"];
|
|
821
|
+
type: EventType;
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
export type ConditionalCommitAuthorizedEventLog_Filter = {
|
|
825
|
+
/** Filter for the block changed event. */
|
|
826
|
+
_change_block?: InputMaybe<BlockChangedFilter>;
|
|
827
|
+
buyerAddress?: InputMaybe<Scalars["String"]>;
|
|
828
|
+
buyerAddress_contains?: InputMaybe<Scalars["String"]>;
|
|
829
|
+
buyerAddress_contains_nocase?: InputMaybe<Scalars["String"]>;
|
|
830
|
+
buyerAddress_ends_with?: InputMaybe<Scalars["String"]>;
|
|
831
|
+
buyerAddress_ends_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
832
|
+
buyerAddress_gt?: InputMaybe<Scalars["String"]>;
|
|
833
|
+
buyerAddress_gte?: InputMaybe<Scalars["String"]>;
|
|
834
|
+
buyerAddress_in?: InputMaybe<Array<Scalars["String"]>>;
|
|
835
|
+
buyerAddress_lt?: InputMaybe<Scalars["String"]>;
|
|
836
|
+
buyerAddress_lte?: InputMaybe<Scalars["String"]>;
|
|
837
|
+
buyerAddress_not?: InputMaybe<Scalars["String"]>;
|
|
838
|
+
buyerAddress_not_contains?: InputMaybe<Scalars["String"]>;
|
|
839
|
+
buyerAddress_not_contains_nocase?: InputMaybe<Scalars["String"]>;
|
|
840
|
+
buyerAddress_not_ends_with?: InputMaybe<Scalars["String"]>;
|
|
841
|
+
buyerAddress_not_ends_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
842
|
+
buyerAddress_not_in?: InputMaybe<Array<Scalars["String"]>>;
|
|
843
|
+
buyerAddress_not_starts_with?: InputMaybe<Scalars["String"]>;
|
|
844
|
+
buyerAddress_not_starts_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
845
|
+
buyerAddress_starts_with?: InputMaybe<Scalars["String"]>;
|
|
846
|
+
buyerAddress_starts_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
847
|
+
commitCount?: InputMaybe<Scalars["BigInt"]>;
|
|
848
|
+
commitCount_gt?: InputMaybe<Scalars["BigInt"]>;
|
|
849
|
+
commitCount_gte?: InputMaybe<Scalars["BigInt"]>;
|
|
850
|
+
commitCount_in?: InputMaybe<Array<Scalars["BigInt"]>>;
|
|
851
|
+
commitCount_lt?: InputMaybe<Scalars["BigInt"]>;
|
|
852
|
+
commitCount_lte?: InputMaybe<Scalars["BigInt"]>;
|
|
853
|
+
commitCount_not?: InputMaybe<Scalars["BigInt"]>;
|
|
854
|
+
commitCount_not_in?: InputMaybe<Array<Scalars["BigInt"]>>;
|
|
855
|
+
gating?: InputMaybe<Scalars["Int"]>;
|
|
856
|
+
gating_gt?: InputMaybe<Scalars["Int"]>;
|
|
857
|
+
gating_gte?: InputMaybe<Scalars["Int"]>;
|
|
858
|
+
gating_in?: InputMaybe<Array<Scalars["Int"]>>;
|
|
859
|
+
gating_lt?: InputMaybe<Scalars["Int"]>;
|
|
860
|
+
gating_lte?: InputMaybe<Scalars["Int"]>;
|
|
861
|
+
gating_not?: InputMaybe<Scalars["Int"]>;
|
|
862
|
+
gating_not_in?: InputMaybe<Array<Scalars["Int"]>>;
|
|
863
|
+
groupId?: InputMaybe<Scalars["String"]>;
|
|
864
|
+
groupId_contains?: InputMaybe<Scalars["String"]>;
|
|
865
|
+
groupId_contains_nocase?: InputMaybe<Scalars["String"]>;
|
|
866
|
+
groupId_ends_with?: InputMaybe<Scalars["String"]>;
|
|
867
|
+
groupId_ends_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
868
|
+
groupId_gt?: InputMaybe<Scalars["String"]>;
|
|
869
|
+
groupId_gte?: InputMaybe<Scalars["String"]>;
|
|
870
|
+
groupId_in?: InputMaybe<Array<Scalars["String"]>>;
|
|
871
|
+
groupId_lt?: InputMaybe<Scalars["String"]>;
|
|
872
|
+
groupId_lte?: InputMaybe<Scalars["String"]>;
|
|
873
|
+
groupId_not?: InputMaybe<Scalars["String"]>;
|
|
874
|
+
groupId_not_contains?: InputMaybe<Scalars["String"]>;
|
|
875
|
+
groupId_not_contains_nocase?: InputMaybe<Scalars["String"]>;
|
|
876
|
+
groupId_not_ends_with?: InputMaybe<Scalars["String"]>;
|
|
877
|
+
groupId_not_ends_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
878
|
+
groupId_not_in?: InputMaybe<Array<Scalars["String"]>>;
|
|
879
|
+
groupId_not_starts_with?: InputMaybe<Scalars["String"]>;
|
|
880
|
+
groupId_not_starts_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
881
|
+
groupId_starts_with?: InputMaybe<Scalars["String"]>;
|
|
882
|
+
groupId_starts_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
883
|
+
hash?: InputMaybe<Scalars["String"]>;
|
|
884
|
+
hash_contains?: InputMaybe<Scalars["String"]>;
|
|
885
|
+
hash_contains_nocase?: InputMaybe<Scalars["String"]>;
|
|
886
|
+
hash_ends_with?: InputMaybe<Scalars["String"]>;
|
|
887
|
+
hash_ends_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
888
|
+
hash_gt?: InputMaybe<Scalars["String"]>;
|
|
889
|
+
hash_gte?: InputMaybe<Scalars["String"]>;
|
|
890
|
+
hash_in?: InputMaybe<Array<Scalars["String"]>>;
|
|
891
|
+
hash_lt?: InputMaybe<Scalars["String"]>;
|
|
892
|
+
hash_lte?: InputMaybe<Scalars["String"]>;
|
|
893
|
+
hash_not?: InputMaybe<Scalars["String"]>;
|
|
894
|
+
hash_not_contains?: InputMaybe<Scalars["String"]>;
|
|
895
|
+
hash_not_contains_nocase?: InputMaybe<Scalars["String"]>;
|
|
896
|
+
hash_not_ends_with?: InputMaybe<Scalars["String"]>;
|
|
897
|
+
hash_not_ends_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
898
|
+
hash_not_in?: InputMaybe<Array<Scalars["String"]>>;
|
|
899
|
+
hash_not_starts_with?: InputMaybe<Scalars["String"]>;
|
|
900
|
+
hash_not_starts_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
901
|
+
hash_starts_with?: InputMaybe<Scalars["String"]>;
|
|
902
|
+
hash_starts_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
903
|
+
id?: InputMaybe<Scalars["ID"]>;
|
|
904
|
+
id_gt?: InputMaybe<Scalars["ID"]>;
|
|
905
|
+
id_gte?: InputMaybe<Scalars["ID"]>;
|
|
906
|
+
id_in?: InputMaybe<Array<Scalars["ID"]>>;
|
|
907
|
+
id_lt?: InputMaybe<Scalars["ID"]>;
|
|
908
|
+
id_lte?: InputMaybe<Scalars["ID"]>;
|
|
909
|
+
id_not?: InputMaybe<Scalars["ID"]>;
|
|
910
|
+
id_not_in?: InputMaybe<Array<Scalars["ID"]>>;
|
|
911
|
+
maxCommits?: InputMaybe<Scalars["BigInt"]>;
|
|
912
|
+
maxCommits_gt?: InputMaybe<Scalars["BigInt"]>;
|
|
913
|
+
maxCommits_gte?: InputMaybe<Scalars["BigInt"]>;
|
|
914
|
+
maxCommits_in?: InputMaybe<Array<Scalars["BigInt"]>>;
|
|
915
|
+
maxCommits_lt?: InputMaybe<Scalars["BigInt"]>;
|
|
916
|
+
maxCommits_lte?: InputMaybe<Scalars["BigInt"]>;
|
|
917
|
+
maxCommits_not?: InputMaybe<Scalars["BigInt"]>;
|
|
918
|
+
maxCommits_not_in?: InputMaybe<Array<Scalars["BigInt"]>>;
|
|
919
|
+
offerId?: InputMaybe<Scalars["String"]>;
|
|
920
|
+
offerId_contains?: InputMaybe<Scalars["String"]>;
|
|
921
|
+
offerId_contains_nocase?: InputMaybe<Scalars["String"]>;
|
|
922
|
+
offerId_ends_with?: InputMaybe<Scalars["String"]>;
|
|
923
|
+
offerId_ends_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
924
|
+
offerId_gt?: InputMaybe<Scalars["String"]>;
|
|
925
|
+
offerId_gte?: InputMaybe<Scalars["String"]>;
|
|
926
|
+
offerId_in?: InputMaybe<Array<Scalars["String"]>>;
|
|
927
|
+
offerId_lt?: InputMaybe<Scalars["String"]>;
|
|
928
|
+
offerId_lte?: InputMaybe<Scalars["String"]>;
|
|
929
|
+
offerId_not?: InputMaybe<Scalars["String"]>;
|
|
930
|
+
offerId_not_contains?: InputMaybe<Scalars["String"]>;
|
|
931
|
+
offerId_not_contains_nocase?: InputMaybe<Scalars["String"]>;
|
|
932
|
+
offerId_not_ends_with?: InputMaybe<Scalars["String"]>;
|
|
933
|
+
offerId_not_ends_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
934
|
+
offerId_not_in?: InputMaybe<Array<Scalars["String"]>>;
|
|
935
|
+
offerId_not_starts_with?: InputMaybe<Scalars["String"]>;
|
|
936
|
+
offerId_not_starts_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
937
|
+
offerId_starts_with?: InputMaybe<Scalars["String"]>;
|
|
938
|
+
offerId_starts_with_nocase?: InputMaybe<Scalars["String"]>;
|
|
939
|
+
timestamp?: InputMaybe<Scalars["BigInt"]>;
|
|
940
|
+
timestamp_gt?: InputMaybe<Scalars["BigInt"]>;
|
|
941
|
+
timestamp_gte?: InputMaybe<Scalars["BigInt"]>;
|
|
942
|
+
timestamp_in?: InputMaybe<Array<Scalars["BigInt"]>>;
|
|
943
|
+
timestamp_lt?: InputMaybe<Scalars["BigInt"]>;
|
|
944
|
+
timestamp_lte?: InputMaybe<Scalars["BigInt"]>;
|
|
945
|
+
timestamp_not?: InputMaybe<Scalars["BigInt"]>;
|
|
946
|
+
timestamp_not_in?: InputMaybe<Array<Scalars["BigInt"]>>;
|
|
947
|
+
tokenId?: InputMaybe<Scalars["BigInt"]>;
|
|
948
|
+
tokenId_gt?: InputMaybe<Scalars["BigInt"]>;
|
|
949
|
+
tokenId_gte?: InputMaybe<Scalars["BigInt"]>;
|
|
950
|
+
tokenId_in?: InputMaybe<Array<Scalars["BigInt"]>>;
|
|
951
|
+
tokenId_lt?: InputMaybe<Scalars["BigInt"]>;
|
|
952
|
+
tokenId_lte?: InputMaybe<Scalars["BigInt"]>;
|
|
953
|
+
tokenId_not?: InputMaybe<Scalars["BigInt"]>;
|
|
954
|
+
tokenId_not_in?: InputMaybe<Array<Scalars["BigInt"]>>;
|
|
955
|
+
type?: InputMaybe<EventType>;
|
|
956
|
+
type_in?: InputMaybe<Array<EventType>>;
|
|
957
|
+
type_not?: InputMaybe<EventType>;
|
|
958
|
+
type_not_in?: InputMaybe<Array<EventType>>;
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
export enum ConditionalCommitAuthorizedEventLog_OrderBy {
|
|
962
|
+
BuyerAddress = "buyerAddress",
|
|
963
|
+
CommitCount = "commitCount",
|
|
964
|
+
Gating = "gating",
|
|
965
|
+
GroupId = "groupId",
|
|
966
|
+
Hash = "hash",
|
|
967
|
+
Id = "id",
|
|
968
|
+
MaxCommits = "maxCommits",
|
|
969
|
+
OfferId = "offerId",
|
|
970
|
+
Timestamp = "timestamp",
|
|
971
|
+
TokenId = "tokenId",
|
|
972
|
+
Type = "type"
|
|
973
|
+
}
|
|
974
|
+
|
|
809
975
|
export type Dispute = {
|
|
810
976
|
__typename?: "Dispute";
|
|
811
977
|
buyer: Buyer;
|
|
@@ -1598,6 +1764,7 @@ export enum EventType {
|
|
|
1598
1764
|
/** ExchangeHandler events */
|
|
1599
1765
|
BuyerCommitted = "BUYER_COMMITTED",
|
|
1600
1766
|
BuyerCreated = "BUYER_CREATED",
|
|
1767
|
+
ConditionalCommit = "CONDITIONAL_COMMIT",
|
|
1601
1768
|
DisputeDecided = "DISPUTE_DECIDED",
|
|
1602
1769
|
DisputeEscalated = "DISPUTE_ESCALATED",
|
|
1603
1770
|
DisputeExpired = "DISPUTE_EXPIRED",
|
|
@@ -6868,6 +7035,8 @@ export type Query = {
|
|
|
6868
7035
|
buyers: Array<Buyer>;
|
|
6869
7036
|
conditionEntities: Array<ConditionEntity>;
|
|
6870
7037
|
conditionEntity?: Maybe<ConditionEntity>;
|
|
7038
|
+
conditionalCommitAuthorizedEventLog?: Maybe<ConditionalCommitAuthorizedEventLog>;
|
|
7039
|
+
conditionalCommitAuthorizedEventLogs: Array<ConditionalCommitAuthorizedEventLog>;
|
|
6871
7040
|
dispute?: Maybe<Dispute>;
|
|
6872
7041
|
disputeEventLog?: Maybe<DisputeEventLog>;
|
|
6873
7042
|
disputeEventLogs: Array<DisputeEventLog>;
|
|
@@ -7044,6 +7213,22 @@ export type QueryConditionEntityArgs = {
|
|
|
7044
7213
|
subgraphError?: _SubgraphErrorPolicy_;
|
|
7045
7214
|
};
|
|
7046
7215
|
|
|
7216
|
+
export type QueryConditionalCommitAuthorizedEventLogArgs = {
|
|
7217
|
+
block?: InputMaybe<Block_Height>;
|
|
7218
|
+
id: Scalars["ID"];
|
|
7219
|
+
subgraphError?: _SubgraphErrorPolicy_;
|
|
7220
|
+
};
|
|
7221
|
+
|
|
7222
|
+
export type QueryConditionalCommitAuthorizedEventLogsArgs = {
|
|
7223
|
+
block?: InputMaybe<Block_Height>;
|
|
7224
|
+
first?: InputMaybe<Scalars["Int"]>;
|
|
7225
|
+
orderBy?: InputMaybe<ConditionalCommitAuthorizedEventLog_OrderBy>;
|
|
7226
|
+
orderDirection?: InputMaybe<OrderDirection>;
|
|
7227
|
+
skip?: InputMaybe<Scalars["Int"]>;
|
|
7228
|
+
subgraphError?: _SubgraphErrorPolicy_;
|
|
7229
|
+
where?: InputMaybe<ConditionalCommitAuthorizedEventLog_Filter>;
|
|
7230
|
+
};
|
|
7231
|
+
|
|
7047
7232
|
export type QueryDisputeArgs = {
|
|
7048
7233
|
block?: InputMaybe<Block_Height>;
|
|
7049
7234
|
id: Scalars["ID"];
|
|
@@ -8775,6 +8960,8 @@ export type Subscription = {
|
|
|
8775
8960
|
buyers: Array<Buyer>;
|
|
8776
8961
|
conditionEntities: Array<ConditionEntity>;
|
|
8777
8962
|
conditionEntity?: Maybe<ConditionEntity>;
|
|
8963
|
+
conditionalCommitAuthorizedEventLog?: Maybe<ConditionalCommitAuthorizedEventLog>;
|
|
8964
|
+
conditionalCommitAuthorizedEventLogs: Array<ConditionalCommitAuthorizedEventLog>;
|
|
8778
8965
|
dispute?: Maybe<Dispute>;
|
|
8779
8966
|
disputeEventLog?: Maybe<DisputeEventLog>;
|
|
8780
8967
|
disputeEventLogs: Array<DisputeEventLog>;
|
|
@@ -8951,6 +9138,22 @@ export type SubscriptionConditionEntityArgs = {
|
|
|
8951
9138
|
subgraphError?: _SubgraphErrorPolicy_;
|
|
8952
9139
|
};
|
|
8953
9140
|
|
|
9141
|
+
export type SubscriptionConditionalCommitAuthorizedEventLogArgs = {
|
|
9142
|
+
block?: InputMaybe<Block_Height>;
|
|
9143
|
+
id: Scalars["ID"];
|
|
9144
|
+
subgraphError?: _SubgraphErrorPolicy_;
|
|
9145
|
+
};
|
|
9146
|
+
|
|
9147
|
+
export type SubscriptionConditionalCommitAuthorizedEventLogsArgs = {
|
|
9148
|
+
block?: InputMaybe<Block_Height>;
|
|
9149
|
+
first?: InputMaybe<Scalars["Int"]>;
|
|
9150
|
+
orderBy?: InputMaybe<ConditionalCommitAuthorizedEventLog_OrderBy>;
|
|
9151
|
+
orderDirection?: InputMaybe<OrderDirection>;
|
|
9152
|
+
skip?: InputMaybe<Scalars["Int"]>;
|
|
9153
|
+
subgraphError?: _SubgraphErrorPolicy_;
|
|
9154
|
+
where?: InputMaybe<ConditionalCommitAuthorizedEventLog_Filter>;
|
|
9155
|
+
};
|
|
9156
|
+
|
|
8954
9157
|
export type SubscriptionDisputeArgs = {
|
|
8955
9158
|
block?: InputMaybe<Block_Height>;
|
|
8956
9159
|
id: Scalars["ID"];
|
|
@@ -13311,6 +13514,32 @@ export type GetDisputeResolversQueryQuery = {
|
|
|
13311
13514
|
}>;
|
|
13312
13515
|
};
|
|
13313
13516
|
|
|
13517
|
+
export type GetConditionalCommitAuthorizedEventLogsQueryQueryVariables = Exact<{
|
|
13518
|
+
conditionalCommitAuthorizedLogsSkip?: InputMaybe<Scalars["Int"]>;
|
|
13519
|
+
conditionalCommitAuthorizedLogsFirst?: InputMaybe<Scalars["Int"]>;
|
|
13520
|
+
conditionalCommitAuthorizedLogsOrderBy?: InputMaybe<ConditionalCommitAuthorizedEventLog_OrderBy>;
|
|
13521
|
+
conditionalCommitAuthorizedLogsOrderDirection?: InputMaybe<OrderDirection>;
|
|
13522
|
+
conditionalCommitAuthorizedLogsFilter?: InputMaybe<ConditionalCommitAuthorizedEventLog_Filter>;
|
|
13523
|
+
}>;
|
|
13524
|
+
|
|
13525
|
+
export type GetConditionalCommitAuthorizedEventLogsQueryQuery = {
|
|
13526
|
+
__typename?: "Query";
|
|
13527
|
+
conditionalCommitAuthorizedEventLogs: Array<{
|
|
13528
|
+
__typename?: "ConditionalCommitAuthorizedEventLog";
|
|
13529
|
+
id: string;
|
|
13530
|
+
hash: string;
|
|
13531
|
+
groupId: string;
|
|
13532
|
+
gating: number;
|
|
13533
|
+
commitCount: string;
|
|
13534
|
+
buyerAddress: string;
|
|
13535
|
+
maxCommits: string;
|
|
13536
|
+
offerId: string;
|
|
13537
|
+
timestamp: string;
|
|
13538
|
+
tokenId: string;
|
|
13539
|
+
type: EventType;
|
|
13540
|
+
}>;
|
|
13541
|
+
};
|
|
13542
|
+
|
|
13314
13543
|
export type SellerFieldsFragment = {
|
|
13315
13544
|
__typename?: "Seller";
|
|
13316
13545
|
id: string;
|
|
@@ -15251,6 +15480,21 @@ export type BaseDisputeResolutionTermsEntityFieldsFragment = {
|
|
|
15251
15480
|
buyerEscalationDeposit: string;
|
|
15252
15481
|
};
|
|
15253
15482
|
|
|
15483
|
+
export type BaseConditionalCommitAuthorizedEventLogsFieldsFragment = {
|
|
15484
|
+
__typename?: "ConditionalCommitAuthorizedEventLog";
|
|
15485
|
+
id: string;
|
|
15486
|
+
hash: string;
|
|
15487
|
+
groupId: string;
|
|
15488
|
+
gating: number;
|
|
15489
|
+
commitCount: string;
|
|
15490
|
+
buyerAddress: string;
|
|
15491
|
+
maxCommits: string;
|
|
15492
|
+
offerId: string;
|
|
15493
|
+
timestamp: string;
|
|
15494
|
+
tokenId: string;
|
|
15495
|
+
type: EventType;
|
|
15496
|
+
};
|
|
15497
|
+
|
|
15254
15498
|
export type GetDisputeByIdQueryQueryVariables = Exact<{
|
|
15255
15499
|
disputeId: Scalars["ID"];
|
|
15256
15500
|
offersSkip?: InputMaybe<Scalars["Int"]>;
|
|
@@ -35404,6 +35648,21 @@ export const DisputeResolverFieldsFragmentDoc = gql`
|
|
|
35404
35648
|
${BaseOfferFieldsFragmentDoc}
|
|
35405
35649
|
${BaseEventLogFieldsFragmentDoc}
|
|
35406
35650
|
`;
|
|
35651
|
+
export const BaseConditionalCommitAuthorizedEventLogsFieldsFragmentDoc = gql`
|
|
35652
|
+
fragment BaseConditionalCommitAuthorizedEventLogsFields on ConditionalCommitAuthorizedEventLog {
|
|
35653
|
+
id
|
|
35654
|
+
hash
|
|
35655
|
+
groupId
|
|
35656
|
+
gating
|
|
35657
|
+
commitCount
|
|
35658
|
+
buyerAddress
|
|
35659
|
+
maxCommits
|
|
35660
|
+
offerId
|
|
35661
|
+
timestamp
|
|
35662
|
+
tokenId
|
|
35663
|
+
type
|
|
35664
|
+
}
|
|
35665
|
+
`;
|
|
35407
35666
|
export const DisputeFieldsFragmentDoc = gql`
|
|
35408
35667
|
fragment DisputeFields on Dispute {
|
|
35409
35668
|
...BaseDisputeFields
|
|
@@ -35845,6 +36104,26 @@ export const GetDisputeResolversQueryDocument = gql`
|
|
|
35845
36104
|
}
|
|
35846
36105
|
${DisputeResolverFieldsFragmentDoc}
|
|
35847
36106
|
`;
|
|
36107
|
+
export const GetConditionalCommitAuthorizedEventLogsQueryDocument = gql`
|
|
36108
|
+
query getConditionalCommitAuthorizedEventLogsQuery(
|
|
36109
|
+
$conditionalCommitAuthorizedLogsSkip: Int
|
|
36110
|
+
$conditionalCommitAuthorizedLogsFirst: Int
|
|
36111
|
+
$conditionalCommitAuthorizedLogsOrderBy: ConditionalCommitAuthorizedEventLog_orderBy
|
|
36112
|
+
$conditionalCommitAuthorizedLogsOrderDirection: OrderDirection
|
|
36113
|
+
$conditionalCommitAuthorizedLogsFilter: ConditionalCommitAuthorizedEventLog_filter
|
|
36114
|
+
) {
|
|
36115
|
+
conditionalCommitAuthorizedEventLogs(
|
|
36116
|
+
skip: $conditionalCommitAuthorizedLogsSkip
|
|
36117
|
+
first: $conditionalCommitAuthorizedLogsFirst
|
|
36118
|
+
orderBy: $conditionalCommitAuthorizedLogsOrderBy
|
|
36119
|
+
orderDirection: $conditionalCommitAuthorizedLogsOrderDirection
|
|
36120
|
+
where: $conditionalCommitAuthorizedLogsFilter
|
|
36121
|
+
) {
|
|
36122
|
+
...BaseConditionalCommitAuthorizedEventLogsFields
|
|
36123
|
+
}
|
|
36124
|
+
}
|
|
36125
|
+
${BaseConditionalCommitAuthorizedEventLogsFieldsFragmentDoc}
|
|
36126
|
+
`;
|
|
35848
36127
|
export const GetDisputeByIdQueryDocument = gql`
|
|
35849
36128
|
query getDisputeByIdQuery(
|
|
35850
36129
|
$disputeId: ID!
|
|
@@ -36389,6 +36668,21 @@ export function getSdk(
|
|
|
36389
36668
|
"query"
|
|
36390
36669
|
);
|
|
36391
36670
|
},
|
|
36671
|
+
getConditionalCommitAuthorizedEventLogsQuery(
|
|
36672
|
+
variables?: GetConditionalCommitAuthorizedEventLogsQueryQueryVariables,
|
|
36673
|
+
requestHeaders?: Dom.RequestInit["headers"]
|
|
36674
|
+
): Promise<GetConditionalCommitAuthorizedEventLogsQueryQuery> {
|
|
36675
|
+
return withWrapper(
|
|
36676
|
+
(wrappedRequestHeaders) =>
|
|
36677
|
+
client.request<GetConditionalCommitAuthorizedEventLogsQueryQuery>(
|
|
36678
|
+
GetConditionalCommitAuthorizedEventLogsQueryDocument,
|
|
36679
|
+
variables,
|
|
36680
|
+
{ ...requestHeaders, ...wrappedRequestHeaders }
|
|
36681
|
+
),
|
|
36682
|
+
"getConditionalCommitAuthorizedEventLogsQuery",
|
|
36683
|
+
"query"
|
|
36684
|
+
);
|
|
36685
|
+
},
|
|
36392
36686
|
getDisputeByIdQuery(
|
|
36393
36687
|
variables: GetDisputeByIdQueryQueryVariables,
|
|
36394
36688
|
requestHeaders?: Dom.RequestInit["headers"]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export async function* batchTasks<T>(
|
|
2
|
+
tasks: (() => Promise<T>)[],
|
|
3
|
+
limit: number,
|
|
4
|
+
taskCallback = (r: T): T => r
|
|
5
|
+
) {
|
|
6
|
+
// iterate over tasks
|
|
7
|
+
for (let i = 0; i < tasks.length; i = i + limit) {
|
|
8
|
+
// grab the batch of tasks for current iteration
|
|
9
|
+
const batch = tasks.slice(i, i + limit);
|
|
10
|
+
// wait for them to resolve concurrently
|
|
11
|
+
const result = await Promise.all(
|
|
12
|
+
// optionally attach callback to perform any side effects
|
|
13
|
+
batch.map((task) => task().then((r) => taskCallback(r)))
|
|
14
|
+
);
|
|
15
|
+
// yield the batched result and let consumer know
|
|
16
|
+
yield result;
|
|
17
|
+
}
|
|
18
|
+
}
|