Introduction

We covered what a wallet in general looks like in the Accessing Wallets section and then what a wallet connector looks like in the Interacting With Wallets section. However, the wallet connector looks slightly different when dealing with Solana. Specifically, there are some methods available for Solana embedded wallets which are not available for Solana branded wallets i.e. Backpack.

Solana Wallet Connector

The connector for Solana wallets will generally have a couple of extra fields. Specifically, in order to interact using public actions with Solana, you can use a “connection”, and so we have a field on the connector called “Connection”:

import { Connection } from '@solana/web3.js';

const connection = await (
    primaryWallet as any
).connector.getPublicClient<Connection | undefined>();

This class will be an instance of the Solana connection class, which you can use to interact with the Solana network. Read more: https://solana-labs.github.io/solana-web3.js/classes/Connection.html

Typescript

There are different types for the different kinds of signer that you can get from the wallet connector including ISolana, ISolanaSigner, IBackpackSolanaSigner and IEmbeddedWalletSolanaSigner. Learn how to use each one in the example.

Examples

You can find examples of how to interact with Solana wallets in the examples section: