mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
API add pending withdraws filter on GET /exits
This commit is contained in:
@@ -911,8 +911,8 @@ func (hdb *HistoryDB) GetExitAPI(batchNum *uint, idx *common.Idx) (*ExitAPI, err
|
||||
|
||||
// GetExitsAPI returns a list of exits from the DB and pagination info
|
||||
func (hdb *HistoryDB) GetExitsAPI(
|
||||
ethAddr *ethCommon.Address, bjj *babyjub.PublicKey,
|
||||
tokenID *common.TokenID, idx *common.Idx, batchNum *uint,
|
||||
ethAddr *ethCommon.Address, bjj *babyjub.PublicKey, tokenID *common.TokenID,
|
||||
idx *common.Idx, batchNum *uint, onlyPendingWithdraws *bool,
|
||||
fromItem, limit *uint, order string,
|
||||
) ([]ExitAPI, *db.Pagination, error) {
|
||||
if ethAddr != nil && bjj != nil {
|
||||
@@ -975,6 +975,18 @@ func (hdb *HistoryDB) GetExitsAPI(
|
||||
args = append(args, batchNum)
|
||||
nextIsAnd = true
|
||||
}
|
||||
// onlyPendingWithdraws
|
||||
if onlyPendingWithdraws != nil {
|
||||
if *onlyPendingWithdraws {
|
||||
if nextIsAnd {
|
||||
queryStr += "AND "
|
||||
} else {
|
||||
queryStr += "WHERE "
|
||||
}
|
||||
queryStr += "(exit_tree.instant_withdrawn IS NULL AND exit_tree.delayed_withdrawn IS NULL) "
|
||||
nextIsAnd = true
|
||||
}
|
||||
}
|
||||
if fromItem != nil {
|
||||
if nextIsAnd {
|
||||
queryStr += "AND "
|
||||
|
||||
Reference in New Issue
Block a user