The @abstraxn/solana-relayer package lets your app build, sign, and relay Solana transactions — gaslessly. The relayer reserves a fee-payer on your behalf so end-users never need SOL for fees. Gas sponsorship works the same way as the Paymaster on EVM chains — you fund a gas pool from the dashboard and the relayer draws from it to cover transaction fees on behalf of your users. What you can do:
  • Send native SOL transfers
  • Send SPL-token transfers (with automatic ATA creation)
  • Submit arbitrary program instructions
  • Track transaction status until finality
  • Sponsor gas for your users (same model as EVM Paymaster)

Installation


Setup

Relayer URL Format

The Solana relayer URL follows this pattern:

Get Your Relayer URL

  1. Visit https://dashboard.abstraxn.com/ and log in or sign up
  2. Go to Apps → create or select an app with Solana as a supported chain
  3. Navigate to Paymaster — if your app has Solana selected, you will see the Solana paymaster link
  4. Copy the Paymaster URL — this is your relayer URL
The Solana Relayer uses the same gas sponsorship model as the EVM Paymaster. Fund your gas pool from the Paymaster section in the dashboard, and the relayer draws from it to cover transaction fees on behalf of your users.
Your relayer URL contains your API key. Store it in environment variables — never hardcode it in client-side code.

Create the Client

That’s it — one config, one client. All four SDK methods use this instance.

Core Flow

Every relayed transaction follows four steps:
sendTx must be called after a successful buildTx — the SDK stores the reservation token from the build step internally.

Native SOL Transfer

Send SOL from one wallet to another, with gas paid by the relayer:

SPL Token Transfer

Transfer any SPL token. If the recipient’s Associated Token Account (ATA) does not exist, the SDK automatically creates it with the relayer as rent payer.

Token transfer parameters

When the mint supports jsonParsed RPC, the SDK reads on-chain decimals and uses TransferChecked. The decimals parameter is only a fallback. If the sender or recipient ATA is missing, the SDK prepends a createAssociatedTokenAccount instruction with the relayer as payer.

Custom Program Transaction

For any instruction set that isn’t a simple transfer — swaps, NFT mints, program calls — pass your own instructions:

Static instructions

Dynamic instructions with buildInstructions

When your instructions need the relayer’s public key before they can be built (e.g. ATA creation where the relayer pays rent), use the buildInstructions callback:
instructions, buildInstructions, and transaction are mutually exclusive — pass exactly one. Passing more than one will throw an error.

buildTx Input Variants

buildTx accepts exactly one of three transaction types: All variants require connection and sender.

API Reference

new SolanaRelayer(config)

buildTx(params){ tx, lastValidBlockHeight }

Fetches an available relayer, reserves it, and builds a VersionedTransaction. Returns the transaction and block height for expiry tracking.

signTx(params)serializedTransaction

sendTx(params){ txnId }

getTxStatus(params){ status, signature }

Returns:

How It Works Under the Hood

The SDK communicates with sol-relayer-hub using a JSON-RPC style protocol over a single POST endpoint:
You never call these directly — the SDK handles serialization, reservation tokens, and retries.

Integrating with Wallet Adapters

The signTx method accepts any standard Solana wallet adapter. Here’s a React example using @solana/wallet-adapter-react:

Troubleshooting

Q: buildTx fails with “no relayer available” All relayers are currently reserved. Wait a moment and retry — relayers are released after submission or timeout. Q: sendTx returns an error
  • Ensure you call sendTx after a successful buildTx (the reservation token is stored internally).
  • Check that the lastValidBlockHeight has not expired — if the block height has passed, rebuild the transaction.
Q: Token transfer fails with “account not found”
  • Verify the mint address is correct on the target network (devnet vs mainnet).
  • Ensure splTokenProgramId matches the token standard (Token vs Token-2022).
Q: Transaction stuck in pending
  • Check Solana network status for congestion.
  • Verify the relayer hub is healthy via its health endpoint.

Security Notes

  • Store the relayer URL (which contains your API key) in server-side environment variables.
  • Validate all user inputs (addresses, amounts) before building transactions.
  • The relayer only pays gas from your sponsored pool — it cannot move user funds. Users must still sign with their own wallet.
  • Monitor your gas pool balance in the dashboard to avoid failed sponsorships.