@bosonprotocol/core-sdk 1.44.0-alpha.9 → 1.44.1-alpha.0

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 (121) hide show
  1. package/dist/cjs/accounts/mixin.d.ts +1 -0
  2. package/dist/cjs/accounts/mixin.d.ts.map +1 -1
  3. package/dist/cjs/accounts/mixin.js +4 -2
  4. package/dist/cjs/accounts/mixin.js.map +1 -1
  5. package/dist/cjs/disputes/handler.d.ts +14 -0
  6. package/dist/cjs/disputes/handler.d.ts.map +1 -1
  7. package/dist/cjs/disputes/handler.js.map +1 -1
  8. package/dist/cjs/disputes/interface.d.ts +4 -0
  9. package/dist/cjs/disputes/interface.d.ts.map +1 -1
  10. package/dist/cjs/disputes/interface.js +13 -3
  11. package/dist/cjs/disputes/interface.js.map +1 -1
  12. package/dist/cjs/disputes/mixin.d.ts +10 -0
  13. package/dist/cjs/disputes/mixin.d.ts.map +1 -1
  14. package/dist/cjs/disputes/mixin.js +17 -9
  15. package/dist/cjs/disputes/mixin.js.map +1 -1
  16. package/dist/cjs/exchanges/handler.d.ts.map +1 -1
  17. package/dist/cjs/exchanges/handler.js +16 -15
  18. package/dist/cjs/exchanges/handler.js.map +1 -1
  19. package/dist/cjs/exchanges/interface.d.ts +1 -0
  20. package/dist/cjs/exchanges/interface.d.ts.map +1 -1
  21. package/dist/cjs/exchanges/interface.js +4 -3
  22. package/dist/cjs/exchanges/interface.js.map +1 -1
  23. package/dist/cjs/funds/handler.d.ts +2 -2
  24. package/dist/cjs/funds/handler.js +1 -1
  25. package/dist/cjs/funds/interface.d.ts +1 -1
  26. package/dist/cjs/funds/interface.js +2 -2
  27. package/dist/cjs/funds/mixin.d.ts +4 -4
  28. package/dist/cjs/funds/mixin.js +3 -3
  29. package/dist/cjs/groups/interface.js +1 -1
  30. package/dist/cjs/groups/interface.js.map +1 -1
  31. package/dist/cjs/meta-tx/handler.d.ts +2 -2
  32. package/dist/cjs/meta-tx/handler.d.ts.map +1 -1
  33. package/dist/cjs/meta-tx/handler.js +18 -23
  34. package/dist/cjs/meta-tx/handler.js.map +1 -1
  35. package/dist/cjs/meta-tx/mixin.d.ts +3 -1
  36. package/dist/cjs/meta-tx/mixin.d.ts.map +1 -1
  37. package/dist/cjs/meta-tx/mixin.js +1 -1
  38. package/dist/cjs/meta-tx/mixin.js.map +1 -1
  39. package/dist/cjs/native-meta-tx/tokenSpecifics.d.ts.map +1 -1
  40. package/dist/cjs/offers/interface.d.ts +3 -2
  41. package/dist/cjs/offers/interface.d.ts.map +1 -1
  42. package/dist/cjs/offers/interface.js +16 -7
  43. package/dist/cjs/offers/interface.js.map +1 -1
  44. package/dist/cjs/orchestration/mixin.d.ts +43 -8
  45. package/dist/cjs/orchestration/mixin.d.ts.map +1 -1
  46. package/dist/cjs/orchestration/mixin.js +84 -85
  47. package/dist/cjs/orchestration/mixin.js.map +1 -1
  48. package/dist/cjs/utils/promises.d.ts.map +1 -1
  49. package/dist/cjs/utils/signature.d.ts +5 -0
  50. package/dist/cjs/utils/signature.d.ts.map +1 -1
  51. package/dist/cjs/utils/signature.js +13 -0
  52. package/dist/cjs/utils/signature.js.map +1 -1
  53. package/dist/esm/accounts/mixin.d.ts +1 -0
  54. package/dist/esm/accounts/mixin.d.ts.map +1 -1
  55. package/dist/esm/accounts/mixin.js +3 -1
  56. package/dist/esm/accounts/mixin.js.map +1 -1
  57. package/dist/esm/disputes/handler.d.ts +14 -0
  58. package/dist/esm/disputes/handler.d.ts.map +1 -1
  59. package/dist/esm/disputes/handler.js.map +1 -1
  60. package/dist/esm/disputes/interface.d.ts +4 -0
  61. package/dist/esm/disputes/interface.d.ts.map +1 -1
  62. package/dist/esm/disputes/interface.js +13 -3
  63. package/dist/esm/disputes/interface.js.map +1 -1
  64. package/dist/esm/disputes/mixin.d.ts +10 -0
  65. package/dist/esm/disputes/mixin.d.ts.map +1 -1
  66. package/dist/esm/disputes/mixin.js +17 -9
  67. package/dist/esm/disputes/mixin.js.map +1 -1
  68. package/dist/esm/exchanges/handler.d.ts.map +1 -1
  69. package/dist/esm/exchanges/handler.js +6 -7
  70. package/dist/esm/exchanges/handler.js.map +1 -1
  71. package/dist/esm/exchanges/interface.d.ts +1 -0
  72. package/dist/esm/exchanges/interface.d.ts.map +1 -1
  73. package/dist/esm/exchanges/interface.js +3 -2
  74. package/dist/esm/exchanges/interface.js.map +1 -1
  75. package/dist/esm/funds/handler.d.ts +2 -2
  76. package/dist/esm/funds/handler.js +1 -1
  77. package/dist/esm/funds/interface.d.ts +1 -1
  78. package/dist/esm/funds/interface.js +2 -2
  79. package/dist/esm/funds/mixin.d.ts +4 -4
  80. package/dist/esm/funds/mixin.js +2 -2
  81. package/dist/esm/groups/interface.js +1 -1
  82. package/dist/esm/groups/interface.js.map +1 -1
  83. package/dist/esm/meta-tx/handler.d.ts +2 -2
  84. package/dist/esm/meta-tx/handler.d.ts.map +1 -1
  85. package/dist/esm/meta-tx/handler.js +20 -25
  86. package/dist/esm/meta-tx/handler.js.map +1 -1
  87. package/dist/esm/meta-tx/mixin.d.ts +3 -1
  88. package/dist/esm/meta-tx/mixin.d.ts.map +1 -1
  89. package/dist/esm/meta-tx/mixin.js +1 -1
  90. package/dist/esm/meta-tx/mixin.js.map +1 -1
  91. package/dist/esm/native-meta-tx/tokenSpecifics.d.ts.map +1 -1
  92. package/dist/esm/offers/interface.d.ts +3 -2
  93. package/dist/esm/offers/interface.d.ts.map +1 -1
  94. package/dist/esm/offers/interface.js +17 -7
  95. package/dist/esm/offers/interface.js.map +1 -1
  96. package/dist/esm/orchestration/mixin.d.ts +43 -8
  97. package/dist/esm/orchestration/mixin.d.ts.map +1 -1
  98. package/dist/esm/orchestration/mixin.js +126 -85
  99. package/dist/esm/orchestration/mixin.js.map +1 -1
  100. package/dist/esm/utils/promises.d.ts.map +1 -1
  101. package/dist/esm/utils/signature.d.ts +5 -0
  102. package/dist/esm/utils/signature.d.ts.map +1 -1
  103. package/dist/esm/utils/signature.js +12 -0
  104. package/dist/esm/utils/signature.js.map +1 -1
  105. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  106. package/package.json +3 -3
  107. package/src/accounts/mixin.ts +5 -1
  108. package/src/disputes/handler.ts +63 -30
  109. package/src/disputes/interface.ts +27 -10
  110. package/src/disputes/mixin.ts +69 -33
  111. package/src/exchanges/handler.ts +18 -8
  112. package/src/exchanges/interface.ts +6 -2
  113. package/src/funds/handler.ts +4 -4
  114. package/src/funds/interface.ts +2 -2
  115. package/src/funds/mixin.ts +6 -6
  116. package/src/groups/interface.ts +1 -1
  117. package/src/meta-tx/handler.ts +35 -31
  118. package/src/meta-tx/mixin.ts +5 -2
  119. package/src/offers/interface.ts +36 -11
  120. package/src/orchestration/mixin.ts +315 -42
  121. package/src/utils/signature.ts +24 -0
