Modify batch allowances to take an array of spenders

This commit is contained in:
Amir Bandeali
2019-05-26 17:19:01 -07:00
parent 4d9f2586d9
commit 543011c3de
2 changed files with 20 additions and 14 deletions

View File

@@ -383,10 +383,14 @@ describe('LibAssetData', () => {
await setERC20AllowanceAsync();
await setERC721AllowanceAsync();
expect(
await libAssetData.getBatchAllowances.callAsync(tokenOwnerAddress, approvedSpenderAddress, [
await libAssetData.encodeERC20AssetData.callAsync(erc20TokenAddress),
await libAssetData.encodeERC721AssetData.callAsync(erc721TokenAddress, firstERC721TokenId),
]),
await libAssetData.getBatchAllowances.callAsync(
tokenOwnerAddress,
[approvedSpenderAddress, approvedSpenderAddress],
[
await libAssetData.encodeERC20AssetData.callAsync(erc20TokenAddress),
await libAssetData.encodeERC721AssetData.callAsync(erc721TokenAddress, firstERC721TokenId),
],
),
).to.deep.equal([new BigNumber(1), new BigNumber(1)]);
});
@@ -418,9 +422,11 @@ describe('LibAssetData', () => {
it('should query balances and allowances together, from an asset data array', async () => {
await setERC20AllowanceAsync();
expect(
await libAssetData.getBatchBalancesAndAllowances.callAsync(tokenOwnerAddress, approvedSpenderAddress, [
await libAssetData.encodeERC20AssetData.callAsync(erc20TokenAddress),
]),
await libAssetData.getBatchBalancesAndAllowances.callAsync(
tokenOwnerAddress,
[approvedSpenderAddress, approvedSpenderAddress],
[await libAssetData.encodeERC20AssetData.callAsync(erc20TokenAddress)],
),
).to.deep.equal([[new BigNumber(erc20TokenTotalSupply)], [new BigNumber(1)]]);
});
});