@@ -265,16 +265,31 @@ class NftSwapV4 implements INftSwapV4 {
265265 nonce : BigNumberish ,
266266 orderType : 'ERC721' | 'ERC1155'
267267 ) : Promise < ContractTransaction > => {
268- if ( orderType === 'ERC1155' ) {
269- return this . exchangeProxy . cancelERC1155Order ( nonce ) ;
270- }
271268 if ( orderType === 'ERC721' ) {
272269 return this . exchangeProxy . cancelERC721Order ( nonce ) ;
273270 }
271+ if ( orderType === 'ERC1155' ) {
272+ return this . exchangeProxy . cancelERC1155Order ( nonce ) ;
273+ }
274274 console . log ( 'unsupported order' , orderType ) ;
275275 throw new Error ( 'unsupport order' ) ;
276276 } ;
277277
278+ /**
279+ * Derives order hash from order (currently requires a provider to derive)
280+ * @param order A 0x v4 order (signed or unsigned)
281+ * @returns Order hash
282+ */
283+ getOrderHash = ( order : NftOrderV4Serialized ) : Promise < string > => {
284+ if ( 'erc721Token' in order ) {
285+ return this . exchangeProxy . getERC721OrderHash ( order ) ;
286+ }
287+ if ( 'erc1155Token' in order ) {
288+ return this . exchangeProxy . getERC1155OrderHash ( order ) ;
289+ }
290+ throw new Error ( 'unsupport order' ) ;
291+ } ;
292+
278293 /**
279294 * Looks up the order status for a given 0x v4 order.
280295 * (Available states for an order are 'filled', 'expired', )
@@ -287,6 +302,12 @@ class NftSwapV4 implements INftSwapV4 {
287302 * Expired = 3,
288303 */
289304 getOrderStatus = async ( order : NftOrderV4 ) : Promise < number > => {
305+ if ( 'erc721Token' in order ) {
306+ const erc721OrderStatus = await this . exchangeProxy . getERC721OrderStatus (
307+ order
308+ ) ;
309+ return erc721OrderStatus ;
310+ }
290311 if ( 'erc1155Token' in order ) {
291312 const [
292313 _erc1155OrderHash ,
@@ -296,12 +317,6 @@ class NftSwapV4 implements INftSwapV4 {
296317 ] = await this . exchangeProxy . getERC1155OrderInfo ( order ) ;
297318 return erc1155OrderStatus ;
298319 }
299- if ( 'erc721Token' in order ) {
300- const erc721OrderStatus = await this . exchangeProxy . getERC721OrderStatus (
301- order
302- ) ;
303- return erc721OrderStatus ;
304- }
305320 console . log ( 'unsupported order' , order ) ;
306321 throw new Error ( 'unsupport order' ) ;
307322 } ;
0 commit comments