From 9fcd5b346e006021b8a3d18742daab8b58313507 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Fri, 18 Aug 2023 13:20:02 +0900 Subject: [PATCH] fix: throw error when required options is missing --- src/strategies/erc1155-balance-of/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/strategies/erc1155-balance-of/index.ts b/src/strategies/erc1155-balance-of/index.ts index 32ce8bd92..9a63986a1 100644 --- a/src/strategies/erc1155-balance-of/index.ts +++ b/src/strategies/erc1155-balance-of/index.ts @@ -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, @@ -28,6 +34,7 @@ export async function strategy( ]), { blockTag } ); + return Object.fromEntries( response.map((value, i) => [ addresses[i],