Skip to content

Commit

Permalink
Reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastijankuzner committed Jan 8, 2025
1 parent d372994 commit 646df84
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/transaction-pool-service/source/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ import { inject, injectable } from "@mainsail/container";
import { Contracts, Identifiers } from "@mainsail/contracts";
import { Utils } from "@mainsail/kernel";

type SortFunction = (a: Contracts.Crypto.Transaction, b: Contracts.Crypto.Transaction) => number;
type SenderMempoolSelectorFunction = (
mempool: Contracts.TransactionPool.SenderMempool,
) => Contracts.Crypto.Transaction[];

const sortByHighestGasPrice = (a: Contracts.Crypto.Transaction, b: Contracts.Crypto.Transaction) =>
b.data.gasPrice - a.data.gasPrice;

const sortByLowestGasPrice = (a: Contracts.Crypto.Transaction, b: Contracts.Crypto.Transaction) =>
a.data.gasPrice - b.data.gasPrice;

export class QueryIterable implements Contracts.TransactionPool.QueryIterable {
public transactions: Contracts.Crypto.Transaction[];
public predicates: Contracts.TransactionPool.QueryPredicate[] = [];
Expand Down Expand Up @@ -138,14 +149,3 @@ export class Query implements Contracts.TransactionPool.Query {
return new QueryIterable(selectedTransactions);
}
}

type SortFunction = (a: Contracts.Crypto.Transaction, b: Contracts.Crypto.Transaction) => number;
type SenderMempoolSelectorFunction = (
mempool: Contracts.TransactionPool.SenderMempool,
) => Contracts.Crypto.Transaction[];

const sortByHighestGasPrice = (a: Contracts.Crypto.Transaction, b: Contracts.Crypto.Transaction) =>
b.data.gasPrice - a.data.gasPrice;

const sortByLowestGasPrice = (a: Contracts.Crypto.Transaction, b: Contracts.Crypto.Transaction) =>
a.data.gasPrice - b.data.gasPrice;

0 comments on commit 646df84

Please sign in to comment.