Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove graphql query for accessDetails as it is return by aquarius #1996

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions src/@context/Asset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { getAsset } from '@utils/aquarius'
import { useCancelToken } from '@hooks/useCancelToken'
import { getOceanConfig, sanitizeDevelopmentConfig } from '@utils/ocean'
import { getAccessDetails } from '@utils/accessDetailsAndPricing'

Check warning on line 15 in src/@context/Asset.tsx

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 18)

'getAccessDetails' is defined but never used

Check warning on line 15 in src/@context/Asset.tsx

View workflow job for this annotation

GitHub Actions / test (macos-latest, 18)

'getAccessDetails' is defined but never used

Check warning on line 15 in src/@context/Asset.tsx

View workflow job for this annotation

GitHub Actions / test (windows-latest, 18)

'getAccessDetails' is defined but never used
import { useIsMounted } from '@hooks/useIsMounted'
import { useMarketMetadata } from './MarketMetadata'
import { assetStateToString } from '@utils/assetState'
Expand Down Expand Up @@ -115,28 +115,9 @@

setLoading(false)
},
[did, accountId]

Check warning on line 118 in src/@context/Asset.tsx

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 18)

React Hook useCallback has an unnecessary dependency: 'accountId'. Either exclude it or remove the dependency array

Check warning on line 118 in src/@context/Asset.tsx

View workflow job for this annotation

GitHub Actions / test (macos-latest, 18)

React Hook useCallback has an unnecessary dependency: 'accountId'. Either exclude it or remove the dependency array

Check warning on line 118 in src/@context/Asset.tsx

View workflow job for this annotation

GitHub Actions / test (windows-latest, 18)

React Hook useCallback has an unnecessary dependency: 'accountId'. Either exclude it or remove the dependency array
)

// -----------------------------------
// Helper: Get and set asset access details
// -----------------------------------
const fetchAccessDetails = useCallback(async (): Promise<void> => {
if (!asset?.chainId || !asset?.services?.length) return
bogdanfazakas marked this conversation as resolved.
Show resolved Hide resolved

const accessDetails = await getAccessDetails(
asset.chainId,
asset.services[0].datatokenAddress,
asset.services[0].timeout,
accountId
)
setAsset((prevState) => ({
...prevState,
accessDetails
}))
LoggerInstance.log(`[asset] Got access details for ${did}`, accessDetails)
}, [asset?.chainId, asset?.services, accountId, did])

// -----------------------------------
// 1. Get and set asset based on passed DID
// -----------------------------------
Expand All @@ -146,15 +127,6 @@
fetchAsset(newCancelToken())
}, [appConfig?.metadataCacheUri, fetchAsset, newCancelToken, isMounted])

// -----------------------------------
// 2. Attach access details to asset
// -----------------------------------
useEffect(() => {
if (!isMounted) return

fetchAccessDetails()
}, [accountId, fetchAccessDetails, isMounted])

// -----------------------------------
// Check user network against asset network
// -----------------------------------
Expand Down
6 changes: 4 additions & 2 deletions src/@utils/compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ export function getQueryString(
const baseParams = {
chainIds: [chainId],
sort: { sortBy: SortTermOptions.Created },
filters: [getFilterTerm('metadata.type', 'algorithm')]
filters: [getFilterTerm('metadata.type', 'algorithm')],
esPaginationOptions: {
size: 2000
}
} as BaseQueryParams
algorithmDidList?.length > 0 &&
baseParams.filters.push(getFilterTerm('_id', algorithmDidList))
Expand Down Expand Up @@ -200,7 +203,6 @@ export async function getAlgorithmsForAsset(
),
token
)

const algorithms: Asset[] = gueryResults?.results
return algorithms
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/Asset/AssetActions/Compute/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ export default function Compute({
signer,
algoProviderFees
)
console.log(algorithmOrderPriceAndFees)
bogdanfazakas marked this conversation as resolved.
Show resolved Hide resolved

if (!algorithmOrderPriceAndFees)
throw new Error('Error setting algorithm price and fees!')

Expand All @@ -209,6 +211,7 @@ export default function Compute({
if (!datasetPriceAndFees)
throw new Error('Error setting dataset price and fees!')

console.log(datasetPriceAndFees)
setDatasetOrderPriceAndFees(datasetPriceAndFees)
}
}
Expand Down Expand Up @@ -241,6 +244,8 @@ export default function Compute({
asset.metadata.type
)[0]
)
console.log(initializedProvider?.datasets?.[0]?.providerFee)
bogdanfazakas marked this conversation as resolved.
Show resolved Hide resolved

await setDatasetPrice(initializedProvider?.datasets?.[0]?.providerFee)
setComputeStatusText(
getComputeFeedback(
Expand All @@ -267,6 +272,7 @@ export default function Compute({
}, [asset?.accessDetails, accountId, isUnsupportedPricing])

useEffect(() => {
console.log(selectedAlgorithmAsset)
bogdanfazakas marked this conversation as resolved.
Show resolved Hide resolved
if (!selectedAlgorithmAsset?.accessDetails) return

setIsRequestingAlgoOrderPrice(true)
Expand Down
Loading