Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [unreleased]

## [0.47.0] - 2026-03-11

- Add two query parameters to the endpoints `v0/accTransactions`, `v1/accTransactions`, `v2/accTransactions`, and `v3/accTransactions`:
- `blockHeightFrom`: excludes transactions with block height earlier than `blockTimeFrom`
- `blockHeightTo`: exclude transactions with block height later than `blockHeightTo`

## [0.46.0] - 2026-03-10

- Add `GET` endpoint `/v0/blockInfo/{blockHash}` for getting block information for a given block hash.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,8 @@ They support the following parameters.
- `all`: include all rewards. This is also the default if not supplied.
- `blockTimeFrom`: exclude any transactions with block time earlier than `blockTimeFrom` (integer number of seconds after epoch).
- `blockTimeTo`: exclude any transactions with block time later than `blockTimeTo` (integer number of seconds after epoch).
- `blockHeightFrom`: exclude any transactions with block height earlier than `blockTimeFrom`.
- `blockHeightTo`: exclude any transactions with block height later than `blockHeightTo`.
- `blockRewards`: whether to include block rewards. Possible values:
- `y`: include block rewards. (The default)
- `n`: exclude block rewards.
Expand Down Expand Up @@ -835,7 +837,7 @@ A transactions of type `"transfer"` is not considered a simple transfer if the d
### Example

```console
$ curl -XGET http://localhost:3000/v0/accTransactions/4KYJHs49FX7tPD2pFY2whbfZ8AjupEtX8yNSLwWMFQFUZgRobL?limit=2&from=4&order=a
$ curl -XGET "http://localhost:3000/v0/accTransactions/4KYJHs49FX7tPD2pFY2whbfZ8AjupEtX8yNSLwWMFQFUZgRobL?limit=2&from=4&order=a"
```
```JSON
{
Expand Down Expand Up @@ -1652,7 +1654,7 @@ or

```console
stack run wallet-proxy -- \
--grpc-ip grpc.devnet-plt-beta.concordium.com \
--grpc-ip grpc.testnet.concordium.com \
--grpc-port 20000\
--db "host=localhost port=5432 dbname=transaction-outcome user=postgres password=password"\
--ip-data ./examples/identity-providers-with-metadata.json\
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wallet-proxy
version: 0.46.0
version: 0.47.0
github: "Concordium/concordium-wallet-proxy"
author: "Concordium"
maintainer: "developers@concordium.com"
Expand Down
44 changes: 35 additions & 9 deletions src/Proxy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,28 @@ getAccountTransactionsWorker includeMemos includeSuspensionEvents includePltEven
Just seconds -> Just $ \s ->
E.where_ (s E.^. SummaryTimestamp E.<=. (E.val Timestamp{tsMillis = seconds * 1000}))

-- Exclude any transactions with block height earlier than `blockHeightFrom`
maybeBlockHeightFromFilter <-
lookupGetParam "blockHeightFrom" <&> \mText ->
case mText of
Nothing -> Just $ \_ -> return () -- default: no filter
Just txt ->
case readMaybe (Text.unpack txt) of
Nothing -> Nothing
Just height -> Just $ \s ->
E.where_ (s E.^. SummaryHeight E.>=. E.val (AbsoluteBlockHeight (fromIntegral (height :: Int))))

-- Exclude any transactions with block height later than `blockHeightTo`
maybeBlockHeightToFilter <-
lookupGetParam "blockHeightTo" <&> \mText ->
case mText of
Nothing -> Just $ \_ -> return () -- default: no filter
Just txt ->
case readMaybe (Text.unpack txt) of
Nothing -> Nothing
Just height -> Just $ \s ->
E.where_ (s E.^. SummaryHeight E.<=. E.val (AbsoluteBlockHeight (fromIntegral (height :: Int))))

-- Construct filters to only query the relevant transaction types specified by `blockRewards`, `finalizationRewards`,
-- `bakingRewards`, and `onlyEncrypted`.
-- This is done as part of the SQL query since it is both more efficient, but also simpler since we do not have to filter
Expand Down Expand Up @@ -2128,15 +2150,17 @@ getAccountTransactionsWorker includeMemos includeSuspensionEvents includePltEven
)

