UNPKG

mind-hubs-sdk

Version:

Typescript SDK to interact with MIND Hub Framework

73 lines (72 loc) 2.4 kB
import { JsonRpcProvider } from 'ethers'; /** * SdkContextManager module for the SDK * Handles initialization and retrieval of core SDK configuration and runtime context */ export declare const CoreContextManager: { /** * Private variable to store the SDK configuration * This should only be modified during initialization */ _sdkConfig: Readonly<CoreConfig> | null; /** * Private variable to store the runtime context, including providers and utilities * This is populated during initialization */ _sdkContext: Readonly<CoreContext> | null; /** * Initializes the SDK configuration * This must be called before accessing the configuration or context * * @param config - The CoreConfig object containing necessary configuration parameters * @throws {Error} If any required configuration parameter is missing */ initialize(config: CoreConfig): void; /** * Retrieves the current SDK configuration * Ensures the configuration has been initialized before access * * @returns A readonly CoreConfig object * @throws {Error} If the configuration has not been initialized */ getConfiguration(): Readonly<CoreConfig>; /** * Retrieves the current runtime context for the SDK * * @returns The CoreContext object containing utilities such as the JsonRpcProvider * @throws {Error} If the context has not been initialized */ getContext(): Readonly<CoreContext>; }; /** * CoreConfig defines the required configuration structure for the SDK */ export type CoreConfig = { /** * Address of the Key Registry contract * This is a central registry that stores key information, allowing hubs to refer to keys using an ID to save gas */ fheKeyRegistryAddress: string; /** * Address of the Member Pool contract * This contract manages rewards and delegation to all hubs */ memberPoolAddress: string; /** * RPC endpoint for interacting with the blockchain network */ rpc: string; /** * Chain ID for the blockchain network */ chainID: number; }; /** * SdkContext represents utilities and providers available after initialization */ export type CoreContext = { /** * JsonRpcProvider instance for interacting with the blockchain */ jsonRpcProvider: JsonRpcProvider; };