Constructors

Methods

  • Attempts to connect to IMX silently without user interaction.

    Returns Promise<null | IMXProvider>

    A promise that resolves to an IMX provider if successful, or null if no cached session exists

    The method login with an argument of { useCachedSession: true } should be used in conjunction with connectImx instead

  • Connects to IMX, prompting user interaction if necessary.

    Returns Promise<IMXProvider>

    A promise that resolves to an IMX provider

  • Connects to EVM and optionally announces the provider. Uses: Auth + Wallet packages

    Parameters

    Returns Promise<ZkEvmProvider>

    The EVM provider instance

  • Logs in the user (works for both zkEVM and IMX). Uses: Auth class

    Parameters

    Returns Promise<null | UserProfile>

    A promise that resolves to the user profile if logged in, null otherwise

    If retrieving the cached user session fails (except for "Unknown or invalid refresh token" errors) and useCachedSession is true

  • Handles the login callback from the authentication service. Uses: Auth class

    Returns Promise<void>

    A promise that resolves when the login callback is handled

  • Logs out the user (works for both zkEVM and IMX). Uses: Auth class

    Returns Promise<void>

    A promise that resolves when the user is logged out

  • Retrieves the current user's information. Uses: Auth class

    Returns Promise<undefined | UserProfile>

    A promise that resolves to the user profile if logged in, undefined otherwise

  • Retrieves the ID token.

    Returns Promise<undefined | string>

    A promise that resolves to the ID token if available, undefined otherwise

  • Retrieves the access token.

    Returns Promise<undefined | string>

    A promise that resolves to the access token if available, undefined otherwise

  • Retrieves the PKCE authorization URL for the login flow. Uses: Auth class

    Parameters

    • OptionaldirectLoginOptions: DirectLoginOptions

      Optional direct login options

    • OptionalimPassportTraceId: string

      Optional trace ID

    Returns Promise<string>

    A promise that resolves to the authorization URL

  • Handles the PKCE login callback. Uses: Auth class

    Parameters

    • authorizationCode: string

      The authorization code from the OAuth provider

    • state: string

      The state parameter for CSRF protection

    Returns Promise<UserProfile>

    A promise that resolves to the user profile

  • Stores the provided tokens and retrieves the user profile. Uses: Auth class

    Parameters

    Returns Promise<UserProfile>

    A promise that resolves to the user profile

  • Retrieves the logout URL.

    Returns Promise<undefined | string>

    A promise that resolves to the logout URL, or undefined if not available

  • Handles the silent logout callback.

    Parameters

    • url: string

      The URL containing the logout information

    Returns Promise<void>

    A promise that resolves when the silent logout callback is handled

  • Retrieves the addresses linked to the current user's account.

    Returns Promise<string[]>

    A promise that resolves to an array of linked addresses

  • Links an external wallet to the user's Passport account.

    Parameters

    Returns Promise<LinkedWallet>

    A promise that resolves to the linked wallet information

    If the user is not logged in (NOT_LOGGED_IN_ERROR)

    • If the user is not registered with StarkEx (USER_NOT_REGISTERED_ERROR)
    • If the wallet is already linked (LINK_WALLET_ALREADY_LINKED_ERROR)
    • If the maximum number of wallets are linked (LINK_WALLET_MAX_WALLETS_LINKED_ERROR)
    • Duplicate nonce used (LINK_WALLET_DUPLICATE_NONCE_ERROR)
    • Validation fails (LINK_WALLET_VALIDATION_ERROR)
    • Other generic errors (LINK_WALLET_GENERIC_ERROR)