Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main -> develop #4119

Merged
merged 2 commits into from
Mar 29, 2024
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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"apps/cowswap-frontend": "1.64.1",
"apps/cowswap-frontend": "1.64.2",
"apps/explorer": "2.29.2",
"libs/permit-utils": "0.1.2",
"libs/widget-lib": "0.7.1",
Expand Down
7 changes: 7 additions & 0 deletions apps/cowswap-frontend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.64.2](https://github.com/cowprotocol/cowswap/compare/cowswap-v1.64.1...cowswap-v1.64.2) (2024-03-29)


### Bug Fixes

* **limit-orders:** use ff for zero balance orders ([#4117](https://github.com/cowprotocol/cowswap/issues/4117)) ([28c60bd](https://github.com/cowprotocol/cowswap/commit/28c60bda7b8817ff7156e9e24f253f57da427b36))

## [1.64.1](https://github.com/cowprotocol/cowswap/compare/cowswap-v1.64.0...cowswap-v1.64.1) (2024-03-28)


Expand Down
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cowprotocol/cowswap",
"version": "1.64.1",
"version": "1.64.2",
"description": "CoW Swap",
"main": "index.js",
"author": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ import { LimitOrdersConfirmModal } from '../LimitOrdersConfirmModal'
import { RateInput } from '../RateInput'
import { SettingsWidget } from '../SettingsWidget'

export const LIMIT_BULLET_LIST_CONTENT: BulletListItem[] = [
const LIMIT_BULLET_LIST_CONTENT: BulletListItem[] = [
{ content: 'Set any limit price and time horizon' },
{ content: 'FREE order placement and cancellation' },
{ content: 'Place multiple orders using the same balance' },
{ content: 'Receive surplus of your order' },
{ content: 'Protection from MEV by default' },
{
content: <span>Place orders for higher than available balance!</span>,
featureFlag: 'isZeroBalanceOrdersEnabled',
content: 'Place orders for higher than available balance!',
},
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { wasImFeelingLuckyClickedAtom } from 'modules/swap/hooks/useImFeelingLuc
import { useOpenTokenSelectWidget } from 'modules/tokensList'
import { useIsAlternativeOrderModalVisible } from 'modules/trade/state/alternativeOrder'

import { FeatureGuard } from 'common/containers/FeatureGuard'
import { useCategorizeRecentActivity } from 'common/hooks/useCategorizeRecentActivity'
import { useIsProviderNetworkUnsupported } from 'common/hooks/useIsProviderNetworkUnsupported'
import { useThrottleFn } from 'common/hooks/useThrottleFn'
Expand Down Expand Up @@ -107,7 +108,6 @@ export function TradeWidgetForm(props: TradeWidgetProps) {

const showDropdown = shouldShowMyOrdersButton || isInjectedWidgetMode


const currencyInputCommonProps = {
isChainIdUnsupported,
chainId,
Expand Down Expand Up @@ -172,24 +172,26 @@ export function TradeWidgetForm(props: TradeWidgetProps) {
{...currencyInputCommonProps}
/>

{isLimitOrderMode &&
!isWrapOrUnwrap &&
ClosableBanner(ZERO_BANNER_STORAGE_KEY, (onClose) => (
<InlineBanner
bannerType="success"
orientation={BannerOrientation.Horizontal}
customIcon={ICON_TOKENS}
iconSize={32}
margin={'10px 0 0'}
onClose={onClose}
>
<p>
<b>NEW: </b>You can now place limit orders for amounts larger than your wallet balance. Partial
fill orders will execute until you run out of sell tokens. Fill-or-kill orders will become active
once you top up your balance.
</p>
</InlineBanner>
))}
<FeatureGuard featureFlag="isZeroBalanceOrdersEnabled">
{isLimitOrderMode &&
!isWrapOrUnwrap &&
ClosableBanner(ZERO_BANNER_STORAGE_KEY, (onClose) => (
<InlineBanner
bannerType="success"
orientation={BannerOrientation.Horizontal}
customIcon={ICON_TOKENS}
iconSize={32}
margin={'10px 0 0'}
onClose={onClose}
>
<p>
<b>NEW: </b>You can now place limit orders for amounts larger than your wallet balance. Partial
fill orders will execute until you run out of sell tokens. Fill-or-kill orders will become
active once you top up your balance.
</p>
</InlineBanner>
))}
</FeatureGuard>
</div>
{!isWrapOrUnwrap && middleContent}
{!hideBuyTokenInput && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import { ExternalLink } from '@cowprotocol/ui'

import SVG from 'react-inlinesvg'

import { FeatureGuard } from 'common/containers/FeatureGuard'

import * as styledEl from './styled'

export type BulletListItem = {
content: string | React.ReactNode
isNew?: boolean
featureFlag?: string
}

type UnlockWidgetProps = {
Expand Down Expand Up @@ -42,14 +45,18 @@ export function UnlockWidgetScreen({

{items && (
<styledEl.List>
{items.map(({ isNew, content }, index) => (
<li key={index} data-is-new={isNew || null}>
<span>
<SVG src={iconCompleted} />
</span>{' '}
{content}
</li>
))}
{items.map(({ isNew, content, featureFlag }, index) => {
const item = (
<li key={index} data-is-new={isNew || null}>
<span>
<SVG src={iconCompleted} />
</span>{' '}
{content}
</li>
)

return featureFlag ? <FeatureGuard featureFlag={featureFlag}>{item}</FeatureGuard> : item
})}
</styledEl.List>
)}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo } from 'react'

import { useFeatureFlags } from '@cowprotocol/common-hooks'
import { useENSAddress } from '@cowprotocol/ens'
import { useIsTradeUnsupported } from '@cowprotocol/tokens'
import { useGnosisSafeInfo, useIsBundlingSupported, useWalletDetails, useWalletInfo } from '@cowprotocol/wallet'
Expand All @@ -19,6 +20,7 @@ export function useTradeFormValidationContext(): TradeFormValidationCommonContex
const { account } = useWalletInfo()
const { state: derivedTradeState } = useDerivedTradeState()
const tradeQuote = useTradeQuote()
const { isZeroBalanceOrdersEnabled } = useFeatureFlags()

const { inputCurrency, outputCurrency, slippageAdjustedSellAmount, recipient, tradeType } = derivedTradeState || {}
const { state: approvalState } = useApproveState(slippageAdjustedSellAmount)
Expand All @@ -35,7 +37,7 @@ export function useTradeFormValidationContext(): TradeFormValidationCommonContex

const isPermitSupported = useTokenSupportsPermit(inputCurrency, tradeType)

const isInsufficientBalanceOrderAllowed = tradeType === TradeType.LIMIT_ORDER
const isInsufficientBalanceOrderAllowed = isZeroBalanceOrdersEnabled && tradeType === TradeType.LIMIT_ORDER

const commonContext = {
account,
Expand Down
Loading