Skip to content
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 the tryGetWindowKeys method to get the currently injected wallet #256

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/sdk/src/utils/web-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ export function getWindow(): Window | undefined {
}

/**
* The function try to get window keys, if it is not available it returns empty array.
* The function try to get window entries, if it is not available it returns empty array.
* As an example, for Safari's private mode it returns empty array, because the browser does not allow to get window keys.
*/
export function tryGetWindowKeys(): string[] {
export function tryGetWindowKeys(): [string, any][] {
const window = getWindow();
if (!window) {
return [];
}

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