@@ -5,12 +5,15 @@ import {
5
5
  OfferDatesStruct,
6
6
  OfferDurationsStruct,
7
7
  PriceType,
8
- RoyaltyInfo
8
+ RoyaltyInfo,
9
+ OfferCreator,
10
+ DRParametersStruct
9
11
  } from "@bosonprotocol/common";
10
12
  import { Interface } from "@ethersproject/abi";
11
13
  import { getAddress } from "@ethersproject/address";
12
14
  import { BigNumberish } from "@ethersproject/bignumber";
13
15
  import { CreateOfferArgs } from "./types";
16
+ import { AddressZero } from "@ethersproject/constants";
14
17
 
15
18
  export const bosonOfferHandlerIface = new Interface(abis.IBosonOfferHandlerABI);
16
19
 
@@ -46,7 +49,7 @@ export function encodeCreateOfferBatch(argsBatch: CreateOfferArgs[]) {
46
49
  Partial<OfferStruct>,
47
50
  Partial<OfferDatesStruct>,
48
51
  Partial<OfferDurationsStruct>,
49
- BigNumberish,
52
+ Partial<DRParametersStruct>,
50
53
  BigNumberish,
51
54
  BigNumberish
52
55
  ][] = argsBatch.map((args) => createOfferArgsToStructs(args));
