Skip to content

Modular imports

AlgoKit Utils is designed with a modular architecture that allows you to import only the functionality you need. This enables better tree-shaking and smaller bundle sizes for your applications.

The library is organized into several subpath exports, each containing related functionality:

SubpathPurposeKey Exports
/transactTransaction primitivesTransaction, TransactionSigner, OnApplicationComplete, LogicSigAccount, MultisigAccount, BoxReference
/abiABI utilitiesABIMethod, ABIType, ABIStringType, ABIValue, Arc56 contract utilities
/algod-clientAlgod API typesAlgodClient, PendingTransactionResponse, and other Algod models
/indexer-clientIndexer API typesIndexerClient, response types like TransactionResponse, AccountResponse
/kmd-clientKMD API typesKmdClient, wallet types
/commonShared utilitiesAddress class, encoding/decoding codecs
/testingTest utilitiesalgorandFixture, algoKitLogCaptureFixture, TestLogger

For most use cases, you can import from the main package:

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

For specific types or when optimizing bundle size, use subpath imports:

// Transaction types
import { Transaction, TransactionSigner, OnApplicationComplete } from '@algorandfoundation/algokit-utils/transact'
// ABI utilities
import { ABIMethod, ABIType, ABIStringType } from '@algorandfoundation/algokit-utils/abi'
// API client types
import { PendingTransactionResponse } from '@algorandfoundation/algokit-utils/algod-client'
import { TransactionResponse, AccountResponse } from '@algorandfoundation/algokit-utils/indexer-client'
// Testing utilities
import { algorandFixture } from '@algorandfoundation/algokit-utils/testing'

When you only need types (not runtime values), use type-only imports:

import type { Transaction, TransactionSigner } from '@algorandfoundation/algokit-utils/transact'
import type { ABIMethod } from '@algorandfoundation/algokit-utils/abi'

Contains core transaction primitives and signing utilities:

import {
// Transaction class
Transaction,
// Signing
TransactionSigner,
AddressWithTransactionSigner,
LogicSigAccount,
MultisigAccount,
// App call types
OnApplicationComplete,
BoxReference,
// Transaction encoding/decoding
encodeTransaction,
decodeTransaction,
} from '@algorandfoundation/algokit-utils/transact'

Contains ABI (Application Binary Interface) utilities for smart contract interaction:

import {
// ABI Method
ABIMethod,
// ABI Types
ABIType,
ABIStringType,
ABIUintType,
ABIAddressType,
ABIArrayDynamicType,
ABITupleType,
// ABI Values
ABIValue,
// Arc56 utilities
Arc56Contract,
getBoxABIStorageKey,
getGlobalABIStorageKey,
} from '@algorandfoundation/algokit-utils/abi'

Contains autogenerated types from the Algod API specification:

import {
AlgodClient,
PendingTransactionResponse,
// ... other Algod API types
} from '@algorandfoundation/algokit-utils/algod-client'

Contains autogenerated types from the Indexer API specification:

import {
IndexerClient,
TransactionResponse,
TransactionsResponse,
AccountResponse,
ApplicationResponse,
AssetResponse,
// ... other Indexer API types
} from '@algorandfoundation/algokit-utils/indexer-client'

Contains testing utilities for automated tests:

import {
algorandFixture,
algoKitLogCaptureFixture,
getTestAccount,
runWhenIndexerCaughtUp,
} from '@algorandfoundation/algokit-utils/testing'

Using modular imports helps bundlers (like webpack, esbuild, or rollup) eliminate unused code from your final bundle. For example, if you only need transaction types:

// This imports only what you need
import { Transaction } from '@algorandfoundation/algokit-utils/transact'
// Instead of importing everything
import { Transaction } from '@algorandfoundation/algokit-utils'

Use the main export when:

  • You’re using AlgorandClient as your primary interface
  • Bundle size isn’t a critical concern
  • You need multiple related features

Use subpath imports when:

  • You need specific types for type annotations
  • You’re building a library that should have minimal dependencies
  • You want to optimize bundle size
  • You’re working with lower-level APIs directly