ClientManager
Defined in: algokit-utils-ts/src/types/client-manager.ts:48
Exposes access to various API clients.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ClientManager(
clientsOrConfig,algorandClient?):ClientManager
Defined in: algokit-utils-ts/src/types/client-manager.ts:74
algosdk clients or config for interacting with the official Algorand APIs.
Parameters
Section titled “Parameters”clientsOrConfig
Section titled “clientsOrConfig”The clients or config to use
algorandClient?
Section titled “algorandClient?”Returns
Section titled “Returns”ClientManager
Examples
Section titled “Examples”Algod client only
const clientManager = new ClientManager({ algod: algodClient })All clients
const clientManager = new ClientManager({ algod: algodClient, indexer: indexerClient, kmd: kmdClient })Algod config only
const clientManager = new ClientManager({ algodConfig })All client configs
const clientManager = new ClientManager({ algodConfig, indexerConfig, kmdConfig })Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get algod():
AlgodClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:93
Returns an algosdk Algod API client.
Returns
Section titled “Returns”AlgodClient
The Algod client
indexer
Section titled “indexer”Get Signature
Section titled “Get Signature”get indexer():
IndexerClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:102
Returns an algosdk Indexer API client or throws an error if it’s not been provided.
Throws
Section titled “Throws”Error if no Indexer client is configured
Returns
Section titled “Returns”IndexerClient
The Indexer client
indexerIfPresent
Section titled “indexerIfPresent”Get Signature
Section titled “Get Signature”get indexerIfPresent():
IndexerClient|undefined
Defined in: algokit-utils-ts/src/types/client-manager.ts:111
Returns an algosdk Indexer API client or undefined if it’s not been provided.
Returns
Section titled “Returns”IndexerClient | undefined
The Indexer client or undefined
Get Signature
Section titled “Get Signature”get kmd():
KmdClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:120
Returns an algosdk KMD API client or throws an error if it’s not been provided.
Throws
Section titled “Throws”Error if no KMD client is configured
Returns
Section titled “Returns”KmdClient
The KMD client
Methods
Section titled “Methods”getAppClientByCreatorAndName()
Section titled “getAppClientByCreatorAndName()”getAppClientByCreatorAndName(
params):Promise<AppClient>
Defined in: algokit-utils-ts/src/types/client-manager.ts:284
Returns a new AppClient client for managing calls and state for an ARC-32/ARC-56 app.
This method resolves the app ID by looking up the creator address and name
using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
Parameters
Section titled “Parameters”params
Section titled “params”The parameters to create the app client
appLookupCache?
Section titled “appLookupCache?”An optional cached app lookup that matches a name to on-chain details;
either this is needed or indexer is required to be passed in to this ClientManager on construction.
appName?
Section titled “appName?”string
Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name
approvalSourceMap?
Section titled “approvalSourceMap?”ProgramSourceMap
Optional source map for the approval program
appSpec
Section titled “appSpec”string | Arc56Contract | AppSpec
The ARC-56 or ARC-32 application spec as either:
- Parsed JSON ARC-56
Contract - Parsed JSON ARC-32
AppSpec - Raw JSON string (in either ARC-56 or ARC-32 format)
clearSourceMap?
Section titled “clearSourceMap?”ProgramSourceMap
Optional source map for the clear state program
creatorAddress
Section titled “creatorAddress”string | Address
The address of the creator account for the app
defaultSender?
Section titled “defaultSender?”string | Address
Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”TransactionSigner
Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).
ignoreCache?
Section titled “ignoreCache?”boolean
Whether or not to ignore the AppDeployer lookup cache and force an on-chain lookup, default: use any cached value
Returns
Section titled “Returns”Promise<AppClient>
The AppClient instance
Example
Section titled “Example”Basic
const appClient = clientManager.getAppClientByCreatorAndName({ appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}', // appId resolved by looking for app ID of named app by this creator creatorAddress: 'CREATORADDRESS',})getAppClientById()
Section titled “getAppClientById()”getAppClientById(
params):AppClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:307
Returns a new AppClient client for managing calls and state for an ARC-32/ARC-56 app.
Parameters
Section titled “Parameters”params
Section titled “params”The parameters to create the app client
bigint
The ID of the app instance this client should make calls against.
appName?
Section titled “appName?”string
Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name
approvalSourceMap?
Section titled “approvalSourceMap?”ProgramSourceMap
Optional source map for the approval program
appSpec
Section titled “appSpec”string | Arc56Contract | AppSpec
The ARC-56 or ARC-32 application spec as either:
- Parsed JSON ARC-56
Contract - Parsed JSON ARC-32
AppSpec - Raw JSON string (in either ARC-56 or ARC-32 format)
clearSourceMap?
Section titled “clearSourceMap?”ProgramSourceMap
Optional source map for the clear state program
defaultSender?
Section titled “defaultSender?”string | Address
Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”TransactionSigner
Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).
Returns
Section titled “Returns”The AppClient instance
Example
Section titled “Example”Basic
const appClient = clientManager.getAppClientById({ appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}', appId: 12345n,})getAppClientByNetwork()
Section titled “getAppClientByNetwork()”getAppClientByNetwork(
params):Promise<AppClient>
Defined in: algokit-utils-ts/src/types/client-manager.ts:330
Returns a new AppClient client for managing calls and state for an ARC-56 app.
This method resolves the app ID for the current network based on
pre-determined network-specific app IDs specified in the ARC-56 app spec.
If no IDs are in the app spec or the network isn’t recognised, an error is thrown.
Parameters
Section titled “Parameters”params
Section titled “params”The parameters to create the app client
appName?
Section titled “appName?”string
Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name
approvalSourceMap?
Section titled “approvalSourceMap?”ProgramSourceMap
Optional source map for the approval program
appSpec
Section titled “appSpec”string | Arc56Contract | AppSpec
The ARC-56 or ARC-32 application spec as either:
- Parsed JSON ARC-56
Contract - Parsed JSON ARC-32
AppSpec - Raw JSON string (in either ARC-56 or ARC-32 format)
clearSourceMap?
Section titled “clearSourceMap?”ProgramSourceMap
Optional source map for the clear state program
defaultSender?
Section titled “defaultSender?”string | Address
Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”TransactionSigner
Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).
Returns
Section titled “Returns”Promise<AppClient>
The AppClient instance
Example
Section titled “Example”Basic
const appClient = clientManager.getAppClientByNetwork({ appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}', // appId resolved by using ARC-56 spec to find app ID for current network})getAppFactory()
Section titled “getAppFactory()”getAppFactory(
params):AppFactory
Defined in: algokit-utils-ts/src/types/client-manager.ts:261
Returns a new AppFactory client
Parameters
Section titled “Parameters”params
Section titled “params”The parameters to create the app factory
appName?
Section titled “appName?”string
Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name.
appSpec
Section titled “appSpec”string | Arc56Contract | AppSpec
The ARC-56 or ARC-32 application spec as either:
- Parsed JSON ARC-56
Contract - Parsed JSON ARC-32
AppSpec - Raw JSON string (in either ARC-56 or ARC-32 format)
defaultSender?
Section titled “defaultSender?”string | Address
Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”TransactionSigner
Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).
deletable?
Section titled “deletable?”boolean
Whether or not the contract should have deploy-time permanence control set, undefined = ignore.
If specified here will get used in calls to deploy and create calls unless overridden in those calls.
Useful if you want to vend multiple contracts from the same factory without specifying this value for each call.
deployTimeParams?
Section titled “deployTimeParams?”Optional deploy-time TEAL template replacement parameters.
If specified here will get used in calls to deploy and create calls unless overridden in those calls.
Useful if you want to vend multiple contracts from the same factory without specifying this value for each call.
updatable?
Section titled “updatable?”boolean
Whether or not the contract should have deploy-time immutability control set, undefined = ignore.
If specified here will get used in calls to deploy and create calls unless overridden in those calls.
Useful if you want to vend multiple contracts from the same factory without specifying this value for each call.
version?
Section titled “version?”string
The version of app that is / will be deployed; defaults to 1.0
Returns
Section titled “Returns”The AppFactory instance
Examples
Section titled “Examples”Basic example
const factory = clientManager.getAppFactory({ appSpec: '{/* ARC-56 or ARC-32 compatible JSON */}',})Advanced example
const factory = clientManager.getAppFactory({ appSpec: parsedAppSpec_AppSpec_or_Arc56Contract, defaultSender: "SENDERADDRESS", appName: "OverriddenAppName", version: "2.0.0", updatable: true, deletable: false, deployTimeParams: { ONE: 1, TWO: 'value' }})getTestNetDispenser()
Section titled “getTestNetDispenser()”getTestNetDispenser(
params):TestNetDispenserApiClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:215
Returns a TestNet Dispenser API client.
Refer to docs on guidance to obtain an access token.
Parameters
Section titled “Parameters”params
Section titled “params”TestNetDispenserApiClientParams
An object containing parameters for the TestNetDispenserApiClient class.
Returns
Section titled “Returns”An instance of the TestNetDispenserApiClient class.
Example
Section titled “Example”const client = clientManager.getTestNetDispenser( { authToken: 'your_auth_token', requestTimeout: 15, })getTestNetDispenserFromEnvironment()
Section titled “getTestNetDispenserFromEnvironment()”getTestNetDispenserFromEnvironment(
params?):TestNetDispenserApiClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:234
Returns a TestNet Dispenser API client, loading the auth token from process.env.ALGOKIT_DISPENSER_ACCESS_TOKEN.
Refer to docs on guidance to obtain an access token.
Parameters
Section titled “Parameters”params?
Section titled “params?”Omit<TestNetDispenserApiClientParams, "authToken">
An object containing parameters for the TestNetDispenserApiClient class.
Returns
Section titled “Returns”An instance of the TestNetDispenserApiClient class.
Example
Section titled “Example”const client = clientManager.getTestNetDispenserFromEnvironment( { requestTimeout: 15, })getTypedAppClientByCreatorAndName()
Section titled “getTypedAppClientByCreatorAndName()”getTypedAppClientByCreatorAndName<
TClient>(typedClient,params):Promise<InstanceType<TClient>>
Defined in: algokit-utils-ts/src/types/client-manager.ts:358
Returns a new typed client, resolving the app by creator address and name.
Type Parameters
Section titled “Type Parameters”TClient
Section titled “TClient”TClient extends TypedAppClient<InstanceType<TClient>>
Parameters
Section titled “Parameters”typedClient
Section titled “typedClient”TClient
The typed client type to use
params
Section titled “params”The params to resolve the app by creator address and name
appLookupCache?
Section titled “appLookupCache?”An optional cached app lookup that matches a name to on-chain details;
either this is needed or indexer is required to be passed in to this ClientManager on construction.
appName?
Section titled “appName?”string
Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name
approvalSourceMap?
Section titled “approvalSourceMap?”ProgramSourceMap
Optional source map for the approval program
clearSourceMap?
Section titled “clearSourceMap?”ProgramSourceMap
Optional source map for the clear state program
creatorAddress
Section titled “creatorAddress”string | Address
The address of the creator account for the app
defaultSender?
Section titled “defaultSender?”string | Address
Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”TransactionSigner
Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).
ignoreCache?
Section titled “ignoreCache?”boolean
Whether or not to ignore the AppDeployer lookup cache and force an on-chain lookup, default: use any cached value
Returns
Section titled “Returns”Promise<InstanceType<TClient>>
The typed client instance
Examples
Section titled “Examples”Use name in ARC-32 / ARC-56 app spec
const appClient = clientManager.getTypedAppClientByCreatorAndName(MyContractClient, { creatorAddress: "CREATORADDRESS", defaultSender: alice,})Specify name
const appClient = clientManager.getTypedAppClientByCreatorAndName(MyContractClient, { creatorAddress: "CREATORADDRESS", name: "contract-name", defaultSender: alice,})getTypedAppClientById()
Section titled “getTypedAppClientById()”getTypedAppClientById<
TClient>(typedClient,params):InstanceType<TClient>
Defined in: algokit-utils-ts/src/types/client-manager.ts:382
Returns a new typed client, resolving the app by app ID.
Type Parameters
Section titled “Type Parameters”TClient
Section titled “TClient”TClient extends TypedAppClient<InstanceType<TClient>>
Parameters
Section titled “Parameters”typedClient
Section titled “typedClient”TClient
The typed client type to use
params
Section titled “params”The params to resolve the app by ID
bigint
The ID of the app instance this client should make calls against.
appName?
Section titled “appName?”string
Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name
approvalSourceMap?
Section titled “approvalSourceMap?”ProgramSourceMap
Optional source map for the approval program
clearSourceMap?
Section titled “clearSourceMap?”ProgramSourceMap
Optional source map for the clear state program
defaultSender?
Section titled “defaultSender?”string | Address
Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”TransactionSigner
Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).
Returns
Section titled “Returns”InstanceType<TClient>
The typed client instance
Example
Section titled “Example”const appClient = clientManager.getTypedAppClientById(MyContractClient, { appId: 12345n, defaultSender: alice,})getTypedAppClientByNetwork()
Section titled “getTypedAppClientByNetwork()”getTypedAppClientByNetwork<
TClient>(typedClient,params?):Promise<InstanceType<TClient>>
Defined in: algokit-utils-ts/src/types/client-manager.ts:408
Returns a new typed client, resolves the app ID for the current network based on pre-determined network-specific app IDs specified in the ARC-56 app spec.
If no IDs are in the app spec or the network isn’t recognised, an error is thrown.
Type Parameters
Section titled “Type Parameters”TClient
Section titled “TClient”TClient extends TypedAppClient<InstanceType<TClient>>
Parameters
Section titled “Parameters”typedClient
Section titled “typedClient”TClient
The typed client type to use
params?
Section titled “params?”The params to resolve the app by network
appName?
Section titled “appName?”string
Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name
approvalSourceMap?
Section titled “approvalSourceMap?”ProgramSourceMap
Optional source map for the approval program
clearSourceMap?
Section titled “clearSourceMap?”ProgramSourceMap
Optional source map for the clear state program
defaultSender?
Section titled “defaultSender?”string | Address
Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”TransactionSigner
Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).
Returns
Section titled “Returns”Promise<InstanceType<TClient>>
The typed client instance
Example
Section titled “Example”const appClient = clientManager.getTypedAppClientByNetwork(MyContractClient, { defaultSender: alice,})getTypedAppFactory()
Section titled “getTypedAppFactory()”getTypedAppFactory<
TClient>(typedFactory,params?):TClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:431
Returns a new typed app factory.
Type Parameters
Section titled “Type Parameters”TClient
Section titled “TClient”TClient
Parameters
Section titled “Parameters”typedFactory
Section titled “typedFactory”TypedAppFactory<TClient>
The typed factory type to use
params?
Section titled “params?”The params to resolve the factory by
appName?
Section titled “appName?”string
Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name.
defaultSender?
Section titled “defaultSender?”string | Address
Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”TransactionSigner
Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).
deletable?
Section titled “deletable?”boolean
Whether or not the contract should have deploy-time permanence control set, undefined = ignore.
If specified here will get used in calls to deploy and create calls unless overridden in those calls.
Useful if you want to vend multiple contracts from the same factory without specifying this value for each call.
deployTimeParams?
Section titled “deployTimeParams?”Optional deploy-time TEAL template replacement parameters.
If specified here will get used in calls to deploy and create calls unless overridden in those calls.
Useful if you want to vend multiple contracts from the same factory without specifying this value for each call.
updatable?
Section titled “updatable?”boolean
Whether or not the contract should have deploy-time immutability control set, undefined = ignore.
If specified here will get used in calls to deploy and create calls unless overridden in those calls.
Useful if you want to vend multiple contracts from the same factory without specifying this value for each call.
version?
Section titled “version?”string
The version of app that is / will be deployed; defaults to 1.0
Returns
Section titled “Returns”TClient
The typed client instance
Example
Section titled “Example”const appFactory = clientManager.getTypedAppFactory(MyContractClient, { sender: alice,})isLocalNet()
Section titled “isLocalNet()”isLocalNet():
Promise<boolean>
Defined in: algokit-utils-ts/src/types/client-manager.ts:171
Returns true if the current network is LocalNet.
Returns
Section titled “Returns”Promise<boolean>
True if the current network is LocalNet.
Example
Section titled “Example”const isLocalNet = await clientManager.isLocalNet()isMainNet()
Section titled “isMainNet()”isMainNet():
Promise<boolean>
Defined in: algokit-utils-ts/src/types/client-manager.ts:195
Returns true if the current network is MainNet.
Returns
Section titled “Returns”Promise<boolean>
True if the current network is MainNet.
Example
Section titled “Example”const isMainNet = await clientManager.isMainNet()isTestNet()
Section titled “isTestNet()”isTestNet():
Promise<boolean>
Defined in: algokit-utils-ts/src/types/client-manager.ts:183
Returns true if the current network is TestNet.
Returns
Section titled “Returns”Promise<boolean>
True if the current network is TestNet.
Example
Section titled “Example”const isTestNet = await clientManager.isTestNet()network()
Section titled “network()”network():
Promise<NetworkDetails>
Defined in: algokit-utils-ts/src/types/client-manager.ts:135
Get details about the current network.
Returns
Section titled “Returns”Promise<NetworkDetails>
The current network details
Example
Section titled “Example”Getting genesis ID
const network = await networkClient.network()const genesisId = network.genesisIdgenesisIdIsLocalNet()
Section titled “genesisIdIsLocalNet()”
staticgenesisIdIsLocalNet(genesisId): genesisId is “devnet-v1” | “sandnet-v1” | “dockernet-v1”
Defined in: algokit-utils-ts/src/types/client-manager.ts:159
Returns true if the given network genesisId is associated with a LocalNet network.
Parameters
Section titled “Parameters”genesisId
Section titled “genesisId”string
The network genesis ID
Returns
Section titled “Returns”genesisId is “devnet-v1” | “sandnet-v1” | “dockernet-v1”
Whether the given genesis ID is associated with a LocalNet network
Example
Section titled “Example”const isLocalNet = ClientManager.genesisIdIsLocalNet('testnet-v1.0')getAlgodClient()
Section titled “getAlgodClient()”
staticgetAlgodClient(config):AlgodClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:590
Returns an algod SDK client that automatically retries on idempotent calls.
Parameters
Section titled “Parameters”config
Section titled “config”The config of the client
Returns
Section titled “Returns”AlgodClient
The Algod client
Examples
Section titled “Examples”AlgoNode (testnet)
const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('testnet', 'algod')) await algod.healthCheck().do()AlgoNode (mainnet)
const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('mainnet', 'algod')) await algod.healthCheck().do()Custom (e.g. default LocalNet)
const algod = ClientManager.getAlgodClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'}) await algod.healthCheck().do()getAlgodClientFromEnvironment()
Section titled “getAlgodClientFromEnvironment()”
staticgetAlgodClientFromEnvironment():AlgodClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:608
Returns an algod SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).
Returns
Section titled “Returns”AlgodClient
The Algod client
Example
Section titled “Example” // Uses process.env.ALGOD_SERVER, process.env.ALGOD_PORT and process.env.ALGOD_TOKEN const algod = ClientManager.getAlgodClientFromEnvironment() await algod.healthCheck().do()getAlgodConfigFromEnvironment()
Section titled “getAlgodConfigFromEnvironment()”
staticgetAlgodConfigFromEnvironment():AlgoClientConfig
Defined in: algokit-utils-ts/src/types/client-manager.ts:492
Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment)
Expects process.env.ALGOD_SERVER to be defined, and you can also specify process.env.ALGOD_PORT and process.env.ALGOD_TOKEN.
Returns
Section titled “Returns”The Algod client configuration
Throws
Section titled “Throws”Error if process.env.ALGOD_SERVER is not defined
Example
Section titled “Example”const config = ClientManager.getAlgodConfigFromEnvironment()getAlgoNodeConfig()
Section titled “getAlgoNodeConfig()”
staticgetAlgoNodeConfig(network,config):AlgoClientConfig
Defined in: algokit-utils-ts/src/types/client-manager.ts:545
Returns the Algorand configuration to point to the free tier of the AlgoNode service.
Parameters
Section titled “Parameters”network
Section titled “network”"testnet" | "mainnet"
Which network to connect to - TestNet or MainNet
config
Section titled “config”"algod" | "indexer"
Which algod config to return - Algod or Indexer
Returns
Section titled “Returns”The AlgoNode client configuration
Example
Section titled “Example”const config = ClientManager.getAlgoNodeConfig('testnet', 'algod')getConfigFromEnvironmentOrLocalNet()
Section titled “getConfigFromEnvironmentOrLocalNet()”
staticgetConfigFromEnvironmentOrLocalNet():AlgoConfig
Defined in: algokit-utils-ts/src/types/client-manager.ts:456
Retrieve client configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment)
If both process.env.INDEXER_SERVER and process.env.ALGOD_SERVER is defined it will use both along with optional process.env.ALGOD_PORT, process.env.ALGOD_TOKEN, process.env.INDEXER_PORT and process.env.INDEXER_TOKEN.
If only process.env.ALGOD_SERVER is defined it will use this along with optional process.env.ALGOD_PORT and process.env.ALGOD_TOKEN and leave indexer as undefined.
If only process.env.INDEXER_SERVER is defined it will use the default (LocalNet) configuration for both algod and indexer.
It will return a KMD configuration that uses process.env.KMD_PORT (or port 4002) if process.env.ALGOD_SERVER is defined,
otherwise it will use the default LocalNet config unless it detects testnet or mainnet.
Returns
Section titled “Returns”The config for algod, indexer and kmd
Example
Section titled “Example”const config = ClientManager.getConfigFromEnvironmentOrLocalNet()getDefaultLocalNetConfig()
Section titled “getDefaultLocalNetConfig()”
staticgetDefaultLocalNetConfig(configOrPort):AlgoClientConfig
Defined in: algokit-utils-ts/src/types/client-manager.ts:561
Returns the Algorand configuration to point to the default LocalNet.
Parameters
Section titled “Parameters”configOrPort
Section titled “configOrPort”number | "algod" | "indexer" | "kmd"
Which algod config to return - algod, kmd, or indexer OR a port number
Returns
Section titled “Returns”The LocalNet client configuration
Example
Section titled “Example”const config = ClientManager.getDefaultLocalNetConfig('algod')getIndexerClient()
Section titled “getIndexerClient()”
staticgetIndexerClient(config):IndexerClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:633
Returns an indexer SDK client that automatically retries on idempotent calls
Parameters
Section titled “Parameters”config
Section titled “config”The config of the client
Returns
Section titled “Returns”IndexerClient
The Indexer client
Examples
Section titled “Examples”AlgoNode (testnet)
const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('testnet', 'indexer')) await indexer.makeHealthCheck().do()AlgoNode (mainnet)
const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('mainnet', 'indexer')) await indexer.makeHealthCheck().do()Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
const indexer = ClientManager.getIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'}) await indexer.makeHealthCheck().do()getIndexerClientFromEnvironment()
Section titled “getIndexerClientFromEnvironment()”
staticgetIndexerClientFromEnvironment():IndexerClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:652
Returns an indexer SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).
Returns
Section titled “Returns”IndexerClient
The Indexer client
Example
Section titled “Example” // Uses process.env.INDEXER_SERVER, process.env.INDEXER_PORT and process.env.INDEXER_TOKEN const indexer = ClientManager.getIndexerClientFromEnvironment() await indexer.makeHealthCheck().do()getIndexerConfigFromEnvironment()
Section titled “getIndexerConfigFromEnvironment()”
staticgetIndexerConfigFromEnvironment():AlgoClientConfig
Defined in: algokit-utils-ts/src/types/client-manager.ts:519
Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment).
Expects process.env.INDEXER_SERVER to be defined, and you can also specify process.env.INDEXER_PORT and process.env.INDEXER_TOKEN.
Returns
Section titled “Returns”The Indexer client configuration
Throws
Section titled “Throws”Error if process.env.INDEXER_SERVER is not defined
Example
Section titled “Example”const config = ClientManager.getIndexerConfigFromEnvironment()getKmdClient()
Section titled “getKmdClient()”
staticgetKmdClient(config):KmdClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:668
Returns a KMD SDK client.
KMD client allows you to export private keys, which is useful to (for instance) get the default account in a LocalNet network.
Parameters
Section titled “Parameters”config
Section titled “config”The config for the client
Returns
Section titled “Returns”KmdClient
The KMD client
Example
Section titled “Example”Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
const kmd = ClientManager.getKmdClient({server: 'http://localhost', port: '4002', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})getKmdClientFromEnvironment()
Section titled “getKmdClientFromEnvironment()”
staticgetKmdClientFromEnvironment():KmdClient
Defined in: algokit-utils-ts/src/types/client-manager.ts:683
Returns a KMD SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).
Returns
Section titled “Returns”KmdClient
The KMD client
Example
Section titled “Example” // Uses process.env.ALGOD_SERVER, process.env.KMD_PORT (or if not specified: port 4002) and process.env.ALGOD_TOKEN const kmd = ClientManager.getKmdClientFromEnvironment()