diff --git a/src/connectors/argentMobile/modal/index.ts b/src/connectors/argentMobile/modal/index.ts index ac56043..35231f9 100644 --- a/src/connectors/argentMobile/modal/index.ts +++ b/src/connectors/argentMobile/modal/index.ts @@ -1,4 +1,7 @@ -import type { StarknetWindowObject } from "get-starknet-core" +import type { + StarknetWindowObject, + ConnectedStarknetWindowObject, +} from "get-starknet-core" import { login } from "./login" import type { IArgentLoginOptions } from "./login" @@ -8,4 +11,4 @@ export type { StarknetWindowObject, IArgentLoginOptions } export const getStarknetWindowObject = async ( options: IArgentLoginOptions, -): Promise => login(options, StarknetAdapter) +): Promise => login(options, StarknetAdapter) diff --git a/src/connectors/argentMobile/modal/login.ts b/src/connectors/argentMobile/modal/login.ts index f0e5f54..77be181 100644 --- a/src/connectors/argentMobile/modal/login.ts +++ b/src/connectors/argentMobile/modal/login.ts @@ -8,6 +8,7 @@ const Network: typeof constants.NetworkName = constants.NetworkName import type { NamespaceAdapter, NamespaceAdapterOptions } from "./adapter" import { argentModal } from "./argentModal" +import { resetWalletConnect } from "../../../helpers/resetWalletConnect" export interface IArgentLoginOptions { projectId?: string @@ -79,6 +80,10 @@ export const login = async ( } const params = { requiredNamespaces: adapter.getRequiredNamespaces() } + + resetWalletConnect() + // wait for cookies to be removed and reset the websocket for walletconnect + await new Promise((resolve) => setTimeout(resolve, 200)) const { uri, approval } = await client.connect(params) // Open QRCode modal if a URI was returned (i.e. we're not connecting an existing pairing). diff --git a/src/connectors/argentMobile/modal/starknet/adapter.ts b/src/connectors/argentMobile/modal/starknet/adapter.ts index f16d7d9..39366e0 100644 --- a/src/connectors/argentMobile/modal/starknet/adapter.ts +++ b/src/connectors/argentMobile/modal/starknet/adapter.ts @@ -126,8 +126,9 @@ export class StarknetAdapter // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - get isConnected(): boolean { - return this.signerConnection.connected + get isConnected(): true { + // needed to be implemented returning true since it's implementing ConnectedStarknetWindowObject + return true } async isPreauthorized(): Promise {