Skip to content

Commit

Permalink
chore(release): 1.48.0 - Merge pull request #3203 from cowprotocol/re…
Browse files Browse the repository at this point in the history
…lease/1.48.0

chore(release): 1.48.0
  • Loading branch information
alfetopito authored Oct 16, 2023
2 parents 1e87615 + dede0d0 commit 9523c14
Show file tree
Hide file tree
Showing 1,423 changed files with 13,284 additions and 8,166 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ jobs:
key: ${{ runner.os }}-generatedFiles-${{ hashFiles('**/yarn.lock') }}

- name: Run eslint
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }}
run: yarn lint

integration-tests:
Expand Down
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"position": "before"
},
{
"pattern": "{@cowswap,@cowprotocol,@uniswap,@safe-global,@ethersproject,@web3-react}/**",
"pattern": "{@cowprotocol,@cowprotocol,@uniswap,@safe-global,@ethersproject,@web3-react}/**",
"group": "external",
"position": "before"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/cosmos.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"fixtureFileSuffix": "cosmos",
"watchDirs": ["src"],
"port": 5001,
"exportPath": "./public/cosmos",
"exportPath": "../../build/cosmos",
"publicUrl": "./",
"plugins": ["react-cosmos-plugin-vite"],
"vite": {
Expand Down
128 changes: 0 additions & 128 deletions apps/cowswap-frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,134 +36,6 @@

<!-- Other tags -->
<meta name="fortmatic-site-verification" content="%REACT_APP_FORTMATIC_SITE_VERIFICATION%" />

<!-- Meta Pixel Code -->
<script>
!(function (f, b, e, v, n, t, s) {
if (f.fbq) return
n = f.fbq = function () {
n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments)
}
if (!f._fbq) f._fbq = n
n.push = n
n.loaded = !0
n.version = '2.0'
n.queue = []
t = b.createElement(e)
t.async = !0
t.src = v
s = b.getElementsByTagName(e)[0]
s.parentNode.insertBefore(t, s)
})(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js')
fbq('init', '8773630776042211')
fbq('track', 'PageView')
</script>
<!-- End Meta Pixel Code -->

<!-- Linkedin Pixel Code -->
<script type="text/javascript">
_linkedin_partner_id = '4587034'
window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || []
window._linkedin_data_partner_ids.push(_linkedin_partner_id)
</script>
<script type="text/javascript">
;(function (l) {
if (!l) {
window.lintrk = function (a, b) {
window.lintrk.q.push([a, b])
}
window.lintrk.q = []
}
var s = document.getElementsByTagName('script')[0]
var b = document.createElement('script')
b.type = 'text/javascript'
b.async = true
b.src = 'https://snap.licdn.com/li.lms-analytics/insight.min.js'
s.parentNode.insertBefore(b, s)
})(window.lintrk)
</script>
<!-- End Linkedin Pixel Code -->

<!-- Twitter conversion tracking base code -->
<script>
!(function (e, t, n, s, u, a) {
e.twq ||
((s = e.twq =
function () {
s.exe ? s.exe.apply(s, arguments) : s.queue.push(arguments)
}),
(s.version = '1.1'),
(s.queue = []),
(u = t.createElement(n)),
(u.async = !0),
(u.src = 'https://static.ads-twitter.com/uwt.js'),
(a = t.getElementsByTagName(n)[0]),
a.parentNode.insertBefore(u, a))
})(window, document, 'script')
twq('config', 'oddz2')
</script>
<!-- End Twitter conversion tracking base code -->

<!-- Reddit Pixel -->
<script>
!(function (w, d) {
if (!w.rdt) {
var p = (w.rdt = function () {
p.sendEvent ? p.sendEvent.apply(p, arguments) : p.callQueue.push(arguments)
})
p.callQueue = []
var t = d.createElement('script')
;(t.src = 'https://www.redditstatic.com/ads/pixel.js'), (t.async = !0)
var s = d.getElementsByTagName('script')[0]
s.parentNode.insertBefore(t, s)
}
})(window, document)
rdt('init', 't2_v12pyheq', { optOut: false, useDecimalCurrencyValues: true, aaid: '<AAID-HERE>' })
rdt('track', 'PageVisit')
</script>
<!-- DO NOT MODIFY UNLESS TO REPLACE A USER IDENTIFIER -->
<!-- End Reddit Pixel -->

<!-- Start Paved Pixel Snippet -->
<script>
!(function (e, t, n, o, p, i, a) {
e[o] ||
(((p = e[o] =
function () {
p.process ? p.process.apply(p, arguments) : p.queue.push(arguments)
}).queue = []),
(p.t = +new Date()),
((i = t.createElement(n)).async = 1),
(i.src = 'https://pvdpix.com/pixel.js?t=' + 864e5 * Math.ceil(new Date() / 864e5)),
(a = t.getElementsByTagName(n)[0]).parentNode.insertBefore(i, a))
})(window, document, 'script', 'pvd'),
pvd('init', '97dc323d-7e9e'),
pvd('event', 'pageload')
</script>
<!-- End Paved Pixel Snippet -->

<!-- Start Microsoft Ads Pixel Snippet -->
<script>
;(function (w, d, t, r, u) {
var f, n, i
;(w[u] = w[u] || []),
(f = function () {
var o = { ti: '343027006' }
;(o.q = w[u]), (w[u] = new UET(o)), w[u].push('pageLoad')
}),
(n = d.createElement(t)),
(n.src = r),
(n.async = 1),
(n.onload = n.onreadystatechange =
function () {
var s = this.readyState
;(s && s !== 'loaded' && s !== 'complete') || (f(), (n.onload = n.onreadystatechange = null))
}),
(i = d.getElementsByTagName(t)[0]),
i.parentNode.insertBefore(n, i)
})(window, document, 'script', '//bat.bing.com/bat.js', 'uetq')
</script>
<!-- End Microsoft Ads Pixel Snippet -->
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint-disable */
export default {
displayName: 'cowswap',
preset: './jest.preset.js',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
Expand Down
11 changes: 0 additions & 11 deletions apps/cowswap-frontend/jest.preset.js

This file was deleted.

24 changes: 12 additions & 12 deletions apps/cowswap-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
"author": "",
"license": "ISC",
"scripts": {
"ipfs:build": "nx exec -- cross-env PUBLIC_URL=\".\" yarn build",
"ipfs:publish": "nx exec -- ipfs-deploy build -p pinata -O",
"patch-package": "nx exec -- patch-package",
"i18n": "nx exec -- yarn i18n:compile",
"i18n:compile": "yarn i18n:extract && lingui compile",
"i18n:extract": "cross-env NODE_ENV=development lingui extract --locale en-US",
"i18n:pseudo": "lingui extract --locale pseudo && lingui compile",
"postinstall": "yarn i18n",
"cosmos:clear": "nx exec -- rm -rf ./public/cosmos",
"cosmos:run": "nx exec -- yarn _cosmos:run ",
"cosmos:export": "nx exec -- cross-env NODE_ENV=development cosmos-export",
"_cosmos:run": "yarn cosmos:clear && cosmos"
"ipfs:build": "cross-env PUBLIC_URL=\".\" yarn build",
"ipfs:publish": "npx ipfs-deploy build -p pinata -O",
"patch-package": "npx patch-package",
"i18n": "yarn run i18n:compile",
"i18n:compile": "yarn run i18n:extract && npx lingui compile",
"i18n:extract": "cross-env NODE_ENV=development npx lingui extract --locale en-US",
"i18n:pseudo": "npx lingui extract --locale pseudo && lingui compile",
"postinstall": "yarn run i18n",
"cosmos:clear": "rm -rf ./public/cosmos",
"cosmos:run": "yarn run _cosmos:run",
"cosmos:export": "cross-env NODE_ENV=development npx cosmos-export",
"_cosmos:run": "yarn cosmos:clear && npx cosmos"
},
"browser": {
"crypto": false
Expand Down
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/apps/cowswap-frontend"
"outputPath": "build"
},
"configurations": {
"development": {
Expand Down
4 changes: 2 additions & 2 deletions apps/cowswap-frontend/src/api/1inch/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { getTokensFromMarket } from '@cowprotocol/common-utils'
import { OrderKind } from '@cowprotocol/contracts'
import { SupportedChainId as ChainId } from '@cowprotocol/cow-sdk'

import { PriceInformation } from 'types'

import { getTokensFromMarket } from 'legacy/utils/misc'
import { LegacyPriceQuoteParams } from 'legacy/state/price/types'
import { getValidParams } from 'legacy/utils/price'

import { LegacyPriceQuoteParams } from 'api/gnosisProtocol/legacy/types'
import { fetchWithRateLimit } from 'common/utils/fetch'

export const API_NAME = '1inch'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ALL_SUPPORTED_CHAIN_IDS } from '@cowprotocol/cow-sdk'

import * as Sentry from '@sentry/browser'
import BlocknativeSdk from 'bnc-sdk'

import { ALL_SUPPORTED_CHAIN_IDS } from 'legacy/constants/chains'

const BLOCKNATIVE_API_KEY = process.env.REACT_APP_BLOCKNATIVE_API_KEY

interface SDKError {
Expand Down
4 changes: 1 addition & 3 deletions apps/cowswap-frontend/src/api/gasPrices/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { DEFAULT_NETWORK_FOR_LISTS, GAS_API_KEYS, GAS_FEE_ENDPOINTS } from '@cowprotocol/common-const'
import { SupportedChainId as ChainId } from '@cowprotocol/cow-sdk'

import { GAS_FEE_ENDPOINTS, GAS_API_KEYS } from 'legacy/constants'
import { DEFAULT_NETWORK_FOR_LISTS } from 'legacy/constants/lists'

import { fetchWithRateLimit } from 'common/utils/fetch'

const fetchRateLimitted = fetchWithRateLimit({
Expand Down
46 changes: 26 additions & 20 deletions apps/cowswap-frontend/src/api/gnosisProtocol/api.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
import { ZERO_ADDRESS } from '@cowprotocol/common-const'
import { isBarn, isDev, isLocal, isPr, toErc20Address, toNativeBuyAddress } from '@cowprotocol/common-utils'
import {
Address,
CowEnv,
EnrichedOrder,
NativePriceResponse,
OrderBookApiError,
OrderKind,
OrderQuoteRequest,
OrderQuoteResponse,
OrderQuoteSideKindBuy,
OrderQuoteSideKindSell,
PartialApiContext,
PriceQuality,
SigningScheme,
SupportedChainId as ChainId,
Trade,
PriceQuality,
TotalSurplus,
OrderQuoteSideKindBuy,
OrderQuoteSideKindSell,
Trade,
} from '@cowprotocol/cow-sdk'

import { orderBookApi } from 'cowSdk'

import { ZERO_ADDRESS } from 'legacy/constants/misc'
import { isBarn, isDev, isLocal, isPr } from 'legacy/utils/environments'
import { toErc20Address, toNativeBuyAddress } from 'legacy/utils/tokens'
import { LegacyFeeQuoteParams as FeeQuoteParams } from 'legacy/state/price/types'

import { getAppData } from 'modules/appData'

import { ApiErrorCodes, ApiErrorObject } from 'api/gnosisProtocol/errors/OperatorError'
import { ApiErrorCodes } from 'api/gnosisProtocol/errors/OperatorError'
import GpQuoteError, { GpQuoteErrorDetails, mapOperatorErrorToQuoteError } from 'api/gnosisProtocol/errors/QuoteError'

import { LegacyFeeQuoteParams as FeeQuoteParams } from './legacy/types'
import { getIsOrderBookTypedError } from './getIsOrderBookTypedError'

function getProfileUrl(): Partial<Record<ChainId, string>> {
if (isLocal || isDev || isPr || isBarn) {
Expand Down Expand Up @@ -103,7 +102,20 @@ const ETH_FLOW_AUX_QUOTE_PARAMS = {
}

function _mapNewToLegacyParams(params: FeeQuoteParams): OrderQuoteRequest {
const { amount, kind, userAddress, receiver, validTo, sellToken, buyToken, chainId, priceQuality, isEthFlow } = params
const {
amount,
kind,
userAddress,
receiver,
validTo,
sellToken,
buyToken,
chainId,
priceQuality,
isEthFlow,
appData,
appDataHash,
} = params
const fallbackAddress = userAddress || ZERO_ADDRESS

const baseParams = {
Expand All @@ -112,7 +124,8 @@ function _mapNewToLegacyParams(params: FeeQuoteParams): OrderQuoteRequest {
buyToken: toNativeBuyAddress(buyToken, chainId),
from: fallbackAddress,
receiver: receiver || fallbackAddress,
appData: getAppData().appDataKeccak256,
appData: appData || getAppData().appDataKeccak256,
appDataHash,
validTo,
partiallyFillable: false,
priceQuality,
Expand Down Expand Up @@ -153,7 +166,7 @@ export async function getQuote(params: FeeQuoteParams): Promise<OrderQuoteRespon
}

return orderBookApi.getQuote(quoteParams, { chainId }).catch((error) => {
if (isOrderbookTypedError(error)) {
if (getIsOrderBookTypedError(error)) {
const errorObject = mapOperatorErrorToQuoteError(error.body)

return Promise.reject(errorObject ? new GpQuoteError(errorObject) : error)
Expand All @@ -163,13 +176,6 @@ export async function getQuote(params: FeeQuoteParams): Promise<OrderQuoteRespon
})
}

export type OrderbookTypedError = OrderBookApiError<ApiErrorObject>

function isOrderbookTypedError(e: any): e is OrderbookTypedError {
const error = e as OrderbookTypedError
return error.body.errorType !== undefined && error.body.description !== undefined
}

export async function getOrder(chainId: ChainId, orderId: string, env?: CowEnv): Promise<EnrichedOrder | null> {
const contextOverride = {
chainId,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { OrderBookApiError } from '@cowprotocol/cow-sdk'

import { ApiErrorObject } from './errors/OperatorError'

export type OrderBookTypedError = OrderBookApiError<ApiErrorObject>

export function getIsOrderBookTypedError(e: any): e is OrderBookTypedError {
const error = e as OrderBookTypedError
return error.body.errorType !== undefined && error.body.description !== undefined
}
5 changes: 2 additions & 3 deletions apps/cowswap-frontend/src/api/gnosisProtocol/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { GP_ORDER_UPDATE_INTERVAL } from '@cowprotocol/common-const'
import { EnrichedOrder } from '@cowprotocol/cow-sdk'
import { useWalletInfo } from '@cowprotocol/wallet'

import useSWR from 'swr'

import { GP_ORDER_UPDATE_INTERVAL } from 'legacy/constants'

import { useSWROrdersRequest } from 'modules/orders/hooks/useSWROrdersRequest'
import { useWalletInfo } from 'modules/wallet'

import { getOrders } from './api'

Expand Down
1 change: 1 addition & 0 deletions apps/cowswap-frontend/src/api/gnosisProtocol/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as realApi from './api'
import * as mockApi from './mock'

export type { UnsupportedToken, OrderID } from './api'
export { getIsOrderBookTypedError } from './getIsOrderBookTypedError'

const useMock = process.env.REACT_APP_MOCK === 'true'

Expand Down
Loading

0 comments on commit 9523c14

Please sign in to comment.