SDK Overview
The @akta/sdk package is a TypeScript SDK that provides high-level classes for every Akita smart contract. Each class wraps a generated contract client and exposes developer-friendly methods for reading state and composing transactions.
Architecture
Section titled “Architecture”Every SDK class extends BaseSDK<T>, which handles:
- App ID resolution — from constructor, environment, or baked-in network config
- Network detection — from the AlgorandClient’s algod URL
- Send parameters — default sender/signer management
- Reader account — a zero-balance account for read-only simulate calls
abstract class BaseSDK<T> { appId: bigint client: T // The generated contract client algorand: AlgorandClient network: AkitaNetwork // Detected: 'mainnet' | 'testnet' | 'localnet' readerAccount: string sendParams: ExpandedSendParams}Constructor Pattern
Section titled “Constructor Pattern”All SDK classes follow the same constructor pattern:
import { AlgorandClient } from '@algorandfoundation/algokit-utils'import { StakingSDK } from '@akta/sdk/staking'
const algorand = AlgorandClient.testNet()const staking = new StakingSDK({ algorand })App IDs are auto-resolved from the network (testnet/mainnet have baked-in IDs). For write operations, set a default sender and signer:
const staking = new StakingSDK({ algorand, factoryParams: { defaultSender: myAddress, defaultSigner: mySigner, },})factoryParams
Section titled “factoryParams”| Field | Type | Description |
|---|---|---|
appId | bigint? | Application ID. Auto-resolved from env/network if omitted. |
defaultSender | string? | Default sender address for all transactions. |
defaultSigner | TransactionSigner? | Default signer for all transactions. |
For localnet or custom deployments, pass appId explicitly:
const staking = new StakingSDK({ algorand, factoryParams: { appId: 1027n },})Method Patterns
Section titled “Method Patterns”Read-Only Methods
Section titled “Read-Only Methods”Methods prefixed with get perform read-only operations using simulate (no transaction fees):
const state = await staking.getGlobalState()const plugins = await wallet.getPlugins()const proposal = await dao.getProposal(1n)Write Methods
Section titled “Write Methods”Write methods require a sender and signer — either from the constructor defaults or passed per-call:
// Uses constructor defaultsawait staking.stake({ amount: 1_000_000n })
// Override per-callawait staking.stake({ amount: 1_000_000n, sender: otherAddr, signer: otherSigner,})The MaybeSigner type appears on most write methods:
type MaybeSigner = { sender?: Address | string signer?: TransactionSigner}Return Types
Section titled “Return Types”Write methods return transaction details:
type TxnReturn<T> = { groupId: string txIds: string[] confirmations: PendingTransactionResponse[] transactions: Transaction[] return?: T // The ABI return value, if any}Group operations return:
type GroupReturn = { groupId: string txIds: string[] returns: ABIReturn[] confirmations: PendingTransactionResponse[] transactions: Transaction[]}SDK Classes
Section titled “SDK Classes”| Class | Import | Description |
|---|---|---|
WalletSDK | @akta/sdk/wallet | ARC-58 abstracted account management |
WalletFactorySDK | @akta/sdk/wallet | Create new ARC-58 wallets |
AkitaDaoSDK | @akta/sdk/dao | DAO governance — proposals, voting, execution |
StakingSDK | @akta/sdk/staking | Universal public staking utility (heartbeat, soft, hard, lock) |
RewardsSDK | @akta/sdk/rewards | Reward distribution and claims |
SubscriptionsSDK | @akta/sdk/subscriptions | Recurring payment services |
EscrowSDK | @akta/sdk/escrow | Standalone escrow |
EscrowFactorySDK | @akta/sdk/escrow | Create escrow instances |
Social
Section titled “Social”| Class | Import | Description |
|---|---|---|
SocialSDK | @akta/sdk/social | Posts, reactions, follows, social interactions |
Marketplace
Section titled “Marketplace”| Class | Import | Description |
|---|---|---|
MarketplaceSDK | @akta/sdk/marketplace | NFT marketplace management |
ListingSDK | @akta/sdk/marketplace | Individual listing operations |
AuctionSDK | @akta/sdk/auction | Auction operations |
AuctionFactorySDK | @akta/sdk/auction | Create new auctions |
RaffleSDK | @akta/sdk/raffle | Raffle operations |
RaffleFactorySDK | @akta/sdk/raffle | Create new raffles |
PrizeBoxSDK | @akta/sdk/prize-box | Escrow-based asset bundle sales |
PrizeBoxFactorySDK | @akta/sdk/prize-box | Create prize box escrows |
| Class | Import | Description |
|---|---|---|
HyperSwapSDK | @akta/sdk/hyper-swap | Atomic swaps via merkle proofs |
StakingPoolSDK | @akta/sdk/staking-pool | Long-duration reward distribution (public utility) |
StakingPoolFactorySDK | @akta/sdk/staking-pool | Create staking pools for any token |
Governance & Access
Section titled “Governance & Access”| Class | Import | Description |
|---|---|---|
PollSDK | @akta/sdk/poll | Community polling |
PollFactorySDK | @akta/sdk/poll | Create polls |
GateSDK | @akta/sdk/gates | Access control with subgates |
MetaMerklesSDK | @akta/sdk/meta-merkles | Decentralized royalties and verifiable metadata |
Fee Handling
Section titled “Fee Handling”The SDK handles fee consolidation for complex multi-transaction groups. When using methods like wallet.usePlugin() or dao.newProposal(), the SDK:
- Simulates the transaction group to calculate exact inner transaction fees
- Consolidates all fees onto the first transaction in the group
- Sets remaining transaction fees to zero
This simplifies fee management — you don’t need to manually calculate inner transaction fees.
await wallet.usePlugin({ sender: myAddress, signer: mySigner, calls: [payPlugin.pay(...)], consolidateFees: true,})Next Steps
Section titled “Next Steps”- Wallet SDK — ARC-58 wallets, plugins, escrows
- DAO SDK — Governance proposals and voting
- Smart Contracts — Understanding the underlying contracts