> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reown.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Solana

> Solana JSON-RPC Methods

## solana\_getAccounts

This method returns an Array of public keys available to sign from the wallet.

### Parameters

none

### Returns

`Array` - Array of accounts:

* `Object` :
  * `pubkey` : `String` - public key for keypair

### Example

```typescript theme={null}
// Request
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "solana_getAccounts",
  "params": {}
}

// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [{ "pubkey": "722RdWmHC5TGXBjTejzNjbc8xEiduVDLqZvoUGz6Xzbp" }]
}
```

## solana\_requestAccounts

This method returns an Array of public keys available to sign from the wallet.

### Parameters

none

### Returns

`Array` - Array of accounts:

* `Object` :
  * `pubkey` : `String` - public key for keypair

### Example

```typescript theme={null}
// Request
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "solana_getAccounts",
  "params": {}
}

// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [{ "pubkey": "722RdWmHC5TGXBjTejzNjbc8xEiduVDLqZvoUGz6Xzbp" }]
}
```

## solana\_signMessage

This method returns a signature for the provided message from the requested signer address.

### Parameters

`Object` - Signing parameters:

* `message` : `String` - the message to be signed (base58 encoded)
* `pubkey` : `String` - public key of the signer

### Returns

`Object`:

* `signature` : `String` - corresponding signature for signed message

### Example

```javascript theme={null}
// Request
{
	"id": 1,
	"jsonrpc": "2.0",
	"method": "solana_signMessage",
	"params": {
		"message": "37u9WtQpcm6ULa3VtWDFAWoQc1hUvybPrA3dtx99tgHvvcE7pKRZjuGmn7VX2tC3JmYDYGG7",
		"pubkey": "AqP3MyNwDP4L1GJKYhzmaAUdrjzpqJUZjahM7kHpgavm"
	}
}

// Result
{
	"id": 1,
	"jsonrpc": "2.0",
	"result":  { signature: "2Lb1KQHWfbV3pWMqXZveFWqneSyhH95YsgCENRWnArSkLydjN1M42oB82zSd6BBdGkM9pE6sQLQf1gyBh8KWM2c4" }
}
```

## solana\_signTransaction

This method returns a signature over the provided instructions by the targeted public key.

<Warning>
  **WARNING**:

  Refer always to `transaction` param.
  The deprecated parameters are not compatible with versioned transactions.
</Warning>

### Parameters

`Object` - Signing parameters:<br />

* `transaction` : `String` - base64-encoded serialized transaction<br />
* **\[deprecated]** `feePayer` : `String | undefined` - public key of the transaction fee payer<br />
* **\[deprecated]** `instructions` : `Array` of `Object` or `undefined` - instructions to be atomically executed:<br />
   - `Object` - instruction<br />
   - `programId` : `String` - public key of the on chain program<br />
   - `data` : `String | undefined` - encoded calldata for instruction<br />
   - `keys` : `Array` of `Object` - account metadata used to define instructions<br />
    - `Object` - key<br />
     - `isSigner` : `Boolean` - true if an instruction requires a transaction signature matching `pubkey`<br />
     - `isWritable` : `Boolean` - true if the `pubkey` can be loaded as a read-write account<br />
     - `pubkey` : `String` - public key of authorized program<br />
* **\[deprecated]** `recentBlockhash` : `String | undefined` - a recent blockhash<br />
* **\[deprecated]** `signatures` : `Array` of `Object` or `undefined` - (optional) previous partial signatures for this instruction set<br />
   - `Object` - partial signature<br />
   - `pubkey` : `String` - pubkey of the signer<br />
   - `signature` : `String` - signature matching `pubkey`<br />

### Returns

`Object`:

* `signature`: `String` - corresponding signature for signed instructions
* `transaction`?: `String | undefined` - optional: base64-encoded serialized transaction

### Example

```typescript theme={null}
// Request
{
	"id": 1,
	"jsonrpc": "2.0",
	"method": "solana_signTransaction",
	"params": {
		"feePayer": "AqP3MyNwDP4L1GJKYhzmaAUdrjzpqJUZjahM7kHpgavm",
		"instructions": [{
			"programId": "Vote111111111111111111111111111111111111111",
			"data": "37u9WtQpcm6ULa3VtWDFAWoQc1hUvybPrA3dtx99tgHvvcE7pKRZjuGmn7VX2tC3JmYDYGG7",
			"keys": [{
				"isSigner": true,
				"isWritable": true,
				"pubkey": "AqP3MyNwDP4L1GJKYhzmaAUdrjzpqJUZjahM7kHpgavm"
			}]
		}],
		"recentBlockhash": "2bUz6wu3axM8cDDncLB5chWuZaoscSjnoMD2nVvC1swe",
		"signatures": [{
			"pubkey": "AqP3MyNwDP4L1GJKYhzmaAUdrjzpqJUZjahM7kHpgavm",
			"signature": "2Lb1KQHWfbV3pWMqXZveFWqneSyhH95YsgCENRWnArSkLydjN1M42oB82zSd6BBdGkM9pE6sQLQf1gyBh8KWM2c4"
		}],
    "transaction": "r32f2..FD33r"
	}
}

// Result
{
	"id": 1,
	"jsonrpc": "2.0",
	"result":  { signature: "2Lb1KQHWfbV3pWMqXZveFWqneSyhH95YsgCENRWnArSkLydjN1M42oB82zSd6BBdGkM9pE6sQLQf1gyBh8KWM2c4" }
}
```

## solana\_signAllTransactions

This method is responsible for signing a list of transactions. The wallet must sign all transactions and return the signed transactions in the same order as received. Wallets must sign all transactions or return an error if it is not possible to sign any of them.

### Parameters

`Object` - Signing parameters:

* `transactions` : `String[]` - base64-encoded serialized list of transactions<br />

### Returns

`Object`:

* `transactions` : `String[]` - base64-encoded serialized list of signed transactions in the same order as received<br />

### Example

```typescript theme={null}
// Request
{
	"id": 1,
	"jsonrpc": "2.0",
	"method": "solana_signAllTransactions",
	"params": {
    "transactions": string[]
	}
}

// Response
{
	"id": 1,
	"jsonrpc": "2.0",
	"result":  {
	  "transactions": string[]
	}
}
```

## solana\_signAndSendTransaction

This method is responsible for signing and sending a transaction to the Solana network. The wallet must sent the transaction and return the signature that can be used as a transaction id.

### Parameters

`Object` - transaction and options:<br />

* `transaction` : `String` - the whole transaction serialized and encoded with base64<br />
* `sendOptions` : `Object` - options for sending the transaction<br />
  * `skipPreflight` : `Boolean` - skip preflight checks<br />
  * `preflightCommitment` : `'processed' | 'confirmed' | 'finalized' | 'recent' | 'single' | 'singleGossip' | 'root' | 'max'` - preflight commitment level<br />
  * `maxRetries` : `Number` - maximum number of retries<br />
  * `minContextSlot` : `Number` - minimum context slot<br />

### Returns

`Object`:

* `signature` : `String`, - the signature of the transaction encoded with base58 used as transaction id<br />

### Example

```typescript theme={null}
// Request
{
	"id": 1,
	"jsonrpc": "2.0",
	"method": "solana_signAndSendTransaction",
	"params": {
    "transaction": string,
    "sendOptions": {
	    "skipPreflight"?: boolean,
	    "preflightCommitment"?: 'processed' | 'confirmed' | 'finalized' | 'recent' | 'single' | 'singleGossip' | 'root' | 'max',
	    "maxRetries"?: number,
	    "minContextSlot"?: number,
    }
	}
}

// Response
{
	"id": 1,
	"jsonrpc": "2.0",
	"result":  {
	  "signature": string
	}
}
```
