-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix: argent mobile connector based on in app browser #119
Conversation
src/connectors/argentMobile/index.ts
Outdated
export class ArgentMobileConnector { | ||
static init(options: ArgentMobileConnectorOptions = {}) { | ||
if (isInArgentMobileAppBrowser()) { | ||
return new InjectedConnector({ options: { id: "argentX" } }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we also configure name and icon in the options here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, will add tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, simple change, big benefit 👍
What is the issue that this is fixing? |
@@ -1,6 +1,10 @@ | |||
import type { StarknetWindowObject } from "@starknet-io/types-js" | |||
|
|||
export const isInArgentMobileAppBrowser = (): boolean => { | |||
if (typeof window === "undefined") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent ssr errors
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👌
Issue / feature description
Many dapps don’t support in-app browser properly and add Mobile connector instead which makes for poor experience.
Changes
When the dapp would want to create mobile connector, we could check if it’s in app browser, and return the standard connector instead.
ArgentMobileBaseConnector
ArgentMobileConnector
now provide a static method to instantiate the right connectorChecklist
Please keep your pull request as small as possible. If you need to make multiple changes, please create separate pull requests for each change. Create a draft pull request if you need early feedback. This will mark the pull request as a work in progress and prevent it from being reviewed or merged until you are ready.
Please move drafts to the ready for review (regular PR) when you are ready to start the review process and other developers will pick it up from there.