Skip to content

Commit fe38422

Browse files
committed
feat: implement app details and app deals functionality with GraphQL queries and components
1 parent f214340 commit fe38422

File tree

11 files changed

+623
-1
lines changed

11 files changed

+623
-1
lines changed

src/components/SmartLinkGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function SmartLinkGroup({
3838
deal: 'deals',
3939
dataset: 'dataset',
4040
workerpool: 'workerpool',
41-
app: 'apps',
41+
app: 'app',
4242
address: 'address',
4343
transaction: 'transaction',
4444
};

src/graphql/gql.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import * as types from './graphql';
1515
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1616
*/
1717
type Documents = {
18+
"\n query AppDeals($length: Int = 20, $skip: Int = 0, $appAddress: ID!) {\n app(id: $appAddress) {\n address: id\n deals: usages(\n orderBy: timestamp\n orderDirection: desc\n first: $length\n skip: $skip\n ) {\n dealid: id\n timestamp\n requester {\n address: id\n }\n beneficiary {\n address: id\n }\n callback {\n address: id\n }\n app {\n address: id\n name\n }\n dataset {\n address: id\n name\n }\n workerpool {\n address: id\n description\n }\n category {\n catid: id\n workClockTimeRef\n }\n startTime\n appPrice\n datasetPrice\n workerpoolPrice\n botSize\n trust\n completedTasksCount\n claimedTasksCount\n }\n }\n }\n": typeof types.AppDealsDocument,
19+
"\n query App($appAddress: ID!, $appAddressString: String!) {\n app(id: $appAddress) {\n address: id\n name\n owner {\n address: id\n }\n multiaddr\n mrenclave\n checksum\n transfers(\n where: { app: $appAddressString }\n orderBy: timestamp\n orderDirection: asc\n ) {\n app {\n address: id\n }\n from {\n address: id\n }\n to {\n address: id\n }\n transaction {\n txHash: id\n timestamp\n blockNumber\n }\n }\n }\n }\n": typeof types.AppDocument,
20+
"\n query NextAppDeals($length: Int = 20, $skip: Int = 0, $appAddress: ID!) {\n app(id: $appAddress) {\n address: id\n deals: usages(\n orderBy: timestamp\n orderDirection: desc\n first: $length\n skip: $skip\n ) {\n dealid: id\n }\n }\n }\n": typeof types.NextAppDealsDocument,
1821
"\n query Apps($length: Int = 20, $skip: Int = 0) {\n apps(\n first: $length\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n address: id\n owner {\n address: id\n }\n timestamp\n name\n type\n multiaddr\n checksum\n mrenclave\n transfers(orderBy: timestamp, orderDirection: desc) {\n transaction {\n txHash: id\n timestamp\n blockNumber\n }\n }\n }\n }\n": typeof types.AppsDocument,
1922
"\n query NextApps($length: Int = 20, $skip: Int = 0) {\n apps(\n first: $length\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n address: id\n }\n }\n": typeof types.NextAppsDocument,
2023
"\n query DatasetDeals($length: Int = 20, $skip: Int = 0, $datasetAddress: ID!) {\n dataset(id: $datasetAddress) {\n address: id\n deals: usages(\n first: $length\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n dealid: id\n timestamp\n requester {\n address: id\n }\n beneficiary {\n address: id\n }\n callback {\n address: id\n }\n app {\n address: id\n name\n }\n dataset {\n address: id\n name\n }\n workerpool {\n address: id\n description\n }\n category {\n catid: id\n workClockTimeRef\n }\n startTime\n appPrice\n datasetPrice\n workerpoolPrice\n botSize\n trust\n completedTasksCount\n claimedTasksCount\n }\n }\n }\n": typeof types.DatasetDealsDocument,
@@ -35,6 +38,9 @@ type Documents = {
3538
"\n query Workerpools($length: Int = 20, $skip: Int = 0) {\n workerpools(\n first: $length\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n address: id\n owner {\n address: id\n }\n timestamp\n description\n workerStakeRatio\n schedulerRewardRatio\n transfers(orderBy: timestamp, orderDirection: desc) {\n transaction {\n txHash: id\n timestamp\n blockNumber\n }\n }\n }\n }\n": typeof types.WorkerpoolsDocument,
3639
};
3740
const documents: Documents = {
41+
"\n query AppDeals($length: Int = 20, $skip: Int = 0, $appAddress: ID!) {\n app(id: $appAddress) {\n address: id\n deals: usages(\n orderBy: timestamp\n orderDirection: desc\n first: $length\n skip: $skip\n ) {\n dealid: id\n timestamp\n requester {\n address: id\n }\n beneficiary {\n address: id\n }\n callback {\n address: id\n }\n app {\n address: id\n name\n }\n dataset {\n address: id\n name\n }\n workerpool {\n address: id\n description\n }\n category {\n catid: id\n workClockTimeRef\n }\n startTime\n appPrice\n datasetPrice\n workerpoolPrice\n botSize\n trust\n completedTasksCount\n claimedTasksCount\n }\n }\n }\n": types.AppDealsDocument,
42+
"\n query App($appAddress: ID!, $appAddressString: String!) {\n app(id: $appAddress) {\n address: id\n name\n owner {\n address: id\n }\n multiaddr\n mrenclave\n checksum\n transfers(\n where: { app: $appAddressString }\n orderBy: timestamp\n orderDirection: asc\n ) {\n app {\n address: id\n }\n from {\n address: id\n }\n to {\n address: id\n }\n transaction {\n txHash: id\n timestamp\n blockNumber\n }\n }\n }\n }\n": types.AppDocument,
43+
"\n query NextAppDeals($length: Int = 20, $skip: Int = 0, $appAddress: ID!) {\n app(id: $appAddress) {\n address: id\n deals: usages(\n orderBy: timestamp\n orderDirection: desc\n first: $length\n skip: $skip\n ) {\n dealid: id\n }\n }\n }\n": types.NextAppDealsDocument,
3844
"\n query Apps($length: Int = 20, $skip: Int = 0) {\n apps(\n first: $length\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n address: id\n owner {\n address: id\n }\n timestamp\n name\n type\n multiaddr\n checksum\n mrenclave\n transfers(orderBy: timestamp, orderDirection: desc) {\n transaction {\n txHash: id\n timestamp\n blockNumber\n }\n }\n }\n }\n": types.AppsDocument,
3945
"\n query NextApps($length: Int = 20, $skip: Int = 0) {\n apps(\n first: $length\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n address: id\n }\n }\n": types.NextAppsDocument,
4046
"\n query DatasetDeals($length: Int = 20, $skip: Int = 0, $datasetAddress: ID!) {\n dataset(id: $datasetAddress) {\n address: id\n deals: usages(\n first: $length\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n dealid: id\n timestamp\n requester {\n address: id\n }\n beneficiary {\n address: id\n }\n callback {\n address: id\n }\n app {\n address: id\n name\n }\n dataset {\n address: id\n name\n }\n workerpool {\n address: id\n description\n }\n category {\n catid: id\n workClockTimeRef\n }\n startTime\n appPrice\n datasetPrice\n workerpoolPrice\n botSize\n trust\n completedTasksCount\n claimedTasksCount\n }\n }\n }\n": types.DatasetDealsDocument,
@@ -55,6 +61,18 @@ const documents: Documents = {
5561
"\n query Workerpools($length: Int = 20, $skip: Int = 0) {\n workerpools(\n first: $length\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n address: id\n owner {\n address: id\n }\n timestamp\n description\n workerStakeRatio\n schedulerRewardRatio\n transfers(orderBy: timestamp, orderDirection: desc) {\n transaction {\n txHash: id\n timestamp\n blockNumber\n }\n }\n }\n }\n": types.WorkerpoolsDocument,
5662
};
5763

64+
/**
65+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
66+
*/
67+
export function graphql(source: "\n query AppDeals($length: Int = 20, $skip: Int = 0, $appAddress: ID!) {\n app(id: $appAddress) {\n address: id\n deals: usages(\n orderBy: timestamp\n orderDirection: desc\n first: $length\n skip: $skip\n ) {\n dealid: id\n timestamp\n requester {\n address: id\n }\n beneficiary {\n address: id\n }\n callback {\n address: id\n }\n app {\n address: id\n name\n }\n dataset {\n address: id\n name\n }\n workerpool {\n address: id\n description\n }\n category {\n catid: id\n workClockTimeRef\n }\n startTime\n appPrice\n datasetPrice\n workerpoolPrice\n botSize\n trust\n completedTasksCount\n claimedTasksCount\n }\n }\n }\n"): typeof import('./graphql').AppDealsDocument;
68+
/**
69+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
70+
*/
71+
export function graphql(source: "\n query App($appAddress: ID!, $appAddressString: String!) {\n app(id: $appAddress) {\n address: id\n name\n owner {\n address: id\n }\n multiaddr\n mrenclave\n checksum\n transfers(\n where: { app: $appAddressString }\n orderBy: timestamp\n orderDirection: asc\n ) {\n app {\n address: id\n }\n from {\n address: id\n }\n to {\n address: id\n }\n transaction {\n txHash: id\n timestamp\n blockNumber\n }\n }\n }\n }\n"): typeof import('./graphql').AppDocument;
72+
/**
73+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
74+
*/
75+
export function graphql(source: "\n query NextAppDeals($length: Int = 20, $skip: Int = 0, $appAddress: ID!) {\n app(id: $appAddress) {\n address: id\n deals: usages(\n orderBy: timestamp\n orderDirection: desc\n first: $length\n skip: $skip\n ) {\n dealid: id\n }\n }\n }\n"): typeof import('./graphql').NextAppDealsDocument;
5876
/**
5977
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
6078
*/

src/graphql/graphql.ts

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8356,6 +8356,32 @@ export enum _SubgraphErrorPolicy_ {
83568356
Deny = 'deny'
83578357
}
83588358

8359+
export type AppDealsQueryVariables = Exact<{
8360+
length?: InputMaybe<Scalars['Int']['input']>;
8361+
skip?: InputMaybe<Scalars['Int']['input']>;
8362+
appAddress: Scalars['ID']['input'];
8363+
}>;
8364+
8365+
8366+
export type AppDealsQuery = { __typename?: 'Query', app?: { __typename?: 'App', address: string, deals: Array<{ __typename?: 'Deal', timestamp: any, startTime: any, appPrice: any, datasetPrice: any, workerpoolPrice: any, botSize: any, trust: any, completedTasksCount: any, claimedTasksCount: any, dealid: string, requester: { __typename?: 'Account', address: string }, beneficiary: { __typename?: 'Account', address: string }, callback: { __typename?: 'Account', address: string }, app: { __typename?: 'App', name: string, address: string }, dataset?: { __typename?: 'Dataset', name: string, address: string } | null, workerpool: { __typename?: 'Workerpool', description: string, address: string }, category: { __typename?: 'Category', workClockTimeRef: any, catid: string } }> } | null };
8367+
8368+
export type AppQueryVariables = Exact<{
8369+
appAddress: Scalars['ID']['input'];
8370+
appAddressString: Scalars['String']['input'];
8371+
}>;
8372+
8373+
8374+
export type AppQuery = { __typename?: 'Query', app?: { __typename?: 'App', name: string, multiaddr: any, mrenclave: any, checksum: any, address: string, owner: { __typename?: 'Account', address: string }, transfers: Array<{ __typename?: 'AppTransfer', app: { __typename?: 'App', address: string }, from: { __typename?: 'Account', address: string }, to: { __typename?: 'Account', address: string }, transaction: { __typename?: 'Transaction', timestamp: any, blockNumber: any, txHash: string } }> } | null };
8375+
8376+
export type NextAppDealsQueryVariables = Exact<{
8377+
length?: InputMaybe<Scalars['Int']['input']>;
8378+
skip?: InputMaybe<Scalars['Int']['input']>;
8379+
appAddress: Scalars['ID']['input'];
8380+
}>;
8381+
8382+
8383+
export type NextAppDealsQuery = { __typename?: 'Query', app?: { __typename?: 'App', address: string, deals: Array<{ __typename?: 'Deal', dealid: string }> } | null };
8384+
83598385
export type AppsQueryVariables = Exact<{
83608386
length?: InputMaybe<Scalars['Int']['input']>;
83618387
skip?: InputMaybe<Scalars['Int']['input']>;
@@ -8521,6 +8547,104 @@ export class TypedDocumentString<TResult, TVariables>
85218547
}
85228548
}
85238549

8550+
export const AppDealsDocument = new TypedDocumentString(`
8551+
query AppDeals($length: Int = 20, $skip: Int = 0, $appAddress: ID!) {
8552+
app(id: $appAddress) {
8553+
address: id
8554+
deals: usages(
8555+
orderBy: timestamp
8556+
orderDirection: desc
8557+
first: $length
8558+
skip: $skip
8559+
) {
8560+
dealid: id
8561+
timestamp
8562+
requester {
8563+
address: id
8564+
}
8565+
beneficiary {
8566+
address: id
8567+
}
8568+
callback {
8569+
address: id
8570+
}
8571+
app {
8572+
address: id
8573+
name
8574+
}
8575+
dataset {
8576+
address: id
8577+
name
8578+
}
8579+
workerpool {
8580+
address: id
8581+
description
8582+
}
8583+
category {
8584+
catid: id
8585+
workClockTimeRef
8586+
}
8587+
startTime
8588+
appPrice
8589+
datasetPrice
8590+
workerpoolPrice
8591+
botSize
8592+
trust
8593+
completedTasksCount
8594+
claimedTasksCount
8595+
}
8596+
}
8597+
}
8598+
`) as unknown as TypedDocumentString<AppDealsQuery, AppDealsQueryVariables>;
8599+
export const AppDocument = new TypedDocumentString(`
8600+
query App($appAddress: ID!, $appAddressString: String!) {
8601+
app(id: $appAddress) {
8602+
address: id
8603+
name
8604+
owner {
8605+
address: id
8606+
}
8607+
multiaddr
8608+
mrenclave
8609+
checksum
8610+
transfers(
8611+
where: {app: $appAddressString}
8612+
orderBy: timestamp
8613+
orderDirection: asc
8614+
) {
8615+
app {
8616+
address: id
8617+
}
8618+
from {
8619+
address: id
8620+
}
8621+
to {
8622+
address: id
8623+
}
8624+
transaction {
8625+
txHash: id
8626+
timestamp
8627+
blockNumber
8628+
}
8629+
}
8630+
}
8631+
}
8632+
`) as unknown as TypedDocumentString<AppQuery, AppQueryVariables>;
8633+
export const NextAppDealsDocument = new TypedDocumentString(`
8634+
query NextAppDeals($length: Int = 20, $skip: Int = 0, $appAddress: ID!) {
8635+
app(id: $appAddress) {
8636+
address: id
8637+
deals: usages(
8638+
orderBy: timestamp
8639+
orderDirection: desc
8640+
first: $length
8641+
skip: $skip
8642+
) {
8643+
dealid: id
8644+
}
8645+
}
8646+
}
8647+
`) as unknown as TypedDocumentString<NextAppDealsQuery, NextAppDealsQueryVariables>;
85248648
export const AppsDocument = new TypedDocumentString(`
85258649
query Apps($length: Int = 20, $skip: Int = 0) {
85268650
apps(first: $length, skip: $skip, orderBy: timestamp, orderDirection: desc) {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { ChainLink } from '@/components/ChainLink';
2+
import {
3+
Breadcrumb,
4+
BreadcrumbItem,
5+
BreadcrumbLink,
6+
BreadcrumbList,
7+
BreadcrumbPage,
8+
BreadcrumbSeparator,
9+
} from '@/components/ui/breadcrumb';
10+
import { truncateAddress } from '@/utils/truncateAddress';
11+
12+
export function AppBreadcrumbs({ appId }: { appId: string }) {
13+
return (
14+
<Breadcrumb>
15+
<BreadcrumbList>
16+
<BreadcrumbItem>
17+
<BreadcrumbLink asChild>
18+
<ChainLink to="/">Homepage</ChainLink>
19+
</BreadcrumbLink>
20+
</BreadcrumbItem>
21+
<BreadcrumbSeparator />
22+
<BreadcrumbItem>
23+
<BreadcrumbLink asChild>
24+
<ChainLink to="/apps">All apps</ChainLink>
25+
</BreadcrumbLink>
26+
</BreadcrumbItem>
27+
<BreadcrumbSeparator />
28+
<BreadcrumbItem>
29+
<BreadcrumbPage>
30+
App <span className="font-normal">{truncateAddress(appId)}</span>
31+
</BreadcrumbPage>
32+
</BreadcrumbItem>
33+
</BreadcrumbList>
34+
</Breadcrumb>
35+
);
36+
}

0 commit comments

Comments
 (0)