@@ -14,7 +14,9 @@ import { UnexpectedAssetTypeError } from '../error';
1414import type {
1515 ECSignature ,
1616 ERC1155OrderStruct ,
17+ ERC1155OrderStructSerialized ,
1718 ERC721OrderStruct ,
19+ ERC721OrderStructSerialized ,
1820 NftOrderV4 ,
1921 OrderStructOptionsCommon ,
2022 OrderStructOptionsCommonStrict ,
@@ -328,29 +330,33 @@ export const generateErc721Order = (
328330 nft : UserFacingERC721AssetDataSerialized ,
329331 erc20 : UserFacingERC20AssetDataSerialized ,
330332 orderData : Partial < OrderStructOptionsCommon > & OrderStructOptionsCommonStrict
331- ) : ERC721OrderStruct => {
332- const erc721Order : ERC721OrderStruct = {
333- erc721Token : nft . tokenAddress ,
333+ ) : ERC721OrderStructSerialized => {
334+ const erc721Order : ERC721OrderStructSerialized = {
335+ erc721Token : nft . tokenAddress . toLowerCase ( ) ,
334336 erc721TokenId : nft . tokenId ,
335- direction : orderData . direction ,
336- erc20Token : erc20 . tokenAddress ,
337+ direction : parseInt ( orderData . direction . toString ( ) ) , // KLUDGE(johnrjj) - There's some footgun here when only doing orderData.direction.toString(), need to parseInt it
338+ erc20Token : erc20 . tokenAddress . toLowerCase ( ) ,
337339 erc20TokenAmount : erc20 . amount ,
338- maker : orderData . maker ,
340+ maker : orderData . maker . toLowerCase ( ) ,
339341 // Defaults not required...
340- erc721TokenProperties : orderData . tokenProperties ?? [ ] ,
342+ erc721TokenProperties :
343+ orderData . tokenProperties ?. map ( ( property ) => ( {
344+ propertyData : property . propertyData ,
345+ propertyValidator : property . propertyValidator ,
346+ } ) ) ?? [ ] ,
341347 fees :
342348 orderData . fees ?. map ( ( x ) => {
343349 return {
344- amount : x . amount ,
345- recipient : x . recipient ,
346- feeData : x . feeData ?? '0x' ,
350+ amount : x . amount . toString ( ) ,
351+ recipient : x . recipient . toLowerCase ( ) ,
352+ feeData : x . feeData ?. toString ( ) ?? '0x' ,
347353 } ;
348354 } ) ?? [ ] ,
349355 expiry : orderData . expiry
350- ? getUnixTime ( orderData . expiry )
351- : INFINITE_TIMESTAMP_SEC ,
352- nonce : orderData . nonce ?? generateRandomNonce ( ) ,
353- taker : orderData . taker ?? NULL_ADDRESS ,
356+ ? getUnixTime ( orderData . expiry ) . toString ( )
357+ : INFINITE_TIMESTAMP_SEC . toString ( ) ,
358+ nonce : orderData . nonce ?. toString ( ) ?? generateRandomNonce ( ) ,
359+ taker : orderData . taker ?. toLowerCase ( ) ?? NULL_ADDRESS ,
354360 } ;
355361
356362 return erc721Order ;
@@ -360,30 +366,34 @@ export const generateErc1155Order = (
360366 nft : UserFacingERC1155AssetDataSerializedNormalizedSingle ,
361367 erc20 : UserFacingERC20AssetDataSerialized ,
362368 orderData : Partial < OrderStructOptionsCommon > & OrderStructOptionsCommonStrict
363- ) : ERC1155OrderStruct => {
364- const erc1155Order : ERC1155OrderStruct = {
365- erc1155Token : nft . tokenAddress ,
369+ ) : ERC1155OrderStructSerialized => {
370+ const erc1155Order : ERC1155OrderStructSerialized = {
371+ erc1155Token : nft . tokenAddress . toLowerCase ( ) ,
366372 erc1155TokenId : nft . tokenId ,
367373 erc1155TokenAmount : nft . amount ?? '1' ,
368- direction : orderData . direction ,
369- erc20Token : erc20 . tokenAddress ,
374+ direction : parseInt ( orderData . direction . toString ( ) ) , // KLUDGE(johnrjj) - There's some footgun here when only doing orderData.direction.toString(), need to parseInt it
375+ erc20Token : erc20 . tokenAddress . toLowerCase ( ) ,
370376 erc20TokenAmount : erc20 . amount ,
371- maker : orderData . maker ,
377+ maker : orderData . maker . toLowerCase ( ) ,
372378 // Defaults not required...
373- erc1155TokenProperties : orderData . tokenProperties ?? [ ] ,
379+ erc1155TokenProperties :
380+ orderData . tokenProperties ?. map ( ( property ) => ( {
381+ propertyData : property . propertyData . toString ( ) ,
382+ propertyValidator : property . propertyValidator ,
383+ } ) ) ?? [ ] ,
374384 fees :
375- orderData . fees ?. map ( ( x ) => {
385+ orderData . fees ?. map ( ( fee ) => {
376386 return {
377- amount : x . amount ,
378- recipient : x . recipient ,
379- feeData : x . feeData ?? '0x' ,
387+ amount : fee . amount . toString ( ) ,
388+ recipient : fee . recipient . toLowerCase ( ) ,
389+ feeData : fee . feeData ?. toString ( ) ?? '0x' ,
380390 } ;
381391 } ) ?? [ ] ,
382392 expiry : orderData . expiry
383- ? getUnixTime ( orderData . expiry )
384- : INFINITE_TIMESTAMP_SEC ,
385- nonce : orderData . nonce ?? generateRandomNonce ( ) ,
386- taker : orderData . taker ?? NULL_ADDRESS ,
393+ ? getUnixTime ( orderData . expiry ) . toString ( )
394+ : INFINITE_TIMESTAMP_SEC . toString ( ) ,
395+ nonce : orderData . nonce ?. toString ( ) ?? generateRandomNonce ( ) ,
396+ taker : orderData . taker ?. toLowerCase ( ) ?? NULL_ADDRESS ,
387397 } ;
388398
389399 return erc1155Order ;
0 commit comments