JavaScript SDK
Full-featured SDK for Node.js, browsers, and modern JavaScript runtimes.
Installation
npm install @aethex/sdk
# or
yarn add @aethex/sdk
# or
pnpm add @aethex/sdk
Configuration
import { AeThex } from '@aethex/sdk';
const aethex = new AeThex({
projectId: 'your-project-id',
apiKey: 'your-api-key',
environment: 'production', // or 'staging'
region: 'auto' // or 'us', 'eu', 'asia'
});
TypeScript Support
The SDK is written in TypeScript and provides full type definitions:
import { AeThex, User, Asset, Session } from '@aethex/sdk';
const user: User = await aethex.identity.getProfile();
const assets: Asset[] = await aethex.assets.getInventory();
Error Handling
import { AeThexError, RateLimitError } from '@aethex/sdk';
try {
await aethex.assets.transfer({ ... });
} catch (error) {
if (error instanceof RateLimitError) {
console.log('Rate limited, retry after:', error.retryAfter);
} else if (error instanceof AeThexError) {
console.log('API error:', error.code, error.message);
}
}