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

@wakeuplabs/as-stylus

v0.2.9

Published

SDK to build AssemblyScript contracts for Stylus

Readme

AssemblyScript Stylus SDK

⚠️ ALPHA VERSION NOTICE

This SDK is currently in alpha development and is actively being worked on. It is not production-ready and may contain bugs, breaking changes, or incomplete features. Use at your own risk and avoid deploying to mainnet without thorough testing.

Smart contracts on Arbitrum using AssemblyScript

npm version License


Overview

The AssemblyScript Stylus SDK enables smart contract developers to write programs for Arbitrum Stylus using AssemblyScript with TypeScript-like syntax. Stylus programs are compiled to WebAssembly and can be deployed on-chain to execute alongside Solidity smart contracts. AssemblyScript contracts are not only faster and cheaper but also provide a familiar development experience for JavaScript/TypeScript developers.

For more information about Stylus, see Stylus: A Gentle Introduction. For deployment, see the Cargo Stylus CLI Tool.

Features

  • TypeScript-like Syntax: Write contracts using familiar decorators and TypeScript syntax
  • Type Safety: Strong typing with compile-time validation
  • High Performance: Compiled to WASM for optimal execution on Stylus
  • Rich Type System: Support for U256, I256, Address, String, Boolean, Mapping, and Struct types
  • Event System: Emit events with proper ABI encoding
  • Error Handling: Custom error types with revert functionality
  • ABI Generation: Automatic generation of Ethereum-compatible ABIs
  • Interoperability: Full compatibility with Solidity contracts

Quick Start

Generate a new project

npx @wakeuplabs/as-stylus generate my-counter
cd my-counter

This creates a basic project structure:

my-counter/
├── contract.ts       # Your contract code
├── package.json      # Project dependencies
├── tsconfig.json     # TypeScript configuration
└── asconfig.json     # AssemblyScript configuration

Write Your Contract

Edit contract.ts:

import { Contract, External, U256, U256Factory, View } from "@wakeuplabs/as-stylus";

@Contract
export class Counter {
  counter: U256;

  constructor() {
    this.counter = U256Factory.create();
  }

  @External
  set(value: U256): void {
    this.counter = value;
  }

  @External
  increment(): void {
    const delta: U256 = U256Factory.fromString("1");
    this.counter = this.counter.addUnchecked(delta);
  }

  @External
  decrement(): void {
    const delta: U256 = U256Factory.fromString("1");
    this.counter = this.counter.subUnchecked(delta);
  }

  @View
  get(): U256 {
    return this.counter;
  }
}

Build and deploy

npx @wakeuplabs/as-stylus compile <contract-file> --endpoint <rpc-url>    # build artifacts, Compile to WASM and check Validate with cargo stylus
npm run deploy <contract-file> --endpoint <rpc-url> --private-key <private-key>  --output <output-file> --constructor-args <constructor-args...>                      # Deploy to Arbitrum

CLI Commands

The as-stylus CLI provides several commands for contract development:

| Command | Description | Usage | | ------------ | -------------------------------------------- | ----------------------------------------------- | | generate | Create a new Stylus project with boilerplate | @wakeuplabs/as-stylus generate <project-name> | | compile | Compile AssemblyScript to WASM | @wakeuplabs/as-stylus compile <contract-path> | | deploy | Deploy contract to Stylus network | @wakeuplabs/as-stylus deploy <contract-path> | | clean | Remove build artifacts and temporary files | @wakeuplabs/as-stylus clean |

Requirements

  • Node.js ≥ 18.x
  • AssemblyScript ≥ 0.27.x
  • cargo stylus CLI tool (for compilation and deployment)

Install cargo stylus:

cargo install --force cargo-stylus
rustup target add wasm32-unknown-unknown

🏗️ Project Structure

your-project/
├── contract.ts           # Main contract code
├── package.json          # Dependencies and scripts
├── tsconfig.json         # TypeScript configuration
├── asconfig.json         # AssemblyScript configuration
└── artifacts             # Generated files (after build)
    ├── index.ts          # Transformed AssemblyScript
    ├── package.json      # Generated package config
    ├── abi/              # Abi generated (after build)
    └── build/            # Compiled WASM (after compile)
        └── module.wasm   # Final bytecode

Related Resources

License

This project is licensed under either of:

  • Apache License, Version 2.0
  • MIT License

at your option.


Ready to build the future of smart contracts with AssemblyScript?

Start with npx @wakeuplabs/as-stylus generate my-first-contract and join the Stylus revolution!