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

Commit

Permalink
Using cow-sdk 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
henrypalacios committed Jul 26, 2022
1 parent e730713 commit af592de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"dependencies": {
"@amcharts/amcharts4": "^4.9.12",
"@apollo/client": "^3.1.5",
"@cowprotocol/cow-sdk": "^1.0.0",
"@cowprotocol/cow-sdk": "^1.0.0-RC.0",
"@fortawesome/fontawesome-svg-core": "^1.2.26",
"@fortawesome/free-regular-svg-icons": "^5.12.0",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
Expand Down
4 changes: 2 additions & 2 deletions src/components/orders/DetailsTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { faProjectDiagram } from '@fortawesome/free-solid-svg-icons'
import { getCidHashFromAppData, getDecodedAppData } from 'hooks/useAppData'
import useSafeState from 'hooks/useSafeState'
import { useNetworkId } from 'state/network'
import { LatestAppDataDocVersion } from '@cowprotocol/cow-sdk'
import { AnyAppDataDocVersion } from '@cowprotocol/cow-sdk'
import { DEFAULT_IPFS_READ_URI, IPFS_INVALID_APP_IDS } from 'const'

const Table = styled(SimpleTable)`
Expand Down Expand Up @@ -221,7 +221,7 @@ export function DetailsTable(props: Props): JSX.Element | null {
} = order
const [appDataLoading, setAppDataLoading] = useSafeState(false)
const [appDataError, setAppDataError] = useSafeState(false)
const [decodedAppData, setDecodedAppData] = useSafeState<LatestAppDataDocVersion | void | undefined>(undefined)
const [decodedAppData, setDecodedAppData] = useSafeState<AnyAppDataDocVersion | void | undefined>(undefined)
const [ipfsUri, setIpfsUri] = useSafeState<string>('')

const [showDecodedAppData, setShowDecodedAppData] = useSafeState<boolean>(false)
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useAppData.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { useEffect, useState } from 'react'
import { LatestAppDataDocVersion } from '@cowprotocol/cow-sdk'
import { AnyAppDataDocVersion } from '@cowprotocol/cow-sdk'
import { useNetworkId } from 'state/network'
import { COW_SDK } from 'const'
import { Network } from 'types'

export const useAppData = (
appDataHash: string,
): { isLoading: boolean; appDataDoc: LatestAppDataDocVersion | void | undefined } => {
): { isLoading: boolean; appDataDoc: AnyAppDataDocVersion | void | undefined } => {
const network = useNetworkId() || undefined
const [isLoading, setLoading] = useState<boolean>(false)
const [appDataDoc, setAppDataDoc] = useState<LatestAppDataDocVersion | void>()
const [appDataDoc, setAppDataDoc] = useState<AnyAppDataDocVersion | void>()
useEffect(() => {
async function getAppDataDoc(): Promise<void> {
setLoading(true)
Expand All @@ -33,7 +33,7 @@ export const useAppData = (
export const getDecodedAppData = (
appDataHash: string,
networkId = Network.MAINNET,
): Promise<void | AppDataDoc> | undefined => {
): Promise<void | AnyAppDataDocVersion> | undefined => {
return COW_SDK[networkId]?.metadataApi.decodeAppData(appDataHash)
}

Expand Down

0 comments on commit af592de

Please sign in to comment.