Skip to content

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.

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
}

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,
},
})
FieldTypeDescription
appIdbigint?Application ID. Auto-resolved from env/network if omitted.
defaultSenderstring?Default sender address for all transactions.
defaultSignerTransactionSigner?Default signer for all transactions.

For localnet or custom deployments, pass appId explicitly:

const staking = new StakingSDK({
algorand,
factoryParams: { appId: 1027n },
})

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 require a sender and signer — either from the constructor defaults or passed per-call:

// Uses constructor defaults
await staking.stake({ amount: 1_000_000n })
// Override per-call
await 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
}

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[]
}
ClassImportDescription
WalletSDK@akta/sdk/walletARC-58 abstracted account management
WalletFactorySDK@akta/sdk/walletCreate new ARC-58 wallets
AkitaDaoSDK@akta/sdk/daoDAO governance — proposals, voting, execution
StakingSDK@akta/sdk/stakingUniversal public staking utility (heartbeat, soft, hard, lock)
RewardsSDK@akta/sdk/rewardsReward distribution and claims
SubscriptionsSDK@akta/sdk/subscriptionsRecurring payment services
EscrowSDK@akta/sdk/escrowStandalone escrow
EscrowFactorySDK@akta/sdk/escrowCreate escrow instances
ClassImportDescription
SocialSDK@akta/sdk/socialPosts, reactions, follows, social interactions
ClassImportDescription
MarketplaceSDK@akta/sdk/marketplaceNFT marketplace management
ListingSDK@akta/sdk/marketplaceIndividual listing operations
AuctionSDK@akta/sdk/auctionAuction operations
AuctionFactorySDK@akta/sdk/auctionCreate new auctions
RaffleSDK@akta/sdk/raffleRaffle operations
RaffleFactorySDK@akta/sdk/raffleCreate new raffles
PrizeBoxSDK@akta/sdk/prize-boxEscrow-based asset bundle sales
PrizeBoxFactorySDK@akta/sdk/prize-boxCreate prize box escrows
ClassImportDescription
HyperSwapSDK@akta/sdk/hyper-swapAtomic swaps via merkle proofs
StakingPoolSDK@akta/sdk/staking-poolLong-duration reward distribution (public utility)
StakingPoolFactorySDK@akta/sdk/staking-poolCreate staking pools for any token
ClassImportDescription
PollSDK@akta/sdk/pollCommunity polling
PollFactorySDK@akta/sdk/pollCreate polls
GateSDK@akta/sdk/gatesAccess control with subgates
MetaMerklesSDK@akta/sdk/meta-merklesDecentralized royalties and verifiable metadata

The SDK handles fee consolidation for complex multi-transaction groups. When using methods like wallet.usePlugin() or dao.newProposal(), the SDK:

  1. Simulates the transaction group to calculate exact inner transaction fees
  2. Consolidates all fees onto the first transaction in the group
  3. 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,
})