@@ -54,23 +57,32 @@ export function encodeCreateOfferBatch(argsBatch: CreateOfferArgs[]) {
54
57
  offers,
55
58
  offerDates,
56
59
  offerDurations,
57
- disputeResolverIds,
60
+ drParameters,
58
61
  agentIds,
59
62
  feeLimits
60
63
  ]: [
61
64
  Partial<OfferStruct>[],
62
65
  Partial<OfferDatesStruct>[],
63
66
  Partial<OfferDurationsStruct>[],
64
- BigNumberish[],
67
+ Partial<DRParametersStruct>[],
65
68
  BigNumberish[],
66
69
  BigNumberish[]
67
- ] = argsTuples.reduce(
70
+ ] = argsTuples.reduce<
71
+ [
72
+ Partial<OfferStruct>[],
73
+ Partial<OfferDatesStruct>[],
74
+ Partial<OfferDurationsStruct>[],
75
+ Partial<DRParametersStruct>[],
76
+ BigNumberish[],
77
+ BigNumberish[]
78
+ ]
79
+ >(
68
80
  (acc, tuple) => {
69
81
  const [
70
82
  offer,
71
83
  offerDates,
72
84
  offerDurations,
73
- disputeResolverId,
85
+ drParameters,
74
86
  agentId,
75
87
  feeLimit
76
88
  ] = tuple;
@@ -78,7 +90,7 @@ export function encodeCreateOfferBatch(argsBatch: CreateOfferArgs[]) {
78
90
  [...acc[0], offer],
79
91
  [...acc[1], offerDates],
80
92
  [...acc[2], offerDurations],
81
- [...acc[3], disputeResolverId],
93
+ [...acc[3], drParameters],
82
94
  [...acc[4], agentId],
83
95
  [...acc[5], feeLimit]
84
96
  ];
@@ -90,7 +102,7 @@ export function encodeCreateOfferBatch(argsBatch: CreateOfferArgs[]) {
90
102
  offers,
91
103
  offerDates,
92
104
  offerDurations,
93
- disputeResolverIds,
105
+ drParameters,
94
106
  agentIds,
95
107
  feeLimits
96
108
  ]);
@@ -102,7 +114,7 @@ export function createOfferArgsToStructs(
102
114
  Partial<OfferStruct>,
103
115
  Partial<OfferDatesStruct>,
104
116
  Partial<OfferDurationsStruct>,
105
- BigNumberish,
117
+ Partial<DRParametersStruct>,
106
118
  BigNumberish,
107
119
  BigNumberish
108
120
  ] {
@@ -111,7 +123,7 @@ export function createOfferArgsToStructs(
111
123
  argsToOfferStruct(args),
112
124
  argsToOfferDatesStruct(args),
113
125
  argsToOfferDurationsStruct(args),
114
- args.disputeResolverId,
126
+ argsToDRParametersStruct(args),
115
127
  args.agentId,
116
128
  feeLimit
117
129
  ];
@@ -122,6 +134,8 @@ export function argsToOfferStruct(args: CreateOfferArgs): Partial<OfferStruct> {
122
134
 
123
135
  const priceType =
124
136
  args.priceType !== undefined ? args.priceType : PriceType.Static;
137
+ const creator =
138
+ args.creator !== undefined ? args.creator : OfferCreator.Seller;
125
139
  const royaltyInfo =
126
140
  args.royaltyInfo !== undefined
127
141
  ? args.royaltyInfo
@@ -135,6 +149,7 @@ export function argsToOfferStruct(args: CreateOfferArgs): Partial<OfferStruct> {
135
149
  return {
136
150
  id: "0",
137
151
  sellerId: "0",
152
+ buyerId: "0",
138
153
  ...restArgs,
139
154
  exchangeToken: getAddress(exchangeToken),
140
155
  priceType,
@@ -145,7 +160,8 @@ export function argsToOfferStruct(args: CreateOfferArgs): Partial<OfferStruct> {
145
160
  getAddress(recipient)
146
161
  )
147
162
  };
148
- })
163
+ }),
164
+ creator
149
165
  };
