getAlgoClient
getAlgoClient(
config?):AlgodClient
Defined in: algokit-utils-ts/src/network-client.ts:88
Parameters
Section titled “Parameters”config?
Section titled “config?”The config if you want to override the default (getting config from process.env)
Returns
Section titled “Returns”AlgodClient
Examples
Section titled “Examples”Default (load from environment variables)
// Uses process.env.ALGOD_SERVER, process.env.ALGOD_PORT and process.env.ALGOD_TOKEN // Automatically detects if you are using PureStake to switch in the right header name for ALGOD_TOKEN const algod = getAlgoClient() await algod.healthCheck().do()AlgoNode (testnet)
const algod = getAlgoClient(getAlgoNodeConfig('testnet', 'algod')) await algod.healthCheck().do()AlgoNode (mainnet)
const algod = getAlgoClient(getAlgoNodeConfig('mainnet', 'algod')) await algod.healthCheck().do()Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
const algod = getAlgoClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'}) await algod.healthCheck().do()