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

# Solana Transactions

> Correlate Solana transactions with a trace via web3.solana.addTxHint

## Overview

Mirador correlates Solana transactions to a trace by transaction **signature** — the ed25519 signature that uniquely identifies a Solana transaction (base58, \~88 chars). The Web3Plugin exposes this under its `web3.solana` namespace.

```typescript theme={null}
trace.web3.solana.addTxHint(tx.signature);
```

Unlike EVM hints, Solana hints take no chain argument. The chain identity is implicit — Solana doesn't have a numeric chain ID, and the hint is emitted on the wire as `chain_name = "solana"`. On the platform side, the hint is routed through the same correlation machinery as EVM tx hints, so Solana transactions appear inline in the trace waterfall alongside any other on-chain or off-chain activity.

<Note>
  Solana methods require the `Web3Plugin`. See [Plugins](/concepts/plugins) for setup.
</Note>

## Adding a Solana Transaction Hint

Pass the signature returned by your Solana client of choice — `@solana/web3.js`, `@solana/kit`, Anchor, Jupiter, or anything that surfaces a base58 signature string.

```typescript theme={null}
import { Connection, sendAndConfirmTransaction } from '@solana/web3.js';

const signature = await sendAndConfirmTransaction(connection, transaction, [payer]);
trace.web3.solana.addTxHint(signature);
```

### With Details

Attach a free-form note for downstream debugging:

```typescript theme={null}
trace.web3.solana.addTxHint(signature, 'Jupiter swap');
trace.web3.solana.addTxHint(refundSig, 'Refund leg');
```

### Method Signature

```typescript theme={null}
trace.web3.solana.addTxHint(signature: string, details?: string): Trace
```

| Parameter   | Type     | Required | Description                                               |
| ----------- | -------- | -------- | --------------------------------------------------------- |
| `signature` | `string` | Yes      | Solana transaction signature (base58, ed25519)            |
| `details`   | `string` | No       | Free-form note attached to the hint for debugging context |

## End-to-End Example

```typescript theme={null}
import { Client, Web3Plugin } from '@miradorlabs/web-sdk';
import { Connection, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';

const client = new Client('your-api-key', {
  plugins: [Web3Plugin()],
});

async function executeSolanaSwap(params: SwapParams) {
  const trace = client.trace({ name: 'SolanaSwap' })
    .addAttributes({
      user: params.user,
      inputMint: params.inputMint,
      outputMint: params.outputMint,
      amount: params.amount,
    })
    .addTags(['swap', 'jupiter', 'solana']);

  try {
    trace.addEvent('quote_received');

    const tx = await buildSwapTransaction(params);
    const signature = await sendAndConfirmTransaction(connection, tx, [params.signer]);

    trace.web3.solana.addTxHint(signature, 'Swap settlement');
    trace.addEvent('confirmed');
  } catch (err) {
    trace.error('swap_failed', { message: err.message });
  }
}
```

## Cross-Chain Workflows

Solana hints compose freely with EVM hints, Safe hints, and Relay hints. A trace that spans Solana and an EVM chain just calls both methods:

```typescript theme={null}
const trace = client.trace({ name: 'CrossChainBridge' });

// Leg 1: deposit on Ethereum
trace.web3.evm.addTxHint(ethTxHash, 'ethereum', 'Deposit');

// Leg 2: fill on Solana
trace.web3.solana.addTxHint(solanaSig, 'Fill');
```

For intent-based bridges that already touch Solana on one side, prefer [`web3.relay.addQuoteHint()`](/concepts/relay-bridges) and let the backend processor co-emit both legs for you.

## Why No Chain Argument?

EVM tx hints carry a numeric chain ID so the backend knows which chain to look the tx hash up on. Solana doesn't have a chain ID — there's one mainnet, plus testnets/devnets that are identified by RPC endpoint, not by an enum value. So the API simply omits the chain parameter:

```typescript theme={null}
// EVM — chain is required
trace.web3.evm.addTxHint('0x123...', 'ethereum');

// Solana — no chain
trace.web3.solana.addTxHint('5Xy...');
```

The hint emits `chain_name = "solana"` on the wire so the platform routes it correctly.

## Best Practices

### Add the Hint as Soon as You Have the Signature

Don't wait for confirmation. Solana sigs are deterministic from the transaction, so you can record the hint the instant you send:

```typescript theme={null}
const signature = await connection.sendTransaction(tx);
trace.web3.solana.addTxHint(signature);

// Then confirm
await connection.confirmTransaction(signature);
```

### Describe Each Leg in a Multi-Tx Flow

When a single user action produces several Solana transactions (e.g. setup + swap, or staged Jupiter route), use the optional `details` arg to label each leg so the waterfall is self-explanatory:

```typescript theme={null}
trace.web3.solana.addTxHint(setupSig, 'ATA setup');
trace.web3.solana.addTxHint(swapSig, 'Swap execution');
```

## Next Steps

<CardGroup cols={2}>
  <Card title="EVM Transaction Hints" icon="cube" href="/concepts/transaction-hints">
    EVM tx correlation and the supported chain list
  </Card>

  <Card title="Relay Bridges" icon="bridge" href="/concepts/relay-bridges">
    Intent-based cross-chain bridges
  </Card>

  <Card title="Plugins" icon="puzzle-piece" href="/concepts/plugins">
    Web3Plugin setup and namespaces
  </Card>
</CardGroup>
