mirror of
https://github.com/lux-tel/websites.git
synced 2026-10-30 20:31:36 +00:00
14 lines
377 B
TypeScript
14 lines
377 B
TypeScript
import type { ArbitrumEvent } from '@session/staking-api-js/schema';
|
|
|
|
/**
|
|
* Events are sorted in descending order by block number and then by log index.
|
|
* @param a - first event
|
|
* @param b - second event
|
|
*/
|
|
export function sortEvents(a: ArbitrumEvent, b: ArbitrumEvent) {
|
|
if (a.block === b.block) {
|
|
return b.log_index - a.log_index;
|
|
}
|
|
return b.block - a.block;
|
|
}
|