mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Fixing linting errors
This commit is contained in:
parent
881c28c174
commit
c6e3e186e8
@ -2,8 +2,7 @@ module.exports = {
|
||||
client: {
|
||||
service: {
|
||||
name: 'ocean',
|
||||
url:
|
||||
'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
|
||||
url: 'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
|
||||
// optional disable SSL validation check
|
||||
skipSSLValidation: true
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ export default function InputElement({
|
||||
case 'assetSelection':
|
||||
return (
|
||||
<AssetSelection
|
||||
assets={(options as unknown) as AssetSelectionAsset[]}
|
||||
assets={options as unknown as AssetSelectionAsset[]}
|
||||
{...field}
|
||||
{...props}
|
||||
/>
|
||||
@ -115,7 +115,7 @@ export default function InputElement({
|
||||
case 'assetSelectionMultiple':
|
||||
return (
|
||||
<AssetSelection
|
||||
assets={(options as unknown) as AssetSelectionAsset[]}
|
||||
assets={options as unknown as AssetSelectionAsset[]}
|
||||
multiple
|
||||
disabled={disabled}
|
||||
{...field}
|
||||
@ -132,7 +132,7 @@ export default function InputElement({
|
||||
return (
|
||||
<BoxSelection
|
||||
name={name}
|
||||
options={(options as unknown) as BoxSelectionOption[]}
|
||||
options={options as unknown as BoxSelectionOption[]}
|
||||
{...field}
|
||||
{...props}
|
||||
/>
|
||||
|
@ -11,13 +11,8 @@ import Web3Feedback from './Feedback'
|
||||
import styles from './Details.module.css'
|
||||
|
||||
export default function Details(): ReactElement {
|
||||
const {
|
||||
web3Provider,
|
||||
web3ProviderInfo,
|
||||
connect,
|
||||
logout,
|
||||
networkData
|
||||
} = useWeb3()
|
||||
const { web3Provider, web3ProviderInfo, connect, logout, networkData } =
|
||||
useWeb3()
|
||||
const { balance, config } = useOcean()
|
||||
const { locale } = useUserPreferences()
|
||||
|
||||
|
@ -82,10 +82,8 @@ export default function FormStartCompute({
|
||||
const data = useStaticQuery(contentQuery)
|
||||
const content = data.content.edges[0].node.childPagesJson
|
||||
|
||||
const {
|
||||
isValid,
|
||||
values
|
||||
}: FormikContextType<{ algorithm: string }> = useFormikContext()
|
||||
const { isValid, values }: FormikContextType<{ algorithm: string }> =
|
||||
useFormikContext()
|
||||
const { price, ddo } = useAsset()
|
||||
const [totalPrice, setTotalPrice] = useState(price?.value)
|
||||
|
||||
|
@ -69,15 +69,12 @@ export default function Compute({
|
||||
const [isPublished, setIsPublished] = useState(false)
|
||||
const [hasPreviousDatasetOrder, setHasPreviousDatasetOrder] = useState(false)
|
||||
const [previousDatasetOrderId, setPreviousDatasetOrderId] = useState<string>()
|
||||
const [hasPreviousAlgorithmOrder, setHasPreviousAlgorithmOrder] = useState(
|
||||
false
|
||||
)
|
||||
const [hasPreviousAlgorithmOrder, setHasPreviousAlgorithmOrder] =
|
||||
useState(false)
|
||||
const [algorithmDTBalance, setalgorithmDTBalance] = useState<string>()
|
||||
const [algorithmPrice, setAlgorithmPrice] = useState<BestPrice>()
|
||||
const [
|
||||
previousAlgorithmOrderId,
|
||||
setPreviousAlgorithmOrderId
|
||||
] = useState<string>()
|
||||
const [previousAlgorithmOrderId, setPreviousAlgorithmOrderId] =
|
||||
useState<string>()
|
||||
const [datasetTimeout, setDatasetTimeout] = useState<string>()
|
||||
const [algorithmTimeout, setAlgorithmTimeout] = useState<string>()
|
||||
|
||||
|
@ -48,12 +48,8 @@ export default function Consume({
|
||||
const [hasPreviousOrder, setHasPreviousOrder] = useState(false)
|
||||
const [previousOrderId, setPreviousOrderId] = useState<string>()
|
||||
const { isInPurgatory, price, type } = useAsset()
|
||||
const {
|
||||
buyDT,
|
||||
pricingStepText,
|
||||
pricingError,
|
||||
pricingIsLoading
|
||||
} = usePricing()
|
||||
const { buyDT, pricingStepText, pricingError, pricingIsLoading } =
|
||||
usePricing()
|
||||
const { consumeStepText, consume, consumeError } = useConsume()
|
||||
const [isDisabled, setIsDisabled] = useState(true)
|
||||
const [hasDatatoken, setHasDatatoken] = useState(false)
|
||||
|
@ -13,10 +13,8 @@ export default function DebugEditCompute({
|
||||
ddo: DDO
|
||||
}): ReactElement {
|
||||
const { ocean } = useOcean()
|
||||
const [
|
||||
formTransformed,
|
||||
setFormTransformed
|
||||
] = useState<ServiceComputePrivacy>()
|
||||
const [formTransformed, setFormTransformed] =
|
||||
useState<ServiceComputePrivacy>()
|
||||
|
||||
useEffect(() => {
|
||||
if (!ocean) return
|
||||
|
@ -29,15 +29,12 @@ export default function FormEditComputeDataset({
|
||||
const { accountId } = useWeb3()
|
||||
const { ocean, config } = useOcean()
|
||||
const { ddo } = useAsset()
|
||||
const {
|
||||
isValid,
|
||||
values
|
||||
}: FormikContextType<ComputePrivacyForm> = useFormikContext()
|
||||
const { isValid, values }: FormikContextType<ComputePrivacyForm> =
|
||||
useFormikContext()
|
||||
const [allAlgorithms, setAllAlgorithms] = useState<AssetSelectionAsset[]>()
|
||||
|
||||
const { publisherTrustedAlgorithms } = ddo?.findServiceByType(
|
||||
'compute'
|
||||
).attributes.main.privacy
|
||||
const { publisherTrustedAlgorithms } =
|
||||
ddo?.findServiceByType('compute').attributes.main.privacy
|
||||
|
||||
async function getAlgorithmList(
|
||||
publisherTrustedAlgorithms: PublisherTrustedAlgorithm[]
|
||||
|
@ -48,11 +48,8 @@ export default function Output({
|
||||
coin: string
|
||||
}): ReactElement {
|
||||
const data = useStaticQuery(contentQuery)
|
||||
const {
|
||||
help,
|
||||
titleIn,
|
||||
titleOut
|
||||
} = data.content.edges[0].node.childContentJson.pool.add.output
|
||||
const { help, titleIn, titleOut } =
|
||||
data.content.edges[0].node.childContentJson.pool.add.output
|
||||
|
||||
// Connect with form
|
||||
const { values }: FormikContextType<FormAddLiquidity> = useFormikContext()
|
||||
|
@ -83,10 +83,8 @@ export default function Pool(): ReactElement {
|
||||
const [totalUserLiquidityInOcean, setTotalUserLiquidityInOcean] = useState(0)
|
||||
const [totalLiquidityInOcean, setTotalLiquidityInOcean] = useState(0)
|
||||
|
||||
const [
|
||||
creatorTotalLiquidityInOcean,
|
||||
setCreatorTotalLiquidityInOcean
|
||||
] = useState(0)
|
||||
const [creatorTotalLiquidityInOcean, setCreatorTotalLiquidityInOcean] =
|
||||
useState(0)
|
||||
const [creatorLiquidity, setCreatorLiquidity] = useState<PoolBalance>()
|
||||
const [creatorPoolTokens, setCreatorPoolTokens] = useState<string>()
|
||||
const [creatorPoolShare, setCreatorPoolShare] = useState<string>()
|
||||
|
@ -9,7 +9,8 @@ export async function getMaxPercentRemove(
|
||||
poolAddress
|
||||
)
|
||||
|
||||
const amountMaxPoolShares = await ocean.pool.getPoolSharesRequiredToRemoveOcean(
|
||||
const amountMaxPoolShares =
|
||||
await ocean.pool.getPoolSharesRequiredToRemoveOcean(
|
||||
poolAddress,
|
||||
amountMaxOcean
|
||||
)
|
||||
|
@ -6,10 +6,8 @@ import styles from './Slippage.module.css'
|
||||
|
||||
export default function Slippage(): ReactElement {
|
||||
// Connect with form
|
||||
const {
|
||||
setFieldValue,
|
||||
values
|
||||
}: FormikContextType<FormTradeData> = useFormikContext()
|
||||
const { setFieldValue, values }: FormikContextType<FormTradeData> =
|
||||
useFormikContext()
|
||||
|
||||
function handleChange(e: ChangeEvent<HTMLSelectElement>) {
|
||||
setFieldValue('slippage', e.target.value)
|
||||
|
@ -8,8 +8,8 @@ export default function MetaFull(): ReactElement {
|
||||
const { ddo, metadata, isInPurgatory, type } = useAsset()
|
||||
|
||||
function DockerImage() {
|
||||
const algorithmContainer = ddo.findServiceByType('metadata').attributes.main
|
||||
.algorithm.container
|
||||
const algorithmContainer =
|
||||
ddo.findServiceByType('metadata').attributes.main.algorithm.container
|
||||
const { image } = algorithmContainer
|
||||
const { tag } = algorithmContainer
|
||||
return <span>{`${image}:${tag}`}</span>
|
||||
|
@ -25,13 +25,8 @@ export default function FormPricing({
|
||||
|
||||
// Connect with form
|
||||
const { values, setFieldValue, submitForm } = useFormikContext()
|
||||
const {
|
||||
price,
|
||||
oceanAmount,
|
||||
weightOnOcean,
|
||||
weightOnDataToken,
|
||||
type
|
||||
} = values as PriceOptionsMarket
|
||||
const { price, oceanAmount, weightOnOcean, weightOnDataToken, type } =
|
||||
values as PriceOptionsMarket
|
||||
|
||||
// Switch type value upon tab change
|
||||
function handleTabChange(tabName: string) {
|
||||
|
@ -57,12 +57,8 @@ export default function Pricing({ ddo }: { ddo: DDO }): ReactElement {
|
||||
const [showPricing, setShowPricing] = useState(false)
|
||||
const [success, setSuccess] = useState<string>()
|
||||
|
||||
const {
|
||||
createPricing,
|
||||
pricingIsLoading,
|
||||
pricingError,
|
||||
pricingStepText
|
||||
} = usePricing()
|
||||
const { createPricing, pricingIsLoading, pricingError, pricingStepText } =
|
||||
usePricing()
|
||||
|
||||
const hasFeedback = pricingIsLoading || typeof success !== 'undefined'
|
||||
|
||||
|
@ -15,9 +15,8 @@ export default function Permission({
|
||||
const url = appConfig.rbacUrl
|
||||
const [data, updateData] = useState<boolean | 'ERROR'>()
|
||||
const [errorMessage, updateError] = useState<string>()
|
||||
const [messageState, updateMessageState] = useState<
|
||||
'error' | 'warning' | 'info' | 'success'
|
||||
>()
|
||||
const [messageState, updateMessageState] =
|
||||
useState<'error' | 'warning' | 'info' | 'success'>()
|
||||
const { accountId } = useWeb3()
|
||||
useEffect(() => {
|
||||
if (url === undefined) return
|
||||
|
@ -93,9 +93,8 @@ export default function PublishPage({
|
||||
.initialValues as MetadataPublishFormDataset)) ||
|
||||
initialValues
|
||||
)
|
||||
const [publishType, setPublishType] = useState<MetadataMain['type']>(
|
||||
'dataset'
|
||||
)
|
||||
const [publishType, setPublishType] =
|
||||
useState<MetadataMain['type']>('dataset')
|
||||
const hasFeedback = isLoading || error || success
|
||||
|
||||
const emptyAlgoDT = Object.values(algoInitialValues.dataTokenOptions).every(
|
||||
@ -138,7 +137,7 @@ export default function PublishPage({
|
||||
)
|
||||
|
||||
const ddo = await publish(
|
||||
(metadata as unknown) as Metadata,
|
||||
metadata as unknown as Metadata,
|
||||
serviceType,
|
||||
values.dataTokenOptions,
|
||||
timeout
|
||||
@ -187,7 +186,7 @@ export default function PublishPage({
|
||||
Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions)
|
||||
|
||||
const ddo = await publish(
|
||||
(metadata as unknown) as Metadata,
|
||||
metadata as unknown as Metadata,
|
||||
values.algorithmPrivacy === true ? 'compute' : 'access',
|
||||
values.dataTokenOptions,
|
||||
timeout
|
||||
|
@ -36,8 +36,9 @@ export default function FilterPrice({
|
||||
async function handleSelectedFilter(isSelected: boolean, value: string) {
|
||||
if (isSelected) {
|
||||
if (serviceSelections.length > 1) {
|
||||
const otherValue = serviceFilterItems.find((p) => p.value !== value)
|
||||
.value
|
||||
const otherValue = serviceFilterItems.find(
|
||||
(p) => p.value !== value
|
||||
).value
|
||||
await applyServiceFilter(otherValue)
|
||||
setServiceSelections([otherValue])
|
||||
} else {
|
||||
|
@ -27,7 +27,8 @@ export const FilterByTypeOptions = {
|
||||
Data: 'dataset',
|
||||
Algorithm: 'algorithm'
|
||||
} as const
|
||||
type FilterByTypeOptions = typeof FilterByTypeOptions[keyof typeof FilterByTypeOptions]
|
||||
type FilterByTypeOptions =
|
||||
typeof FilterByTypeOptions[keyof typeof FilterByTypeOptions]
|
||||
|
||||
function addTypeFilterToQuery(sortTerm: string, typeFilter: string): string {
|
||||
sortTerm = typeFilter
|
||||
|
@ -202,13 +202,8 @@ function usePricing(): UsePricing {
|
||||
|
||||
if (!ocean || !accountId || !dtSymbol) return
|
||||
|
||||
const {
|
||||
type,
|
||||
oceanAmount,
|
||||
price,
|
||||
weightOnDataToken,
|
||||
swapFee
|
||||
} = priceOptions
|
||||
const { type, oceanAmount, price, weightOnDataToken, swapFee } =
|
||||
priceOptions
|
||||
|
||||
let { dtAmount } = priceOptions
|
||||
const isPool = type === 'dynamic'
|
||||
|
@ -69,7 +69,8 @@ function usePublish(): UsePublish {
|
||||
switch (serviceType) {
|
||||
case 'access': {
|
||||
if (!timeout) timeout = 0
|
||||
const accessService = await ocean.assets.createAccessServiceAttributes(
|
||||
const accessService =
|
||||
await ocean.assets.createAccessServiceAttributes(
|
||||
account,
|
||||
price,
|
||||
publishedDate,
|
||||
|
@ -2,7 +2,8 @@ import { MetadataPublishFormAlgorithm } from '../@types/MetaData'
|
||||
import { File as FileMetadata } from '@oceanprotocol/lib'
|
||||
import * as Yup from 'yup'
|
||||
|
||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormAlgorithm> = Yup.object()
|
||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormAlgorithm> =
|
||||
Yup.object()
|
||||
.shape({
|
||||
// ---- required fields ----
|
||||
name: Yup.string()
|
||||
|
@ -6,12 +6,11 @@ export interface ComputePrivacyForm {
|
||||
publisherTrustedAlgorithms: string[]
|
||||
}
|
||||
|
||||
export const validationSchema: Yup.SchemaOf<ComputePrivacyForm> = Yup.object().shape(
|
||||
{
|
||||
export const validationSchema: Yup.SchemaOf<ComputePrivacyForm> =
|
||||
Yup.object().shape({
|
||||
allowAllPublishedAlgorithms: Yup.boolean().nullable(),
|
||||
publisherTrustedAlgorithms: Yup.array().nullable()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
export function getInitialValues(
|
||||
compute: ServiceComputePrivacy
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { PriceOptionsMarket } from '../@types/MetaData'
|
||||
import * as Yup from 'yup'
|
||||
|
||||
export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> = Yup.object().shape(
|
||||
{
|
||||
export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> =
|
||||
Yup.object().shape({
|
||||
price: Yup.number()
|
||||
.min(1, (param) => `Must be more or equal to ${param.min}`)
|
||||
.required('Required'),
|
||||
@ -22,8 +22,7 @@ export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> = Yup.object().s
|
||||
.max(10, 'Maximum is 10%')
|
||||
.required('Required')
|
||||
.nullable()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
export const initialValues: PriceOptionsMarket = {
|
||||
price: 1,
|
||||
|
@ -2,7 +2,8 @@ import { MetadataPublishFormDataset } from '../@types/MetaData'
|
||||
import { File as FileMetadata } from '@oceanprotocol/lib'
|
||||
import * as Yup from 'yup'
|
||||
|
||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormDataset> = Yup.object()
|
||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormDataset> =
|
||||
Yup.object()
|
||||
.shape({
|
||||
// ---- required fields ----
|
||||
name: Yup.string()
|
||||
|
@ -6,11 +6,8 @@ import { Helmet } from 'react-helmet'
|
||||
import Button from '../components/atoms/Button'
|
||||
|
||||
export default function PageGatsby404(props: PageProps): ReactElement {
|
||||
const {
|
||||
title,
|
||||
description,
|
||||
actions
|
||||
} = (props.data as any).content.edges[0].node.childPagesJson
|
||||
const { title, description, actions } = (props.data as any).content.edges[0]
|
||||
.node.childPagesJson
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -122,7 +122,7 @@ function AssetProvider({
|
||||
|
||||
// Get metadata from DDO
|
||||
const { attributes } = ddo.findServiceByType('metadata')
|
||||
setMetadata((attributes as unknown) as MetadataMarket)
|
||||
setMetadata(attributes as unknown as MetadataMarket)
|
||||
setTitle(attributes?.main.name)
|
||||
setType(attributes.main.type)
|
||||
setOwner(ddo.publicKey[0].owner)
|
||||
|
@ -51,9 +51,8 @@ function OceanProvider({
|
||||
eth: undefined,
|
||||
ocean: undefined
|
||||
})
|
||||
const [config, setConfig] = useState<ConfigHelperConfig | Config>(
|
||||
initialConfig
|
||||
)
|
||||
const [config, setConfig] =
|
||||
useState<ConfigHelperConfig | Config>(initialConfig)
|
||||
const [loading, setLoading] = useState<boolean>()
|
||||
|
||||
// -----------------------------------
|
||||
|
@ -13,7 +13,8 @@ export async function createTrustedAlgorithmList(
|
||||
const trustedAlgorithms = []
|
||||
|
||||
for (const selectedAlgorithm of selectedAlgorithms) {
|
||||
const trustedAlgorithm = await ocean.compute.createPublisherTrustedAlgorithmfromDID(
|
||||
const trustedAlgorithm =
|
||||
await ocean.compute.createPublisherTrustedAlgorithmfromDID(
|
||||
selectedAlgorithm
|
||||
)
|
||||
trustedAlgorithms.push(trustedAlgorithm)
|
||||
|
@ -28,9 +28,9 @@ export const computeFeedback: { [key in number]: string } = {
|
||||
2: '3/3 Access granted. Starting job...'
|
||||
}
|
||||
|
||||
export function getCreatePricingPoolFeedback(
|
||||
dtSymbol: string
|
||||
): { [key: number]: string } {
|
||||
export function getCreatePricingPoolFeedback(dtSymbol: string): {
|
||||
[key: number]: string
|
||||
} {
|
||||
return {
|
||||
99: `Minting ${dtSymbol} ...`,
|
||||
0: 'Creating pool ...',
|
||||
@ -41,9 +41,9 @@ export function getCreatePricingPoolFeedback(
|
||||
}
|
||||
}
|
||||
|
||||
export function getCreatePricingExchangeFeedback(
|
||||
dtSymbol: string
|
||||
): { [key: number]: string } {
|
||||
export function getCreatePricingExchangeFeedback(dtSymbol: string): {
|
||||
[key: number]: string
|
||||
} {
|
||||
return {
|
||||
99: `Minting ${dtSymbol} ...`,
|
||||
0: 'Creating exchange ...',
|
||||
|
@ -127,10 +127,8 @@ export async function getPreviousOrders(
|
||||
id: id,
|
||||
account: account
|
||||
}
|
||||
const fetchedPreviousOrders: ApolloQueryResult<AssetPreviousOrder> = await fetchData(
|
||||
PreviousOrderQuery,
|
||||
variables
|
||||
)
|
||||
const fetchedPreviousOrders: ApolloQueryResult<AssetPreviousOrder> =
|
||||
await fetchData(PreviousOrderQuery, variables)
|
||||
if (fetchedPreviousOrders.data?.tokenOrders?.length === 0) return null
|
||||
if (assetTimeout === '0') {
|
||||
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
|
||||
|
@ -5,8 +5,7 @@ const ddo: Partial<DDO> = {
|
||||
id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
||||
publicKey: [
|
||||
{
|
||||
id:
|
||||
'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
||||
id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
||||
type: 'EthereumECDSAKey',
|
||||
owner: '0x4D156A2ef69ffdDC55838176C6712C90f60a2285'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user