150
166
  }
151
167
 
@@ -187,6 +203,15 @@ export function argsToOfferDurationsStruct(
187
203
  };
188
204
  }
189
205
 
206
+ export function argsToDRParametersStruct(
207
+ args: CreateOfferArgs
208
+ ): Partial<DRParametersStruct> {
209
+ return {
210
+ disputeResolverId: args.disputeResolverId,
211
+ mutualizerAddress: args.mutualizerAddress || AddressZero
212
+ };
213
+ }
214
+
190
215
  export function encodeReserveRange(
191
216
  offerId: BigNumberish,
192
217
  length: BigNumberish,
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ConditionStruct,
3
3
  TransactionResponse,
4
+ TransactionRequest,
4
5
  Web3LibAdapter
5
6
  } from "@bosonprotocol/common";
6
7
  import { BigNumberish } from "@ethersproject/bignumber";
@@ -19,21 +20,57 @@ export class OrchestrationMixin<
19
20
  * @param overrides - Optional overrides.
20
21
  * @returns Transaction response.
21
22
  */
23
+ // Overload: returnTxInfo is true → returns TransactionRequest
22
24
  public async createOfferWithCondition(
23
25
  offerToCreate: offers.CreateOfferArgs,
24
26
  condition: ConditionStruct,
25
27
  overrides: Partial<{
26
28
  contractAddress: string;
29
+ returnTxInfo: true;
30
+ }>
31
+ ): Promise<TransactionRequest>;
32
+
33
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
34
+ public async createOfferWithCondition(
35
+ offerToCreate: offers.CreateOfferArgs,
36
+ condition: ConditionStruct,
37
+ overrides?: Partial<{
38
+ contractAddress: string;
39
+ returnTxInfo?: false;
40
+ }>
41
+ ): Promise<TransactionResponse>;
42
+
43
+ // Implementation
44
+ public async createOfferWithCondition(
45
+ offerToCreate: offers.CreateOfferArgs,
46
+ condition: ConditionStruct,
47
+ overrides: Partial<{
48
+ contractAddress: string;
49
+ returnTxInfo?: boolean;
27
50
  }> = {}
28
- ): Promise<TransactionResponse> {
29
- return handler.createOfferWithCondition({
51
+ ): Promise<TransactionResponse | TransactionRequest> {
52
+ const { returnTxInfo } = overrides;
53
+
54
+ const createArgs = {
30
55
  offerToCreate,
31
- contractAddress: overrides.contractAddress || this._protocolDiamond,
56
+ condition,
32
57
  web3Lib: this._web3Lib,
33
58
  metadataStorage: this._metadataStorage,
34
59
  theGraphStorage: this._theGraphStorage,
35
- condition
36
- });
60
+ contractAddress: overrides.contractAddress || this._protocolDiamond
61
+ } as const satisfies Parameters<typeof handler.createOfferWithCondition>[0];
62
+
63
+ if (returnTxInfo === true) {
64
+ return handler.createOfferWithCondition({
65
+ ...createArgs,
66
+ returnTxInfo: true
67
+ });
68
+ } else {
69
+ return handler.createOfferWithCondition({
70
+ ...createArgs,
71
+ returnTxInfo: false
72
+ });
73
+ }
37
74
  }
38
75
  /**
39
76
  * Creates a seller account and offer with a specific conditions
@@ -44,50 +81,130 @@ export class OrchestrationMixin<
44
81
  * @param overrides - Optional overrides.
45
82
  * @returns Transaction response.
46
83
  */
