-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ import { | |
} from "../connector" | ||
import { DEFAULT_ARGENT_MOBILE_ICON, DEFAULT_PROJECT_ID } from "./constants" | ||
import type { StarknetAdapter } from "./modal/starknet/adapter" | ||
import { isInArgentMobileAppBrowser } from "./helpers" | ||
import { InjectedConnector } from "../injected" | ||
|
||
export interface ArgentMobileConnectorOptions { | ||
dappName?: string | ||
|
@@ -40,7 +42,7 @@ export interface ArgentMobileConnectorOptions { | |
rpcUrl?: string | ||
} | ||
|
||
export class ArgentMobileConnector extends Connector { | ||
export class ArgentMobileBaseConnector extends Connector { | ||
private _wallet: StarknetWindowObject | null = null | ||
private _options: ArgentMobileConnectorOptions | ||
|
||
|
@@ -242,4 +244,14 @@ export class ArgentMobileConnector extends Connector { | |
} | ||
} | ||
|
||
export { isInArgentMobileAppBrowser } from "./helpers" | ||
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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
} else { | ||
return new ArgentMobileBaseConnector(options) | ||
} | ||
} | ||
} | ||
|
||
export { isInArgentMobileAppBrowser } |
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