@@ -915,8 +915,10 @@ class NftSwapV4 implements INftSwapV4 {
915915 console . log ( 'unsupported order' , signedOrder ) ;
916916 throw new Error ( 'unsupport signedOrder type' ) ;
917917 } ;
918+
918919 /**
919- * Pre-signs and submits an order
920+ * Pre-signs and submits signed order on chain (use this to sign orders for smart contract wallets)
921+ * Presigned on-chain transaction will emit an event that is indexable w/ the full fillable order
920922 * @param signedOrder An unsigned 0x v4 order
921923 * @param fillOrderOverrides Optional configuration on possible ways to fill the order
922924 * @param transactionOverrides Ethers transaction overrides (e.g. gas price)
@@ -927,34 +929,19 @@ class NftSwapV4 implements INftSwapV4 {
927929 fillOrderOverrides ?: Partial < FillOrderOverrides > ,
928930 transactionOverrides ?: Partial < PayableOverrides >
929931 ) => {
930- // Only Sell orders can be filled with ETH
931- const canOrderTypeBeFilledWithNativeToken =
932- order . direction === TradeDirection . SellNFT ;
933- // Is ERC20 being traded the native token
934- const isNativeToken = this . isErc20NativeToken ( order ) ;
935- const needsEthAttached =
936- isNativeToken && canOrderTypeBeFilledWithNativeToken ;
937- if ( needsEthAttached ) {
938- console . log (
939- "can't pre-sign orders that need to be filled with ETH" ,
940- order
941- ) ;
942- throw new Error ( "can't pre-sign orders that need to be filled with ETH" ) ;
943- }
944- // do fill
932+ // Do pre-sign
945933 if ( 'erc1155Token' in order ) {
946934 // If maker is selling an NFT, taker wants to 'buy' nft
947935 if (
948936 order . direction === TradeDirection . BuyNFT &&
949937 order . erc1155TokenProperties . length > 0 &&
950938 fillOrderOverrides ?. tokenIdToSellForCollectionOrder === undefined
951939 ) {
952- // property based order, let's make sure they've specifically provided a tokenIdToSellForCollectionOrder
940+ // Property based order, let's make sure they've specifically provided a tokenIdToSellForCollectionOrder
953941 throw new Error (
954942 'Collection order missing NFT tokenId to fill with. Specify in fillOrderOverrides.tokenIdToSellForCollectionOrder'
955943 ) ;
956944 }
957-
958945 return this . exchangeProxy . preSignERC1155Order ( order , {
959946 ...transactionOverrides ,
960947 } ) ;
@@ -975,7 +962,7 @@ class NftSwapV4 implements INftSwapV4 {
975962 ...transactionOverrides ,
976963 } ) ;
977964 }
978- console . log ( 'unsupported order', order ) ;
965+ warning ( 'Unsupported order', order ) ;
979966 throw new Error ( 'unsupport signedOrder type' ) ;
980967 } ;
981968
0 commit comments