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

Merge pull request #86 from deltaDAO/feat/alignment #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 12 additions & 1 deletion app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,16 @@ module.exports = {
},

// Display alert banner for the developer preview deployment
showPreviewAlert: process.env.NEXT_PUBLIC_SHOW_PREVIEW_ALERT || 'false'
showPreviewAlert: process.env.NEXT_PUBLIC_SHOW_PREVIEW_ALERT || 'false',

networkAlertConfig: {
// Refresh interval for network status - 30 sec
refreshInterval: 30000,
// Margin of error for block count (how much difference between min / max block numbers before showing an alert)
errorMargin: 10,
// Map chainIds to their respective status endpoints
statusEndpoints: {
100: 'https://status.genx.delta-dao.com/api/check-blocks'
}
}
}
66 changes: 50 additions & 16 deletions content/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,70 +26,104 @@
"subItems": [
{
"name": "Pontus-X",
"link": "https://pontus-x.eu/"
"link": "https://pontus-x.eu/",
"isLive": true
},
{
"name": "GX4M moveID",
"link": "https://portal.moveid.eu/",
"description": "moveID aims to develop a decentralized digital mobility identity infrastructure for Europe.",
"image": "moveid-logo.webp",
"category": "mobility"
"category": "mobility",
"isLive": true
},
{
"name": "Cooperants",
"link": "https://cooperants.pontus-x.eu/",
"description": "The world's only collaborative alliance in the Aeronautics and space sector that solves pressing digital collaboration problems by creating a common data space.",
"image": "cooperants-logo.webp",
"category": "space"
"category": "manufacturing",
"isLive": true
},
{
"name": "Airbus",
"link": "https://airbus.pontus-x.eu/",
"description": "For those who make this world a safer place. We pioneer defense and space for their mission success.",
"image": "airbus-logo.webp",
"category": "space"
"category": "manufacturing",
"isLive": true
},
{
"name": "Service-Meister",
"link": "https://servicemeister.pontus-x.eu/",
"description": "An AI-based Service Ecosystem for Technical Service in the Age of Industry 4.0.",
"image": "service-meister-logo.webp",
"category": "manufacturing"
},
{
"name": "Future Mobility Marketplace",
"link": "https://marketplace.future-mobility-alliance.org/",
"description": "Find or publish datasets and AI algorithms for solving challenges in mobility.",
"image": "fmdm-logo.webp",
"category": "mobility"
"category": "AI",
"isLive": true
},
{
"name": "Berlin State Library",
"link": "https://sbb.pontus-x.eu/",
"description": "Explore the Open Science Ecosystem, a collaboration of libraries, universities, and science pioneers under Gaia-X principles for limitless shared knowledge.",
"image": "sbb-logo.webp",
"category": "science"
"category": "language models",
"isLive": true
},
{
"name": "Flex4Res",
"link": "https://flex4res.pontus-x.eu/",
"description": "Flex4Res stands for Data spaces for FLEXible production lines and supply chains FOR RESilient manufacturing. Flex4Res develops an open platform for secure and sovereign data exchange",
"image": "flex4res-logo.webp",
"category": "manufacturing",
"isLive": true
},
{
"name": "Future Mobility Marketplace",
"link": "https://marketplace.future-mobility-alliance.org/",
"description": "Find or publish datasets and AI algorithms for solving challenges in mobility.",
"image": "fmdm-logo.webp",
"category": "mobility",
"isLive": true
},
{
"name": "EnergySHR",
"link": "https://www.energyshr.nl/",
"description": "A platform for sharing (SHR) datasets and AI algorithms that contribute to solving challenges of the energy transition.",
"image": "energy-shr-logo.webp",
"category": "science"
"category": "energy",
"isLive": true
},
{
"name": "Clinical Insights Exchange",
"link": "https://cix.triall.io/",
"description": "A federated data platform to change clinical data assets and analytics services in a trusted, privacy-friendly environment.",
"image": "clinical-insights-exchange-logo.webp",
"category": "health"
"category": "health",
"isLive": true
},
{
"name": "UdL Research Data Space",
"link": "https://dataspace.angliru.udl.cat/",
"description": "An open research platform following the FAIR guiding principles of findability, accessibility, interoperability and reusability, while guaranteeing data sovereignty.",
"image": "udl-logo.webp",
"category": "science"
"category": "agriculture",
"isLive": true
},
{
"name": "Under Construction: ACCURATE",
"link": "https://ec.europa.eu/info/funding-tenders/opportunities/portal/screen/how-to-participate/org-details/999999999/project/101138269/program/43108390/details",
"description": "Gaia-X Lighthouse ACCURATE aims to boost the competitiveness of European manufacturing companies with DSS and Manufacturing as a Service frameworks. ",
"image": "accurate-logo.webp",
"category": "manufacturing",
"isLive": false
},
{
"name": "deltaDAO AI marketplace",
"link": "https://market.delta-dao.com/",
"description": "With deltaDAO's AI Marketplace, you have the freedom to decide how your AI service is offered. By keeping your AI private, you retain full control and do not disclose your valuable IP.",
"image": "deltadao-logo.webp",
"category": "AI",
"isLive": false
}
]
}
Expand Down
34 changes: 19 additions & 15 deletions src/@context/Automation/AutomationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@ export enum AUTOMATION_MODES {
ADVANCED = 'advanced'
}

