@algorandfoundation/algokit-utils
TypeScript icon, indicating that this package has built-in type declarations

6.2.1 • Public • Published

AlgoKit TypeScript Utilities

A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand. This project is part of AlgoKit.

The goal of this library is to provide intuitive, productive utility functions that make it easier, quicker and safer to build applications on Algorand. Largely these functions wrap the underlying Algorand SDK, but provide a higher level interface with sensible defaults and capabilities for common tasks.

Note: If you prefer Python there's an equivalent Python utility library.

Install | Documentation

Install

This library can be installed from NPM using your favourite npm client, e.g.:

npm install @algorandfoundation/algokit-utils

Then to import it:

import { AlgorandClient, Config } from '@algorandfoundation/algokit-utils'

See usage for more.

Guiding principles

This library follows the Guiding Principles of AlgoKit.

NextJS compatibility

algokit-utils-ts has a set of node specific utilities used for simplifying aggregation of artifacts for AlgoKit VSCode Debugger Extension. Which causes Next.js based projects to fail on fs module not found. To fix this issue, you can add the following to your next.config.js file:

  webpack: (config, { isServer }) => {
    // Fix for Module not found: Can't resolve 'fs'
    if (!isServer) {
      config.resolve.fallback.fs = false;
    }
    return config;
  },

