@@ -183,18 +183,21 @@ export class Seaport {
183
183
* @param input.salt Arbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty.
184
184
* @param input.offerer The order's creator address. Defaults to the first address on the provider.
185
185
* @param accountAddress Optional address for which to create the order with
186
+ * @param exactApproval optional boolean to indicate whether the approval should be exact or not
186
187
* @returns a use case containing the list of actions needed to be performed in order to create the order
187
188
*/
188
189
public async createOrder (
189
190
input : CreateOrderInput ,
190
- accountAddress ?: string
191
+ accountAddress ?: string ,
192
+ exactApproval ?: boolean
191
193
) : Promise < OrderUseCase < CreateOrderAction > > {
192
194
const signer = this . _getSigner ( accountAddress ) ;
193
195
const offerer = await signer . getAddress ( ) ;
194
196
195
197
const { orderComponents, approvalActions } = await this . _formatOrder (
196
198
signer ,
197
199
offerer ,
200
+ Boolean ( exactApproval ) ,
198
201
input
199
202
) ;
200
203
@@ -229,11 +232,13 @@ export class Seaport {
229
232
* or a signature request that will then be supplied into the final orders, ready to be fulfilled.
230
233
*
231
234
* @param input See {@link createOrder} for more details about the input parameters.
235
+ * @param exactApproval optional boolean to indicate whether the approval should be exact or not
232
236
* @returns a use case containing the list of actions needed to be performed in order to create the orders
233
237
*/
234
238
public async createBulkOrders (
235
239
createOrderInput : CreateOrderInput [ ] ,
236
- accountAddress ?: string
240
+ accountAddress ?: string ,
241
+ exactApproval ?: boolean
237
242
) : Promise < OrderUseCase < CreateBulkOrdersAction > > {
238
243
const signer = this . _getSigner ( accountAddress ) ;
239
244
const offerer = await signer . getAddress ( ) ;
@@ -247,6 +252,7 @@ export class Seaport {
247
252
const { orderComponents, approvalActions } = await this . _formatOrder (
248
253
signer ,
249
254
offerer ,
255
+ Boolean ( exactApproval ) ,
250
256
input
251
257
) ;
252
258
@@ -289,6 +295,7 @@ export class Seaport {
289
295
private async _formatOrder (
290
296
signer : Signer ,
291
297
offerer : string ,
298
+ exactApproval : boolean ,
292
299
{
293
300
conduitKey = this . defaultConduitKey ,
294
301
zone = ethers . constants . AddressZero ,
@@ -388,7 +395,11 @@ export class Seaport {
388
395
operator,
389
396
} ) ;
390
397
391
- const approvals = await getApprovalActions ( insufficientApprovals , signer ) ;
398
+ const approvals = await getApprovalActions (
399
+ insufficientApprovals ,
400
+ exactApproval ,
401
+ signer
402
+ ) ;
392
403
approvalActions . push ( ...approvals ) ;
393
404
}
394
405
@@ -764,6 +775,7 @@ export class Seaport {
764
775
* @param input.recipientAddress optional recipient to forward the offer to as opposed to the fulfiller.
765
776
* Defaults to the zero address which means the offer goes to the fulfiller
766
777
* @param input.domain optional domain to be hashed and appended to calldata
778
+ * @param input.exactApproval optional boolean to indicate whether the approval should be exact or not
767
779
* @returns a use case containing the set of approval actions and fulfillment action
768
780
*/
769
781
public async fulfillOrder ( {
@@ -777,6 +789,7 @@ export class Seaport {
777
789
conduitKey = this . defaultConduitKey ,
778
790
recipientAddress = ethers . constants . AddressZero ,
779
791
domain = "" ,
792
+ exactApproval = false ,
780
793
} : {
781
794
order : OrderWithCounter ;
782
795
unitsToFill ?: BigNumberish ;
@@ -788,6 +801,7 @@ export class Seaport {
788
801
conduitKey ?: string ;
789
802
recipientAddress ?: string ;
790
803
domain ?: string ;
804
+ exactApproval ?: boolean ;
791
805
} ) : Promise <
792
806
OrderUseCase <
793
807
ExchangeAction <
@@ -868,44 +882,50 @@ export class Seaport {
868
882
shouldUseBasicFulfill ( sanitizedOrder . parameters , totalFilled )
869
883
) {
870
884
// TODO: Use fulfiller proxy if there are approvals needed directly, but none needed for proxy
871
- return fulfillBasicOrder ( {
885
+ return fulfillBasicOrder (
886
+ {
887
+ order : sanitizedOrder ,
888
+ seaportContract : this . contract ,
889
+ offererBalancesAndApprovals,
890
+ fulfillerBalancesAndApprovals,
891
+ timeBasedItemParams,
892
+ conduitKey,
893
+ offererOperator,
894
+ fulfillerOperator,
895
+ signer : fulfiller ,
896
+ tips : tipConsiderationItems ,
897
+ domain,
898
+ } ,
899
+ exactApproval
900
+ ) ;
901
+ }
902
+
903
+ // Else, we fallback to the standard fulfill order
904
+ return fulfillStandardOrder (
905
+ {
872
906
order : sanitizedOrder ,
907
+ unitsToFill,
908
+ totalFilled,
909
+ totalSize : totalSize . eq ( 0 )
910
+ ? getMaximumSizeForOrder ( sanitizedOrder )
911
+ : totalSize ,
912
+ offerCriteria,
913
+ considerationCriteria,
914
+ tips : tipConsiderationItems ,
915
+ extraData,
873
916
seaportContract : this . contract ,
874
917
offererBalancesAndApprovals,
875
918
fulfillerBalancesAndApprovals,
876
919
timeBasedItemParams,
877
920
conduitKey,
921
+ signer : fulfiller ,
878
922
offererOperator,
879
923
fulfillerOperator,
880
- signer : fulfiller ,
881
- tips : tipConsiderationItems ,
924
+ recipientAddress,
882
925
domain,
883
- } ) ;
884
- }
885
-
886
- // Else, we fallback to the standard fulfill order
887
- return fulfillStandardOrder ( {
888
- order : sanitizedOrder ,
889
- unitsToFill,
890
- totalFilled,
891
- totalSize : totalSize . eq ( 0 )
892
- ? getMaximumSizeForOrder ( sanitizedOrder )
893
- : totalSize ,
894
- offerCriteria,
895
- considerationCriteria,
896
- tips : tipConsiderationItems ,
897
- extraData,
898
- seaportContract : this . contract ,
899
- offererBalancesAndApprovals,
900
- fulfillerBalancesAndApprovals,
901
- timeBasedItemParams,
902
- conduitKey,
903
- signer : fulfiller ,
904
- offererOperator,
905
- fulfillerOperator,
906
- recipientAddress,
907
- domain,
908
- } ) ;
926
+ } ,
927
+ exactApproval
928
+ ) ;
909
929
}
910
930
911
931
/**
@@ -918,6 +938,7 @@ export class Seaport {
918
938
* @param input.recipientAddress optional recipient to forward the offer to as opposed to the fulfiller.
919
939
* Defaults to the zero address which means the offer goes to the fulfiller
920
940
* @param input.domain optional domain to be hashed and appended to calldata
941
+ * @param input.exactApproval optional boolean to indicate whether the approval should be exact or not
921
942
* @returns a use case containing the set of approval actions and fulfillment action
922
943
*/
923
944
public async fulfillOrders ( {
@@ -926,6 +947,7 @@ export class Seaport {
926
947
conduitKey = this . defaultConduitKey ,
927
948
recipientAddress = ethers . constants . AddressZero ,
928
949
domain = "" ,
950
+ exactApproval = false ,
929
951
} : {
930
952
fulfillOrderDetails : {
931
953
order : OrderWithCounter ;
@@ -939,6 +961,7 @@ export class Seaport {
939
961
conduitKey ?: string ;
940
962
recipientAddress ?: string ;
941
963
domain ?: string ;
964
+ exactApproval ?: boolean ;
942
965
} ) {
943
966
const fulfiller = this . _getSigner ( accountAddress ) ;
944
967
@@ -1029,6 +1052,7 @@ export class Seaport {
1029
1052
conduitKey,
1030
1053
recipientAddress,
1031
1054
domain,
1055
+ exactApproval,
1032
1056
} ) ;
1033
1057
}
1034
1058
0 commit comments