diff options
Diffstat (limited to 'packages/order-utils')
-rw-r--r-- | packages/order-utils/src/asset_proxy_utils.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/order-utils/src/asset_proxy_utils.ts b/packages/order-utils/src/asset_proxy_utils.ts index 61a9b12e9..c7b301c1a 100644 --- a/packages/order-utils/src/asset_proxy_utils.ts +++ b/packages/order-utils/src/asset_proxy_utils.ts @@ -119,10 +119,12 @@ export const assetProxyUtils = { const tokenId = assetProxyUtils.decodeUint256(encodedTokenId); const nullData = '0x'; let receiverData = nullData; - if (encodedAssetData.byteLength > receiverDataLengthOffset + 1) { + const lengthUpToReceiverDataLength = receiverDataLengthOffset + 1; + if (encodedAssetData.byteLength > lengthUpToReceiverDataLength) { const encodedReceiverDataLength = encodedAssetData.slice(receiverDataLengthOffset, receiverDataOffset); const receiverDataLength = assetProxyUtils.decodeUint256(encodedReceiverDataLength); - const expectedReceiverDataLength = new BigNumber(encodedAssetData.byteLength - (receiverDataOffset + 1)); + const lengthUpToReceiverData = receiverDataOffset + 1; + const expectedReceiverDataLength = new BigNumber(encodedAssetData.byteLength - lengthUpToReceiverData); if (!receiverDataLength.equals(expectedReceiverDataLength)) { throw new Error( `Data length (${receiverDataLength}) does not match actual length of data (${expectedReceiverDataLength})`, @@ -167,12 +169,12 @@ export const assetProxyUtils = { return generalizedERC20AssetData; case AssetProxyId.ERC721: const erc721AssetData = assetProxyUtils.decodeERC721AssetData(assetData); - const generaliedERC721AssetData = { + const generalizedERC721AssetData = { assetProxyId, tokenAddress: erc721AssetData.tokenAddress, data: erc721AssetData.tokenId, }; - return generaliedERC721AssetData; + return generalizedERC721AssetData; default: throw new Error(`Unrecognized asset proxy id: ${assetProxyId}`); } |