export interface NativeTokenBalance {
symbol: string
balance: string
}
export interface AutomationProviderValue {
autoWallet: Wallet
autoWalletAddress: string
isAutomationEnabled: boolean
balance: UserBalance
nativeBalance: NativeTokenBalance
isLoading: boolean
decryptPercentage: number
hasValidEncryptedWallet: boolean
Expand Down Expand Up @@ -65,8 +60,12 @@ function AutomationProvider({ children }) {
address: autoWallet?.address as `0x${string}`
})

const [nativeBalance, setNativeBalance] = useState<NativeTokenBalance>()
const [balance, setBalance] = useState<UserBalance>({})
const [balance, setBalance] = useState<UserBalance>({
native: {
symbol: 'eth',
balance: '0'
}
})

const [hasDeleteRequest, setHasDeleteRequest] = useState(false)

Expand Down Expand Up @@ -98,16 +97,22 @@ function AutomationProvider({ children }) {
if (!autoWallet) return

try {
const newBalance: UserBalance = {
native: {
symbol: 'eth',
balance: '0'
}
}
if (balanceNativeToken)
setNativeBalance({
symbol: balanceNativeToken?.symbol.toLowerCase() || 'ETH',
balance: balanceNativeToken?.formatted
})
newBalance.native.symbol =
balanceNativeToken?.symbol.toLowerCase() || 'eth'
newBalance.native.balance = balanceNativeToken?.formatted

if (approvedBaseTokens?.length > 0) {
const newBalance = await getApprovedTokenBalances(autoWallet?.address)
setBalance(newBalance)
} else setBalance(undefined)
const approved = await getApprovedTokenBalances(autoWallet?.address)
newBalance.approved = approved
}
setBalance(newBalance)
} catch (error) {
LoggerInstance.error('[AutomationProvider] Error: ', error.message)
}
Expand Down Expand Up @@ -207,7 +212,6 @@ function AutomationProvider({ children }) {
autoWallet,
autoWalletAddress,
balance,
nativeBalance,
isAutomationEnabled,
isLoading,
decryptPercentage,
Expand Down
12 changes: 12 additions & 0 deletions src/@context/MarketMetadata/_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ export interface AppConfig {
roughTxGasEstimate: number
}
showPreviewAlert: string
networkAlertConfig: {
// Refresh interval for network status - 30 sec
refreshInterval: number
// Margin of error for block count (how much difference between min / max block numbers before showing an alert)
errorMargin: number
// Map chainIds to their respective status endpoints
statusEndpoints: {
[chainId: number]: string
}
}
}
export interface SiteContent {
siteTitle: string
Expand All @@ -52,12 +62,14 @@ export interface SiteContent {
description?: string
image?: string
category?: string
isLive?: boolean
subItems?: {
name: string
link: string
description?: string
image?: string
category?: string
isLive?: boolean
}[]
}[]
}[]
Expand Down
21 changes: 13 additions & 8 deletions src/@hooks/useBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getTokenBalance } from '@utils/wallet'

interface BalanceProviderValue {
balance: UserBalance
getApprovedTokenBalances: (address: string) => Promise<UserBalance>
getApprovedTokenBalances: (address: string) => Promise<TokenBalances>
}

