@@ -1461,30 +1461,43 @@ export const POLYMARKET_POST_CASH_OUT_MOCKS = async (mockServer: Mockttp) => {
14611461 const body = bodyText ? JSON . parse ( bodyText ) : { } ;
14621462 const order = body ?. order ;
14631463
1464- // Verify the request matches cash-out order structure
1465- // Only check consistent fields - allow variable values for dynamic fields (salt, tokenId, amounts, signature, owner)
1466- return (
1467- order &&
1468- ( body . orderType === 'FOK' || body . orderType === 'FAK' ) &&
1469- order . maker ?. toLowerCase ( ) === PROXY_WALLET_ADDRESS . toLowerCase ( ) &&
1470- order . signer ?. toLowerCase ( ) === USER_WALLET_ADDRESS . toLowerCase ( ) &&
1471- order . taker === '0x0000000000000000000000000000000000000000' &&
1472- order . expiration === '0' &&
1473- order . nonce === '0' &&
1474- typeof order . feeRateBps === 'string' &&
1475- order . side === 'SELL' &&
1476- order . signatureType === 2 &&
1477- typeof order . salt === 'number' &&
1478- typeof order . tokenId === 'string' &&
1479- order . tokenId . length > 0 &&
1480- typeof order . makerAmount === 'string' &&
1481- order . makerAmount . length > 0 &&
1482- typeof order . takerAmount === 'string' &&
1483- order . takerAmount . length > 0 &&
1484- typeof order . signature === 'string' &&
1485- order . signature . startsWith ( '0x' ) &&
1486- order . signature . length > 10
1487- ) ;
1464+ // Flexible matching: require SELL order to relayer endpoint.
1465+ // CLOB v2 cash-out payloads no longer include some legacy fields
1466+ // (for example taker/nonce/feeRateBps), so only validate stable fields.
1467+ if ( ! order || order . side !== 'SELL' ) {
1468+ return false ;
1469+ }
1470+
1471+ if (
1472+ body . orderType !== undefined &&
1473+ body . orderType !== 'FOK' &&
1474+ body . orderType !== 'FAK'
1475+ ) {
1476+ return false ;
1477+ }
1478+
1479+ if ( order . maker !== undefined && order . signer !== undefined ) {
1480+ const makerMatch =
1481+ order . maker ?. toLowerCase ( ) === PROXY_WALLET_ADDRESS . toLowerCase ( ) ;
1482+ const signerMatch =
1483+ order . signer ?. toLowerCase ( ) === USER_WALLET_ADDRESS . toLowerCase ( ) ;
1484+
1485+ if ( ! makerMatch || ! signerMatch ) {
1486+ return false ;
1487+ }
1488+ }
1489+
1490+ if ( order . signature !== undefined ) {
1491+ if (
1492+ typeof order . signature !== 'string' ||
1493+ ! order . signature . startsWith ( '0x' ) ||
1494+ order . signature . length < 10
1495+ ) {
1496+ return false ;
1497+ }
1498+ }
1499+
1500+ return true ;
14881501 } catch {
14891502 return false ;
14901503 }
0 commit comments