Skip to content

Commit

Permalink
Order the results of next block sql queries
Browse files Browse the repository at this point in the history
  • Loading branch information
jhbertra committed Oct 4, 2023
1 parent 3f5e6c7 commit 4e9906a
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ getNewContracts blocks =
JOIN marlowe.txOut USING (txId, txIx)
LEFT JOIN marlowe.txOutAsset USING (txId, txIx)
GROUP BY txId, txIx
ORDER BY (ARRAY_AGG(createTxOut.blockId))[1], createTxOut.txId, createTxOut.txIx
|]

type CreateTransactionRow =
Expand Down Expand Up @@ -251,6 +252,7 @@ getApplyInputsTransactions blocks = do
ON applyTx.txId = txOutAsset.txId
AND applyTx.outputTxIx = txOutAsset.txIx
GROUP BY applyTx.txId
ORDER BY (ARRAY_AGG(applyTx.blockId))[1]
|]
payoutsByTxId <- T.statement txs do
dimap encodeIds decodePayouts do
Expand Down Expand Up @@ -416,6 +418,7 @@ getWithdrawTransactions blocks =
FROM marlowe.withdrawalTxIn
JOIN (SELECT UNNEST($1 :: bytea[]) AS blockId) as blockId USING (blockId)
GROUP BY txId
ORDER BY (ARRAY_AGG(withdrawalTxIn.blockId))[1]
|]

type WithdrawTransactionRow =
Expand Down

0 comments on commit 4e9906a

Please sign in to comment.