84
+ // Overload: returnTxInfo is true → returns TransactionRequest
47
85
  public async createSellerAndOfferWithCondition(
48
86
  sellerToCreate: accounts.CreateSellerArgs,
49
87
  offerToCreate: offers.CreateOfferArgs,
50
88
  condition: ConditionStruct,
51
89
  overrides: Partial<{
52
90
  contractAddress: string;
91
+ returnTxInfo: true;
92
+ }>
93
+ ): Promise<TransactionRequest>;
94
+
95
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
96
+ public async createSellerAndOfferWithCondition(
97
+ sellerToCreate: accounts.CreateSellerArgs,
98
+ offerToCreate: offers.CreateOfferArgs,
99
+ condition: ConditionStruct,
100
+ overrides?: Partial<{
101
+ contractAddress: string;
102
+ returnTxInfo?: false;
103
+ }>
104
+ ): Promise<TransactionResponse>;
105
+
106
+ // Implementation
107
+ public async createSellerAndOfferWithCondition(
108
+ sellerToCreate: accounts.CreateSellerArgs,
109
+ offerToCreate: offers.CreateOfferArgs,
110
+ condition: ConditionStruct,
111
+ overrides: Partial<{
112
+ contractAddress: string;
113
+ returnTxInfo?: boolean;
53
114
  }> = {}
54
- ): Promise<TransactionResponse> {
55
- return handler.createSellerAndOfferWithCondition({
115
+ ): Promise<TransactionResponse | TransactionRequest> {
116
+ const { returnTxInfo } = overrides;
117
+
118
+ const createArgs = {
56
119
  sellerToCreate,
57
120
  offerToCreate,
58
- contractAddress: overrides.contractAddress || this._protocolDiamond,
121
+ condition,
59
122
  web3Lib: this._web3Lib,
60
123
  metadataStorage: this._metadataStorage,
61
124
  theGraphStorage: this._theGraphStorage,
62
- condition
63
- });
125
+ contractAddress: overrides.contractAddress || this._protocolDiamond
126
+ } as const satisfies Parameters<
127
+ typeof handler.createSellerAndOfferWithCondition
128
+ >[0];
129
+
130
+ if (returnTxInfo === true) {
131
+ return handler.createSellerAndOfferWithCondition({
132
+ ...createArgs,
133
+ returnTxInfo: true
134
+ });
135
+ } else {
136
+ return handler.createSellerAndOfferWithCondition({
137
+ ...createArgs,
138
+ returnTxInfo: false
139
+ });
140
+ }
64
141
  }
65
142
 
66
143
  /**
67
144
  * Creates a preminted offer and adds it to an existing group
68
145
  * @param offerToCreate - Offer arguments.
69
- * @param reservedRangeLength - Already reserved range length.
146
+ * @param premintParameters - Premint parameters.
70
147
  * @param groupId - Group ID the offer will be added to
71
148
  * @param overrides - Optional overrides.
72
149
  * @returns Transaction response.
73
150
  */
151
+ // Overload: returnTxInfo is true → returns TransactionRequest
152
+ public async createPremintedOfferAddToGroup(
153
+ offerToCreate: offers.CreateOfferArgs,
154
+ premintParameters: PremintParametersStruct,
155
+ groupId: BigNumberish,
156
+ overrides: Partial<{
157
+ contractAddress: string;
158
+ returnTxInfo: true;
159
+ }>
160
+ ): Promise<TransactionRequest>;
161
+
162
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
163
+ public async createPremintedOfferAddToGroup(
164
+ offerToCreate: offers.CreateOfferArgs,
165
+ premintParameters: PremintParametersStruct,
166
+ groupId: BigNumberish,
167
+ overrides?: Partial<{
168
+ contractAddress: string;
169
+ returnTxInfo?: false;
170
+ }>
171
+ ): Promise<TransactionResponse>;
172
+
173
+ // Implementation
74
174
  public async createPremintedOfferAddToGroup(
75
175
  offerToCreate: offers.CreateOfferArgs,
76
176
  premintParameters: PremintParametersStruct,
77
177
  groupId: BigNumberish,
78
178
  overrides: Partial<{
79
179
  contractAddress: string;
180
+ returnTxInfo?: boolean;
80
181
  }> = {}
81
- ): Promise<TransactionResponse> {
82
- return handler.createPremintedOfferAddToGroup({
182
+ ): Promise<TransactionResponse | TransactionRequest> {
183
+ const { returnTxInfo } = overrides;
184
+
185
+ const createArgs = {
83
186
  offerToCreate,
84
187
  premintParameters,
85
188
  groupId,
86
- contractAddress: overrides.contractAddress || this._protocolDiamond,
87
189
  web3Lib: this._web3Lib,
88
190
  metadataStorage: this._metadataStorage,
89
- theGraphStorage: this._theGraphStorage
90
- });
191
+ theGraphStorage: this._theGraphStorage,
192
+ contractAddress: overrides.contractAddress || this._protocolDiamond
193
+ } as const satisfies Parameters<
194
+ typeof handler.createPremintedOfferAddToGroup
195
+ >[0];
196
+
197
+ if (returnTxInfo === true) {
198
+ return handler.createPremintedOfferAddToGroup({
199
+ ...createArgs,
200
+ returnTxInfo: true
201
+ });
202
+ } else {
203
+ return handler.createPremintedOfferAddToGroup({
204
+ ...createArgs,
205
+ returnTxInfo: false
206
+ });
207
+ }
91
208
  }
