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

@travelx/algob-ext

v0.0.9

Published

Extension engine for AlgoBuilder projects

Readme

Algo Builder extension & helpers


[[TOC]]

📄 Description

All stuff which help us to develop and test Algorand Smart Contract

💬 Resources


📜 Docs

📁 Ext

Main directory to customize scripts

AlgoBuilderScript

Basic AlgoBuilder script wrapper with some built-in extension to use out-of-box.

# scripts/my-script.ts
export default AlgoBuilderScript.of((ctx) => {
    // Do stuff with the context
});
Context [IRunScriptContext]
  • runtimeEnv: RuntimeEnvExt: Extended environment RuntimeEnv (from algo-builder) with properties on NetworkConfig.
    • runtimeEnv.network.config.assets: Config custom asset ids for external networks like TestNet
    • runtimeEnv.network.config.addresses: Config addresses without private key to use
  • deployerExt: IDeployerExt: The built-in extension methods from base deployer of AlgoBuilder
  • addresses: IScriptAddresses: Service to read and resolve addresses from config file. ctx.addresses.getOrFail('requiredAddress')
Deployer Ext [IDeployerExt]
  • algoBalanceOf: Return balance in algos.
  • usdcBalanceOf: Return balance of common stable asset USDC (must be deployed before. See examples/scripts/usdc.ts)
  • usdcDispenser: Dispense $USDC to account. master is the sender
  • algoDispenser: Dispense $ALGO to account. master is the sender
  • funder: Return a callable dispense which send the amount of usdc & algo to reach the algoLt & usdcLt configure amount. send(algoLt - account.algos)
  • accountSummary: Print a summary of account in stdout
  • nftsOf: Return a list of non-fungible asset which account hold.
  • resolveAssetIndex: Resolve the asset index from their name or fallback to artifact folder of algobuilder.
⭐️ ❯ AlgoBuilderScriptFactory

This is the main extensible feature to customize, configure and extend custom scripts contexts with custom plugins features.

// # scripts/ext/my-custom-script-context.ts
const MyAlgoBuilderScript = AlgoBuilderScriptFactory()
  .withPlugin((ctx) => {
    return {
      ...ctx, // It's the base context IRunScriptContext
      myCoolStuff: (account: Account) => `Hello ${account.address}`
    }
  })
  // Also can add more plugins .withPlugin(otherPlugin) with context inherit

// # scripts/use.ts
export default MyAlgoBuilderScript.of((ctx) => {
    // ctx.myCoolStuff is available. And it have AUTOCOMPLETE!! 🎉
    ctx.myCoolStuff(ctx.deployer.accountsByName.get('Alice'))
    // Hello AKCX..YQJETM
})

📁 Accouts

accountsBalanceReference

Show changes on the balances of accounts

const ref = await accountsBalanceReference(ctx.deployerExt).of([alice])
// transfer 1000 $ALGO to alice
ref.printDiff() // Yes!! it have colors 🤪
┌───────┬────────────────────────────────────────────────────────────┬─────────────────┬─────────────────────────┬────────┬───────────┐
│ Name  │ address                                                    │ $µALGO          │ $µALGO diff             │ $USD   │ $USD diff │
├───────┼────────────────────────────────────────────────────────────┼─────────────────┼─────────────────────────┼────────┼───────────┤
│ Alice │ FYPJZLHO67DNODLNNTUG7KQBE2ZTBOQJIXSBGSJB5DYFPARDKOZAEDCRYI │ 0 -> 1000000000 │ ↑ 1000000000 • $409.131 │ 0 -> 0 │  0        │
└───────┴────────────────────────────────────────────────────────────┴─────────────────┴─────────────────────────┴────────┴───────────┘

📁 Applications

AppState

Show changes on the state (global & local) of application (smart contracts)

const state = new AppState(ctx, 'Factory')
await state.takeSnapshot()
// do something interesting with the contract
await state.printDiff()

The following will be printed on the console:

┌──────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────┐
│ Key          │ Old Value                                    │ New Value                                                                                │
├──────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│ FEE_ADDR     │ 5rjfIlCKqXUaKhpXWP3rfLua3Nvb3OFHUYWDqk+qfxw= │ 5rjfIlCKqXUaKhpXWP3rfLua3Nvb3OFHUYWDqk+qfxw=                                             │
├──────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│ MANAGER_ADDR │ 5rjfIlCKqXUaKhpXWP3rfLua3Nvb3OFHUYWDqk+qfxw= │ 5rjfIlCKqXUaKhpXWP3rfLua3Nvb3OFHUYWDqk+qfxw=                                             │
├──────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│ POFIP_HASH   │ null                                         │ hnzzWDKj8vXxjuf2+ysPFugHLyHbF4lNMTbUPRjbpQOGfPNYMqPy9fGO5/b7Kw8W6AcvIdsXiU0xNtQ9GNulAw== │
└──────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────┘

tip: you can call takeSnapshot() again on the same object to update snapshot.

📁 Constants

FLAT_PAY

Common object to pass on ctx.deployer.executeTx()

flatPayWithMore(amountOfTransactions)

A flat pay to use on application call which do more than N inner transaction

📁 Encoder

strToUInt8Array

Convert from string to Uint8Array

uInt8ArrayToStr

Convert from Uint8Array to string

b64ToString

Convert from encoded b64 string to string. Example b64ToString('SEVMTE8=') -> HELLO (playground)

📁 Model

Interfaces to use and type responses of AlgoClient.

📁 Terminal

forPressEnter

Just a sync method which wait to press enter on the stdin. It block the execution script.

TODO

  • [ ] Extend asset list for customization (see AssetName)
  • [ ] Complete doc with more example and refs
  • [ ] Split imports
    • import { AlgoBuilderScriptFactory } from '@travelx/algob-ext/ext/factory'
    • import { Encoder } from '@travelx/algob-ext/encoder'. Then Encoder.strToUInt8Array(..)