@cheqd/sdk
Version:
A TypeScript SDK built with CosmJS to interact with the cheqd network ledger
62 lines • 3.04 kB
TypeScript
import { GeneratedType } from '@cosmjs/proto-signing';
import { CheqdSigningStargateClient } from '../signer.js';
import { IModuleMethodMap, QueryExtensionSetup } from '../types.js';
import { CheqdQuerier } from '../querier.js';
/**
* Abstract base class for all Cheqd SDK modules.
* Provides common functionality and enforces implementation of required methods.
*/
export declare abstract class AbstractCheqdSDKModule {
/** Signing client for blockchain transactions */
_signer: CheqdSigningStargateClient;
/** Module methods registry */
methods: IModuleMethodMap;
/** Querier client for data retrieval */
querier: CheqdQuerier;
/** List of methods that should not be exposed externally */
readonly _protectedMethods: string[];
/** Static registry of protobuf message types */
static readonly registryTypes: Iterable<[string, GeneratedType]>;
/** Static querier extension setup function */
static readonly querierExtensionSetup: QueryExtensionSetup<any>;
/**
* Creates a new SDK module instance.
*
* @param signer - Signing client for blockchain transactions
* @param querier - Querier client for data retrieval
* @throws Error if signer or querier is not provided
*/
constructor(signer: CheqdSigningStargateClient, querier: CheqdQuerier);
/**
* Gets the registry types for message encoding/decoding.
* Must be implemented by each module to provide its specific message types.
*
* @returns Iterable of [typeUrl, GeneratedType] pairs for the registry
*/
abstract getRegistryTypes(): Iterable<[string, GeneratedType]>;
}
/**
* Minimal importable interface for SDK modules.
* Excludes internal implementation details and protected methods for clean external APIs.
*/
export type MinimalImportableCheqdSDKModule<T extends AbstractCheqdSDKModule> = Omit<T, '_signer' | '_protectedMethods' | 'registryTypes' | 'querierExtensionSetup' | 'getRegistryTypes' | 'getQuerierExtensionSetup'>;
/**
* Creates a new instance of a Cheqd SDK module.
* Generic factory function for instantiating any module type.
*
* @param module - Module constructor class
* @param args - Constructor arguments for the module
* @returns New instance of the specified module
*/
export declare function instantiateCheqdSDKModule<T extends new (...args: any[]) => T>(module: T, ...args: ConstructorParameters<T>): T;
/**
* Extracts registry types from a module instance.
* Safely retrieves protobuf message types with fallback to empty array.
*
* @param module - Module instance to extract registry types from
* @returns Iterable of [typeUrl, GeneratedType] pairs for protobuf messages
*/
export declare function instantiateCheqdSDKModuleRegistryTypes(module: any): Iterable<[string, GeneratedType]>;
export declare function instantiateCheqdSDKModuleQuerierExtensionSetup(module: any): QueryExtensionSetup<any>;
export declare function applyMixins(derivedCtor: any, constructors: any[]): IModuleMethodMap;
//# sourceMappingURL=_.d.ts.map