@bosonprotocol/core-sdk 1.48.0-alpha.0 → 1.48.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.
Files changed (55) hide show
  1. package/dist/cjs/exchanges/handler.d.ts +6 -0
  2. package/dist/cjs/exchanges/handler.d.ts.map +1 -1
  3. package/dist/cjs/exchanges/handler.js +1 -0
  4. package/dist/cjs/exchanges/handler.js.map +1 -1
  5. package/dist/cjs/meta-tx/handler.d.ts +30 -0
  6. package/dist/cjs/meta-tx/handler.d.ts.map +1 -1
  7. package/dist/cjs/meta-tx/handler.js +40 -0
  8. package/dist/cjs/meta-tx/handler.js.map +1 -1
  9. package/dist/cjs/meta-tx/mixin.d.ts +36 -0
  10. package/dist/cjs/meta-tx/mixin.d.ts.map +1 -1
  11. package/dist/cjs/meta-tx/mixin.js +27 -0
  12. package/dist/cjs/meta-tx/mixin.js.map +1 -1
  13. package/dist/cjs/orchestration/handler.d.ts +59 -1
  14. package/dist/cjs/orchestration/handler.d.ts.map +1 -1
  15. package/dist/cjs/orchestration/handler.js +114 -0
  16. package/dist/cjs/orchestration/handler.js.map +1 -1
  17. package/dist/cjs/orchestration/interface.d.ts +4 -1
  18. package/dist/cjs/orchestration/interface.d.ts.map +1 -1
  19. package/dist/cjs/orchestration/interface.js +23 -5
  20. package/dist/cjs/orchestration/interface.js.map +1 -1
  21. package/dist/cjs/orchestration/mixin.d.ts +49 -1
  22. package/dist/cjs/orchestration/mixin.d.ts.map +1 -1
  23. package/dist/cjs/orchestration/mixin.js +62 -0
  24. package/dist/cjs/orchestration/mixin.js.map +1 -1
  25. package/dist/esm/exchanges/handler.d.ts +6 -0
  26. package/dist/esm/exchanges/handler.d.ts.map +1 -1
  27. package/dist/esm/exchanges/handler.js +1 -1
  28. package/dist/esm/exchanges/handler.js.map +1 -1
  29. package/dist/esm/meta-tx/handler.d.ts +30 -0
  30. package/dist/esm/meta-tx/handler.d.ts.map +1 -1
  31. package/dist/esm/meta-tx/handler.js +47 -1
  32. package/dist/esm/meta-tx/handler.js.map +1 -1
  33. package/dist/esm/meta-tx/mixin.d.ts +36 -0
  34. package/dist/esm/meta-tx/mixin.d.ts.map +1 -1
  35. package/dist/esm/meta-tx/mixin.js +61 -0
  36. package/dist/esm/meta-tx/mixin.js.map +1 -1
  37. package/dist/esm/orchestration/handler.d.ts +59 -1
  38. package/dist/esm/orchestration/handler.d.ts.map +1 -1
  39. package/dist/esm/orchestration/handler.js +126 -2
  40. package/dist/esm/orchestration/handler.js.map +1 -1
  41. package/dist/esm/orchestration/interface.d.ts +4 -1
  42. package/dist/esm/orchestration/interface.d.ts.map +1 -1
  43. package/dist/esm/orchestration/interface.js +15 -0
  44. package/dist/esm/orchestration/interface.js.map +1 -1
  45. package/dist/esm/orchestration/mixin.d.ts +49 -1
  46. package/dist/esm/orchestration/mixin.d.ts.map +1 -1
  47. package/dist/esm/orchestration/mixin.js +74 -0
  48. package/dist/esm/orchestration/mixin.js.map +1 -1
  49. package/package.json +3 -3
  50. package/src/exchanges/handler.ts +1 -1
  51. package/src/meta-tx/handler.ts +133 -1
  52. package/src/meta-tx/mixin.ts +145 -0
  53. package/src/orchestration/handler.ts +267 -1
  54. package/src/orchestration/interface.ts +31 -1
  55. package/src/orchestration/mixin.ts +187 -0
@@ -4,9 +4,14 @@ import {
4
4
  TransactionResponse,
5
5
  MetadataStorage,
6
6
  utils,
7
- ConditionStruct
7
+ ConditionStruct,
8
+ FullOfferArgs,
9
+ OfferCreator
8
10
  } from "@bosonprotocol/common";
