UNPKG

@wasserstoff/tribes-sdk

Version:

SDK for integrating with Tribes by Astrix platform on any EVM compatible chain

110 lines (109 loc) 2.92 kB
import { ethers } from 'ethers'; import { AstrixSDKConfig } from '../types/core'; import { ContractAddresses } from '../types/contracts'; import { TokenModule } from '../modules/token'; import { PointsModule } from '../modules/points'; import { TribesModule } from '../modules/tribes'; import { ProfilesModule } from '../modules/profiles'; import { ContentModule } from '../modules/content'; import { OrganizationsModule } from '../modules/organizations'; import { AnalyticsModule } from '../modules/analytics'; import { RolesModule } from '../modules/roles'; /** * Core SDK class for interacting with the Tribes by Astrix platform */ export declare class AstrixSDK { private provider; private signer; private readonly config; private _token; private _points; private _tribes; private _profiles; private _content; private _organizations; private _analytics; private _roles; private contractAddresses; /** * Create a new instance of the SDK * @param config Configuration options */ constructor(config: AstrixSDKConfig); /** * Async initialization method to be called after construction */ init(): Promise<void>; /** * Initialize all modules */ private initializeModules; /** * Initialize contract addresses based on the connected network and any overrides * @param contractOverrides Optional contract address overrides */ private initContractAddresses; /** * Connect with a signer (wallet) * @param signer Ethers signer object */ connect(signer: ethers.Signer): Promise<void>; /** * Check if the SDK is connected with a signer */ isConnected(): boolean; /** * Get the connected address */ getAddress(): Promise<string>; /** * Get the provider */ getProvider(): ethers.JsonRpcProvider; /** * Get the signer */ getSigner(): ethers.Signer | null; /** * Get the configuration */ getConfig(): AstrixSDKConfig; /** * Get the contract address for a specific contract * @param contractName Name of the contract * @returns Contract address */ getContractAddress(contractName: keyof ContractAddresses): string; /** * Get the token module */ get token(): TokenModule; /** * Get the points module */ get points(): PointsModule; /** * Get the tribes module */ get tribes(): TribesModule; /** * Get the profiles module */ get profiles(): ProfilesModule; /** * Get the content module */ get content(): ContentModule; /** * Get the organizations module */ get organizations(): OrganizationsModule; /** * Get the analytics module */ get analytics(): AnalyticsModule; /** * Get the roles module */ get roles(): RolesModule; }