Skip to content

Commit

Permalink
fix: throw error if wallet list is not provided (#1911)
Browse files Browse the repository at this point in the history
Co-authored-by: Magomed Khamidov <53529533+KosmosKey@users.noreply.github.com>
Co-authored-by: Daniel Sinclair <d@niel.nyc>
  • Loading branch information
3 people committed Apr 4, 2024
1 parent 34b2ca3 commit 1a0f209
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-mugs-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rainbow-me/rainbowkit": patch
---

Add a small check to throw an error if the wallet list is empty overall or empty within any category.
10 changes: 10 additions & 0 deletions packages/rainbowkit/src/wallets/connectorsForWallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ export const connectorsForWallets = (
appIcon,
}: ConnectorsForWalletsParameters,
): CreateConnectorFn[] => {
if (!walletList.length) {
throw new Error('No wallet list was provided');
}

for (const { wallets, groupName } of walletList) {
if (!wallets.length) {
throw new Error(`No wallets provided for group: ${groupName}`);
}
}

let index = -1;

const connectors: CreateConnectorFn[] = [];
Expand Down

0 comments on commit 1a0f209

Please sign in to comment.