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

biatec-router

v1.0.1

Published

Biatec Router NPM library

Readme

Biatec Router

Biatec router allows users to swap efficiently from one asset to another.

At the time of writing it is the most efficient DEX aggregator on Algorand as it allows to do trades at Pact.Fi, TinyMan and Biatec DEX. Other DEX aggregators does not handle Biatec DEX - the first concentrated liquidity AMM on Algorand.

Authentication

Biatec Router is using ARC14 authentication header which prevents the DDOS attacks and allows incentivization of good actors. Any user or app is required to sign the algorand authentication transaction with realm BiatecRouter#ARC14.

Base setup


    // Setup Algorand Client
    const token = process.env.ALGOD_TOKEN || "";
    const server =
      process.env.ALGOD_SERVER || "https://testnet-api.algonode.cloud";
    const port = process.env.ALGOD_PORT || "";
    const algodClient = new algosdk.Algodv2(token, server, port);

    
    // Setup Account
    const email = process.env.ARC76_EMAIL;
    const password = process.env.ARC76_PASSWORD;

    if (!email || !password) {
      throw new Error("ARC76_EMAIL and ARC76_PASSWORD must be defined in .env");
    }

    const account = await generateAlgorandAccount(password, email);

    // Fetch params
    const params= await algodClient.getTransactionParams().do()

Get auth tx

    import { biatecRouter, authTransaction} from "biatec-router";
    import {makeArc14AuthHeader} from "arc14";
    ...
   
    const authTx = await authTransaction(account.addr.toString(), params);
    
    const signed = arc14Tx.signTxn(account.sk);
    const authHeader = makeArc14AuthHeader(signed);

    biatecRouter.OpenAPI.HEADERS = { 'Authorization': authHeader };

Request quotes

Use the same endpoint as for route execution and calculate the quotes.

    const requestBody = {
      sender: account.addr.toString(),
      fromAsset: 0,
      toAsset: 452399768,
      swapAmount: 5_000_000,
      receiveMinimum: 0,
      routesCount: 1,
      maxHops: 3,
    };
    const response = await biatecRouter.RouterService.postApiV1RouterRouteTxs(requestBody);

    if (!response.routes || response.routes.length === 0) {
        console.log("No routes found.");
        return;
    }

    const route = response.routes[0]
    console.log("route",route)

Execute quotes

Always use receiveMinimum when you want to execute the swap to protect your funds.

    const requestBody = {
      sender: account.addr.toString(),
      fromAsset: 0,
      toAsset: 452399768,
      swapAmount: 5_000_000,
      receiveMinimum: 300_000_000,
      routesCount: 1,
      maxHops: 3,
    };
    const response = await biatecRouter.RouterService.postApiV1RouterRouteTxs(requestBody);

    if (!response.routes || response.routes.length === 0) {
        console.log("No routes found.");
        return;
    }

    const route = response.routes[0]
    console.log("route",route)

    if (!route.txsToSign || route.txsToSign.length === 0) {
        console.log("No transactions to sign in the route.");
        return;
    }

    // Decode Transactions
    const transactions: algosdk.Transaction[] = [];

    for (const txBase64 of route.txsToSign) {
        let txBytes = new Uint8Array(Buffer.from(txBase64, "base64"));
        const tx = algosdk.decodeUnsignedTransaction(txBytes);
        transactions.push(tx);
    }

    transactions.forEach((tx) => {tx.group = undefined;});
    const groupId = algosdk.computeGroupID(transactions);
    transactions.forEach((tx) => (tx.group = groupId));

    const signedTxs: Uint8Array[] = [];
    for (const tx of transactions) {
        const signedTx = tx.signTxn(account.sk);
        signedTxs.push(signedTx);
    }

    const txResponse = await algodClient
        .sendRawTransaction(signedTxs)
        .do();


    // Wait for confirmation
    const result = await algosdk.waitForConfirmation(
        algodClient,
        txId,
        4
        );