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

@galacticcouncil/xc-swap

v0.2.0

Published

Cross-chain swap SDK (NEAR Intent Routing)

Readme

@galacticcouncil/xc-swap

Cross-chain swap SDK for Hydration — NEAR Intent Routing (NIR).

It lets a Hydration user buy a NEAR asset in a single transaction: sell asset A on Hydration → WETH, bridge WETH via Wormhole/Moonbeam to Ethereum (where it becomes native ETH at a 1Click deposit address), and have 1Click swap ETH → the destination NEAR asset.

The SDK exposes the supported assets/chains/routes and provides swap(...) (a dry quote — amounts only), whose result can buildCall() the executable EVM calls (approve + IntentEmitter.swapAndBridge) on Hydration's EVM layer from a firm quote. approve is omitted when the emitter already has sufficient allowance.

Phase 1 scope: destination assets nep141:wrap.near (wrapped NEAR) and nep141:zec.omft.near (ZEC) — sourced from the 1Click token registry; origin = any Hydration asset (the Omnipool always routes A → WETH/A → GLMR).

Usage

import { createSdkContext } from '@galacticcouncil/sdk-next';
import { createXcSwap } from '@galacticcouncil/xc-swap';

// Caller owns the connection: build the sdk-next context (router + asset & EVM
// clients). xc-swap reads everything it needs from it.
const sdk = await createSdkContext(papiClient);

const xcSwap = createXcSwap({
  sdk,
  emitter: '0x…', // IntentEmitter proxy on Hydration EVM
});

// Inspect what's supported.
await xcSwap.getOriginAssets();      // every Hydration asset
await xcSwap.getDestinationAssets(); // [ wrap.near, ZEC ] (from 1Click /v0/tokens)
xcSwap.getChains();                  // [ hydration, near, zec ]
await xcSwap.getRoutes();

// Estimate a swap (dry quote — amounts only, no deposit address).
const trade = await xcSwap.swap({
  assetIn: 5,                          // Hydration runtime asset id of A (e.g. DOT)
  amountIn: 10_000_000_000n,           // smallest unit
  destinationAsset: 'nep141:wrap.near',// required
  recipient: 'alice.near',             // NEAR account
  refundTo: '0x…',                     // Hydration EVM refund/sender address
  slippage: 1,                         // percent (1 = 1%); optional, default 1
});

console.log(trade.amountOut.toDecimal(), trade.amountOut.symbol);

// Build the executable request from a firm quote (yields the deposit address).
// `calls` is [approve, swapAndBridge] — or just [swapAndBridge] when already approved.
const { calls, depositAddress, intentId } = await trade.buildCall();

Notes

  • Asset ids are Hydration runtime asset ids — the same id space used by sdk-next's TradeRouter and by IntentEmitter.swapAndBridge. WETH is 20, GLMR is 16 (mirrored from the WHM HydrationConsts).
  • slippage and relayMargin are expressed in percent (1 = 1%), matching sdk-next's TradeTxBuilder.withSlippage. The relay-fee ceiling is read from a quoter (GET /relay-fee?chain=ethereum&marginBps=…); override via quoterUrl.
  • See docs/spec.md for the full design.