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

inkswap-sdk

v1.0.12

Published

InkSwap SDK — cross-chain swaps, gasless deposits, presign signing, and per-developer keepers. Zero-dependency, fetch-first, fully typed.

Readme

inkswap-sdk

Zero-dependency TypeScript SDK for the InkSwap platform — cross-chain swaps, gasless deposits, presign signing, and per-developer keepers.

npm i inkswap-sdk

Quick start (under 5 minutes)

import { InkSwapClient } from "inkswap-sdk";

// 1. Auth — one line. Your wallet address IS the identity (no API keys).
const client = await InkSwapClient.forWallet(
  "https://presigns.useink.xyz",
  wallet.publicKey.toBase58(),
);

// 2. Quote — fee tier + expected output come from the live on-chain quote.
const quote = await client.quote({ amount: "1000000", destinationAddress: "0x…" });

// 3. Create the swap.
const intent = await client.createIntent({
  amount: quote.amount,
  destinationAddress: quote.destinationAddress,
  destChainId: 10143, // Monad
});

// 4. Get the server-built deposit tx — gasless (keeper pays the Solana fee).
const dep = await client.depositTx(intent.swapId, true);

// 5. Sign locally with your own wallet, hand the partial tx back.
const partial = await wallet.signTransaction(dep.txBase64);
await client.submitSponsoredDeposit(intent.swapId, partial.signedTxBase64);

// 6. Wait for settlement (typed states, throws on timeout).
const snap = await client.waitFor(intent.swapId, ["settled"]);

Authentication

Three ways — in increasing order of ceremony:

| Style | When | Code | | --- | --- | --- | | Open (recommended) | Any wallet, testnet/demo | InkSwapClient.forWallet(baseUrl, wallet) — deterministic tw-<wallet> credentials, same wallet → same creds forever | | Env | Server deployments | INK_SWAP_BASE_URL, INK_SWAP_APP_ID, INK_SWAP_SECRET — then new InkSwapClient({}) | | Operator | Partners with webhooks | InkSwapClient.registerApp(baseUrl, { operatorKey, … }) |

Common operations

| You want to… | Use | | --- | --- | | Check the fee before committing | client.quote({ amount, destinationAddress, destChainId }) | | Create a swap | client.createIntent({ amount, destinationAddress }) — returns swapId | | Build the deposit tx | client.depositTx(swapId) or client.depositTx(swapId, true) (gasless) | | Submit a gasless deposit | client.submitSponsoredDeposit(swapId, partialTx) | | Poll until done | client.waitFor(swapId, ["settled"], timeoutMs) | | Provision a keeper (fee account) | client.provisionKeeper({ chains: ["solana", "evm", "sui"] }) | | Verify a settle on-chain | verifySettledOnChain({ rpcUrl, chainId, pool, swapIdHex, settleTx }) | | Verify a webhook | verifyWebhookSignature(secret, rawBody, signature) | | Sign offline, submit later | OfflineTicket.stamp(client, signer, params, store)ticket.submit(client) |

Errors

Every failure throws a typed error. Catch the class, not the message:

import { InkSwapAuthError, InkSwapRateLimitError, InkSwapNotFoundError } from "inkswap-sdk";

try {
  await client.getSwap(swapId);
} catch (e) {
  if (e instanceof InkSwapNotFoundError) return res.redirect("/new-swap");
  if (e instanceof InkSwapRateLimitError) return res.retryAfter(e.retryAfterMs);
  if (e instanceof InkSwapAuthError) return res.redirect("/login");
  throw e;
}

| Class | HTTP | Meaning | | --- | --- | --- | | InkSwapValidationError | 400 / 409 / 422 | Request rejected — the message tells you the fix | | InkSwapAuthError | 401 / 403 | Bad/absent appId + secret | | InkSwapRateLimitError | 429 | Slow down — retryAfterMs has the server hint | | InkSwapNotFoundError | 404 | Wrong swapId / keeperId | | InkSwapApiError | other | Base class — always thrown by the platform |

The SDK retries transient failures automatically (network blips, 429, 5xx) with exponential backoff + jitter; it never retries a rejected 4xx.

Conventions

  • Amounts are raw 6-decimal units ("1000000" = 1 USDC). Use usdcToRaw("1.5") / rawToUsdc("1500000") to convert.
  • Addresses: pass a plain 0x… EVM address — pad32() right-aligns it internally. 32-byte pre-padded values pass through.
  • Everything is typed: Quote, Intent, DepositTx, SwapSnapshot, Keeper, … — your editor knows the response shape.
  • Webhooks are HMAC-signed; verifyWebhookSignature is constant-time.

Environments

fetch-first: runs in Node 18+, Deno, Bun, Cloudflare Workers, and browsers. No polyfills, no node-only built-ins in the client path.

Development

npx tsx sdk/liveTest.ts   # full suite against the live deployment

See CHANGELOG.md for version history.