mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
added schema to MarketContext
This commit is contained in:
parent
6992a8f437
commit
dc54ba3b93
@ -1,5 +1,3 @@
|
||||
import { Asset } from '@oceanprotocol/lib'
|
||||
import { CancelToken } from 'axios'
|
||||
import { ShaclSchema } from './_shaclType'
|
||||
|
||||
export interface OpcFee {
|
||||
@ -54,5 +52,5 @@ export interface MarketMetadataProviderValue {
|
||||
siteContent: SiteContent
|
||||
appConfig: AppConfig
|
||||
getOpcFeeForToken: (tokenAddress: string, chainId: number) => string
|
||||
getShaclSchema: (token?: CancelToken) => Promise<Asset>
|
||||
shaclSchema: ShaclSchema
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ function MarketMetadataProvider({
|
||||
children: ReactNode
|
||||
}): ReactElement {
|
||||
const [opcFees, setOpcFees] = useState<OpcFee[]>()
|
||||
const [shaclSchema, setShaclSchema] = useState<ShaclSchema>()
|
||||
|
||||
useEffect(() => {
|
||||
async function getOpcData() {
|
||||
@ -55,6 +56,12 @@ function MarketMetadataProvider({
|
||||
setOpcFees(opcData)
|
||||
}
|
||||
getOpcData()
|
||||
|
||||
async function getShaclSchema() {
|
||||
const schema = await retrieveShaclSchema()
|
||||
setShaclSchema(schema)
|
||||
}
|
||||
getShaclSchema()
|
||||
}, [])
|
||||
|
||||
const getOpcFeeForToken = useCallback(
|
||||
@ -68,11 +75,6 @@ function MarketMetadataProvider({
|
||||
[opcFees]
|
||||
)
|
||||
|
||||
const getShaclSchema = useCallback(async (token?: CancelToken) => {
|
||||
const schema = await retrieveShaclSchema()
|
||||
return schema
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<MarketMetadataContext.Provider
|
||||
value={
|
||||
@ -81,7 +83,7 @@ function MarketMetadataProvider({
|
||||
siteContent,
|
||||
appConfig,
|
||||
getOpcFeeForToken,
|
||||
getShaclSchema
|
||||
shaclSchema
|
||||
} as MarketMetadataProviderValue
|
||||
}
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user