Make dashboard filters persistent, add disjunctive filter mode

This commit is contained in:
Mononaut
2024-02-08 17:44:32 +00:00
committed by softsimon
parent dfbec0ceef
commit ddee5f927c
9 changed files with 145 additions and 27 deletions

View File

@@ -7,6 +7,13 @@ export interface Filter {
important?: boolean,
}
export type FilterMode = 'and' | 'or';
export interface ActiveFilter {
mode: FilterMode,
filters: string[],
}
// binary flags for transaction classification
export const TransactionFlags = {
// features
@@ -43,6 +50,14 @@ export const TransactionFlags = {
sighash_acp: 0b00010000_00000000_00000000_00000000_00000000_00000000n,
};
export function toFlags(filters: string[]): bigint {
let flag = 0n;
for (const filter of filters) {
flag |= TransactionFlags[filter];
}
return flag;
}
export const TransactionFilters: { [key: string]: Filter } = {
/* features */
rbf: { key: 'rbf', label: 'RBF enabled', flag: TransactionFlags.rbf, toggle: 'rbf', important: true },