With Porto we'll be able to soon offer to every application to "queue" their transactions and order them however they want.

This is very powerful for DeFi, obviously. We will expose that in Typescript via a great API a la how our paymaster-equivalent will work.

I have some ideas, but I am wondering:

If you're building say a DEX, what is your preferred way to program that you want transactions to be ordered in such and such way (e.g. cancels top of block)?

One trivial way is to define a map that says "if this address and this function selector is called, give this priority N, and if some other thing is called, assign priority N-1", and then you sort in buckets of descending priority and sort by fee within the bucket.

Is that a good enough API? Or can we do a lot better?

Maybe Solana frens working on ASS (this needs a rebrand btw) can advise.