Add length check to MultiAsset encoding
This commit is contained in:
parent
1553b366da
commit
0cb5209266
@ -73,6 +73,13 @@ export const assetDataUtils = {
|
||||
* @return The hex encoded assetData string
|
||||
*/
|
||||
encodeMultiAssetData(amounts: BigNumber[], nestedAssetData: string[]): string {
|
||||
if (amounts.length !== nestedAssetData.length) {
|
||||
throw new Error(
|
||||
`Invalid MultiAsset arguments. Expected length of 'amounts' (${
|
||||
amounts.length
|
||||
}) to equal length of 'nestedAssetData' (${nestedAssetData.length})`,
|
||||
);
|
||||
}
|
||||
_.forEach(nestedAssetData, assetDataElement => assetDataUtils.validateAssetDataOrThrow(assetDataElement));
|
||||
const abiEncoder = new AbiEncoder.Method(constants.MULTI_ASSET_METHOD_ABI as MethodAbi);
|
||||
const args = [amounts, nestedAssetData];
|
||||
|
@ -122,7 +122,7 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx
|
||||
const decodedAssetData = assetDataUtils.decodeERC721AssetData(assetData);
|
||||
if (
|
||||
decodedAssetData.assetProxyId === AssetProxyId.ERC721 &&
|
||||
!_.isUndefined(decodedAssetData.tokenAddress) &&
|
||||
decodedAssetData.tokenAddress === tokenAddress &&
|
||||
!_.isUndefined(this._proxyAllowance[assetData][userAddress])
|
||||
) {
|
||||
delete this._proxyAllowance[assetData][userAddress];
|
||||
|
Loading…
x
Reference in New Issue
Block a user