92
209
 
93
210
  /**
@@ -95,54 +212,134 @@ export class OrchestrationMixin<
95
212
  * This transaction only succeeds if there is no existing seller account for the connected signer.
96
213
  * @param sellerToCreate - Addresses to set in the seller account.
97
214
  * @param offerToCreate - Offer arguments.
98
- * @param condition - contract condition applied to the offer
215
+ * @param premintParameters - Premint parameters.
99
216
  * @param overrides - Optional overrides.
100
217
  * @returns Transaction response.
101
218
  */
219
+ // Overload: returnTxInfo is true → returns TransactionRequest
220
+ public async createSellerAndPremintedOffer(
221
+ sellerToCreate: accounts.CreateSellerArgs,
222
+ offerToCreate: offers.CreateOfferArgs,
223
+ premintParameters: PremintParametersStruct,
224
+ overrides: Partial<{
225
+ contractAddress: string;
226
+ returnTxInfo: true;
227
+ }>
228
+ ): Promise<TransactionRequest>;
229
+
230
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
231
+ public async createSellerAndPremintedOffer(
232
+ sellerToCreate: accounts.CreateSellerArgs,
233
+ offerToCreate: offers.CreateOfferArgs,
234
+ premintParameters: PremintParametersStruct,
235
+ overrides?: Partial<{
236
+ contractAddress: string;
237
+ returnTxInfo?: false;
238
+ }>
239
+ ): Promise<TransactionResponse>;
240
+
241
+ // Implementation
102
242
  public async createSellerAndPremintedOffer(
103
243
  sellerToCreate: accounts.CreateSellerArgs,
104
244
  offerToCreate: offers.CreateOfferArgs,
105
245
  premintParameters: PremintParametersStruct,
106
246
  overrides: Partial<{
107
247
  contractAddress: string;
248
+ returnTxInfo?: boolean;
108
249
  }> = {}
109
- ): Promise<TransactionResponse> {
110
- return handler.createSellerAndPremintedOffer({
250
+ ): Promise<TransactionResponse | TransactionRequest> {
251
+ const { returnTxInfo } = overrides;
252
+
253
+ const createArgs = {
111
254
  sellerToCreate,
112
255
  offerToCreate,
113
256
  premintParameters,
114
- contractAddress: overrides.contractAddress || this._protocolDiamond,
115
257
  web3Lib: this._web3Lib,
116
258
  metadataStorage: this._metadataStorage,
117
- theGraphStorage: this._theGraphStorage
118
- });
259
+ theGraphStorage: this._theGraphStorage,
260
+ contractAddress: overrides.contractAddress || this._protocolDiamond
261
+ } as const satisfies Parameters<
262
+ typeof handler.createSellerAndPremintedOffer
263
+ >[0];
264
+
265
+ if (returnTxInfo === true) {
266
+ return handler.createSellerAndPremintedOffer({
267
+ ...createArgs,
268
+ returnTxInfo: true
269
+ });
270
+ } else {
271
+ return handler.createSellerAndPremintedOffer({
272
+ ...createArgs,
273
+ returnTxInfo: false
274
+ });
275
+ }
119
276
  }
120
277
 
121
278
  /**
122
- * Creates a preminted offer and adds it to an existing group
279
+ * Creates a preminted offer with condition
123
280
  * @param offerToCreate - Offer arguments.
124
- * @param reservedRangeLength - Already reserved range length.
125
- * @param groupId - Group ID the offer will be added to
281
+ * @param premintParameters - Premint parameters.
282
+ * @param condition - Contract condition applied to the offer.
126
283
  * @param overrides - Optional overrides.
127
284
  * @returns Transaction response.
128
285
  */
