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 🙏

© 2025 – Pkg Stats / Ryan Hefner

aqua-compiler

v0.0.33

Published

An expressive high level language for the Algorand blockchain that compiles to TEAL code.

Readme

Aqua-compiler

An expressive high level language for the Algorand blockchain smart contracts that compiles to TEAL code.

This is a work in progress. Please report issues and help set the direction for this project.

Using the Aqua command

Download the latest executable for your platform from the releases page.

Add the executable to your path. If you are on MacOS or Linux you should rename the executable from aqua-mac or aqua-linux to just be called aqua (so the rest of the instructions make sense).

You can also install Aqua using npm:

npm install -g aqua-compiler

REPL

Running the executable with no arguments starts the REPL:

aqua

You can type Aqua expressions and statements at the REPL and see the TEAL code that is generated.

Trying entering expressions at the REPL prompt:

  • txn.Amount >= 1000;
  • 15 + txn.Amount >= 1000;
  • txn.Amount <= arg[0];
  • txn.Amount + arg[0] > 1000 && arg[1] > 30;
  • txn.Receiver == addr ABC123;
  • "a string" == txn.Something;
  • return 1+2;

Compiling an Aqua file

To compile an Aqua file to TEAL code, input the Aqua filename:

aqua my-smart-contract.aqua

That prints the generated TEAL code to standard output.

Typically you'll want to capture the TEAL code to a file (so you can run it against the blockchain):

aqua my-smart-contact.aqua > my-smart-contract.teal

Examples of Aqua code

See the examples subdirectory for various examples of Aqua code.

Using the Aqua API

You can compile Aqua to TEAL code using Aqua's JavaScript/TypesScript API.

First install Aqua in your Node.js project:

npm install --save aqua-compiler

Then import Aqua's compile function:

const { compile } = require("aqua-compiler");

Or in TypeScript:

import { compile } from "aqua-compiler";

Now use compile to compile Aqua to TEAL:

const aquaCode = "return 1 + 2;"
const tealCode = compiler(aquaCode);
console.log(tealCode);

Testing Aqua code with Jest

One reason why you might want to use Aqua's API is to enable automated testing.

For example, here's a Jest test that compiles Aqua to TEAL:

import { compile } from "aqua-compiler";
import { readFile } from "fs/promises";

describe("My smart contract test suite", () => {

    test("My first test", async () => {

        const tealCode = await compileAquaFile("my-smart-contract.aqua");

        // ... test that you can execute teal code against your sandbox blockchain ...
    });

    // ... other tests go here ...

});

//
// Loads and compiles an Aqua file.
//
async function compileAquaFile(fileName) {
    const fileContent = await readFile(join(tealPath, tealFileName), { encoding: "utf8" });
    return compile(fileContent);
}

After compiling an Aqua file to TEAL code you can then deploy that code against your sandbox Algorand blockchain.

Another way of testing that is faster and doesn't require having an actual Algorand node instance is to use the TEAL interpreter to simulate the Algorand virtual machine.

A Jest test that runs Aqua code against the TEAL interpreter might look like this:

import { compile } from "aqua-compiler";
import { readFile } from "fs/promises";
import { execute } from "teal-interpreter";

describe("My smart contract test suite", () => {

    test("My first test", async () => {

        const config = {
            // ... configure the initial state of the TEAL interpreter ...
        }
        const result = await executeAqua("my-smart-contract.aqua", config);

        // ... run expectations against the result to check that execution of the aqua code has expected results ...
        
    });

    // ... other tests go here ...

});

//
// Loads and compiles an Aqua file.
//
async function compileAquaFile(fileName) {
    const fileContent = await readFile(join(tealPath, tealFileName), { encoding: "utf8" });
    return compile(fileContent);
}

//
// Executes Aqua code against the TEAL interpreter.
//
async function executeAqua(fileName, config) {
    const tealCode = await compileAquaFile(fileName);
    return await execute(tealCode, config);
}

Development

See the development guide for instructions on development of Aqua.