-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: filter out twap orders from limit (#3550)
* feat: add getIsComposableCowOrder to identify TWAP orders * feat: filter out orders that don't belong based on orderType * chore: temporarily use prod backend⚠️ REVERT ME⚠️ * refactor: extract constant to make if more readable * chore: revert "chore: temporarily use prod backend⚠️ REVERT ME⚠️ " This reverts commit 047331e.
- Loading branch information
1 parent
2bbb745
commit 91ccf8c
Showing
3 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
apps/cowswap-frontend/src/utils/orderUtils/getIsComposableCowOrder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { getIsNotComposableCowOrder } from './getIsNotComposableCowOrder' | ||
|
||
import { ComposableCowInfo } from '../../common/types' | ||
|
||
const TWAP_ORDER_REGEX = /"orderClass":\s*"twap"/ | ||
|
||
export function getIsComposableCowOrder(order?: { | ||
composableCowInfo?: ComposableCowInfo | ||
fullAppData?: string | null | ||
}): boolean { | ||
return ( | ||
!getIsNotComposableCowOrder(order) || // this check only works for orders placed in the same device, thus orders loaded from the API will never have this | ||
TWAP_ORDER_REGEX.test(order?.fullAppData || '') // this check assumes the appData is correctly filled | ||
) | ||
} |