Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
remove unused values (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
matextrem authored Aug 29, 2022
1 parent 2b496c4 commit 5b87f76
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"dependencies": {
"@amcharts/amcharts4": "^4.9.12",
"@apollo/client": "^3.1.5",
"@cowprotocol/app-data": "0.0.1-RC.5",
"@cowprotocol/contracts": "1.3.1",
"@cowprotocol/cow-sdk": "1.0.0-RC.5",
"@fortawesome/fontawesome-svg-core": "^6.1.2",
Expand Down
21 changes: 1 addition & 20 deletions src/apps/explorer/pages/AppData/config.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import React, { RefObject } from 'react'
import Form, { AjvError, FieldProps, FormValidation } from '@rjsf/core'
import {
LATEST_APP_DATA_VERSION,
LATEST_QUOTE_METADATA_VERSION,
LATEST_REFERRER_METADATA_VERSION,
getAppDataSchema,
} from '@cowprotocol/app-data'
import { LATEST_APP_DATA_VERSION, getAppDataSchema } from '@cowprotocol/app-data'
import { JSONSchema7 } from 'json-schema'
import { HelpTooltip } from 'components/Tooltip'

Expand All @@ -28,12 +23,6 @@ export const INVALID_IPFS_CREDENTIALS = [

export type FormProps = Record<string, any>

const APP_VERSION = {
appData: LATEST_APP_DATA_VERSION,
quote: LATEST_QUOTE_METADATA_VERSION,
referrer: LATEST_REFERRER_METADATA_VERSION,
}

export const getSchema = async (): Promise<JSONSchema7> => {
const latestSchema = (await getAppDataSchema(LATEST_APP_DATA_VERSION)).default as JSONSchema7
deleteAllPropertiesByName(latestSchema, 'examples')
Expand All @@ -46,9 +35,6 @@ const setDependencies = (formattedSchema: JSONSchema7, field: string, dependenci
const requiredFields = formattedSchema.properties.metadata['properties'][field].required
deletePropertyPath(formattedSchema, `properties.metadata.properties.${field}.required`)

formattedSchema.properties.metadata['properties'][field].properties.version['readOnly'] = true
formattedSchema.properties.metadata['properties'][field].properties.version['default'] = APP_VERSION[field]

const properties = formattedSchema.properties.metadata['properties'][field].properties
const [fieldKey] = Object.keys(dependencies)
formattedSchema.properties.metadata['properties'][field].properties = {
Expand All @@ -68,11 +54,6 @@ const setDependencies = (formattedSchema: JSONSchema7, field: string, dependenci
const formatSchema = (schema: JSONSchema7): JSONSchema7 => {
const formattedSchema = structuredClone(schema)

if (formattedSchema?.properties?.version) {
formattedSchema.properties.version['readOnly'] = true
formattedSchema.properties.version['default'] = LATEST_APP_DATA_VERSION
}

setDependencies(formattedSchema, 'quote', quoteDependencies)
setDependencies(formattedSchema, 'referrer', referrerDependencies)

Expand Down
9 changes: 7 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,13 @@
exec-sh "^0.3.2"
minimist "^1.2.0"

"@cowprotocol/[email protected]":
version "0.0.1-RC.5"
resolved "https://registry.yarnpkg.com/@cowprotocol/app-data/-/app-data-0.0.1-RC.5.tgz#9ad8c3e45865cc6e1b7e68f7e4f967b0a432af4a"
integrity sha512-cMzXAWt9pLoXaJRExcQHW6QN/ls4sNCrqCHAmi6TCVKaLfHelvjSmyHTEqE0OBwXrCuOeuIzE0jhiEJ7U6qEpg==
dependencies:
ajv "^8.11.0"

"@cowprotocol/app-data@^0.0.1-RC.3":
version "0.0.1-RC.3"
resolved "https://registry.yarnpkg.com/@cowprotocol/app-data/-/app-data-0.0.1-RC.3.tgz#929341c4a74dedff86dc416be1be3d3e5d29d26e"
Expand Down Expand Up @@ -2210,12 +2217,10 @@
dependencies:
"@fortawesome/fontawesome-common-types" "6.1.2"


"@fortawesome/free-regular-svg-icons@^6.1.2":
version "6.1.2"
resolved "https://registry.yarnpkg.com/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.1.2.tgz#9f04009098addcc11d0d185126f058ed042c3099"
integrity sha512-xR4hA+tAwsaTHGfb+25H1gVU/aJ0Rzu+xIUfnyrhaL13yNQ7TWiI2RvzniAaB+VGHDU2a+Pk96Ve+pkN3/+TTQ==

dependencies:
"@fortawesome/fontawesome-common-types" "6.1.2"

Expand Down

0 comments on commit 5b87f76

Please sign in to comment.