import { BlockDTO } from "./dto/BlockDTO"; import { ConfDTO, CurrencyConfDTO } from "./dto/ConfDTO"; import { TransactionDTO } from "./dto/TransactionDTO"; import { DBHead } from "./db/DBHead"; import { FileDAL } from "./dal/fileDAL"; import { DBWallet } from "./db/DBWallet"; export interface IndexEntry { index: string; op: string; writtenOn: number; written_on: string; } export interface MindexEntry extends IndexEntry { pub: string; created_on: string; type: string | null; expires_on: number | null; expired_on: number | null; revocation: string | null; revokes_on: number | null; chainable_on: number | null; revoked_on: string | null; leaving: boolean | null; age: number; isBeingRevoked?: boolean; unchainables: number; numberFollowing?: boolean; distanceOK?: boolean; onRevoked?: boolean; joinsTwice?: boolean; enoughCerts?: boolean; leaverIsMember?: boolean; activeIsMember?: boolean; revokedIsMember?: boolean; alreadyRevoked?: boolean; revocationSigOK?: boolean; created_on_ref?: { medianTime: number; number: number; hash: string; }; } export interface FullMindexEntry { op: string; pub: string; created_on: string; written_on: string; expires_on: number; expired_on: null | number; revokes_on: number; revoked_on: null | string; leaving: boolean; revocation: null | string; chainable_on: number; writtenOn: number; } export interface IindexEntry extends IndexEntry { uid: string | null; pub: string; hash: string | null; sig: string | null; created_on: string | null; member: boolean | null; wasMember: boolean | null; kick: boolean | null; wotb_id: number | null; age: number; pubUnique?: boolean; excludedIsMember?: boolean; isBeingKicked?: boolean; uidUnique?: boolean; hasToBeExcluded?: boolean; } export interface FullIindexEntry { op: string; uid: string; pub: string; hash: string; sig: string; created_on: string; written_on: string; writtenOn: number; member: boolean; wasMember: boolean; kick: boolean; wotb_id: number; } export interface CindexEntry extends IndexEntry { issuer: string; receiver: string; created_on: number; sig: string; chainable_on: number; replayable_on: number; expires_on: number; expired_on: number; from_wid: null; to_wid: null; unchainables: number; age: number; stock: number; fromMember?: boolean; toMember?: boolean; toNewcomer?: boolean; toLeaver?: boolean; isReplay?: boolean; isReplayable?: boolean; sigOK?: boolean; created_on_ref?: { medianTime: number; }; } export interface FullCindexEntry { issuer: string; receiver: string; created_on: number; sig: string; chainable_on: number; expires_on: number; expired_on: number; replayable_on: number; } export interface SindexEntry extends IndexEntry { srcType: "T" | "D"; tx: string | null; identifier: string; pos: number; created_on: string | null; written_time: number; locktime: number; unlock: string | null; amount: number; base: number; conditions: string; consumed: boolean; txObj: TransactionDTO; age: number; type?: string; available?: boolean; isLocked?: boolean; isTimeLocked?: boolean; } export interface FullSindexEntry { tx: string | null; identifier: string; pos: number; created_on: string | null; written_time: number; locktime: number; unlock: string | null; amount: number; base: number; conditions: string; consumed: boolean; } export interface SimpleTxInput { conditions: string; consumed: boolean; written_time: number; amount: number; base: number; } export interface BasedAmount { amount: number; base: number; } export interface SimpleSindexEntryForWallet { op: string; srcType: "T" | "D"; conditions: string; amount: number; base: number; identifier: string; pos: number; } export interface SimpleTxEntryForWallet extends SimpleSindexEntryForWallet { srcType: "T"; } export interface SimpleUdEntryForWallet extends SimpleSindexEntryForWallet { srcType: "D"; } export interface Ranger { (n: number, m: number): Promise; } export interface ExclusionByCert { op: "UPDATE"; pub: string; written_on: string; writtenOn: number; kick: true; } export interface AccountsGarbagingDAL { getWallet: (conditions: string) => Promise; saveWallet: (wallet: DBWallet) => Promise; sindexDAL: { getAvailableForConditions: (conditions: string) => Promise; }; } export interface BlockchainBlocksDAL { getBlock(number: number): Promise; getBlockByBlockstamp(blockstamp: string): Promise; } export declare class Indexer { static localIndex(block: BlockDTO, conf: { sigValidity: number; msValidity: number; msPeriod: number; sigPeriod: number; sigReplay: number; sigStock: number; }): IndexEntry[]; static localSIndex(block: BlockDTO): SindexEntry[]; static quickCompleteGlobalScope(block: BlockDTO, conf: CurrencyConfDTO, bindex: DBHead[], iindex: IindexEntry[], mindex: MindexEntry[], cindex: CindexEntry[], dal: FileDAL): Promise; static completeGlobalScope(block: BlockDTO, conf: ConfDTO, index: IndexEntry[], dal: FileDAL): Promise; static prepareNumber(HEAD: DBHead, HEAD_1: DBHead): void; static prepareIssuersCount(HEAD: DBHead, range: Ranger, HEAD_1: DBHead): Promise; static prepareIssuersFrame(HEAD: DBHead, HEAD_1: DBHead): void; static prepareIssuersFrameVar(HEAD: DBHead, HEAD_1: DBHead): void; static prepareAvgBlockSize(HEAD: DBHead, range: Ranger): Promise; static prepareDiffNumber(HEAD: DBHead, HEAD_1: DBHead, conf: CurrencyConfDTO): void; static prepareUDTime(HEAD: DBHead, HEAD_1: DBHead, conf: CurrencyConfDTO): void; static prepareDividend(HEAD: DBHead, HEAD_1: DBHead, conf: CurrencyConfDTO): void; static prepareUnitBase(HEAD: DBHead): void; static prepareMass(HEAD: DBHead, HEAD_1: DBHead): void; static prepareSpeed(HEAD: DBHead, head: (n: number) => Promise, conf: CurrencyConfDTO): Promise; static preparePersonalizedPoW(HEAD: DBHead, HEAD_1: DBHead, range: (n: number, m: number) => Promise, conf: ConfDTO): Promise; static prepareIdentitiesAge(iindex: IindexEntry[], HEAD: DBHead, HEAD_1: DBHead, conf: CurrencyConfDTO, dal: FileDAL): Promise; static prepareMembershipsAge(mindex: MindexEntry[], HEAD: DBHead, HEAD_1: DBHead, conf: CurrencyConfDTO, dal: FileDAL): Promise; static prepareCertificationsAge(cindex: CindexEntry[], HEAD: DBHead, HEAD_1: DBHead, conf: CurrencyConfDTO, dal: FileDAL): Promise; static ruleVersion(HEAD: DBHead, HEAD_1: DBHead): boolean; static ruleBlockSize(HEAD: DBHead): boolean; static ruleCurrency(block: BlockDTO, HEAD: DBHead): boolean; static ruleNumber(block: BlockDTO, HEAD: DBHead): boolean; static rulePreviousHash(block: BlockDTO, HEAD: DBHead): boolean; static rulePreviousIssuer(block: BlockDTO, HEAD: DBHead): boolean; static ruleIssuerIsMember(HEAD: DBHead): boolean; static ruleIssuersCount(block: BlockDTO, HEAD: DBHead): boolean; static ruleIssuersFrame(block: BlockDTO, HEAD: DBHead): boolean; static ruleIssuersFrameVar(block: BlockDTO, HEAD: DBHead): boolean; static ruleMedianTime(block: BlockDTO, HEAD: DBHead): boolean; static ruleDividend(block: BlockDTO, HEAD: DBHead): boolean; static ruleUnitBase(block: BlockDTO, HEAD: DBHead): boolean; static ruleMembersCount(block: BlockDTO, HEAD: DBHead): boolean; static rulePowMin(block: BlockDTO, HEAD: DBHead): boolean; static ruleProofOfWork(HEAD: DBHead): boolean; static ruleIdentityWritability(iindex: IindexEntry[], conf: ConfDTO): boolean; static ruleMembershipWritability(mindex: MindexEntry[], conf: ConfDTO): boolean; static ruleMembershipPeriod(mindex: MindexEntry[]): boolean; static ruleCertificationWritability(cindex: CindexEntry[], conf: ConfDTO): boolean; static ruleCertificationStock(cindex: CindexEntry[], conf: ConfDTO): boolean; static ruleCertificationPeriod(cindex: CindexEntry[]): boolean; static ruleCertificationFromMember(HEAD: DBHead, cindex: CindexEntry[]): boolean; static ruleCertificationToMemberOrNewcomer(cindex: CindexEntry[]): boolean; static ruleCertificationToLeaver(cindex: CindexEntry[]): boolean; static ruleCertificationReplay(cindex: CindexEntry[]): boolean; static ruleCertificationSignature(cindex: CindexEntry[]): boolean; static ruleIdentityUIDUnicity(iindex: IindexEntry[]): boolean; static ruleIdentityPubkeyUnicity(iindex: IindexEntry[]): boolean; static ruleMembershipSuccession(mindex: MindexEntry[]): boolean; static ruleMembershipDistance(HEAD: DBHead, mindex: MindexEntry[]): boolean; static ruleMembershipOnRevoked(mindex: MindexEntry[]): boolean; static ruleMembershipJoinsTwice(mindex: MindexEntry[]): boolean; static ruleMembershipEnoughCerts(mindex: MindexEntry[]): boolean; static ruleMembershipLeaverIsMember(mindex: MindexEntry[]): boolean; static ruleMembershipActiveIsMember(mindex: MindexEntry[]): boolean; static ruleMembershipRevokedIsMember(mindex: MindexEntry[]): boolean; static ruleMembershipRevokedSingleton(mindex: MindexEntry[]): boolean; static ruleMembershipRevocationSignature(mindex: MindexEntry[]): boolean; static ruleMembershipExcludedIsMember(iindex: IindexEntry[]): boolean; static ruleToBeKickedArePresent(iindex: IindexEntry[], dal: FileDAL): Promise; static ruleTxWritability(sindex: SindexEntry[]): boolean; static ruleInputIsAvailable(sindex: SindexEntry[]): boolean; static ruleInputIsUnlocked(sindex: SindexEntry[]): boolean; static ruleInputIsTimeUnlocked(sindex: SindexEntry[]): boolean; static ruleOutputBase(sindex: SindexEntry[], HEAD_1: DBHead): boolean; static ruleIndexGenDividend(HEAD: DBHead, local_iindex: IindexEntry[], dal: FileDAL): Promise; static ruleIndexGarbageSmallAccounts(HEAD: DBHead, transactions: SindexEntry[], dividends: SimpleUdEntryForWallet[], dal: AccountsGarbagingDAL): Promise; static ruleIndexGenCertificationExpiry(HEAD: DBHead, dal: FileDAL): Promise<{ op: string; issuer: string; receiver: string; created_on: number; written_on: string; writtenOn: number; expired_on: number; }[]>; static ruleIndexGenMembershipExpiry(HEAD: DBHead, dal: FileDAL): Promise<{ op: string; pub: string; created_on: string; written_on: string; writtenOn: number; expired_on: number; }[]>; static ruleIndexGenExclusionByMembership(HEAD: DBHead, mindex: MindexEntry[], dal: FileDAL): Promise<{ op: string; pub: string; written_on: string; writtenOn: number; kick: boolean; }[]>; static ruleIndexGenExclusionByCertificatons(HEAD: DBHead, cindex: CindexEntry[], iindex: IindexEntry[], conf: ConfDTO, dal: FileDAL): Promise; static ruleIndexGenImplicitRevocation(HEAD: DBHead, dal: FileDAL): Promise<{ op: string; pub: string; created_on: string; written_on: string; writtenOn: number; revoked_on: string; }[]>; static ruleIndexCorrectMembershipExpiryDate(HEAD: DBHead, mindex: MindexEntry[], dal: FileDAL): Promise; static ruleIndexCorrectCertificationExpiryDate(HEAD: DBHead, cindex: CindexEntry[], dal: FileDAL): Promise; static iindexCreate(index: IndexEntry[]): IindexEntry[]; static mindexCreate(index: IndexEntry[]): MindexEntry[]; static iindex(index: IndexEntry[]): IindexEntry[]; static mindex(index: IndexEntry[]): MindexEntry[]; static cindex(index: IndexEntry[]): CindexEntry[]; static sindex(index: IndexEntry[]): SindexEntry[]; static DUP_HELPERS: { reduce: typeof reduce; reduceOrNull: typeof reduceOrNull; reduceBy: typeof reduceBy; getMaxBlockSize: (HEAD: DBHead) => number; checkPeopleAreNotOudistanced: typeof checkPeopleAreNotOudistanced; }; } export declare function reduceOrNull(records: T[]): T | null; export declare function reduceForDBTrimming(records: T[], belowNumber: number): T[]; export declare function reduce(records: T[]): T; export declare function reduceBy(reducables: T[], properties: (keyof T)[]): T[]; declare function checkPeopleAreNotOudistanced(pubkeys: string[], newLinks: { [k: string]: string[]; }, newcomers: string[], conf: ConfDTO, dal: FileDAL): Promise; export {};