@swaptoshi/governance-module
Version:
Klayr governance on-chain module
44 lines (43 loc) • 2.77 kB
TypeScript
import { Modules, Types, StateMachine } from 'klayr-framework';
import { Schema } from '@klayr/codec';
import { IterateOptions } from '@liskhq/lisk-db';
import { GovernableConfigSetContext, GovernableConfigStoreData, GovernableConfigVerifyContext } from './types';
import { GovernanceMethod } from './method';
import { Types as sTypes } from '@swaptoshi/utils';
export declare abstract class BaseGovernableConfig<T extends object> extends Modules.BaseStore<GovernableConfigStoreData> {
protected storeKey: Buffer<ArrayBuffer>;
protected governanceEvent: Modules.NamedRegistry;
protected method: GovernanceMethod | undefined;
constructor(moduleName: string, index: number);
module: string;
index: number;
registered: boolean;
initialized: boolean;
schema: Schema;
default: T;
genesisConfig: Types.GenesisConfig | undefined;
get name(): string;
register(events: Modules.NamedRegistry, governanceMethod: GovernanceMethod, args: Modules.ModuleInitArgs): void;
unregister(): void;
beforeConfigInit(_genesisConfig: Types.GenesisConfig): void;
beforeSetConfig(_context: GovernableConfigSetContext<T>): Promise<void>;
afterSetConfig(_context: GovernableConfigSetContext<T>): Promise<void>;
verify(_context: GovernableConfigVerifyContext<T>): Promise<StateMachine.VerificationResult>;
init(args: Modules.ModuleInitArgs): void;
initRegisteredConfig(context: StateMachine.GenesisBlockExecuteContext): Promise<void>;
getConfig(context: Modules.ImmutableStoreGetter): Promise<T>;
setConfig(context: StateMachine.MethodContext, value: T): Promise<void>;
getConfigWithPath<P extends sTypes.ConfigPathKeys<T>>(context: Modules.ImmutableStoreGetter, path: P): Promise<sTypes.ConfigPathType<T, P>>;
setConfigWithPath<P extends sTypes.ConfigPathKeys<T>>(context: StateMachine.MethodContext, path: P, value: sTypes.ConfigPathType<T, P>): Promise<void>;
dryRunSetConfig(context: StateMachine.ImmutableMethodContext, value: T): Promise<sTypes.UpdatedProperty[]>;
dryRunSetConfigWithPath<P extends sTypes.ConfigPathKeys<T>>(context: StateMachine.ImmutableMethodContext, path: P, value: sTypes.ConfigPathType<T, P>): Promise<sTypes.UpdatedProperty[]>;
private _setConfigHandler;
get(context: Modules.ImmutableStoreGetter, key: Buffer): Promise<GovernableConfigStoreData>;
has(context: Modules.ImmutableStoreGetter, key: Buffer): Promise<boolean>;
iterate(context: Modules.ImmutableStoreGetter, options: IterateOptions): Promise<{
key: Buffer;
value: GovernableConfigStoreData;
}[]>;
set(context: Modules.StoreGetter, key: Buffer, value: GovernableConfigStoreData): Promise<void>;
del(context: Modules.StoreGetter, key: Buffer): Promise<void>;
}