npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@abstraxn/solana-relayer

v1.0.0

Published

Abstraxn Solana Relayer SDK for building, signing, and relaying Solana transactions.

Downloads

641

Readme

Abstraxn Solana Relayer SDK

Overview

The Abstraxn Solana Relayer SDK provides a class-based client to:

  • build native or SPL-token transfer transactions with one API
  • sign transactions with wallet adapters
  • submit signed transactions to sol-relayer-hub
  • fetch transaction status

This package targets the current Sol relayer API flow.

Installation

Using npm:

npm install @abstraxn/solana-relayer

Using yarn:

yarn add @abstraxn/solana-relayer

Usage

import { Connection, PublicKey } from "@solana/web3.js";
import { SolanaRelayer } from "@abstraxn/solana-relayer";

const client = new SolanaRelayer({
  relayerUrl: "https://solana.abstraxn.com/api/v1/103?apikey=your_api_key",
});

const connection = new Connection("https://api.devnet.solana.com", "confirmed");

const { tx, lastValidBlockHeight } = await client.buildTx({
  connection,
  sender: new PublicKey("<user-wallet-pubkey>"),
  to: new PublicKey("<recipient-pubkey>"),
  lamports: 1000000,
});

const serializedUserSignedTx = await client.signTx({
  wallet: walletAdapter,
  transaction: tx,
});

const submit = await client.sendTx({
  signedTransaction: serializedUserSignedTx,
  lastValidBlockHeight,
});

const finalStatus = await client.getTxStatus({
  txnId: submit.txnId,
});

console.log(finalStatus.status, finalStatus.signature);

Token transfer with program overrides

const { tx, lastValidBlockHeight } = await client.buildTx({
  connection,
  sender: new PublicKey("<owner-pubkey>"),
  mint: new PublicKey("<mint-address>"),
  recipientOwner: new PublicKey("<recipient-owner-pubkey>"),
  amountUi: "1.25",
  decimals: 6,
  splTokenProgramId: new PublicKey("<token-program-id>"), // required
  splAssociatedTokenProgramId: new PublicKey("<ata-program-id>"), // required
});

Custom program transaction (no static SDK program dependency)

import { TransactionInstruction } from "@solana/web3.js";

const instructions: TransactionInstruction[] = [
  // Build any instructions with your own programId/accounts/data
];

const { tx, lastValidBlockHeight } = await client.buildTx({
  connection,
  sender: new PublicKey("<signer-pubkey>"),
  instructions,
});

API

  • buildTx(params)
  • signTx(params)
  • sendTx(params)
  • getTxStatus(params)

Runtime flow

  1. buildTx() fetches an available relayer and reserves it.
  2. SDK stores reservationToken internally from that reservation.
  3. signTx() signs the built transaction with user wallet.
  4. sendTx() submits signed tx with stored reservation token.
  5. getTxStatus() fetches relay status by txnId.

sendTx() must be called after a successful buildTx() call. lastValidBlockHeight should be the value returned by buildTx().

relayerUrl is configured once in SolanaRelayerConfig. SDK uses a single EVM-style method endpoint contract:

  • all operations are POST <relayerUrl>
  • request body carries { method, params, id, jsonrpc }
  • methods used by SDK:
    • sol_getAvailableRelayer
    • sol_sendTx / sol_sendProgrammeTx
    • sol_getTxStatus

buildTx(params) accepts exactly one mutually exclusive branch:

  • native: to + lamports
  • token: mint + recipientOwner + amountUi + decimals + splTokenProgramId + splAssociatedTokenProgramId
  • custom: instructions or transaction

Local Backend Test Flow

Use this sequence to validate SDK integration against local sol-relayer-hub.

1) Start backend services

From solana-relayer/sol-relayer-hub:

npm install
npm run start:dev

Ensure health is reachable:

curl -sS http://localhost:3010/health

2) Build SDK

From abstraxn-sdks/solana-relayer:

npm install
npm run build

3) Wire FE to local SDK source (recommended for local development)

In sol-relayer-test-fe/src/solana.ts, import from:

../../../abstraxn-sdks/solana-relayer/src

This avoids global npm link issues and always uses your latest local SDK code.

4) Build FE

From solana-relayer/sol-relayer-test-fe:

npm install
npm run build

5) Runtime checks

  • GET /relayer/available should return one relayer or 404.
  • POST <relayerUrl> with invalid payload should return validation error.
  • FE happy path should produce:
    • relay submit response with txnId
    • terminal status (confirmed or failed) from status API.

Example negative check:

curl -sS -X POST "http://localhost:3010/api/v1/103?apikey=dev_local_api_key" \
  -H "Content-Type: application/json" \
  -d '{"method":"sol_sendTx","params":[{"serializedUserSignedTx":"abcd","reservationToken":"token","lastValidBlockHeight":1}],"id":1,"jsonrpc":"2.0"}'

Acceptance Criteria

  • SDK builds cleanly.
  • FE builds while importing SDK client methods.
  • Local hub endpoints are reachable.
  • Submit/status flow works via SDK methods in FE for at least one runtime scenario.