function useBalance(): BalanceProviderValue {
Expand All @@ -22,12 +22,15 @@ function useBalance(): BalanceProviderValue {
const { chain } = useNetwork()

const [balance, setBalance] = useState<UserBalance>({
eth: '0'
native: {
symbol: 'eth',
balance: '0'
}
})

const getApprovedTokenBalances = useCallback(
async (address: string): Promise<UserBalance> => {
const newBalance: UserBalance = {}
async (address: string): Promise<TokenBalances> => {
const newBalance: TokenBalances = {}

if (approvedBaseTokens?.length > 0) {
await Promise.allSettled(
Expand Down Expand Up @@ -64,11 +67,13 @@ function useBalance(): BalanceProviderValue {
try {
const userBalance = balanceNativeToken?.formatted
const key = balanceNativeToken?.symbol.toLowerCase()
const newNativeBalance: UserBalance = { [key]: userBalance }

const newBalance = {
...newNativeBalance,
...(await getApprovedTokenBalances(address))
const newBalance: UserBalance = {
native: {
symbol: key,
balance: userBalance
},
approved: await getApprovedTokenBalances(address)
}

setBalance(newBalance)
Expand Down
4 changes: 2 additions & 2 deletions src/@types/AssetExtended.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Asset } from '@oceanprotocol/lib'
import { Asset, Metadata } from '@oceanprotocol/lib'

// declaring into global scope to be able to use this as
// ambiant types despite the above imports
declare global {
interface AssetExtended extends Asset {
accessDetails?: AccessDetails
views?: number
metadata: MetadataExtended
metadata: Metadata
services: ServiceExtended[]
}
}
8 changes: 8 additions & 0 deletions src/@types/TokenBalance.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
interface UserBalance {
native: {
symbol: string
balance: string
}
approved?: TokenBalances
}

interface TokenBalances {
[key: string]: string
}
4 changes: 3 additions & 1 deletion src/@utils/subgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { LoggerInstance } from '@oceanprotocol/lib'
import { getUrqlClientInstance } from '@context/UrqlProvider'
import { getOceanConfig } from './ocean'
import { OrdersData_orders as OrdersData } from '../@types/subgraph/OrdersData'

Check failure on line 5 in src/@utils/subgraph.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 18)

Cannot find module '../@types/subgraph/OrdersData' or its corresponding type declarations.
import { OpcFeesQuery as OpcFeesData } from '../@types/subgraph/OpcFeesQuery'

Check failure on line 6 in src/@utils/subgraph.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 18)

Cannot find module '../@types/subgraph/OpcFeesQuery' or its corresponding type declarations.
import appConfig from '../../app.config'

const UserTokenOrders = gql`
Expand Down Expand Up @@ -58,6 +58,7 @@
export const tokenAddressesEUROe = {
100: '0xe974c4894996e012399dedbda0be7314a73bbff1',
137: '0x820802Fa8a99901F52e39acD21177b0BE6EE2974',
32456: '0x8A4826071983655805bF4f29828577Cd6b1aC0cB',
80001: '0xA089a21902914C3f3325dBE2334E9B466071E5f1'
}

Expand Down Expand Up @@ -187,7 +188,8 @@
...approvedTokens,
{
address: tokenAddressesEUROe[chainId],
decimals: 6,
// TODO: revert once decimals changed to 6 on pontus-x
decimals: chainId === 32456 ? 18 : 6,
name: 'EUROe',
symbol: 'EUROe'
}
Expand Down
6 changes: 3 additions & 3 deletions src/@utils/wallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ export async function getTokenBalance(
}
}

export function getTokenBalanceFromSymbol(
export function getApprovedTokenBalanceFromSymbol(
balance: UserBalance,
symbol: string
): string {
if (!symbol) return

const baseTokenBalance = balance?.[symbol.toLocaleLowerCase()]
const { approved } = balance
const baseTokenBalance = approved?.[symbol.toLocaleLowerCase()]
return baseTokenBalance || '0'
}
27 changes: 25 additions & 2 deletions src/components/@shared/AssetList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AssetTeaser from '@shared/AssetTeaser'
import { ReactElement, useState } from 'react'
import { ReactElement, useEffect, useState } from 'react'
import Pagination from '@shared/Pagination'
import styles from './index.module.css'
import AssetTitle from '@shared/AssetListTitle'
Expand All @@ -10,8 +10,20 @@ import { getServiceByName } from '@utils/ddo'
import AssetViewSelector, { AssetViewOptions } from './AssetViewSelector'
import Time from '../atoms/Time'
import Loader from '../atoms/Loader'
import NetworkName from '../NetworkName'
import { useUserPreferences } from '../../../@context/UserPreferences'
import { ChainDoesNotSupportMulticallError } from 'wagmi'

const columns: TableOceanColumn<AssetExtended>[] = [
const networkColumn: TableOceanColumn<AssetExtended> = {
name: 'Network',
selector: (row) => {
const { chainId } = row
return <NetworkName networkId={chainId} />
},
maxWidth: '10rem'
}

const tableColumns: TableOceanColumn<AssetExtended>[] = [
{
name: 'Dataset',
selector: (row) => {
Expand Down Expand Up @@ -94,6 +106,17 @@ export default function AssetList({
showAssetViewSelector,
defaultAssetView
}: AssetListProps): ReactElement {
const { chainIds } = useUserPreferences()

const [columns, setColumns] = useState(tableColumns)

useEffect(() => {
if (chainIds.length > 1) {
const [datasetColumn, ...otherColumns] = tableColumns
setColumns([datasetColumn, networkColumn, ...otherColumns])
} else setColumns(tableColumns)
}, [chainIds])

const [activeAssetView, setActiveAssetView] = useState<AssetViewOptions>(
defaultAssetView || AssetViewOptions.Grid
)
Expand Down
Loading
Loading