Skip to content

API Reference โ€‹

Welcome to the AAstar SDK API Reference. Our SDK is designed with a "Pre-check first, Action second" philosophy, providing tools for different ecosystem roles.

๐Ÿ“ฆ Packages Overview โ€‹

PackagePurpose
@aastar/sdkMeta Package - The most intuitive entry point for all developers.
@aastar/coreShared Logic - Essential roles, contract addresses, and requirement checkers.
@aastar/accountSmart Accounts - ERC-4337 account utilities and factories.
@aastar/paymasterGas Sponsoring - Client and middleware for Paymaster operations.
@aastar/tokensFinance - Tools for GT staking and XPNTs management.
@aastar/identityReputation - Community reputation scoring and SBT management.
@aastar/analyticsMetrics - Real-time ecosystem monitoring and data retrieval.
@aastar/dappReact Hooks - Ready-to-use hooks for frontend integration.

๐Ÿš€ Installation & Quick Start โ€‹

bash
pnpm add @aastar/sdk viem

1. Initialize Client โ€‹

typescript
import { createPublicClient, createWalletClient, http } from 'viem';
import { sepolia } from 'viem/chains';
import { createCommunityClient, createOperatorClient } from '@aastar/sdk';

const publicClient = createPublicClient({ chain: sepolia, transport: http() });
const walletClient = createWalletClient({ chain: sepolia, transport: http() });

const community = createCommunityClient({ publicClient, walletClient });

2. "Pre-check" Pattern โ€‹

Avoid reverts and save gas by checking requirements off-chain first.

typescript
const check = await community.checkLaunchRequirements(myAddress, parseEther("33"));
if (check.success) {
    await community.launchCommunity({ name: "My DAO" });
}

๐Ÿ—๏ธ Core Scenarios โ€‹

๐Ÿ›๏ธ For Community Owners โ€‹

Manage your community registry, configure SBT rules, and handle user onboarding.

โš™๏ธ For Operators โ€‹

Onboard as a Paymaster operator, stake GToken, and manage your collateral.

๐Ÿ“Š For Finance & Analytics โ€‹

Monitor tokenomics, handle GToken staking, and track ecosystem metrics.


๐Ÿ“š Complete Examples โ€‹

Practical implementations for common scenarios:


๐Ÿ”ง TypeScript Support โ€‹

All packages are written in TypeScript with full type definitions.

typescript
import type { 
  SupportedNetwork, 
  ClientConfig, 
  RoleRequirement
} from '@aastar/core';

๐Ÿ›ก๏ธ Error Handling โ€‹

typescript
import { AAStarError } from '@aastar/sdk';

try {
  // ... SDK call
} catch (error) {
  if (error instanceof AAStarError) {
    console.error(error.code, error.message);
  }
}

Released under the MIT License. | Last Updated: 2026-01-15 09:16