9
11
  import {
12
+ encodeCommitToConditionalOfferAndRedeemVoucher,
13
+ encodeCommitToOfferAndRedeemVoucher,
14
+ encodeCreateOfferCommitAndRedeem,
10
15
  encodeCreateOfferWithCondition,
11
16
  encodeCreatePremintedOfferAddToGroup,
12
17
  encodeCreatePremintedOfferWithCondition,
@@ -17,6 +22,7 @@ import {
17
22
  encodeRaiseAndEscalateDispute
18
23
  } from "./interface";
19
24
  import { storeMetadataOnTheGraph } from "../offers/storage";
25
+ import { AddressZero } from "@ethersproject/constants";
20
26
 
21
27
  import { CreateOfferArgs } from "../offers/types";
22
28
  import { CreateSellerArgs } from "../accounts/types";
@@ -24,6 +30,13 @@ import { BigNumberish } from "@ethersproject/bignumber";
24
30
  import { findCollectionSalt } from "../accounts/handler";
25
31
  import { PremintParametersStruct } from "@bosonprotocol/common/src";
26
32
  import { storeMetadataItems } from "../metadata/storeMetadataItems";
33
+ import { getOfferById } from "../offers/subgraph";
34
+ import {
35
+ checkOfferIsCommittable,
36
+ isFullOfferVoided
37
+ } from "../exchanges/handler";
38
+ import { ensureAllowance } from "../erc20/handler";
39
+ import { getDisputeResolverById } from "../accounts/subgraph";
27
40
 
28
41
  // createOfferAndSeller overloads
29
42
  export async function createOfferAndSeller(args: {
@@ -510,6 +523,259 @@ export async function createSellerAndPremintedOfferWithCondition(args: {
510
523
  }
511
524
  }
512
525
 
526
+ // commitToOfferAndRedeemVoucher overloads
527
+ export async function commitToOfferAndRedeemVoucher(args: {
528
+ offerId: BigNumberish;
529
+ contractAddress: string;
530
+ subgraphUrl: string;
531
+ web3Lib: Web3LibAdapter;
532
+ metadataStorage?: MetadataStorage;
533
+ theGraphStorage?: MetadataStorage;
534
+ returnTxInfo: true;
535
+ }): Promise<TransactionRequest>;
536
+
537
+ export async function commitToOfferAndRedeemVoucher(args: {
538
+ offerId: BigNumberish;
539
+ contractAddress: string;
540
+ subgraphUrl: string;
541
+ web3Lib: Web3LibAdapter;
542
+ metadataStorage?: MetadataStorage;
543
+ theGraphStorage?: MetadataStorage;
544
+ returnTxInfo?: false | undefined;
545
+ }): Promise<TransactionResponse>;
546
+
547
+ export async function commitToOfferAndRedeemVoucher(args: {
548
+ offerId: BigNumberish;
549
+ contractAddress: string;
550
+ subgraphUrl: string;
551
+ web3Lib: Web3LibAdapter;
552
+ metadataStorage?: MetadataStorage;
553
+ theGraphStorage?: MetadataStorage;
554
+ returnTxInfo?: boolean;
555
+ }): Promise<TransactionRequest | TransactionResponse> {
556
+ const offer = await getOfferById(args.subgraphUrl, args.offerId);
557
+
558
+ await checkOfferIsCommittable(args.offerId, offer);
559
+
560
+ if (offer.creator !== OfferCreator.Seller) {
561
+ throw new Error(
562
+ `Offer with id ${args.offerId.toString()} is not seller initiated`
563
+ );
564
+ }
565
+
566
+ if (offer.condition) {
567
+ // keep compatibility with previous version
568
+ if (args.returnTxInfo) {
569
+ return commitToConditionalOfferAndRedeemVoucher({
570
+ ...args,
571
+ returnTxInfo: true,
572
+ tokenId: offer.condition.minTokenId
573
+ });
574
+ }
575
+ return commitToConditionalOfferAndRedeemVoucher({
576
+ ...args,
577
+ returnTxInfo: false,
578
+ tokenId: offer.condition.minTokenId
579
+ });
580
+ }
581
+
582
+ if (offer.exchangeToken.address !== AddressZero) {
583
+ const owner = await args.web3Lib.getSignerAddress();
584
+ await ensureAllowance({
585
+ owner,
586
+ spender: args.contractAddress,
587
+ contractAddress: offer.exchangeToken.address,
588
+ value: offer.price,
589
+ web3Lib: args.web3Lib
590
+ });
591
+ }
592
+
593
+ const transactionRequest = {
594
+ to: args.contractAddress,
595
+ data: encodeCommitToOfferAndRedeemVoucher(args.offerId),
596
+ value: offer.exchangeToken.address === AddressZero ? offer.price : "0"
597
+ } satisfies TransactionRequest;
598
+
599
+ if (args.returnTxInfo) {
600
+ return transactionRequest;
601
+ } else {
602
+ return args.web3Lib.sendTransaction(transactionRequest);
603
+ }
604
+ }
605
+
606
+ // commitToConditionalOfferAndRedeemVoucher overloads
607
+ export async function commitToConditionalOfferAndRedeemVoucher(args: {
608
+ offerId: BigNumberish;
609
+ tokenId: BigNumberish;
610
+ contractAddress: string;
611
+ subgraphUrl: string;
612
+ web3Lib: Web3LibAdapter;
613
+ metadataStorage?: MetadataStorage;
614
+ theGraphStorage?: MetadataStorage;
615
+ returnTxInfo: true;
616
+ }): Promise<TransactionRequest>;
617
+
618
+ export async function commitToConditionalOfferAndRedeemVoucher(args: {
619
+ offerId: BigNumberish;
620
+ tokenId: BigNumberish;
621
+ contractAddress: string;
622
+ subgraphUrl: string;
623
+ web3Lib: Web3LibAdapter;
624
+ metadataStorage?: MetadataStorage;
625
+ theGraphStorage?: MetadataStorage;
626
+ returnTxInfo?: false | undefined;
627
+ }): Promise<TransactionResponse>;
628
+
629
+ export async function commitToConditionalOfferAndRedeemVoucher(args: {
630
+ offerId: BigNumberish;
631
+ tokenId: BigNumberish;
632
+ contractAddress: string;
633
+ subgraphUrl: string;
634
+ web3Lib: Web3LibAdapter;
635
+ metadataStorage?: MetadataStorage;
636
+ theGraphStorage?: MetadataStorage;
637
+ returnTxInfo?: boolean;
638
+ }): Promise<TransactionRequest | TransactionResponse> {
639
+ const offer = await getOfferById(args.subgraphUrl, args.offerId);
640
+
641
+ await checkOfferIsCommittable(args.offerId, offer);
642
+
643
+ if (offer.exchangeToken.address !== AddressZero) {
644
+ const owner = await args.web3Lib.getSignerAddress();
645
+ await ensureAllowance({
646
+ owner,
647
+ spender: args.contractAddress,
648
+ contractAddress: offer.exchangeToken.address,
649
+ value: offer.price,
650
+ web3Lib: args.web3Lib
651
+ });
652
+ }
653
+
654
+ const transactionRequest = {
655
+ to: args.contractAddress,
656
+ data: encodeCommitToConditionalOfferAndRedeemVoucher(
657
+ args.offerId,
658
+ args.tokenId
659
+ ),
660
+ value: offer.exchangeToken.address === AddressZero ? offer.price : "0"
661
+ } satisfies TransactionRequest;
662
+
663
+ if (args.returnTxInfo) {
664
+ return transactionRequest;
665
+ } else {
666
+ return args.web3Lib.sendTransaction(transactionRequest);
667
+ }
668
+ }
669
+
670
+ // createOfferCommitAndRedeem overloads
671
+ export async function createOfferCommitAndRedeem(args: {
672
+ createOfferAndCommitArgs: FullOfferArgs;
673
+ contractAddress: string;
674
+ subgraphUrl: string;
675
+ web3Lib: Web3LibAdapter;
676
+ txRequest?: TransactionRequest;
677
+ metadataStorage?: MetadataStorage;
678
+ theGraphStorage?: MetadataStorage;
679
+ returnTxInfo: true;
680
+ }): Promise<TransactionRequest>;
681
+
682
+ export async function createOfferCommitAndRedeem(args: {
683
+ createOfferAndCommitArgs: FullOfferArgs;
684
+ contractAddress: string;
685
+ subgraphUrl: string;
686
+ web3Lib: Web3LibAdapter;
687
+ txRequest?: TransactionRequest;
688
+ metadataStorage?: MetadataStorage;
689
+ theGraphStorage?: MetadataStorage;
690
+ returnTxInfo?: false | undefined;
691
+ }): Promise<TransactionResponse>;
692
+
693
+ export async function createOfferCommitAndRedeem(args: {
694
+ createOfferAndCommitArgs: FullOfferArgs;
695
+ contractAddress: string;
696
+ subgraphUrl: string;
697
+ web3Lib: Web3LibAdapter;
698
+ txRequest?: TransactionRequest;
699
+ metadataStorage?: MetadataStorage;
700
+ theGraphStorage?: MetadataStorage;
701
+ returnTxInfo?: boolean;
702
+ }): Promise<TransactionRequest | TransactionResponse> {
703
+ utils.validation.createOfferAndCommitArgsSchema.validateSync(
704
+ args.createOfferAndCommitArgs,
705
+ {
706
+ abortEarly: false
707
+ }
708
+ );
709
+
710
+ const { disputeResolverId, exchangeToken, price, sellerDeposit, creator } =
711
+ args.createOfferAndCommitArgs;
712
+ const disputeResolver = await getDisputeResolverById(
713
+ args.subgraphUrl,
714
+ disputeResolverId
715
+ );
716
+ if (!disputeResolver) {
717
+ throw new Error(
718
+ `Dispute resolver with id "${disputeResolverId}" does not exist`
719
+ );
720
+ }
721
+ if (
722
+ !disputeResolver.fees.some(
723
+ (fee) => fee.token.address.toLowerCase() === exchangeToken.toLowerCase()
724
+ )
725
+ ) {
726
+ throw new Error(
727
+ `Dispute resolver with id "${disputeResolverId}" does not support exchange token "${exchangeToken}"`
728
+ );
729
+ }
730
+
731
+ if (
732
+ await isFullOfferVoided({
733
+ ...args,
734
+ fullOfferArgsUnsigned: args.createOfferAndCommitArgs
735
+ })
736
+ ) {
737
+ throw new Error(`The offer has been voided`);
738
+ }
739
+
740
+ await storeMetadataOnTheGraph({
741
+ metadataUriOrHash: args.createOfferAndCommitArgs.metadataUri,
742
+ metadataStorage: args.metadataStorage,
743
+ theGraphStorage: args.theGraphStorage
744
+ });
745
+
746
+ await storeMetadataItems({
747
+ ...args,
748
+ createOffersArgs: [args.createOfferAndCommitArgs]
749
+ });
750
+
751
+ const committerPayment =
752
+ creator === OfferCreator.Buyer ? sellerDeposit : price;
753
+
754
+ if (exchangeToken !== AddressZero) {
755
+ const owner = await args.web3Lib.getSignerAddress();
756
+ await ensureAllowance({
757
+ owner,
758
+ spender: args.contractAddress,
759
+ contractAddress: exchangeToken,
760
+ value: committerPayment,
761
+ web3Lib: args.web3Lib
762
+ });
763
+ }
764
+
765
+ const transactionRequest = {
766
+ ...args.txRequest,
767
+ to: args.contractAddress,
768
+ data: encodeCreateOfferCommitAndRedeem(args.createOfferAndCommitArgs),
769
+ value: exchangeToken === AddressZero ? committerPayment : "0"
770
+ } satisfies TransactionRequest;
771
+
772
+ if (args.returnTxInfo) {
773
+ return transactionRequest;
774
+ } else {
775
+ return args.web3Lib.sendTransaction(transactionRequest);
776
+ }
777
+ }
778
+
513
779
  // raiseAndEscalateDispute overloads
514
780
  export async function raiseAndEscalateDispute(args: {
515
781
  exchangeId: BigNumberish;
@@ -1,7 +1,8 @@
1
- import { abis, ConditionStruct } from "@bosonprotocol/common";
1
+ import { abis, ConditionStruct, FullOfferArgs } from "@bosonprotocol/common";
2
2
  import { Interface } from "@ethersproject/abi";
3
3
  import { createSellerArgsToStruct } from "../accounts/interface";
4
4
  import { createOfferArgsToStructs } from "../offers/interface";
5
+ import { fullOfferArgsToStruct } from "../exchanges/interface";
5
6
 
6
7
  import { CreateSellerArgs } from "../accounts/types";
7
8
  import { CreateOfferArgs } from "../offers/types";
@@ -181,3 +182,32 @@ export function encodeRaiseAndEscalateDispute(exchangeId: BigNumberish) {
181
182
  [exchangeId]
182
183
  );
183
184
  }
185
+
186
+ export function encodeCommitToOfferAndRedeemVoucher(offerId: BigNumberish) {
187
+ return bosonOrchestrationHandlerIface.encodeFunctionData(
188
+ "commitToOfferAndRedeemVoucher",
189
+ [offerId]
190
+ );
191
+ }
192
+
193
+ export function encodeCommitToConditionalOfferAndRedeemVoucher(
194
+ offerId: BigNumberish,
195
+ tokenId: BigNumberish
196
+ ) {
197
+ return bosonOrchestrationHandlerIface.encodeFunctionData(
198
+ "commitToConditionalOfferAndRedeemVoucher",
199
+ [offerId, tokenId]
200
+ );
201
+ }
202
+
203
+ export function encodeCreateOfferCommitAndRedeem(args: FullOfferArgs) {
204
+ return bosonOrchestrationHandlerIface.encodeFunctionData(
205
+ "createOfferCommitAndRedeem",
206
+ [
207
+ fullOfferArgsToStruct(args),
208
+ args.offerCreator,
209
+ args.signature,
210
+ args.conditionalTokenId || "0"
211
+ ]
212
+ );
213
+ }
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  ConditionStruct,
3
+ FullOfferArgs,
3
4
  TransactionResponse,
4
5
  TransactionRequest,
5
6
  Web3LibAdapter
@@ -415,6 +416,192 @@ export class OrchestrationMixin<
415
416
  }
416
417
  }
417
418
 
419
+ /**
420
+ * Commits to a seller-initiated offer and immediately redeems the voucher in
421
+ * a single transaction by calling the `OrchestrationHandler`.
422
+ * @param offerId - ID of offer to commit to.
423
+ * @param overrides - Optional overrides.
424
+ * @returns Transaction response.
425
+ */
426
+ // Overload: returnTxInfo is true → returns TransactionRequest
427
+ public async commitToOfferAndRedeemVoucher(
428
+ offerId: BigNumberish,
429
+ overrides: Partial<{
430
+ contractAddress: string;
431
+ returnTxInfo: true;
432
+ }>
433
+ ): Promise<TransactionRequest>;
434
+
435
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
436
+ public async commitToOfferAndRedeemVoucher(
437
+ offerId: BigNumberish,
438
+ overrides?: Partial<{
439
+ contractAddress: string;
440
+ returnTxInfo?: false;
441
+ }>
442
+ ): Promise<TransactionResponse>;
443
+
444
+ // Implementation
445
+ public async commitToOfferAndRedeemVoucher(
446
+ offerId: BigNumberish,
447
+ overrides: Partial<{
448
+ contractAddress: string;
449
+ returnTxInfo?: boolean;
450
+ }> = {}
451
+ ): Promise<TransactionResponse | TransactionRequest> {
452
+ const { returnTxInfo } = overrides;
453
+
454
+ const commitArgs = {
455
+ offerId,
456
+ web3Lib: this._web3Lib,
457
+ subgraphUrl: this._subgraphUrl,
458
+ metadataStorage: this._metadataStorage,
459
+ theGraphStorage: this._theGraphStorage,
460
+ contractAddress: overrides.contractAddress || this._protocolDiamond
461
+ } as const satisfies Parameters<
462
+ typeof handler.commitToOfferAndRedeemVoucher
463
+ >[0];
464
+
465
+ if (returnTxInfo === true) {
466
+ return handler.commitToOfferAndRedeemVoucher({
467
+ ...commitArgs,
468
+ returnTxInfo: true
469
+ });
470
+ } else {
471
+ return handler.commitToOfferAndRedeemVoucher({
472
+ ...commitArgs,
473
+ returnTxInfo: false
474
+ });
475
+ }
476
+ }
477
+
478
+ /**
479
+ * Commits to a conditional offer and immediately redeems the voucher in a
480
+ * single transaction by calling the `OrchestrationHandler`.
481
+ * @param offerId - ID of offer to commit to.
482
+ * @param tokenId - ID of the token to use for the conditional commit.
483
+ * @param overrides - Optional overrides.
484
+ * @returns Transaction response.
485
+ */
486
+ // Overload: returnTxInfo is true → returns TransactionRequest
487
+ public async commitToConditionalOfferAndRedeemVoucher(
488
+ offerId: BigNumberish,
489
+ tokenId: BigNumberish,
490
+ overrides: Partial<{
491
+ contractAddress: string;
492
+ returnTxInfo: true;
493
+ }>
494
+ ): Promise<TransactionRequest>;
495
+
496
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
497
+ public async commitToConditionalOfferAndRedeemVoucher(
498
+ offerId: BigNumberish,
499
+ tokenId: BigNumberish,
500
+ overrides?: Partial<{
501
+ contractAddress: string;
502
+ returnTxInfo?: false;
503
+ }>
504
+ ): Promise<TransactionResponse>;
505
+
506
+ // Implementation
507
+ public async commitToConditionalOfferAndRedeemVoucher(
508
+ offerId: BigNumberish,
509
+ tokenId: BigNumberish,
510
+ overrides: Partial<{
511
+ contractAddress: string;
512
+ returnTxInfo?: boolean;
513
+ }> = {}
514
+ ): Promise<TransactionResponse | TransactionRequest> {
515
+ const { returnTxInfo } = overrides;
516
+
517
+ const commitArgs = {
518
+ offerId,
519
+ tokenId,
520
+ web3Lib: this._web3Lib,
521
+ subgraphUrl: this._subgraphUrl,
522
+ metadataStorage: this._metadataStorage,
523
+ theGraphStorage: this._theGraphStorage,
524
+ contractAddress: overrides.contractAddress || this._protocolDiamond
525
+ } as const satisfies Parameters<
526
+ typeof handler.commitToConditionalOfferAndRedeemVoucher
527
+ >[0];
528
+
529
+ if (returnTxInfo === true) {
530
+ return handler.commitToConditionalOfferAndRedeemVoucher({
531
+ ...commitArgs,
532
+ returnTxInfo: true
533
+ });
534
+ } else {
535
+ return handler.commitToConditionalOfferAndRedeemVoucher({
536
+ ...commitArgs,
537
+ returnTxInfo: false
538
+ });
539
+ }
540
+ }
541
+
542
+ /**
543
+ * Creates an offer, commits to it and immediately redeems the voucher in a
544
+ * single transaction by calling the `OrchestrationHandler`.
545
+ * @param createOfferAndCommitArgs - Offer and commit arguments.
546
+ * @param overrides - Optional overrides.
547
+ * @returns Transaction response.
548
+ */
549
+ // Overload: returnTxInfo is true → returns TransactionRequest
550
+ public async createOfferCommitAndRedeem(
551
+ createOfferAndCommitArgs: FullOfferArgs,
552
+ overrides: Partial<{
553
+ contractAddress: string;
554
+ txRequest: TransactionRequest;
555
+ returnTxInfo: true;
556
+ }>
557
+ ): Promise<TransactionRequest>;
558
+
559
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
560
+ public async createOfferCommitAndRedeem(
561
+ createOfferAndCommitArgs: FullOfferArgs,
562
+ overrides?: Partial<{
563
+ contractAddress: string;
564
+ txRequest: TransactionRequest;
565
+ returnTxInfo?: false;
566
+ }>
567
+ ): Promise<TransactionResponse>;
568
+
569
+ // Implementation
570
+ public async createOfferCommitAndRedeem(
571
+ createOfferAndCommitArgs: FullOfferArgs,
572
+ overrides: Partial<{
573
+ contractAddress: string;
574
+ txRequest: TransactionRequest;
575
+ returnTxInfo?: boolean;
576
+ }> = {}
577
+ ): Promise<TransactionResponse | TransactionRequest> {
578
+ const { returnTxInfo } = overrides;
579
+
580
+ const offerArgs = {
581
+ createOfferAndCommitArgs,
582
+ web3Lib: this._web3Lib,
583
+ subgraphUrl: this._subgraphUrl,
584
+ metadataStorage: this._metadataStorage,
585
+ theGraphStorage: this._theGraphStorage,
586
+ contractAddress: overrides.contractAddress || this._protocolDiamond,
587
+ txRequest: overrides.txRequest
588
+ } as const satisfies Parameters<
589
+ typeof handler.createOfferCommitAndRedeem
590
+ >[0];
591
+
592
+ if (returnTxInfo === true) {
593
+ return handler.createOfferCommitAndRedeem({
594
+ ...offerArgs,
595
+ returnTxInfo: true
596
+ });
597
+ } else {
598
+ return handler.createOfferCommitAndRedeem({
599
+ ...offerArgs,
600
+ returnTxInfo: false
601
+ });
602
+ }
603
+ }
604
+
418
605
  /**
419
606
  * Raises a dispute and immediately escalates it
420
607
  * @param exchangeId - Exchange ID