Closed steveluscher closed 2 months ago
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @steveluscher and the rest of your teammates on Graphite
Would it make sense to separate the
WalletHandle
concept fromwallet-standard/react
…
Oh, yes. That's the idea. I guess I need to evict this stuff into some other package and then either drop the INTERNAL_ONLY
suffixes, or add DO_NOT_USE_OR_YOU_WILL_BE_FIRED
to every one.
Oh boy.
In this PR we introduce types to represent Wallet Standard wallets and accounts that are specifically designed for use in UI applications. UI developers can treat these like immutable data structures:
UiWallet
orUiWalletAccount
objects that are referentially equal can be understood not to have changed over time (ie. all of the accounts, chains, and features are the same)At the same time, we maintain weak references between every instance of
UiWallet
and the underlyingWallet
, andUiWalletAccount
and the underlyingUiWalletAccount
such that the underlying wallet can be accessed by any (internal) method that needs it.In subsequent PRs in this stack you will find hooks that materialize the concrete implementation of a feature belonging to a
UiWallet
(eg.standard:connect
) by following the weak reference between aUiWallet
and its underlyingWallet
, then binding a callback to the relevantfeature
.To understand more about how this registry is used, see https://app.graphite.dev/github/pr/anza-xyz/wallet-standard/53, https://app.graphite.dev/github/pr/anza-xyz/wallet-standard/54, and https://app.graphite.dev/github/pr/anza-xyz/wallet-standard/55.