File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
packages/thirdweb/src/wallets/in-app/core/wallet Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -140,12 +140,26 @@ export function createInAppWallet(args: {
140140 const ecosystemOptions = await getEcosystemInfo ( ecosystem . id ) ;
141141 const smartAccountOptions = ecosystemOptions ?. smartAccountOptions ;
142142 if ( smartAccountOptions ) {
143- const preferredChain = options . chain ;
144- if ( ! preferredChain ) {
143+ const defaultChainId =
144+ ecosystemOptions . smartAccountOptions . chainIds [ 0 ] ;
145+ if ( ! defaultChainId ) {
145146 throw new Error (
146- "Chain is required for ecosystem smart accounts, pass it via connect() or via UI components " ,
147+ "No default chain ID found for ecosystem smart accounts. Please reach out to the ecosystem owner. " ,
147148 ) ;
148149 }
150+ const preferredChain =
151+ options . chain ?? getCachedChain ( defaultChainId ) ;
152+
153+ if (
154+ ! ecosystemOptions . smartAccountOptions . chainIds . includes (
155+ preferredChain ?. id ,
156+ )
157+ ) {
158+ throw new Error (
159+ `Chain ID ${ preferredChain . id } is not supported for ecosystem smart accounts, pass it via connect() or via UI components` ,
160+ ) ;
161+ }
162+
149163 createOptions = {
150164 ...createOptions ,
151165 smartAccount : {
You can’t perform that action at this time.
0 commit comments