ClientManager
Defined in: src/client-manager.ts:47
Exposes access to various API clients.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ClientManager(
clientsOrConfig,algorandClient?):ClientManager
Defined in: src/client-manager.ts:73
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”const clientManager = new ClientManager({ algod: algodClient })const clientManager = new ClientManager({ algod: algodClient, indexer: indexerClient, kmd: kmdClient })const clientManager = new ClientManager({ algodConfig })const clientManager = new ClientManager({ algodConfig, indexerConfig, kmdConfig })Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get algod():
AlgodClient
Defined in: src/client-manager.ts:92
Returns an Algod API client.
Returns
Section titled “Returns”The Algod client
indexer
Section titled “indexer”Get Signature
Section titled “Get Signature”get indexer():
IndexerClient
Defined in: src/client-manager.ts:101
Returns an 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”The Indexer client
indexerIfPresent
Section titled “indexerIfPresent”Get Signature
Section titled “Get Signature”get indexerIfPresent():
IndexerClient|undefined
Defined in: src/client-manager.ts:110
Returns an 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: src/client-manager.ts:119
Returns a 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”The KMD client
Methods
Section titled “Methods”getAppClientByCreatorAndName()
Section titled “getAppClientByCreatorAndName()”getAppClientByCreatorAndName(
params):Promise<AppClient>
Defined in: src/client-manager.ts:283
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”The address of the creator account for the app
defaultSender?
Section titled “defaultSender?”Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”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”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: src/client-manager.ts:306
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?”Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”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”const appClient = clientManager.getAppClientById({ appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}', appId: 12345n,})getAppClientByNetwork()
Section titled “getAppClientByNetwork()”getAppClientByNetwork(
params):Promise<AppClient>
Defined in: src/client-manager.ts:329
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?”Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”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”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: src/client-manager.ts:260
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?”Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”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”const factory = clientManager.getAppFactory({ appSpec: '{/* ARC-56 or ARC-32 compatible JSON */}',})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: src/client-manager.ts:214
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: src/client-manager.ts:233
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: src/client-manager.ts:357
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”The address of the creator account for the app
defaultSender?
Section titled “defaultSender?”Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”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”const appClient = clientManager.getTypedAppClientByCreatorAndName(MyContractClient, { creatorAddress: "CREATORADDRESS", defaultSender: alice,})const appClient = clientManager.getTypedAppClientByCreatorAndName(MyContractClient, { creatorAddress: "CREATORADDRESS", name: "contract-name", defaultSender: alice,})getTypedAppClientById()
Section titled “getTypedAppClientById()”getTypedAppClientById<
TClient>(typedClient,params):InstanceType<TClient>
Defined in: src/client-manager.ts:381
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?”Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”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: src/client-manager.ts:407
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?”Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”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: src/client-manager.ts:430
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?”Optional address to use for the account to use as the default sender for calls.
defaultSigner?
Section titled “defaultSigner?”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: src/client-manager.ts:170
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: src/client-manager.ts:194
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: src/client-manager.ts:182
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: src/client-manager.ts:134
Get details about the current network.
Returns
Section titled “Returns”Promise<NetworkDetails>
The current network details
Example
Section titled “Example”const network = await networkClient.network()const genesisId = network.genesisIdgenesisIdIsLocalNet()
Section titled “genesisIdIsLocalNet()”
staticgenesisIdIsLocalNet(genesisId): genesisId is “devnet-v1” | “sandnet-v1” | “dockernet-v1”
Defined in: src/client-manager.ts:158
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: src/client-manager.ts:589
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”The Algod client
Examples
Section titled “Examples” const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('testnet', 'algod')) await algod.healthCheck().do() const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('mainnet', 'algod')) await algod.healthCheck().do() const algod = ClientManager.getAlgodClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'}) await algod.healthCheck().do()getAlgodClientFromEnvironment()
Section titled “getAlgodClientFromEnvironment()”
staticgetAlgodClientFromEnvironment():AlgodClient
Defined in: src/client-manager.ts:610
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”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: src/client-manager.ts:491
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: src/client-manager.ts:544
Returns the Algorand configuration to point to the free tier of the AlgoNode service.
Parameters
Section titled “Parameters”network
Section titled “network”Which network to connect to - TestNet or MainNet
"testnet" | "mainnet"
config
Section titled “config”Which algod config to return - Algod or Indexer
"algod" | "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: src/client-manager.ts:455
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: src/client-manager.ts:560
Returns the Algorand configuration to point to the default LocalNet.
Parameters
Section titled “Parameters”configOrPort
Section titled “configOrPort”Which algod config to return - algod, kmd, or indexer OR a port number
number | "algod" | "indexer" | "kmd"
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: src/client-manager.ts:635
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”The Indexer client
Examples
Section titled “Examples” const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('testnet', 'indexer')) await indexer.makeHealthCheck().do() const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('mainnet', 'indexer')) await indexer.makeHealthCheck().do() const indexer = ClientManager.getIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'}) await indexer.makeHealthCheck().do()getIndexerClientFromEnvironment()
Section titled “getIndexerClientFromEnvironment()”
staticgetIndexerClientFromEnvironment():IndexerClient
Defined in: src/client-manager.ts:657
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”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: src/client-manager.ts:518
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: src/client-manager.ts:673
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”The KMD client
Example
Section titled “Example” const kmd = ClientManager.getKmdClient({server: 'http://localhost', port: '4002', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})getKmdClientFromEnvironment()
Section titled “getKmdClientFromEnvironment()”
staticgetKmdClientFromEnvironment():KmdClient
Defined in: src/client-manager.ts:693
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”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()