Skip to content

Quick Start

Terminal window
npm install @akta/sdk algosdk @algorandfoundation/algokit-utils

The SDK requires these peer dependencies:

PackageVersion
algosdk3.5.2
@algorandfoundation/algokit-utils9.1.2

The SDK auto-resolves app IDs for testnet and mainnet. Just tell it which network:

import { setCurrentNetwork } from '@akta/sdk'
setCurrentNetwork('testnet') // or 'mainnet'

Or set the ALGORAND_NETWORK environment variable:

Terminal window
ALGORAND_NETWORK=testnet
import { AlgorandClient } from '@algorandfoundation/algokit-utils'
const algorand = AlgorandClient.testNet()

Every SDK class follows the same pattern — pass an AlgorandClient and optional factoryParams:

import { StakingSDK } from '@akta/sdk/staking'
const staking = new StakingSDK({ algorand })

The appId is resolved automatically from the baked-in testnet/mainnet IDs. For localnet, pass it explicitly:

const staking = new StakingSDK({
algorand,
factoryParams: { appId: 1027n }
})
// Get global state
const state = await staking.getGlobalState()
console.log(state)

For write operations, provide a sender and signer:

import { mnemonicToSecretKey } from 'algosdk'
const account = mnemonicToSecretKey('your mnemonic ...')
const staking = new StakingSDK({
algorand,
factoryParams: {
defaultSender: account.addr.toString(),
defaultSigner: algorand.account.getSigner(account.addr.toString()),
}
})
// Stake tokens
await staking.stake({
amount: 1_000_000n, // 1 AKTA (6 decimals)
})

The SDK is tree-shakeable. Import only what you need:

// Only the wallet module
import { WalletSDK } from '@akta/sdk/wallet'
// Only the DAO module
import { AkitaDaoSDK } from '@akta/sdk/dao'
// Only the social module
import { SocialSDK } from '@akta/sdk/social'
// Only gates
import { GateSDK } from '@akta/sdk/gates'
// Only the connect protocol
import { parseAkitaConnectUri } from '@akta/sdk/connect'

Available sub-module imports:

Import PathContents
@akta/sdkAll SDK classes and utilities
@akta/sdk/walletWalletSDK, WalletFactorySDK, plugins
@akta/sdk/daoAkitaDaoSDK
@akta/sdk/dao-deployableDeployable DAO variant (retains create method for fresh deploys within the 8kb AVM contract size limit)
@akta/sdk/stakingStakingSDK
@akta/sdk/staking-poolStakingPoolSDK, StakingPoolFactorySDK
@akta/sdk/rewardsRewardsSDK
@akta/sdk/subscriptionsSubscriptionsSDK
@akta/sdk/socialSocialSDK
@akta/sdk/marketplaceMarketplaceSDK, ListingSDK
@akta/sdk/auctionAuctionSDK, AuctionFactorySDK
@akta/sdk/raffleRaffleSDK, RaffleFactorySDK
@akta/sdk/pollPollSDK, PollFactorySDK
@akta/sdk/prize-boxPrizeBoxSDK, PrizeBoxFactorySDK
@akta/sdk/hyper-swapHyperSwapSDK
@akta/sdk/escrowEscrowSDK, EscrowFactorySDK
@akta/sdk/gatesGateSDK
@akta/sdk/meta-merklesMetaMerklesSDK
@akta/sdk/connectConnect protocol URI helpers
@akta/sdk/typesShared type definitions