Skip to content

Commit efe2b1b

Browse files
committed
feat: Add address details page with queries for beneficiary deals, requested deals, requested tasks and overview
1 parent ae5d8c4 commit efe2b1b

17 files changed

+1116
-0
lines changed

src/graphql/gql.ts

Lines changed: 42 additions & 0 deletions
Large diffs are not rendered by default.

src/graphql/graphql.ts

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

8359+
export type AddressQueryVariables = Exact<{
8360+
address: Scalars['ID']['input'];
8361+
}>;
8362+
8363+
8364+
export type AddressQuery = { __typename?: 'Query', account?: { __typename?: 'Account', score: any, address: string, staked: any, locked: any, allApps: Array<{ __typename?: 'App', id: string }>, allDatasets: Array<{ __typename?: 'Dataset', id: string }>, allWorkerpools: Array<{ __typename?: 'Workerpool', id: string }>, allContributions: Array<{ __typename?: 'Contribution', id: string }>, allDealRequester: Array<{ __typename?: 'Deal', id: string }>, allDealBeneficiary: Array<{ __typename?: 'Deal', id: string }> } | null };
8365+
8366+
export type AddressBeneficiaryDealsQueryVariables = Exact<{
8367+
length?: InputMaybe<Scalars['Int']['input']>;
8368+
skip?: InputMaybe<Scalars['Int']['input']>;
8369+
address: Scalars['ID']['input'];
8370+
}>;
8371+
8372+
8373+
export type AddressBeneficiaryDealsQuery = { __typename?: 'Query', account?: { __typename?: 'Account', address: string, dealBeneficiary: Array<{ __typename?: 'Deal', timestamp: any, botSize: any, completedTasksCount: any, claimedTasksCount: any, startTime: any, dealid: string, category: { __typename?: 'Category', workClockTimeRef: any }, app: { __typename?: 'App', name: string, address: string }, dataset?: { __typename?: 'Dataset', name: string, address: string } | null, workerpool: { __typename?: 'Workerpool', description: string, address: string } }> } | null };
8374+
8375+
export type NextAddressBeneficiaryDealsQueryVariables = Exact<{
8376+
length?: InputMaybe<Scalars['Int']['input']>;
8377+
skip?: InputMaybe<Scalars['Int']['input']>;
8378+
address: Scalars['ID']['input'];
8379+
}>;
8380+
8381+
8382+
export type NextAddressBeneficiaryDealsQuery = { __typename?: 'Query', account?: { __typename?: 'Account', address: string, dealBeneficiary: Array<{ __typename?: 'Deal', dealid: string }> } | null };
8383+
8384+
export type AddressRequestedDealsQueryVariables = Exact<{
8385+
length?: InputMaybe<Scalars['Int']['input']>;
8386+
skip?: InputMaybe<Scalars['Int']['input']>;
8387+
address: Scalars['ID']['input'];
8388+
}>;
8389+
8390+
8391+
export type AddressRequestedDealsQuery = { __typename?: 'Query', account?: { __typename?: 'Account', address: string, dealRequester: Array<{ __typename?: 'Deal', timestamp: any, botSize: any, completedTasksCount: any, claimedTasksCount: any, startTime: any, dealid: string, category: { __typename?: 'Category', workClockTimeRef: any }, app: { __typename?: 'App', name: string, address: string }, dataset?: { __typename?: 'Dataset', name: string, address: string } | null, workerpool: { __typename?: 'Workerpool', description: string, address: string } }> } | null };
8392+
8393+
export type NextAddressRequestedDealsQueryVariables = Exact<{
8394+
length?: InputMaybe<Scalars['Int']['input']>;
8395+
skip?: InputMaybe<Scalars['Int']['input']>;
8396+
address: Scalars['ID']['input'];
8397+
}>;
8398+
8399+
8400+
export type NextAddressRequestedDealsQuery = { __typename?: 'Query', account?: { __typename?: 'Account', address: string, dealRequester: Array<{ __typename?: 'Deal', timestamp: any, botSize: any, completedTasksCount: any, claimedTasksCount: any, startTime: any, dealid: string, category: { __typename?: 'Category', workClockTimeRef: any }, app: { __typename?: 'App', name: string, address: string }, dataset?: { __typename?: 'Dataset', name: string, address: string } | null, workerpool: { __typename?: 'Workerpool', description: string, address: string } }> } | null };
8401+
8402+
export type AddressRequestedTasksQueryVariables = Exact<{
8403+
length?: InputMaybe<Scalars['Int']['input']>;
8404+
skip?: InputMaybe<Scalars['Int']['input']>;
8405+
address: Scalars['ID']['input'];
8406+
}>;
8407+
8408+
8409+
export type AddressRequestedTasksQuery = { __typename?: 'Query', account?: { __typename?: 'Account', address: string, taskRequester: Array<{ __typename?: 'Task', timestamp: any, status: TaskStatus, finalDeadline: any, taskid: string, deal: { __typename?: 'Deal', dealid: string, app: { __typename?: 'App', name: string, address: string }, dataset?: { __typename?: 'Dataset', name: string, address: string } | null, workerpool: { __typename?: 'Workerpool', description: string, address: string } } }> } | null };
8410+
8411+
export type NextAddressRequestedTasksQueryVariables = Exact<{
8412+
length?: InputMaybe<Scalars['Int']['input']>;
8413+
skip?: InputMaybe<Scalars['Int']['input']>;
8414+
address: Scalars['ID']['input'];
8415+
}>;
8416+
8417+
8418+
export type NextAddressRequestedTasksQuery = { __typename?: 'Query', account?: { __typename?: 'Account', address: string, taskRequester: Array<{ __typename?: 'Task', taskid: string }> } | null };
8419+
83598420
export type AppDealsQueryVariables = Exact<{
83608421
length?: InputMaybe<Scalars['Int']['input']>;
83618422
skip?: InputMaybe<Scalars['Int']['input']>;
@@ -8568,6 +8629,202 @@ export class TypedDocumentString<TResult, TVariables>
85688629
}
85698630
}
85708631

