import { BaseStore } from '../storage'; export type Activity = { timestamp?: bigint; type: Type; id: string; value: ValueType; }; export type WalletName = Activity<'WalletName', string>; export type WalletDescription = Activity<'WalletDescription', string>; export type TransactionFirstSeen = Activity<'TransactionFirstSeen', string>; export type TransactionMemo = Activity<'TransactionMemo', string>; export type XOWalletColor = Activity<'XOWalletColor', string>; export type XOTransactionCategory = Activity<'XOTransactionCategory', string>; export type XOFrozenCoin = Activity<'XOFrozenCoin', boolean>; export type SnapshotByType = { [type: string]: { [id: string]: Activity; }; }; export type PolicyFunction = (existingActivity: Activity | undefined, newActivity: Activity) => Activity; export declare class Activities { store: BaseStore; snapshot: SnapshotByType; private policies; private storeKeyMap; constructor(store: BaseStore); /** * Get all activities of a specific type */ getActivitiesByType(type: string): Activity[]; /** * Get a specific activity by type and id */ getActivity(type: string, id: string): Activity | undefined; /** * Process a single activity and update the snapshot */ private processActivity; /** * Add a new activity to the store */ addActivity(activity: Activity): Promise; /** * Compile a full snapshot from scratch (only needed for initialization or recovery) */ compileSnapshot(): Promise; /** * Register a policy for handling conflicts between activities of the same type * @param type Activity type to register policy for * @param policyFn Function that decides which activity to keep */ registerPolicy(type: string, policyFn: PolicyFunction): void; /** * Get an activity from the snapshot by type and id */ private getActivityFromSnapshot; /** * Set an activity in the snapshot, creating necessary object structure */ private setActivityInSnapshot; /** * Get the snapshot key for an activity */ private getSnapshotKey; /** * Apply policy to determine which activity should be kept */ private applyPolicy; }