Make dashboard filters persistent, add disjunctive filter mode
This commit is contained in:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user