8632+
export const AddressDocument = new TypedDocumentString(`
8633+
query Address($address: ID!) {
8634+
account(id: $address) {
8635+
address: id
8636+
staked: balance
8637+
locked: frozen
8638+
score
8639+
allApps: apps(first: 1000) {
8640+
id
8641+
}
8642+
allDatasets: datasets(first: 1000) {
8643+
id
8644+
}
8645+
allWorkerpools: workerpools(first: 1000) {
8646+
id
8647+
}
8648+
allContributions: contributions(first: 1000) {
8649+
id
8650+
}
8651+
allDealRequester: dealRequester(first: 1000) {
8652+
id
8653+
}
8654+
allDealBeneficiary: dealBeneficiary(first: 1000) {
8655+
id
8656+
}
8657+
}
8658+
}
8659+
`) as unknown as TypedDocumentString<AddressQuery, AddressQueryVariables>;
8660+
export const AddressBeneficiaryDealsDocument = new TypedDocumentString(`
8661+
query AddressBeneficiaryDeals($length: Int = 20, $skip: Int = 0, $address: ID!) {
8662+
account(id: $address) {
8663+
address: id
8664+
dealBeneficiary(
8665+
orderBy: timestamp
8666+
orderDirection: desc
8667+
first: $length
8668+
skip: $skip
8669+
) {
8670+
dealid: id
8671+
timestamp
8672+
botSize
8673+
completedTasksCount
8674+
claimedTasksCount
8675+
category {
8676+
workClockTimeRef
8677+
}
8678+
startTime
8679+
app {
8680+
address: id
8681+
name
8682+
}
8683+
dataset {
8684+
address: id
8685+
name
8686+
}
8687+
workerpool {
8688+
address: id
8689+
description
8690+
}
8691+
}
8692+
}
8693+
}
8694+
`) as unknown as TypedDocumentString<AddressBeneficiaryDealsQuery, AddressBeneficiaryDealsQueryVariables>;
8695+
export const NextAddressBeneficiaryDealsDocument = new TypedDocumentString(`
8696+
query NextAddressBeneficiaryDeals($length: Int = 20, $skip: Int = 0, $address: ID!) {
8697+
account(id: $address) {
8698+
address: id
8699+
dealBeneficiary(
8700+
orderBy: timestamp
8701+
orderDirection: desc
8702+
first: $length
8703+
skip: $skip
8704+
) {
8705+
dealid: id
8706+
}
8707+
}
8708+
}
8709+
`) as unknown as TypedDocumentString<NextAddressBeneficiaryDealsQuery, NextAddressBeneficiaryDealsQueryVariables>;
8710+
export const AddressRequestedDealsDocument = new TypedDocumentString(`
8711+
query AddressRequestedDeals($length: Int = 20, $skip: Int = 0, $address: ID!) {
8712+
account(id: $address) {
8713+
address: id
8714+
dealRequester(
8715+
orderBy: timestamp
8716+
orderDirection: desc
8717+
first: $length
8718+
skip: $skip
8719+
) {
8720+
dealid: id
8721+
timestamp
8722+
botSize
8723+
completedTasksCount
8724+
claimedTasksCount
8725+
category {
8726+
workClockTimeRef
8727+
}
8728+
startTime
8729+
app {
8730+
address: id
8731+
name
8732+
}
8733+
dataset {
8734+
address: id
8735+
name
8736+
}
8737+
workerpool {
8738+
address: id
8739+
description
8740+
}
8741+
}
8742+
}
8743+
}
8744+
`) as unknown as TypedDocumentString<AddressRequestedDealsQuery, AddressRequestedDealsQueryVariables>;
8745+
export const NextAddressRequestedDealsDocument = new TypedDocumentString(`
8746+
query NextAddressRequestedDeals($length: Int = 20, $skip: Int = 0, $address: ID!) {
8747+
account(id: $address) {
8748+
address: id
8749+
dealRequester(
8750+
orderBy: timestamp
8751+
orderDirection: desc
8752+
first: $length
8753+
skip: $skip
8754+
) {
8755+
dealid: id
8756+
timestamp
8757+
botSize
8758+
completedTasksCount
8759+
claimedTasksCount
8760+
category {
8761+
workClockTimeRef
8762+
}
8763+
startTime
8764+
app {
8765+
address: id
8766+
name
8767+
}
8768+
dataset {
8769+
address: id
8770+
name
8771+
}
8772+
workerpool {
8773+
address: id
8774+
description
8775+
}
8776+
}
8777+
}
8778+
}
8779+
`) as unknown as TypedDocumentString<NextAddressRequestedDealsQuery, NextAddressRequestedDealsQueryVariables>;
8780+
export const AddressRequestedTasksDocument = new TypedDocumentString(`
8781+
query AddressRequestedTasks($length: Int = 20, $skip: Int = 0, $address: ID!) {
8782+
account(id: $address) {
8783+
address: id
8784+
taskRequester(
8785+
orderBy: timestamp
8786+
orderDirection: desc
8787+
first: $length
8788+
skip: $skip
8789+
) {
8790+
taskid: id
8791+
timestamp
8792+
status
8793+
finalDeadline
8794+
deal {
8795+
dealid: id
8796+
app {
8797+
address: id
8798+
name
8799+
}
8800+
dataset {
8801+
address: id
8802+
name
8803+
}
8804+
workerpool {
8805+
address: id
8806+
description
8807+
}
8808+
}
8809+
}
8810+
}
8811+
}
8812+
`) as unknown as TypedDocumentString<AddressRequestedTasksQuery, AddressRequestedTasksQueryVariables>;
8813+
export const NextAddressRequestedTasksDocument = new TypedDocumentString(`
8814+
query NextAddressRequestedTasks($length: Int = 20, $skip: Int = 0, $address: ID!) {
8815+
account(id: $address) {
8816+
address: id
8817+
taskRequester(
8818+
orderBy: timestamp
8819+
orderDirection: desc
8820+
first: $length
8821+
skip: $skip
8822+
) {
8823+
taskid: id
8824+
}
8825+
}
8826+
}
8827+
`) as unknown as TypedDocumentString<NextAddressRequestedTasksQuery, NextAddressRequestedTasksQueryVariables>;
85718828
export const AppDealsDocument = new TypedDocumentString(`
85728829
query AppDeals($length: Int = 20, $skip: Int = 0, $appAddress: ID!) {
85738830
app(id: $appAddress) {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
type AddressBreadcrumbsProps = {
13+
addressId: string;
14+
};
15+
16+
export function AddressBreadcrumbs({ addressId }: AddressBreadcrumbsProps) {
17+
return (
18+
<Breadcrumb>
19+
<BreadcrumbList>
20+
<BreadcrumbItem>
21+
<BreadcrumbLink asChild>
22+
<ChainLink to="/">Homepage</ChainLink>
23+
</BreadcrumbLink>
24+
</BreadcrumbItem>
25+
<BreadcrumbSeparator />
26+
<BreadcrumbItem>
27+
<BreadcrumbPage>
28+
Address{' '}
29+
<span className="font-normal">{truncateAddress(addressId)}</span>
30+
</BreadcrumbPage>
31+
</BreadcrumbItem>
32+
</BreadcrumbList>
33+
</Breadcrumb>
34+
);
35+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { graphql } from '@/graphql/gql';
2+
3+
export const addressQuery = graphql(`
4+
query Address($address: ID!) {
5+
account(id: $address) {
6+
address: id
7+
staked: balance
8+
locked: frozen
9+
score
10+
allApps: apps(first: 1000) {
11+
id
12+
}
13+
allDatasets: datasets(first: 1000) {
14+
id
15+
}
16+
allWorkerpools: workerpools(first: 1000) {
17+
id
18+
}
19+
allContributions: contributions(first: 1000) {
20+
id
21+
}
22+
allDealRequester: dealRequester(first: 1000) {
23+
id
24+
}
25+
allDealBeneficiary: dealBeneficiary(first: 1000) {
26+
id
27+
}
28+
}
29+
}
30+
`);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { AddressQuery } from '@/graphql/graphql';
2+
3+
export function buildAddressDetails({
4+
address,
5+
}: {
6+
address: AddressQuery['account'];
7+
}) {
8+
return {
9+
...(address?.allApps && {
10+
Apps: <p>{address.allApps.length}</p>,
11+
}),
12+
...(address?.allDatasets && {
13+
Datasets: <p>{address.allDatasets.length}</p>,
14+
}),
15+
...(address?.allWorkerpools && {
16+
Workerpools: <p>{address.allWorkerpools.length}</p>,
17+
}),
18+
...(address?.allContributions && {
19+
Contributions: <p>{address.allContributions.length}</p>,
20+
}),
21+
...(address?.score && {
22+
Score: <p>{address.score}</p>,
23+
}),
24+
};
25+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { AddressQuery } from '@/graphql/graphql';
2+
3+
export function buildAddressOverview({
4+
address,
5+
}: {
6+
address: AddressQuery['account'];
7+
}) {
8+
return {
9+
...(address?.address && {
10+
Address: <p>{address.address}</p>,
11+
}),
12+
...(address?.allDatasets && {
13+
Stacked: <p>{address.staked}</p>,
14+
}),
15+
...(address?.allWorkerpools && {
16+
Locked: <p>{address.locked}</p>,
17+
}),
18+
};
19+
}

0 commit comments

Comments
 (0)