@bosonprotocol/core-sdk 1.44.0-alpha.8 → 1.44.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 (56) 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/exchanges/handler.d.ts.map +1 -1
  6. package/dist/cjs/exchanges/handler.js +16 -15
  7. package/dist/cjs/exchanges/handler.js.map +1 -1
  8. package/dist/cjs/meta-tx/mixin.d.ts +3 -1
  9. package/dist/cjs/meta-tx/mixin.d.ts.map +1 -1
  10. package/dist/cjs/meta-tx/mixin.js +1 -1
  11. package/dist/cjs/meta-tx/mixin.js.map +1 -1
  12. package/dist/cjs/native-meta-tx/tokenSpecifics.d.ts.map +1 -1
  13. package/dist/cjs/offers/handler.d.ts +2 -0
  14. package/dist/cjs/offers/handler.d.ts.map +1 -1
  15. package/dist/cjs/offers/handler.js +9 -0
  16. package/dist/cjs/offers/handler.js.map +1 -1
  17. package/dist/cjs/offers/mixin.d.ts.map +1 -1
  18. package/dist/cjs/offers/mixin.js +1 -0
  19. package/dist/cjs/offers/mixin.js.map +1 -1
  20. package/dist/cjs/orchestration/mixin.d.ts +43 -8
  21. package/dist/cjs/orchestration/mixin.d.ts.map +1 -1
  22. package/dist/cjs/orchestration/mixin.js +84 -85
  23. package/dist/cjs/orchestration/mixin.js.map +1 -1
  24. package/dist/cjs/utils/promises.d.ts.map +1 -1
  25. package/dist/esm/accounts/mixin.d.ts +1 -0
  26. package/dist/esm/accounts/mixin.d.ts.map +1 -1
  27. package/dist/esm/accounts/mixin.js +3 -1
  28. package/dist/esm/accounts/mixin.js.map +1 -1
  29. package/dist/esm/exchanges/handler.d.ts.map +1 -1
  30. package/dist/esm/exchanges/handler.js +6 -7
  31. package/dist/esm/exchanges/handler.js.map +1 -1
  32. package/dist/esm/meta-tx/mixin.d.ts +3 -1
  33. package/dist/esm/meta-tx/mixin.d.ts.map +1 -1
  34. package/dist/esm/meta-tx/mixin.js +1 -1
  35. package/dist/esm/meta-tx/mixin.js.map +1 -1
  36. package/dist/esm/native-meta-tx/tokenSpecifics.d.ts.map +1 -1
  37. package/dist/esm/offers/handler.d.ts +2 -0
  38. package/dist/esm/offers/handler.d.ts.map +1 -1
  39. package/dist/esm/offers/handler.js +9 -0
  40. package/dist/esm/offers/handler.js.map +1 -1
  41. package/dist/esm/offers/mixin.d.ts.map +1 -1
  42. package/dist/esm/offers/mixin.js +1 -0
  43. package/dist/esm/offers/mixin.js.map +1 -1
  44. package/dist/esm/orchestration/mixin.d.ts +43 -8
  45. package/dist/esm/orchestration/mixin.d.ts.map +1 -1
  46. package/dist/esm/orchestration/mixin.js +126 -85
  47. package/dist/esm/orchestration/mixin.js.map +1 -1
  48. package/dist/esm/utils/promises.d.ts.map +1 -1
  49. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  50. package/package.json +3 -3
  51. package/src/accounts/mixin.ts +5 -1
  52. package/src/exchanges/handler.ts +18 -8
  53. package/src/meta-tx/mixin.ts +5 -2
  54. package/src/offers/handler.ts +24 -0
  55. package/src/offers/mixin.ts +1 -0
  56. package/src/orchestration/mixin.ts +315 -42
@@ -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
  }