The root cause is due to the fact that, unlike many frameworks, Next.js allows you to import server-only (Node.js APIs that don't work in a browser) code into your page files. When Next.js builds your project, it removes server only code from your client-side bundle by checking which code exists inside one any of the following built-in methods (code splitting):

  • getServerSideProps
  • getStaticProps
  • getStaticPaths

The Module not found: can't resolve 'xyz' error happens when you try to use server only code outside of these methods. Despite algokit-utils lazy loading the node specific code dynamically, Next.js does not seem to correctly identify whether a dynamic import is specific to server or client side. Hence the above fix disables the fallback for fs module so it ignores polyfilling it on client side.

Contributing

This is an open source project managed by the Algorand Foundation. See the AlgoKit contributing page to learn about making improvements.

To successfully run the tests in this repository you need to be running LocalNet via AlgoKit and also have package dependencies and .env.template copied to .env (both of which algokit bootstrap all can do for you):

algokit bootstrap all
algokit localnet start

To run tests you can use VS Code, or:

npm run test

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
6.2.1176latest
7.0.0-beta.240main
7.0.0-alpha.351alpha

Version History

VersionDownloads (Last 7 Days)Published
7.0.0-beta.240
7.0.0-alpha.351
7.0.0-alpha.261
7.0.0-alpha.112
7.0.0-beta.2332
7.0.0-beta.2213
7.0.0-beta.212
7.0.0-beta.2028
7.0.0-beta.193
7.0.0-beta.183
7.0.0-beta.171
7.0.0-beta.164
7.0.0-beta.153
7.0.0-beta.141
7.0.0-beta.131
7.0.0-beta.121
7.0.0-beta.111
7.0.0-beta.101
7.0.0-beta.92
7.0.0-beta.81
7.0.0-beta.711
7.0.0-beta.62
7.0.0-beta.51
7.0.0-beta.41
7.0.0-beta.31
7.0.0-beta.22
7.0.0-beta.12
6.3.0-beta.11
6.2.1176
6.2.1-beta.11
6.2.02
6.2.0-beta.12
6.1.3-beta.12
6.1.23
6.1.2-beta.11
6.1.11
6.1.1-beta.22
6.1.1-beta.11
6.1.080
6.1.0-beta.42
6.1.0-beta.31
6.1.0-beta.22
6.1.0-beta.13
6.0.516
6.0.5-beta.11
6.0.41
6.0.4-beta.23
6.0.4-beta.13
6.0.32
6.0.3-beta.22
6.0.3-beta.13
6.0.218
6.0.2-beta.11
6.0.11
6.0.1-beta.12
6.0.01
6.0.0-beta.51
6.0.0-beta.41
6.0.0-beta.32
6.0.0-beta.23
6.0.0-beta.12
5.8.0286
5.8.0-beta.14
5.7.01
5.6.12
5.6.1-beta.13
5.6.02
5.5.22
5.5.2-beta.31
5.5.2-beta.23
5.5.2-beta.13
5.5.13
5.5.1-beta.13
5.5.02
5.5.0-beta.22
5.5.0-beta.13
5.4.1-beta.11
5.4.0170
5.4.0-beta.12
5.3.3-beta.21
5.3.3-beta.12
5.3.22
5.3.2-beta.12
5.3.12
5.3.1-beta.12
5.3.02
5.2.32
5.2.3-beta.12
5.2.22
5.2.12
5.2.1-beta.22
5.2.1-beta.13
5.2.02
5.2.0-beta.43
5.2.0-beta.33
5.2.0-beta.23
5.2.0-beta.13
5.1.4-beta.12
5.1.3114
5.1.3-beta.11
5.1.21
5.1.2-beta.22
5.1.2-beta.12
5.1.12
5.1.1-beta.12
5.1.02
5.1.0-beta.12
5.0.2-beta.11
5.0.12
5.0.1-beta.32
5.0.1-beta.23
5.0.1-beta.12
5.0.052
5.0.0-beta.62
5.0.0-beta.52
5.0.0-beta.42
5.0.0-beta.33
5.0.0-beta.22
5.0.0-beta.12
4.1.1-beta.12
4.1.036
4.1.0-beta.12
4.0.01
4.0.0-beta.21
4.0.0-beta.11
3.1.02
3.1.0-beta.13
3.0.1-beta.22
3.0.1-beta.12
3.0.03
3.0.0-beta.42
3.0.0-beta.32
3.0.0-beta.22
3.0.0-beta.12
2.3.3-beta.62
2.3.3-beta.51
2.3.3-beta.41
2.3.3-beta.33
2.3.3-beta.23
2.3.3-beta.12
2.3.23
2.3.2-beta.22
2.3.2-beta.12
2.3.11
2.3.1-beta.23
2.3.1-beta.12
2.3.01
2.3.0-beta.23
2.3.0-beta.13
2.2.11
2.2.1-beta.12
2.2.03
2.2.0-beta.22
2.2.0-beta.11
2.1.02
2.1.0-beta.12
2.0.02
2.0.0-beta.181
2.0.0-beta.174
2.0.0-beta.162
2.0.0-beta.151
2.0.0-beta.143
2.0.0-beta.133
2.0.0-beta.121
2.0.0-beta.113
2.0.0-beta.102
2.0.0-beta.91
2.0.0-beta.82
2.0.0-beta.72
2.0.0-beta.63
2.0.0-beta.53
2.0.0-beta.43
2.0.0-beta.33
2.0.0-beta.22
2.0.0-beta.11
1.2.0-beta.22
1.2.0-beta.13
1.1.12
1.1.1-beta.12
1.1.03
1.0.0-beta.412
1.0.0-beta.403
1.0.0-beta.392
1.0.0-beta.383
1.0.0-beta.372
1.0.0-beta.363
1.0.0-beta.351
1.0.0-beta.343
1.0.0-beta.333
1.0.0-beta.322
1.0.0-beta.311
1.0.0-beta.303
1.0.0-beta.293
1.0.0-beta.281
1.0.01
1.0.0-beta.273
1.0.0-beta.261
1.0.0-beta.253
1.0.0-beta.243
1.0.0-beta.233
1.0.0-beta.222
1.0.0-beta.213
1.0.0-beta.201
1.0.0-beta.191
1.0.0-beta.182
1.0.0-beta.172
1.0.0-beta.162
1.0.0-beta.151
1.0.0-beta.141
1.0.0-beta.131
1.0.0-beta.122
1.0.0-beta.111
1.0.0-beta.101
1.0.0-beta.93
1.0.0-beta.83
1.0.0-beta.73
1.0.0-beta.61
1.0.0-beta.52
1.0.0-beta.42
1.0.0-beta.32
1.0.0-beta.23
0.1.02

Package Sidebar

Install

npm i @algorandfoundation/algokit-utils

Weekly Downloads

1,299

Version

6.2.1

License

MIT

Unpacked Size

1.37 MB

Total Files

352

Last publish

Collaborators

  • hmd2v
  • bruno.martins.algorand.foundation
  • joe-p
  • loedn
  • shane-at-algo
  • dev_algorand.foundation