Skip to content

Commit 82e7f02

Browse files
committed
fix(sdk): limit WC chains connected to 10 for max payload size
1 parent 895b4d1 commit 82e7f02

File tree

1 file changed

+7
-1
lines changed
  • packages/thirdweb/src/wallets/wallet-connect/receiver

1 file changed

+7
-1
lines changed

packages/thirdweb/src/wallets/wallet-connect/receiver/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,17 @@ export async function createWalletConnectClient(
161161
const {
162162
wallet,
163163
requestHandlers,
164-
chains,
165164
onConnect,
166165
onDisconnect,
167166
client: thirdwebClient,
168167
} = options;
168+
const chains = (() => {
169+
if (options.chains && options.chains.length > 10) {
170+
console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains...");
171+
return options.chains.slice(0, 10);
172+
}
173+
return options.chains;
174+
})();
169175

170176
if (walletConnectClientCache.has(thirdwebClient)) {
171177
return walletConnectClientCache.get(thirdwebClient) as WalletConnectClient;

0 commit comments

Comments
 (0)