> For the complete documentation index, see [llms.txt](/llms.txt).

# MetaMask Connect Solana methods

MetaMask Connect Solana (`@metamask/connect-solana`) exposes several methods, including:

- [createSolanaClient](#createsolanaclient) to initialize the client and automatically register the wallet for compatibility with the Solana Wallet Adapter ecosystem.
- [getInfuraRpcUrls](#getinfurarpcurls) to generate Infura RPC endpoints for Solana networks.
- [getWallet](#getwallet) to access [Wallet Standard features](#supported-wallet-standard-features) (`signTransaction`, `signAndSendTransaction`, `signMessage`).

The client wraps `@metamask/connect-multichain` and handles wallet discovery and session management automatically.

## `createSolanaClient`[​](#createsolanaclient "Direct link to createsolanaclient")

Creates a new Solana client instance. By default, the wallet is automatically registered with the Wallet Standard registry on creation, making MetaMask discoverable by Solana dapps and wallet adapters.

Under the hood, `createSolanaClient` delegates to [createMultichainClient](/metamask-connect/multichain/reference/methods/#createmultichainclient), which is a singleton. Calling `createSolanaClient` multiple times returns the same underlying multichain core and session.

### Parameters[​](#parameters "Direct link to Parameters")

See [SolanaConnectOptions](#solanaconnectoptions).

### Returns[​](#returns "Direct link to Returns")

A promise that resolves to a [SolanaClient](#solanaclient) instance. The client is a singleton; calling `createSolanaClient` again returns the same instance.

### Example[​](#example "Direct link to Example")

```
import { createSolanaClient, getInfuraRpcUrls } from '@metamask/connect-solana'

const client = await createSolanaClient({
  dapp: {
    name: 'My Solana Dapp',
    url: 'https://mydapp.com',
  },
  api: {
    supportedNetworks: getInfuraRpcUrls({
      infuraApiKey: 'YOUR_INFURA_API_KEY',
      networks: ['mainnet', 'devnet'],
    }),
  },
})

```

## `getInfuraRpcUrls`[​](#getinfurarpcurls "Direct link to getinfurarpcurls")

Generates Solana Infura RPC URLs keyed by network name. The returned map can be passed directly to `createSolanaClient({ api: { supportedNetworks } })`.

Under the hood, this delegates to the [multichain getInfuraRpcUrls](/metamask-connect/multichain/reference/methods/#getinfurarpcurls), which maps CAIP-2 chain IDs to Infura endpoints, then translates the result back to Solana network names.

note

Each chain must be activated in your [Infura dashboard](https://app.infura.io/) before `getInfuraRpcUrls` can generate working URLs for it.

### Parameters[​](#parameters-1 "Direct link to Parameters")

| Name         | Type            | Required | Description                                                      |
| ------------ | --------------- | -------- | ---------------------------------------------------------------- |
| infuraApiKey | string          | Yes      | Your Infura API key.                                             |
| networks     | SolanaNetwork[] | Yes      | Solana networks to include (for example, ['mainnet', 'devnet']). |

### Returns[​](#returns-1 "Direct link to Returns")

[SolanaSupportedNetworks](#solanasupportednetworks), a map of network names to Infura RPC URLs.

### Example[​](#example-1 "Direct link to Example")

```
import { createSolanaClient, getInfuraRpcUrls } from '@metamask/connect-solana'

// Each chain must be active in your Infura dashboard
const supportedNetworks = getInfuraRpcUrls({
  infuraApiKey: 'YOUR_INFURA_API_KEY',
  networks: ['mainnet', 'devnet'],
})
// {
//   mainnet: 'https://solana-mainnet.infura.io/v3/YOUR_INFURA_API_KEY',
//   devnet: 'https://solana-devnet.infura.io/v3/YOUR_INFURA_API_KEY',
// }

const client = await createSolanaClient({
  dapp: { name: 'My Solana Dapp', url: 'https://mydapp.com' },
  api: { supportedNetworks },
})

```

## `getWallet`[​](#getwallet "Direct link to getwallet")

Returns a Wallet Standard compatible MetaMask wallet instance. Use this to access wallet features directly outside of the Solana Wallet Adapter.

### Returns[​](#returns-2 "Direct link to Returns")

A Wallet Standard `Wallet` object.

### Example[​](#example-2 "Direct link to Example")

```
const wallet = client.getWallet()
console.log('Wallet name:', wallet.name)

```

## `registerWallet`[​](#registerwallet "Direct link to registerwallet")

Registers the MetaMask wallet with the Wallet Standard registry, making it automatically discoverable by Solana dapps. This is a no-op if the wallet was already auto-registered during creation (that is, `skipAutoRegister` was not set to `true`).

### Returns[​](#returns-3 "Direct link to Returns")

A promise that resolves when registration is complete.

### Example[​](#example-3 "Direct link to Example")

```
const client = await createSolanaClient({
  dapp: { name: 'My Solana Dapp', url: 'https://mydapp.com' },
  skipAutoRegister: true,
})

// Register manually when ready
await client.registerWallet()

```

## `disconnect`[​](#disconnect "Direct link to disconnect")

Disconnects all Solana scopes from MetaMask. This only revokes the Solana-specific scopes:

- `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` (mainnet)
- `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1` (devnet)
- `solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z` (testnet)

It does not terminate the broader multichain session if non-Solana scopes (such as EVM) are also active.

### Returns[​](#returns-4 "Direct link to Returns")

A promise that resolves when the disconnect is complete.

### Example[​](#example-4 "Direct link to Example")

```
await client.disconnect()

```

## Properties[​](#properties "Direct link to Properties")

| Property | Type           | Description                             |
| -------- | -------------- | --------------------------------------- |
| core     | MultichainCore | The underlying MultichainCore instance. |

The `core` property exposes the full multichain client, giving access to lower-level methods such as [connect](/metamask-connect/multichain/reference/methods/#connect), [getSession](/metamask-connect/multichain/reference/methods/#getsession), [invokeMethod](/metamask-connect/multichain/reference/methods/#invokemethod), [on](/metamask-connect/multichain/reference/methods/#on), and [off](/metamask-connect/multichain/reference/methods/#off).

### Example[​](#example-5 "Direct link to Example")

```
const session = await client.core.getSession()
const solAccounts = session.sessionScopes['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp']?.accounts || []
console.log('Solana accounts:', solAccounts)

```

## Supported Wallet Standard features[​](#supported-wallet-standard-features "Direct link to Supported Wallet Standard features")

The wallet returned by [getWallet](#getwallet) implements the following [Wallet Standard](https://github.com/wallet-standard/wallet-standard) features. Access them via `wallet.features['<feature>']`.

| Feature                       | Description                                            |
| ----------------------------- | ------------------------------------------------------ |
| standard:connect              | Connect to the wallet and receive the user's accounts. |
| standard:disconnect           | Disconnect from the wallet.                            |
| standard:events               | Subscribe to account and chain change events.          |
| solana:signMessage            | Sign an arbitrary message (returns a signature).       |
| solana:signTransaction        | Sign a transaction without broadcasting it.            |
| solana:signAndSendTransaction | Sign a transaction and broadcast it to the network.    |

### Example[​](#example-6 "Direct link to Example")

```
const wallet = client.getWallet()

const { accounts } = await wallet.features['standard:connect'].connect()

const message = new TextEncoder().encode('Hello Solana')
const [{ signature }] = await wallet.features['solana:signMessage'].signMessage({
  account: accounts[0],
  message,
})

```

## Types[​](#types "Direct link to Types")

### `SolanaNetwork`[​](#solananetwork "Direct link to solananetwork")

```
type SolanaNetwork = 'mainnet' | 'devnet' | 'testnet'

```

### `SolanaSupportedNetworks`[​](#solanasupportednetworks "Direct link to solanasupportednetworks")

A partial record mapping [SolanaNetwork](#solananetwork) names to RPC URL strings.

```
type SolanaSupportedNetworks = Partial<Record<SolanaNetwork, string>>

```

### `SolanaConnectOptions`[​](#solanaconnectoptions "Direct link to solanaconnectoptions")

Configuration options passed to [createSolanaClient](#createsolanaclient).

| Field                 | Type                    | Required | Description                                                                |
| --------------------- | ----------------------- | -------- | -------------------------------------------------------------------------- |
| dapp                  | object                  | Yes      | Dapp identification and branding settings.                                 |
| dapp.name             | string                  | Yes      | Name of your dapp.                                                         |
| dapp.url              | string                  | No       | URL of your dapp.                                                          |
| dapp.iconUrl          | string                  | No       | URL of your dapp icon.                                                     |
| api                   | object                  | No       | Optional API configuration.                                                |
| api.supportedNetworks | SolanaSupportedNetworks | No       | Map of network names (mainnet, devnet, testnet) to RPC URLs.               |
| debug                 | boolean                 | No       | Reserved for future use; not currently forwarded to the underlying client. |
| skipAutoRegister      | boolean                 | No       | Skips auto-registering the wallet during creation. The default is false.   |

note

`createSolanaClient` does not accept `eventHandlers`. To listen for lower-level multichain events (such as session changes), use `client.core.on` after creating the client. See the [multichain event methods](/metamask-connect/multichain/reference/methods/#on).

### `SolanaClient`[​](#solanaclient "Direct link to solanaclient")

The object returned by [createSolanaClient](#createsolanaclient).

| Property / Method | Type                | Description                                                    |
| ----------------- | ------------------- | -------------------------------------------------------------- |
| core              | MultichainCore      | The underlying MultichainCore instance.                        |
| getWallet         | () => Wallet        | Returns a Wallet Standard compatible MetaMask wallet instance. |
| registerWallet    | () => Promise<void> | Registers MetaMask with the Wallet Standard registry.          |
| disconnect        | () => Promise<void> | Disconnects all Solana scopes from MetaMask.                   |

## Next steps[​](#next-steps "Direct link to Next steps")

- Follow the [JavaScript quickstart](/metamask-connect/solana/quickstart/javascript/) to set up MetaMask Connect Solana in a dapp.
- [Send a legacy transaction](/metamask-connect/solana/guides/send-transactions/legacy/) using the `signAndSendTransaction` Wallet Standard feature.
- [Sign messages](/metamask-connect/solana/guides/sign-data/sign-message/) using the `signMessage` Wallet Standard feature.
- See the [multichain methods](/metamask-connect/multichain/reference/methods/) for the lower-level multichain client API.
