Quick Start
Installation
Section titled “Installation”npm install @akta/sdk algosdk @algorandfoundation/algokit-utilsThe SDK requires these peer dependencies:
| Package | Version |
|---|---|
algosdk | 3.5.2 |
@algorandfoundation/algokit-utils | 9.1.2 |
Basic Usage
Section titled “Basic Usage”1. Set your network
Section titled “1. Set your network”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:
ALGORAND_NETWORK=testnet2. Create an AlgorandClient
Section titled “2. Create an AlgorandClient”import { AlgorandClient } from '@algorandfoundation/algokit-utils'
const algorand = AlgorandClient.testNet()3. Initialize an SDK
Section titled “3. Initialize an SDK”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 }})4. Read on-chain state
Section titled “4. Read on-chain state”// Get global stateconst state = await staking.getGlobalState()console.log(state)5. Write transactions
Section titled “5. Write transactions”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 tokensawait staking.stake({ amount: 1_000_000n, // 1 AKTA (6 decimals)})Using Sub-Modules
Section titled “Using Sub-Modules”The SDK is tree-shakeable. Import only what you need:
// Only the wallet moduleimport { WalletSDK } from '@akta/sdk/wallet'
// Only the DAO moduleimport { AkitaDaoSDK } from '@akta/sdk/dao'
// Only the social moduleimport { SocialSDK } from '@akta/sdk/social'
// Only gatesimport { GateSDK } from '@akta/sdk/gates'
// Only the connect protocolimport { parseAkitaConnectUri } from '@akta/sdk/connect'Available sub-module imports:
| Import Path | Contents |
|---|---|
@akta/sdk | All SDK classes and utilities |
@akta/sdk/wallet | WalletSDK, WalletFactorySDK, plugins |
@akta/sdk/dao | AkitaDaoSDK |
@akta/sdk/dao-deployable | Deployable DAO variant (retains create method for fresh deploys within the 8kb AVM contract size limit) |
@akta/sdk/staking | StakingSDK |
@akta/sdk/staking-pool | StakingPoolSDK, StakingPoolFactorySDK |
@akta/sdk/rewards | RewardsSDK |
@akta/sdk/subscriptions | SubscriptionsSDK |
@akta/sdk/social | SocialSDK |
@akta/sdk/marketplace | MarketplaceSDK, ListingSDK |
@akta/sdk/auction | AuctionSDK, AuctionFactorySDK |
@akta/sdk/raffle | RaffleSDK, RaffleFactorySDK |
@akta/sdk/poll | PollSDK, PollFactorySDK |
@akta/sdk/prize-box | PrizeBoxSDK, PrizeBoxFactorySDK |
@akta/sdk/hyper-swap | HyperSwapSDK |
@akta/sdk/escrow | EscrowSDK, EscrowFactorySDK |
@akta/sdk/gates | GateSDK |
@akta/sdk/meta-merkles | MetaMerklesSDK |
@akta/sdk/connect | Connect protocol URI helpers |
@akta/sdk/types | Shared type definitions |
Next Steps
Section titled “Next Steps”- Configuration — Environment variables and network setup
- SDK Overview — Architecture and patterns
- Wallet SDK — The foundational ARC-58 wallet system