* Compare two transactions by their createdAt time and sequence number in order * to sort them in the order they were created. * @param other - The other transaction to compare to * @returns -1 if this transaction was created before the other, 1 if it was created after, 0 if they were creat
(other: Transaction<any>)
| 545 | * @returns -1 if this transaction was created before the other, 1 if it was created after, 0 if they were created at the same time |
| 546 | */ |
| 547 | compareCreatedAt(other: Transaction<any>): number { |
| 548 | const createdAtComparison = |
| 549 | this.createdAt.getTime() - other.createdAt.getTime() |
| 550 | if (createdAtComparison !== 0) { |
| 551 | return createdAtComparison |
| 552 | } |
| 553 | return this.sequenceNumber - other.sequenceNumber |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | export type { Transaction } |