@elacity-js/api
v0.9.2
Published
Elacity API client SDK. Provides a typed client for interacting with Elacity services (HTTP + GraphQL), intended to be consumed by apps and other SDK packages.
Downloads
109
Readme
@elacity-js/api
Elacity API client SDK. Provides a typed client for interacting with Elacity services (HTTP + GraphQL), intended to be consumed by apps and other SDK packages.
Features
- Multi-Network Support: Automatically routes to the correct API endpoint based on chain ID (Base, Arbitrum Sepolia, Elastos)
- SIWE Authentication: Sign-In with Ethereum authentication flow
- GraphQL & REST: Unified client supporting both GraphQL queries/mutations and REST endpoints
- Type-Safe Services: Fully typed service classes for all Elacity resources
Services
The ElacityClient provides the following services:
nfts(NFTService): Query and retrieve NFT items, collections, and metadatacollections(CollectionService): Discover and manage NFT collectionschannels(ChannelService): Create, update, and query creator channelsidentity(IdentityService): Manage user accounts, profiles, followers, and subscriptionsbackgroundJobs(BackgroundJobService): Track long-running asynchronous operations (media upload, transcoding, encoding)
Quick Start
import { ElacityClient, ChainId } from '@elacity-js/api';
// Initialize client for Base network
const client = new ElacityClient({ chainId: ChainId.Base });
// Authenticate with SIWE
await client.auth.login(address, signature);
// Use services
const nfts = await client.nfts.fetchItems();
const channels = await client.channels.fetchChannels();
const account = await client.identity.me();Documentation
- https://docs.ela.city/sdks/api/
Contributing
If you want to contribute, the quickest workflow is:
- Implement changes under
packages/api/src/lib/(clients/services) - Add/update tests under
packages/api/src/lib/*.spec.ts - Run
nx test api, thennx build api
Small, focused PRs are preferred; avoid unrelated refactors.
This library was generated with Nx.
Building
Run nx build api to build the library.
Running unit tests
Run nx test api to execute the unit tests via Jest.
