Skip to content

Conversation

@fish-yan
Copy link

fix method

export function tryGetWindowKeys(): string[] {
    const window = getWindow();
    if (!window) {
        return [];
    }

    try {
        return Object.keys(window);
    } catch {
        return [];
    }
}

to

export function tryGetWindowKeys(): [string, any][] {
    const window = getWindow();
    if (!window) {
        return [];
    }

    try {
        return Object.entries(window);
    } catch {
        return [];
    }
}

in injected-provider.ts file
windowKeys is to get the keys and entries of the window.

export class InjectedProvider<T extends string = string> implements InternalProvider {

    ...

    public static getCurrentlyInjectedWallets(): WalletInfoCurrentlyInjected[] {
        if (!this.window) {
            return [];
        }

        const windowKeys = tryGetWindowKeys();
        const wallets = windowKeys.filter(([_, value]) =>
            isJSBridgeWithMetadata(value)
        ) as unknown as [string, { tonconnect: InjectedWalletApi }][];

    ...

}

@MrG9090
Copy link

MrG9090 commented Jun 27, 2025

.

@XantreDev
Copy link

@thekiba Will it be fixed? It's an obvious bug that is there for at least two years

@Lapo4kaKek
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants