> For the complete documentation index, see [llms.txt](https://docs.tomo.inc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tomo.inc/tomo-sdk/tomo-telegram-sdk/wallet-provider/solana-provider.md).

# Solana Provider

The Tomo Telegram SDK provides a Solana Provider for querying and sending SOL and SPL tokens.&#x20;

```typescript
// get provider 
const sol = window.tomo_sol;
```

## Connect with the Wallet[​](https://docs.uxuy.com/uxuy-connect/guide/#isconnected) <a href="#isconnected" id="isconnected"></a>

Before using the provider, the user needs to log in to the wallet through the modal by following the method:

```typescript
// connect wallet
await sol?.connectWallet();
```

## Query Methods

Solana providers support two query methods:

* `getAddress`
* `getBalance`

<pre class="language-typescript"><code class="lang-typescript"><strong>const address = sol.getAddress();
</strong>const balance = await sol.getBalance(address);
</code></pre>

## Signing Methods

In Solana providers, we provide four signing methods:

* `signMessage`
* `signTransaction`
* `signTransactions`
* `signTokenTransaction`

### Sign message

`signMessage` the method will create an offchain signature for one message and return the signed transaction in hex.

```typescript
 const response = await sol.signMessage(signMsg);
```

To verify the signature, you need to add the header "\xffsolana offchain" before the \`signMsg\`

### SOL transfer transaction

`signTransaction` is typically used to send SOL to another address and return the signed transaction. You can also use `signTransactions` it to pass an array of transactions for signing.

```typescript
const response = await sol.signTransaction({
  from: 8y9wmwVhban5Mrp8j68fQv1Kceeifeowt5Yw1DjwXoxk,
  to: 646rZ228LDcYecNvoBGNysJ9pGLc7gBeTrnSgZ476rBp,
  value: 0.01,
});
```

### SPL token transaction

and `signTokenTransaction` supports signing transactions for sending SPL tokens. You need to provide a mint address for this transaction.

```typescript
const response = await sol.signTokenTransaction({
  from: '8y9wmwVhban5Mrp8j68fQv1Kceeifeowt5Yw1DjwXoxk',
  to: '646rZ228LDcYecNvoBGNysJ9pGLc7gBeTrnSgZ476rBp',
  value: val,
  chainId: 501,
  contract: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
});
```

## Sending Methods

After signing transactions, you can use `sendTransaction` it to send the transaction. The return value is the transaction hash:

```typescript
const res = await sol.sendTransaction(response);
```
