wallet-adapter Library
The wallet-adapter library listens for events from browser wallet and dispatches events to the browser window by calling browser APIs using Rust compiled for WebAssembly.
The library is async first and uses Rust RwLock wrapped in a Rust Arc which also implement Send and Sync traits to guarantee type safety and strong consistency when used in browser background tasks. For events, async channels are also used.
It contains the following parts:
- WalletAdapter - This is a struct that combines all other components and provides methods for performing operations as specified by the wallet-standard.
- ConnectionInfo - A struct containing the connected wallet and connected account.
- Wallet - A struct describing a registered wallet. It's fields include:
- the name of the wallet
- the SemVer version of the wallet-standard supported by the wallet
- an optional icon
- the wallet accounts of a connected wallet
- the chains supported by the wallet (
solana:mainnet
,solana:devnet
,solana:testnet
andsolana:localnet
). - the features of the
wallet-standard
that the wallet supports
- Wallet Account - A struct describing a connected
Account
. Unlike the Wallet, this struct only exists if a browser wallet is connected when it performed aconnect
operation. The struct contains the:- Account Icon (Optional)
- Account Label (Optional)
- The public key in bytes
- The Base58 address of the account
- The features of the
wallet-standard
that the account supports (standard:connect
,standard-disconnect
,standard:events
,solana:signin
,solana:signMessage
,solana:signTransaction
,solana:signAndSendTransaction
).
- Wallet Storage - Where the registered wallets are stored.
- Wallet Events - Used for sending an receiving the following events:
- Connected
- Reconnected
- Disconnected
- AccountChanged
- Background Task Error
- Error Handling - Error handling enum