286
+ // Overload: returnTxInfo is true → returns TransactionRequest
287
+ public async createPremintedOfferWithCondition(
288
+ offerToCreate: offers.CreateOfferArgs,
289
+ premintParameters: PremintParametersStruct,
290
+ condition: ConditionStruct,
291
+ overrides: Partial<{
292
+ contractAddress: string;
293
+ returnTxInfo: true;
294
+ }>
295
+ ): Promise<TransactionRequest>;
296
+
297
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
298
+ public async createPremintedOfferWithCondition(
299
+ offerToCreate: offers.CreateOfferArgs,
300
+ premintParameters: PremintParametersStruct,
301
+ condition: ConditionStruct,
302
+ overrides?: Partial<{
303
+ contractAddress: string;
304
+ returnTxInfo?: false;
305
+ }>
306
+ ): Promise<TransactionResponse>;
307
+
308
+ // Implementation
129
309
  public async createPremintedOfferWithCondition(
130
310
  offerToCreate: offers.CreateOfferArgs,
131
311
  premintParameters: PremintParametersStruct,
132
312
  condition: ConditionStruct,
133
313
  overrides: Partial<{
134
314
  contractAddress: string;
315
+ returnTxInfo?: boolean;
135
316
  }> = {}
136
- ): Promise<TransactionResponse> {
137
- return handler.createPremintedOfferWithCondition({
317
+ ): Promise<TransactionResponse | TransactionRequest> {
318
+ const { returnTxInfo } = overrides;
319
+
320
+ const createArgs = {
138
321
  offerToCreate,
139
322
  premintParameters,
140
323
  condition,
141
- contractAddress: overrides.contractAddress || this._protocolDiamond,
142
324
  web3Lib: this._web3Lib,
143
325
  metadataStorage: this._metadataStorage,
144
- theGraphStorage: this._theGraphStorage
145
- });
326
+ theGraphStorage: this._theGraphStorage,
327
+ contractAddress: overrides.contractAddress || this._protocolDiamond
328
+ } as const satisfies Parameters<
329
+ typeof handler.createPremintedOfferWithCondition
330
+ >[0];
331
+
332
+ if (returnTxInfo === true) {
333
+ return handler.createPremintedOfferWithCondition({
334
+ ...createArgs,
335
+ returnTxInfo: true
336
+ });
337
+ } else {
338
+ return handler.createPremintedOfferWithCondition({
339
+ ...createArgs,
340
+ returnTxInfo: false
341
+ });
342
+ }
146
343
  }
147
344
 
148
345
  /**
@@ -150,11 +347,36 @@ export class OrchestrationMixin<
150
347
  * This transaction only succeeds if there is no existing seller account for the connected signer.
151
348
  * @param sellerToCreate - Addresses to set in the seller account.
152
349
  * @param offerToCreate - Offer arguments.
153
- * @param reservedRangeLength - Already reserved range length.
154
- * @param condition - contract condition applied to the offer
350
+ * @param premintParameters - Premint parameters.
351
+ * @param condition - Contract condition applied to the offer.
155
352
  * @param overrides - Optional overrides.
156
353
  * @returns Transaction response.
157
354
  */
355
+ // Overload: returnTxInfo is true → returns TransactionRequest
356
+ public async createSellerAndPremintedOfferWithCondition(
357
+ sellerToCreate: accounts.CreateSellerArgs,
358
+ offerToCreate: offers.CreateOfferArgs,
359
+ premintParameters: PremintParametersStruct,
360
+ condition: ConditionStruct,
361
+ overrides: Partial<{
362
+ contractAddress: string;
363
+ returnTxInfo: true;
364
+ }>
365
+ ): Promise<TransactionRequest>;
366
+
367
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
368
+ public async createSellerAndPremintedOfferWithCondition(
369
+ sellerToCreate: accounts.CreateSellerArgs,
370
+ offerToCreate: offers.CreateOfferArgs,
371
+ premintParameters: PremintParametersStruct,
372
+ condition: ConditionStruct,
373
+ overrides?: Partial<{
374
+ contractAddress: string;
375
+ returnTxInfo?: false;
376
+ }>
377
+ ): Promise<TransactionResponse>;
378
+
379
+ // Implementation
158
380
  public async createSellerAndPremintedOfferWithCondition(
159
381
  sellerToCreate: accounts.CreateSellerArgs,
160
382
  offerToCreate: offers.CreateOfferArgs,
@@ -162,18 +384,35 @@ export class OrchestrationMixin<
162
384
  condition: ConditionStruct,
163
385
  overrides: Partial<{
164
386
  contractAddress: string;
387
+ returnTxInfo?: boolean;
165
388
  }> = {}
166
- ): Promise<TransactionResponse> {
167
- return handler.createSellerAndPremintedOfferWithCondition({
389
+ ): Promise<TransactionResponse | TransactionRequest> {
390
+ const { returnTxInfo } = overrides;
391
+
392
+ const createArgs = {
168
393
  sellerToCreate,
169
394
  offerToCreate,
170
395
  premintParameters,
171
- contractAddress: overrides.contractAddress || this._protocolDiamond,
396
+ condition,
172
397
  web3Lib: this._web3Lib,
173
398
  metadataStorage: this._metadataStorage,
174
399
  theGraphStorage: this._theGraphStorage,
175
- condition
176
- });
400
+ contractAddress: overrides.contractAddress || this._protocolDiamond
401
+ } as const satisfies Parameters<
402
+ typeof handler.createSellerAndPremintedOfferWithCondition
403
+ >[0];
404
+
405
+ if (returnTxInfo === true) {
406
+ return handler.createSellerAndPremintedOfferWithCondition({
407
+ ...createArgs,
408
+ returnTxInfo: true
409
+ });
410
+ } else {
411
+ return handler.createSellerAndPremintedOfferWithCondition({
412
+ ...createArgs,
413
+ returnTxInfo: false
414
+ });
415
+ }
177
416
  }
