anza-xyz / wallet-standard

Solana extensions to the Wallet Standard.
Apache License 2.0
79 stars 42 forks source link

Add a compatibility package to allow registering legacy wallet adapters as standard wallets #42

Open wjthieme opened 7 months ago

wjthieme commented 7 months ago

This is an example implementation of an Adapter wrapper that conforms to Wallet. This allows registering any Adapter from @solana/wallet-adapter-wallets in a @wallet-standard/base Wallet.

This is potentially useful in the following scenarios:

This PR merely serves as an example. There at least a few kinks that need to be worked out as well as some testing before there can be any talk about proceeding with this.

cc @jordaaash @steveluscher

wjthieme commented 5 months ago

@steveluscher thanks for the feedback!

The only other meta piece of feedback I have to offer (without actually having inspected the situation too closely) is that there's a lot of ! assertions everywhere. The target number of ! assertions, on the internet, should be zero. I have to believe that there's either something we can do to eliminate those, or worse that the presence of those is burying a bug.

Not really sure why I added all the ! assertions since they're not even doing anything (type-wise) seeing that Array[number] doesn't return x | undefined but just x. Anyway with interleaving they can be removed either way