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

@swapdk/wdk-protocol-bridge-swapdk-solana

v0.1.0

Published

WDK bridge protocol module for cross-chain swaps with Solana as source chain via SwapDK (THORChain, MAYAChain, Chainflip)

Readme

@swapdk/wdk-protocol-bridge-swapdk-solana

WDK bridge protocol module for cross-chain swaps with Solana as source via SwapDK. Extends the standard WDK BridgeProtocol base class. Native SOL can be bridged to any destination supported by swap-engine (ETH, USDC on EVM chains, BTC, TRON, LTC, DOGE) via THORChain and MAYAChain.

How it works

WDK wallet (Solana)
  └── SwapDKBridgeSolana extends BridgeProtocol
        ├── quoteBridge()  →  swap-engine /quote  →  returns estimate + inboundAddress + memo
        └── bridge()       →  swap-engine /quote  →  build Solana tx (transfer + Memo) → wallet signs & broadcasts

Unlike the EVM source module, swap-engine does not prepare a signed-ready tx payload for Solana routes — it returns the THORChain inbound vault address and the routing memo. This client constructs the Solana transaction itself: a SystemProgram transfer instruction alongside a Memo Program instruction carrying the memo bytes.

Installation

npm install @swapdk/wdk-protocol-bridge-swapdk-solana \
            @tetherto/wdk @tetherto/wdk-wallet-solana

Quick start

import WDK from "@tetherto/wdk";
import WalletManagerSolana from "@tetherto/wdk-wallet-solana";
import { SwapDKBridgeSolana } from "@swapdk/wdk-protocol-bridge-swapdk-solana";

const wdk = new WDK(SEED_PHRASE)
  .registerWallet("solana", WalletManagerSolana, {
    rpcUrl: "https://api.mainnet-beta.solana.com",
  })
  .registerProtocol("solana", "swap-dk-bridge", SwapDKBridgeSolana, {
    apiUrl: "https://api.swapdk.com",
    apiKey: "your-api-key",
    slippageBps: 300,
  });

const account = await wdk.getAccount("solana", 0);
const bridge = account.getBridgeProtocol("swap-dk-bridge");

// Quote: 1 SOL → ETH
const quote = await bridge.quoteBridge({
  targetChain: "ethereum",
  recipient:   "0xe89E630553e63EA65b65F1cA2ea2C50cCA8f3E54",
  token:       "",               // empty = native SOL
  amount:      1_000_000_000n,   // 1 SOL in lamports
});
console.log(quote.tokenOutAmount);   // expected ETH in wei
console.log(quote.inboundAddress);   // THORChain vault (rotates)
console.log(quote.memo);             // "=:e:0xe89E...:minOut:commission/SDK:...""

// Execute
const result = await bridge.bridge({
  targetChain: "ethereum",
  recipient:   "0xe89E630553e63EA65b65F1cA2ea2C50cCA8f3E54",
  token:       "",
  amount:      1_000_000_000n,
});
console.log(result.hash);  // Solana tx signature

Tracking the bridge

const status = await bridge.trackBridge(result.hash);
// null → not yet indexed in Midgard; retry in a moment

const final = await bridge.waitForBridge(result.hash, undefined, {
  pollIntervalMs: 5_000,    // default — Solana slots are fast
  timeoutMs:      600_000,
  onUpdate: (s) => console.log(s.status),
});

Tracking is implemented for THORChain and MAYAChain routes only — the same upstream limitation as the EVM module.

Source asset (SOL vs SPL)

  • Native SOL: pass token: "". Amount is in lamports (1 SOL = 10⁹).
  • SPL tokens: not yet supported in this MVP. The transaction-builder currently emits a SystemProgram transfer; an SPL-source path needs a different instruction (SPL Token transfer). Tracked in the roadmap; filed an issue if you need a specific pair.

Destination chains

Any chain swap-engine recognises as a THORChain/MAYAChain destination: Ethereum / Arbitrum / Base / BSC / Avalanche / Optimism / Polygon / Bitcoin / Litecoin / Dogecoin / TRON.

Destination ERC-20s (for tokenOut): USDC, USDT, WETH, WBTC, DAI and wrapped natives out of the box. Extend via registerToken() — same API as in the EVM module.

Configuration

interface SwapDKBridgeConfig {
  apiUrl: string;           // swap-engine base URL
  apiKey: string;           // SwapDK API key (x-api-key header)
  bridgeMaxFee?: bigint;    // max tx fee (lamports) allowed per bridge tx
  slippageBps?: number;     // default 300 (3 %)
  timeoutMs?: number;       // HTTP timeout, default 10_000
  retries?: number;         // max retries on 5xx / network errors, default 2
}

bridgeMaxFee is enforced before broadcast against SOLANA_BASE_FEE_LAMPORTS (5 000). Solana charges 5 000 lamports per signature, our bridge tx has exactly one signature, and the tx-builder doesn't add a ComputeBudgetProgram priority-fee instruction — so the constant is accurate for what we actually send. quoteBridge() returns this same value as fee so callers can surface it in their UI without making any RPC call. The wallet still reports the actual fee after broadcast, which bridge() puts in the result for accounting; if a custom wallet wrapper adds priority fees on top, that surfaces there.

Error handling

Same taxonomy as the EVM module:

import {
  SwapDKUserError,     // invalid input or fee limit exceeded
  SwapDKProviderError, // swap-engine returned no usable routes
  SwapDKApiError,      // non-2xx HTTP response (check .isNotFound on /track 404s)
  SwapDKNetworkError,  // timeout / DNS / connection refused
} from "@swapdk/wdk-protocol-bridge-swapdk-solana";

WDK app integration

See examples/wdk-app.ts for a complete scaffold.

Design notes

The full research behind this module — swap-engine response shape for SOL source, the exact WDK Solana wallet entry point we rely on, the memo-via-Memo-Program flow, and why SPL-source is a follow-up — is in docs/research-solana-source.md.

Development

This package lives in the wdk-protocol-bridges-swapdk monorepo. Build and lint commands run per-package; tests run from the monorepo root.

# From this package directory
npm run build      -w @swapdk/wdk-protocol-bridge-swapdk-solana   # compile to dist/
npm run dev        -w @swapdk/wdk-protocol-bridge-swapdk-solana   # watch mode
npm run lint       -w @swapdk/wdk-protocol-bridge-swapdk-solana   # type-check only

# From the repo root
npm test                                                          # vitest, all packages
npm test -- packages/solana                                       # filter to this package

License

MIT