Configuration
Network Resolution
Section titled “Network Resolution”The SDK needs to know which Algorand network you’re targeting. It uses a priority-based resolution:
- Explicit call —
setCurrentNetwork('testnet') - Environment variable —
ALGORAND_NETWORK=testnet - URL detection — Infers from the AlgorandClient’s algod URL
Setting the Network
Section titled “Setting the Network”Recommended approach — call setCurrentNetwork() at app startup:
import { setCurrentNetwork } from '@akta/sdk'
setCurrentNetwork('mainnet')Environment variable — works in Node.js and with Next.js:
# StandardALGORAND_NETWORK=testnet
# Next.js client-side alternativesNEXT_PUBLIC_ALGORAND_NETWORK=testnetNEXT_PUBLIC_ALGOD_NETWORK=testnetAuto-detection — the SDK can infer the network from your AlgorandClient’s URL:
import { AlgorandClient } from '@algorandfoundation/algokit-utils'
// The SDK detects "testnet" from the URLconst algorand = AlgorandClient.testNet()Detection patterns:
| Network | URL patterns |
|---|---|
| mainnet | mainnet, algonode.io, mainnet-api.algonode.cloud |
| testnet | testnet, testnet-api.algonode.cloud |
| localnet | localhost, 127.0.0.1, :4001 |
App ID Resolution
Section titled “App ID Resolution”Every SDK class needs an application ID. The SDK resolves it through a fallback chain:
- Constructor parameter — explicitly passed
appId - Environment variable — e.g.
DAO_APP_ID=3368388956 - Baked-in network IDs — testnet and mainnet app IDs are built into the SDK
Automatic Resolution (Testnet/Mainnet)
Section titled “Automatic Resolution (Testnet/Mainnet)”For testnet and mainnet, you don’t need to configure anything:
import { setCurrentNetwork, AkitaDaoSDK } from '@akta/sdk'
setCurrentNetwork('mainnet')
// App ID resolves to mainnet DAO: 3368388956const dao = new AkitaDaoSDK({ algorand })Explicit App ID
Section titled “Explicit App ID”Override the auto-resolved ID:
const dao = new AkitaDaoSDK({ algorand, factoryParams: { appId: 123456n }})Environment Variables
Section titled “Environment Variables”Set app IDs through environment variables. This is useful for localnet or when overriding defaults:
# Core contractsDAO_APP_ID=3368388956WALLET_APP_ID=3368395481STAKING_APP_ID=3368393172REWARDS_APP_ID=3368388985SUBSCRIPTIONS_APP_ID=3368389628ESCROW_FACTORY_APP_ID=3368388829WALLET_FACTORY_APP_ID=3368389117STAKING_POOL_FACTORY_APP_ID=3368391029
# SocialSOCIAL_APP_ID=3368393551SOCIAL_GRAPH_APP_ID=3414941676SOCIAL_IMPACT_APP_ID=3368393419SOCIAL_MODERATION_APP_ID=3368393629
# FactoriesAUCTION_FACTORY_APP_ID=3368393933MARKETPLACE_APP_ID=3368394180RAFFLE_FACTORY_APP_ID=3368394210POLL_FACTORY_APP_ID=3368394268PRIZE_BOX_FACTORY_APP_ID=3368394289
# Gates & OtherGATE_APP_ID=3368394436HYPER_SWAP_APP_ID=3368394471META_MERKLES_APP_ID=3368394372
# AssetsAKTA_ASSET_ID=523683256BONES_ASSET_ID=3368406527Full Configuration Object
Section titled “Full Configuration Object”For advanced use, load all config at once:
import { getConfigFromEnv } from '@akta/sdk'
const config = getConfigFromEnv()// Returns: { network, daoAppId, walletAppId, stakingAppId, ... }Browser Environments
Section titled “Browser Environments”In browsers without process.env, set config on window:
window.__AKITA_ENV__ = { ALGORAND_NETWORK: 'mainnet', DAO_APP_ID: '3368388956',}The SDK’s getEnvVar() checks window.__AKITA_ENV__ as a fallback.
Network App IDs
Section titled “Network App IDs”You can access the full set of app IDs for any network:
import { getNetworkAppIds, MAINNET_APP_IDS, TESTNET_APP_IDS } from '@akta/sdk'
const mainnet = getNetworkAppIds('mainnet')console.log(mainnet.dao) // 3368388956nconsole.log(mainnet.wallet) // 3368395481nconsole.log(mainnet.staking) // 3368393172nSee the full App IDs reference for all testnet and mainnet IDs.