rawReason <- isJust <$> lookupGetParam "includeRawRejectReason"
case (maybeTimeFromFilter, maybeTimeToFilter, maybeBlockRewardFilter, maybeFinalizationRewardFilter, maybeBakingRewardFilter, maybeEncryptedFilter, maybeTypeFilter) of
(Nothing, _, _, _, _, _, _) -> respond400Error (EMParseError "Unsupported 'blockTimeFrom' parameter.") RequestInvalid
(_, Nothing, _, _, _, _, _) -> respond400Error (EMParseError "Unsupported 'blockTimeTo' parameter.") RequestInvalid
(_, _, Nothing, _, _, _, _) -> respond400Error (EMParseError "Unsupported 'blockReward' parameter.") RequestInvalid
(_, _, _, Nothing, _, _, _) -> respond400Error (EMParseError "Unsupported 'finalizationReward' parameter.") RequestInvalid
(_, _, _, _, Nothing, _, _) -> respond400Error (EMParseError "Unsupported 'bakingReward' parameter.") RequestInvalid
(_, _, _, _, _, Nothing, _) -> respond400Error (EMParseError "Unsupported 'onlyEncrypted' parameter.") RequestInvalid
(_, _, _, _, _, _, Nothing) -> respond400Error (EMParseError "Unsupported 'includeRewards' parameter.") RequestInvalid
(Just timeFromFilter, Just timeToFilter, Just blockRewardFilter, Just finalizationRewardFilter, Just bakingRewardFilter, Just encryptedFilter, Just typeFilter) -> do
case (maybeTimeFromFilter, maybeTimeToFilter, maybeBlockRewardFilter, maybeFinalizationRewardFilter, maybeBakingRewardFilter, maybeEncryptedFilter, maybeTypeFilter, maybeBlockHeightFromFilter, maybeBlockHeightToFilter) of
(Nothing, _, _, _, _, _, _, _, _) -> respond400Error (EMParseError "Unsupported 'blockTimeFrom' parameter.") RequestInvalid
(_, Nothing, _, _, _, _, _, _, _) -> respond400Error (EMParseError "Unsupported 'blockTimeTo' parameter.") RequestInvalid
(_, _, Nothing, _, _, _, _, _, _) -> respond400Error (EMParseError "Unsupported 'blockReward' parameter.") RequestInvalid
(_, _, _, Nothing, _, _, _, _, _) -> respond400Error (EMParseError "Unsupported 'finalizationReward' parameter.") RequestInvalid
(_, _, _, _, Nothing, _, _, _, _) -> respond400Error (EMParseError "Unsupported 'bakingReward' parameter.") RequestInvalid
(_, _, _, _, _, Nothing, _, _, _) -> respond400Error (EMParseError "Unsupported 'onlyEncrypted' parameter.") RequestInvalid
(_, _, _, _, _, _, Nothing, _, _) -> respond400Error (EMParseError "Unsupported 'includeRewards' parameter.") RequestInvalid
(_, _, _, _, _, _, _, Nothing, _) -> respond400Error (EMParseError "Unsupported 'blockHeightFrom' parameter.") RequestInvalid
(_, _, _, _, _, _, _, _, Nothing) -> respond400Error (EMParseError "Unsupported 'blockHeightTo' parameter.") RequestInvalid
(Just timeFromFilter, Just timeToFilter, Just blockRewardFilter, Just finalizationRewardFilter, Just bakingRewardFilter, Just encryptedFilter, Just typeFilter, Just blockHeightFromFilter, Just blockHeightToFilter) -> do
entries :: [(Entity Entry, Entity Summary)] <- runDB $ do
E.select $ E.from $ \(e `E.InnerJoin` s) -> do
-- Assert join
Expand All @@ -2151,6 +2175,8 @@ getAccountTransactionsWorker includeMemos includeSuspensionEvents includePltEven
-- Apply any additional filters
timeFromFilter s
timeToFilter s
blockHeightFromFilter s
blockHeightToFilter s
blockRewardFilter s
finalizationRewardFilter s
bakingRewardFilter s
Expand Down
Loading