Skip to content

feat(checkout): Surface instructions to fix an invalid passport provider parameter #2569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zaidarain1
Copy link
Contributor

No description provided.

@zaidarain1 zaidarain1 self-assigned this Mar 4, 2025
@zaidarain1 zaidarain1 requested a review from a team as a code owner March 4, 2025 05:52
Copy link

nx-cloud bot commented Mar 4, 2025

View your CI Pipeline Execution ↗ for commit 4c578c8.

Command Status Duration Result
nx affected -t build,lint,test ✅ Succeeded 1m 7s View ↗
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-03-05 23:27:46 UTC

@zaidarain1 zaidarain1 added this pull request to the merge queue Mar 4, 2025
@@ -1218,6 +1218,11 @@
"body": "Check your wallet and try again, or close and try a different option",
"actionButtonText": "Try again"
},
"passportProviderError": {
"heading": "Unable to connect",
"body": "Have you called `await passport.connectEvm()` to initialize the passport provider?",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think this should ever be exposed to the user

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this

}
}
} catch (err: any) {
if (
isError(err, 'INVALID_ARGUMENT')
&& err.message.includes('value={ "ethereumProvider": { "isPassport": true } }')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right place to handle this. We should be a level deeper, perhaps in the checkout.connect call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can only call it here. The checkout.connect call won't pick up on this error. The only option we have for going deeper is in the WrappedBrowserProvider class constructor, however that will preemptively show the error, before a user clicks on passport.

I've also updated the implementation to just a console.error with instructions, similar to what we do for useProvidersContext in widgets-lib

@zaidarain1 zaidarain1 removed this pull request from the merge queue due to a manual request Mar 4, 2025
@zaidarain1 zaidarain1 force-pushed the feat/display-checkout-passport-error branch from c74fae0 to 540427c Compare March 5, 2025 00:00
@zaidarain1 zaidarain1 requested a review from a team as a code owner March 5, 2025 00:20
@zaidarain1 zaidarain1 force-pushed the feat/display-checkout-passport-error branch from f54c551 to 4c578c8 Compare March 5, 2025 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants