# Solana

## Wallet Connect Supported

Reffer to  [Wallect Connect Solana doc](https://docs.walletconnect.com/advanced/multichain/rpc-reference/solana-rpc)

## Detecting the Provider

ioPay's mobile in-app browser will both inject a ioPay object into the window of any web application the user visits. ioPay will not inject the provider into iframes or sites using http\://.

If a `ioPay` object exists, Bitcoin & Ordinals dApps can interact with ioPay via the API found at `window.ioPay.solana`. To detect if ioPay is installed, an application should check for an additional `isIoPay` flag like so:

&#x20; *`const isIoPayInstalled = window?.ioPay?.bitcoin?.isIoPay`*&#x20;

## Sending a Legacy Transaction

### Method

***signAndSendTransaction***

#### Returns:

* `Promise` - `{'signature': obj, ...}` : A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for an object containing the `signature`

#### Example:

<pre><code>const provider = getProvider(); // see "Detecting the Provider"
const transaction = new Transaction();
const { signature } = await provider.signAndSendTransaction(transaction);
<strong>
</strong>// check transaction status
const network = "&#x3C;NETWORK_URL>";
const connection = new Connection(network);
await connection.getSignatureStatus(signature);
</code></pre>

### Method

***signTransaction -*** Signing a transaction without sending

#### Returns:

* `Promise`  : A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for the signed transaction

#### Example:

```
const provider = getProvider();
const transaction = new Transaction();
const signedTransaction = await provider.signTransaction(transaction);

// After the transaction has been signed, an application may submit the transaction itself via web3js
const network = "<NETWORK_URL>";
const connection = new Connection(network);
const signature = await connection.sendRawTransaction(signedTransaction.serialize());
```

## Sending a Versioned Transaction

### Method

***signAndSendTransaction***

#### Returns:

* `Promise`  : A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for the signed transaction

#### Example:

```
// The following example show how to build a simple transfer instruction.
const instructions = [
  SystemProgram.transfer({
    fromPubkey: publicKey,
    toPubkey: publicKey,
    lamports: 10,
  }),
];

// create v0 compatible message
const messageV0 = new TransactionMessage({
  payerKey: publicKey,
  recentBlockhash: blockhash,
  instructions,
}).compileToV0Message();
```

```
const provider = getProvider();

// make a versioned transaction
const transactionV0 = new VersionedTransaction(messageV0);
const { signature } = await provider.signAndSendTransaction(transactionV0);

// check transaction status
const network = "<NETWORK_URL>";
const connection = new Connection(network);
await connection.getSignatureStatus(signature);
```

### Signing a Message

### Method

***signMessage -*** Send a message for the user to sign, request that the encoded message is signed via the user's ioPay wallet

#### Returns:

* `Promise`  - String&#x20;

#### Example:

```
const provider = getProvider(); // see "Detecting the Provider"
const message = `Welcome to XXXXX`;
const encodedMessage = new TextEncoder().encode(message);
const signedMessage = await provider.signMessage(encodedMessage, "utf8")
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.iopay.me/solana.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
