
Solana chain adapter for the Intents Swap Widget. It lets users swap from Solana wallets (Phantom, Solflare, Privy, …) by sending the SOL or SPL-token deposit transaction.
Do I need it?
Without it, Solana swaps fail with "Solana transfers are not supported. Add the Solana plugin from @aurora-is-near/intents-swap-widget-solana …". Without providers.sol, they fail with "… Add a Solana provider …".
Where it fits
flowchart TB
W["Swap Widget<br/>(quote ready)"] -- "plugins.sol.makeTransfer()" --> A["<b>this adapter</b>"]
A -- "build tx + signTransaction" --> WL["User's Solana wallet<br/>(providers.sol)"]
WL -- "SOL / SPL transfer" --> D["1Click deposit address"]
D --> NI["NEAR Intents settles the swap"]
Usage
npm install @aurora-is-near/intents-swap-widget @aurora-is-near/intents-swap-widget-solana
import '@aurora-is-near/intents-swap-widget/styles.css';
import { Widget, WidgetConfigProvider } from '@aurora-is-near/intents-swap-widget';
import { sol } from '@aurora-is-near/intents-swap-widget-solana';
const { publicKey, signMessage, signTransaction, connect, disconnect } =
useYourSolanaWallet(); // e.g. @solana/wallet-adapter-react
<WidgetConfigProvider
config={{
apiKey: 'YOUR_STUDIO_API_KEY', // https://studio.aurora.dev
alchemyApiKey: 'YOUR_ALCHEMY_KEY', // recommended in production, see RPC below
connectedWallets: { default: publicKey?.toBase58() },
providers: { sol: { publicKey, signMessage, signTransaction } },
plugins: { sol },
onWalletSignin: connect,
onWalletSignout: disconnect,
}}>
<Widget />
</WidgetConfigProvider>;
| Field | Type |
publicKey | PublicKey (anything with toString()) |
signMessage | (message: Uint8Array) => Promise<Uint8Array> |
signTransaction | (tx: Transaction) => Promise<Transaction> |
Using Privy? Its wallet API has a different shape, so it needs a small adapter: 📖 Privy example.
What it does
| Step | Behaviour |
| Native SOL | SystemProgram.transfer to the deposit address |
| SPL token | transfer between associated token accounts. Creates the recipient ATA first if it doesn't exist |
| Signing | Builds the tx with a fresh blockhash, signTransaction via the wallet, then sendRawTransaction (preflight on, 3 retries) |
| Result | Returns { hash } (the signature). The widget then tracks the swap status |
RPC
| Config | RPC used for transfers |
alchemyApiKey set | https://solana-mainnet.g.alchemy.com/v2/<key> |
| Not set | https://solana-rpc.publicnode.com (public and rate-limited) |
Exports
| Export | Type | Use |
sol | SolanaNetworkPlugin | Pass it as plugins.sol |
makeTransfer(args, options) | Promise<{ hash }> | The same logic, callable directly |
MakeTransferOptions | type | { provider: SolanaProvider; rpcUrl?: string; alchemyApiKey?: string } |
Dependencies: @solana/web3.js, @solana/spl-token. Peer: @aurora-is-near/intents-swap-widget.
License
MIT