ton-connect / sdk

SDK for TON Connect 2.0 — a comprehensive communication protocol between wallets and apps in TON ecosystem
Apache License 2.0
271 stars 71 forks source link

[<SDK>]: <windowKeys filter would never work> #219

Open liam-safulet opened 1 month ago

liam-safulet commented 1 month ago

Describe the bug

https://github.com/ton-connect/sdk/blob/71f287c7328b4892ff80647638dfe0386cd43d2d/packages/sdk/src/provider/injected/injected-provider.ts#L56

in this piece code,

Object.keys(window).filter(([_, value]) => {})

the value is always the 2nd letter of the key isn't it? For example the key is document, the value is o, how can it be an object as {tonconnect: xxx}. So the getCurrentlyInjectedWallets method would always return empty array

However...some wallets works good with it, I don't know what the magic behind it

Expected behavior

Object.entries(window).filter(([_, value]) => {})

Current behavior

Object.keys(window).filter(([_, value]) => {})

Steps to Reproduce

read code, and run code

Environment

node js

Additional context

No response

fish-yan commented 1 week ago

@thekiba Hope fix this bug,This bug makes it impossible to detect injected wallets.