UNPKG

@cheqd/sdk

Version:

A TypeScript SDK built with CosmJS to interact with the cheqd network ledger

43 lines 1.49 kB
export class AbstractCheqdSDKModule { _signer; methods = {}; querier; _protectedMethods = ['constructor', 'getRegistryTypes', 'getQuerierExtensionSetup']; static registryTypes = []; static querierExtensionSetup = (base) => ({}); constructor(signer, querier) { if (!signer) { throw new Error('signer is required'); } if (!querier) { throw new Error('querier is required'); } this._signer = signer; this.querier = querier; } } export function instantiateCheqdSDKModule(module, ...args) { return new module(...args); } export function instantiateCheqdSDKModuleRegistryTypes(module) { return module.registryTypes ?? []; } export function instantiateCheqdSDKModuleQuerierExtensionSetup(module) { return module.querierExtensionSetup ?? {}; } export function applyMixins(derivedCtor, constructors) { let methods = {}; constructors.forEach((baseCtor) => { Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => { const property = baseCtor.prototype[name]; if (typeof property !== 'function' || derivedCtor.hasOwnProperty(name) || derivedCtor?.protectedMethods.includes(name) || baseCtor.prototype?._protectedMethods?.includes(name)) return; methods = { ...methods, [name]: property }; }); }); return methods; } //# sourceMappingURL=_.js.map