Skip to content

Commit

Permalink
fix: throw error when required options is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Aug 18, 2023
1 parent 5251228 commit 9fcd5b3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/strategies/erc1155-balance-of/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export async function strategy(
options,
snapshot
) {
if (!options.tokenId) {
throw new Error(
'options.tokenId is required for erc-1155-balance-of strategy'
);
}

const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';
const response = await multicall(
network,
Expand All @@ -28,6 +34,7 @@ export async function strategy(
]),
{ blockTag }
);

return Object.fromEntries(
response.map((value, i) => [
addresses[i],
Expand Down

0 comments on commit 9fcd5b3

Please sign in to comment.