178
417
 
179
418
  /**
@@ -182,18 +421,52 @@ export class OrchestrationMixin<
182
421
  * @param overrides - Optional overrides.
183
422
  * @returns Transaction response.
184
423
  */
424
+ // Overload: returnTxInfo is true → returns TransactionRequest
425
+ public async raiseAndEscalateDispute(
426
+ exchangeId: BigNumberish,
427
+ overrides: Partial<{
428
+ contractAddress: string;
429
+ returnTxInfo: true;
430
+ }>
431
+ ): Promise<TransactionRequest>;
432
+
433
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
434
+ public async raiseAndEscalateDispute(
435
+ exchangeId: BigNumberish,
436
+ overrides?: Partial<{
437
+ contractAddress: string;
438
+ returnTxInfo?: false;
439
+ }>
440
+ ): Promise<TransactionResponse>;
441
+
442
+ // Implementation
185
443
  public async raiseAndEscalateDispute(
186
444
  exchangeId: BigNumberish,
187
445
  overrides: Partial<{
188
446
  contractAddress: string;
447
+ returnTxInfo?: boolean;
189
448
  }> = {}
190
- ): Promise<TransactionResponse> {
191
- return handler.raiseAndEscalateDispute({
449
+ ): Promise<TransactionResponse | TransactionRequest> {
450
+ const { returnTxInfo } = overrides;
451
+
452
+ const disputeArgs = {
192
453
  exchangeId,
193
- contractAddress: overrides.contractAddress || this._protocolDiamond,
194
454
  web3Lib: this._web3Lib,
195
455
  metadataStorage: this._metadataStorage,
196
- theGraphStorage: this._theGraphStorage
197
- });
456
+ theGraphStorage: this._theGraphStorage,
457
+ contractAddress: overrides.contractAddress || this._protocolDiamond
458
+ } as const satisfies Parameters<typeof handler.raiseAndEscalateDispute>[0];
459
+
460
+ if (returnTxInfo === true) {
461
+ return handler.raiseAndEscalateDispute({
462
+ ...disputeArgs,
463
+ returnTxInfo: true
464
+ });
465
+ } else {
466
+ return handler.raiseAndEscalateDispute({
467
+ ...disputeArgs,
468
+ returnTxInfo: false
469
+ });
470
+ }
198
471
  }
199
472
  }
@@ -117,3 +117,27 @@ export function getSignatureParameters(signature: string): {
117
117
  signature
118
118
  };
119
119
  }
120
+
121
+ export function rebuildSignature({
122
+ r,
123
+ s,
124
+ v
125
+ }: {
126
+ r: string;
127
+ s: string;
128
+ v: number;
129
+ }): string {
130
+ if (!isHexString(r) || !isHexString(s)) {
131
+ throw new Error("r and s must be valid hex strings");
132
+ }
133
+
134
+ // Remove '0x' prefix if present
135
+ const rValue = r.startsWith("0x") ? r.substring(2) : r;
136
+ const sValue = s.startsWith("0x") ? s.substring(2) : s;
137
+
138
+ // Convert v to two digit hex, handle Ledger signature conversion
139
+ const vValue = v.toString(16).padStart(2, "0");
140
+
141
+ // Concatenate the signature parts
142
+ return "0x" + rValue + sValue + vValue;
143
+ }