feat(wallet) add API to cancel current activity filter
Closes status-desktop #11036
This commit is contained in:
parent
579f7e4a52
commit
5c7748dbf7
|
@ -200,7 +200,6 @@ func (e *Entry) isNFT() bool {
|
|||
return tt != nil && (*tt == TransferTypeErc721 || *tt == TransferTypeErc1155) && ((e.tokenIn != nil && e.tokenIn.TokenID != nil) || (e.tokenOut != nil && e.tokenOut.TokenID != nil))
|
||||
}
|
||||
|
||||
// TODO - #11952: use only one of (big.Int, bigint.BigInt and hexutil.Big)
|
||||
func tokenIDToWalletBigInt(tokenID *hexutil.Big) *bigint.BigInt {
|
||||
if tokenID == nil {
|
||||
return nil
|
||||
|
|
|
@ -161,15 +161,14 @@ SELECT
|
|||
transfers.timestamp AS timestamp,
|
||||
NULL AS mt_type,
|
||||
CASE
|
||||
WHEN from_join.address IS NOT NULL
|
||||
AND to_join.address IS NULL THEN fromTrType
|
||||
WHEN to_join.address IS NOT NULL
|
||||
AND from_join.address IS NULL THEN toTrType
|
||||
WHEN from_join.address IS NOT NULL
|
||||
AND to_join.address IS NOT NULL THEN CASE
|
||||
WHEN transfers.address = transfers.tx_from_address THEN fromTrType
|
||||
ELSE toTrType
|
||||
END
|
||||
WHEN from_join.address IS NOT NULL AND to_join.address IS NULL THEN fromTrType
|
||||
WHEN to_join.address IS NOT NULL AND from_join.address IS NULL THEN toTrType
|
||||
WHEN from_join.address IS NOT NULL AND to_join.address IS NOT NULL THEN
|
||||
CASE
|
||||
WHEN transfers.address = transfers.tx_from_address THEN fromTrType
|
||||
WHEN transfers.address = transfers.tx_to_address THEN toTrType
|
||||
ELSE NULL
|
||||
END
|
||||
ELSE NULL
|
||||
END as tr_type,
|
||||
transfers.tx_from_address AS from_address,
|
||||
|
@ -204,8 +203,6 @@ SELECT
|
|||
FROM
|
||||
transfers
|
||||
CROSS JOIN filter_conditions
|
||||
INNER JOIN filter_to_addresses receiver_join ON filterAllToAddresses != 0
|
||||
OR transfers.tx_to_address = receiver_join.address
|
||||
LEFT JOIN filter_addresses from_join ON transfers.tx_from_address = from_join.address
|
||||
LEFT JOIN filter_addresses to_join ON transfers.tx_to_address = to_join.address
|
||||
WHERE
|
||||
|
@ -267,6 +264,10 @@ WHERE
|
|||
filterAllAddresses -- Every account address has an "owned" entry either as to or from
|
||||
OR (owner_address IN filter_addresses)
|
||||
)
|
||||
AND (
|
||||
filterAllToAddresses
|
||||
OR (transfers.tx_to_address IN filter_to_addresses)
|
||||
)
|
||||
AND (
|
||||
includeAllTokenTypeAssets
|
||||
OR (
|
||||
|
@ -325,15 +326,13 @@ SELECT
|
|||
pending_transactions.timestamp AS timestamp,
|
||||
NULL AS mt_type,
|
||||
CASE
|
||||
WHEN from_join.address IS NOT NULL
|
||||
AND to_join.address IS NULL THEN fromTrType
|
||||
WHEN to_join.address IS NOT NULL
|
||||
AND from_join.address IS NULL THEN toTrType
|
||||
WHEN from_join.address IS NOT NULL
|
||||
AND to_join.address IS NOT NULL THEN CASE
|
||||
WHEN from_join.address < to_join.address THEN fromTrType
|
||||
ELSE toTrType
|
||||
END
|
||||
WHEN from_join.address IS NOT NULL AND to_join.address IS NULL THEN fromTrType
|
||||
WHEN to_join.address IS NOT NULL AND from_join.address IS NULL THEN toTrType
|
||||
WHEN from_join.address IS NOT NULL AND to_join.address IS NOT NULL THEN
|
||||
CASE
|
||||
WHEN from_join.address < to_join.address THEN fromTrType
|
||||
ELSE toTrType
|
||||
END
|
||||
ELSE NULL
|
||||
END as tr_type,
|
||||
pending_transactions.from_address AS from_address,
|
||||
|
@ -356,8 +355,6 @@ SELECT
|
|||
FROM
|
||||
pending_transactions
|
||||
CROSS JOIN filter_conditions
|
||||
INNER JOIN filter_to_addresses receiver_join ON filterAllToAddresses != 0
|
||||
OR pending_transactions.to_address = receiver_join.address
|
||||
LEFT JOIN filter_addresses from_join ON pending_transactions.from_address = from_join.address
|
||||
LEFT JOIN filter_addresses to_join ON pending_transactions.to_address = to_join.address
|
||||
WHERE
|
||||
|
@ -386,6 +383,10 @@ WHERE
|
|||
filterAllAddresses
|
||||
OR tr_type NOT NULL
|
||||
)
|
||||
AND (
|
||||
filterAllToAddresses
|
||||
OR (pending_transactions.to_address IN filter_to_addresses)
|
||||
)
|
||||
AND (
|
||||
includeAllTokenTypeAssets
|
||||
OR (
|
||||
|
@ -443,8 +444,6 @@ SELECT
|
|||
FROM
|
||||
multi_transactions
|
||||
CROSS JOIN filter_conditions
|
||||
INNER JOIN filter_to_addresses receiver_join ON filterAllToAddresses != 0
|
||||
OR multi_transactions.to_address = receiver_join.address
|
||||
LEFT JOIN tr_status ON multi_transactions.ROWID = tr_status.multi_transaction_id
|
||||
LEFT JOIN pending_status ON multi_transactions.ROWID = pending_status.multi_transaction_id
|
||||
WHERE
|
||||
|
@ -478,6 +477,10 @@ WHERE
|
|||
)
|
||||
)
|
||||
)
|
||||
AND (
|
||||
filterAllToAddresses
|
||||
OR (multi_transactions.to_address IN filter_to_addresses)
|
||||
)
|
||||
AND (
|
||||
includeAllTokenTypeAssets
|
||||
OR (
|
||||
|
|
|
@ -236,6 +236,15 @@ func (s *Service) GetOldestTimestampAsync(requestID int32, addresses []common.Ad
|
|||
})
|
||||
}
|
||||
|
||||
func (s *Service) CancelFilterTask(requestID int32) {
|
||||
s.scheduler.Enqueue(requestID, filterTask, func(ctx context.Context) (interface{}, error) {
|
||||
// No-op
|
||||
return nil, nil
|
||||
}, func(result interface{}, taskType async.TaskType, err error) {
|
||||
// Ignore result
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Service) Stop() {
|
||||
s.scheduler.Stop()
|
||||
}
|
||||
|
|
|
@ -577,6 +577,13 @@ func (api *API) FilterActivityAsync(requestID int32, addresses []common.Address,
|
|||
return nil
|
||||
}
|
||||
|
||||
func (api *API) CancelActivityFilterTask(requestID int32) error {
|
||||
log.Debug("wallet.api.CancelActivityFilterTask", "requestID", requestID)
|
||||
|
||||
api.s.activity.CancelFilterTask(requestID)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (api *API) GetMultiTxDetails(ctx context.Context, multiTxID int) (*activity.EntryDetails, error) {
|
||||
log.Debug("wallet.api.GetMultiTxDetails", "multiTxID", multiTxID)
|
||||
|
||||
|
|
Loading…
Reference in New Issue