forked from cerc-io/snowballtools-base
Display bids in auction details
This commit is contained in:
1 parent
b63837d432
commit
ed2badebb6
14 files changed
+224
-125
No files matched your search
@@ -377,7 +377,7 @@ export class Registry {
|
||||
return records.filter((record: AppDeploymentRecord) =>
|
||||
deployments.some(
|
||||
(deployment) =>
|
||||
deployment.applicationRecordId === record.attributes.application
|
||||
deployment.applicationDeploymentRequestId === record.attributes.request
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -197,6 +197,18 @@ type Fee {
|
||||
quantity: String!
|
||||
}
|
||||
|
||||
type Bid {
|
||||
auctionId: String!
|
||||
bidderAddress: String!
|
||||
status: String!
|
||||
commitHash: String!
|
||||
commitTime: String
|
||||
commitFee: Fee
|
||||
revealTime: String
|
||||
revealFee: Fee
|
||||
bidAmount: Fee
|
||||
}
|
||||
|
||||
type Auction {
|
||||
id: String!
|
||||
kind: String!
|
||||
@@ -209,11 +221,12 @@ type Auction {
|
||||
revealFee: Fee!
|
||||
minimumBid: Fee
|
||||
winnerAddresses: [String!]!
|
||||
winningBids: [String!]
|
||||
winningPrice: String
|
||||
maxPrice: String
|
||||
winnerBids: [Fee!]
|
||||
winnerPrice: Fee
|
||||
maxPrice: Fee
|
||||
numProviders: Int!
|
||||
fundsReleased: Boolean!
|
||||
bids: [Bid!]!
|
||||
}
|
||||
|
||||
input AuctionData {
|
||||
|
||||
@@ -165,7 +165,7 @@ export class Service {
|
||||
async updateDeploymentsWithRecordData(
|
||||
records: AppDeploymentRecord[],
|
||||
): Promise<void> {
|
||||
// Get deployments for ApplicationDeploymentRecords
|
||||
// Deployments that are completed, not updated(are in building state and ApplicationDeploymentRecord is present)
|
||||
const deployments = await this.db.getDeployments({
|
||||
where: records.map((record) => ({
|
||||
applicationRecordId: record.attributes.application,
|
||||
@@ -174,13 +174,9 @@ export class Service {
|
||||
createdAt: 'DESC',
|
||||
},
|
||||
});
|
||||
const requestRecordIds = new Set(records.map((record) => record.attributes.request).filter(Boolean));
|
||||
const filteredDeployments = deployments.filter((deployment) =>
|
||||
deployment.applicationDeploymentRequestId && requestRecordIds.has(deployment.applicationDeploymentRequestId)
|
||||
);
|
||||
|
||||
// Get project IDs of deployments that are in production environment
|
||||
const productionDeploymentProjectIds = filteredDeployments.reduce(
|
||||
const productionDeploymentProjectIds = deployments.reduce(
|
||||
(acc, deployment): Set<string> => {
|
||||
if (deployment.environment === Environment.Production) {
|
||||
acc.add(deployment.projectId);
|
||||
@@ -209,6 +205,10 @@ export class Service {
|
||||
const deploymentUpdatePromises = records.map(async (record) => {
|
||||
const deployment = recordToDeploymentsMap[record.attributes.request];
|
||||
|
||||
if(!deployment) {
|
||||
log('Deployment does not exist')
|
||||
}
|
||||
|
||||
await this.db.updateDeploymentById(deployment.id, {
|
||||
applicationDeploymentRecordId: record.id,
|
||||
applicationDeploymentRecordData: record.attributes,
|
||||
|
||||
@@ -82,11 +82,12 @@ export interface Auction {
|
||||
revealFee?: string;
|
||||
minimumBid?: string;
|
||||
winnerAddresses: string[];
|
||||
winningBids: string[];
|
||||
winningPrice?: string;
|
||||
winnerBids?: string[];
|
||||
winnerPrice?: string;
|
||||
maxPrice?: string;
|
||||
numProviders: number;
|
||||
fundsReleased: boolean;
|
||||
bids: string[];
|
||||
}
|
||||
|
||||
export interface AuctionData {
|
||||
|
||||
+56
-92
@@ -2,10 +2,6 @@ import { useCallback, useEffect, useState } from 'react';
|
||||
import { Auction, Project } from 'gql-client';
|
||||
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
Typography,
|
||||
Dialog,
|
||||
DialogTitle,
|
||||
DialogContent,
|
||||
@@ -14,125 +10,93 @@ import {
|
||||
|
||||
import { CheckRoundFilledIcon, LoadingIcon } from 'components/shared/CustomIcon';
|
||||
import { useGQLClient } from 'context/GQLClientContext';
|
||||
import { Button, Tag } from 'components/shared';
|
||||
import { Button, Heading, Tag } from 'components/shared';
|
||||
|
||||
const CHECK_AUCTION_STATUS_INTERVAL = 2000;
|
||||
|
||||
export const AuctionCard = ({
|
||||
project,
|
||||
}: {
|
||||
project: Project;
|
||||
}) => {
|
||||
export const AuctionCard = ({ project }: { project: Project }) => {
|
||||
const [auctionStatus, setAuctionStatus] = useState<string>('');
|
||||
const [deployerLrns, setDeployerLrns] = useState<string[]>([]);
|
||||
const [auctionDetails, setAuctionDetails] = useState<Auction | null>(null);
|
||||
const [openDialog, setOpenDialog] = useState<boolean>(false);
|
||||
const client = useGQLClient();
|
||||
|
||||
const getIconByAuctionStatus = (status: string) => {
|
||||
return status === 'completed' ? (
|
||||
<CheckRoundFilledIcon />
|
||||
) : (
|
||||
<LoadingIcon className="animate-spin" />
|
||||
);
|
||||
};
|
||||
const getIconByAuctionStatus = (status: string) =>
|
||||
status === 'completed' ? <CheckRoundFilledIcon /> : <LoadingIcon className="animate-spin" />;
|
||||
|
||||
const checkAuctionStatus = async () => {
|
||||
const checkAuctionStatus = useCallback(async () => {
|
||||
const result = await client.getAuctionData(project.auctionId);
|
||||
setAuctionStatus(result.status);
|
||||
setAuctionDetails(result);
|
||||
};
|
||||
setDeployerLrns(project.deployerLrn);
|
||||
}, [client, project.auctionId, project.deployerLrn]);
|
||||
|
||||
useEffect(() => {
|
||||
let intervalId: NodeJS.Timeout | null = null;
|
||||
|
||||
if (auctionStatus !== 'completed') {
|
||||
const intervalId = setInterval(checkAuctionStatus, CHECK_AUCTION_STATUS_INTERVAL);
|
||||
checkAuctionStatus();
|
||||
intervalId = setInterval(checkAuctionStatus, CHECK_AUCTION_STATUS_INTERVAL);
|
||||
} else {
|
||||
setDeployerLrns(project.deployerLrn)
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (intervalId) {
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
};
|
||||
}, [auctionStatus]);
|
||||
return () => clearInterval(intervalId);
|
||||
}
|
||||
}, [auctionStatus, checkAuctionStatus]);
|
||||
|
||||
const renderAuctionStatus = useCallback(
|
||||
() => (
|
||||
<Tag
|
||||
leftIcon={getIconByAuctionStatus(auctionStatus)}
|
||||
size="xs"
|
||||
type={auctionStatus === 'completed' ? "positive" : "neutral"}
|
||||
>
|
||||
<Tag leftIcon={getIconByAuctionStatus(auctionStatus)} size="xs" type={auctionStatus === 'completed' ? 'positive' : 'emphasized'}>
|
||||
{auctionStatus.toUpperCase()}
|
||||
</Tag>
|
||||
),
|
||||
[auctionStatus],
|
||||
[auctionStatus]
|
||||
);
|
||||
|
||||
const handleOpenDialog = () => {
|
||||
setOpenDialog(true);
|
||||
};
|
||||
|
||||
const handleCloseDialog = () => {
|
||||
setOpenDialog(false);
|
||||
};
|
||||
const handleOpenDialog = () => setOpenDialog(true);
|
||||
const handleCloseDialog = () => setOpenDialog(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card variant="outlined" className="my-4">
|
||||
<CardHeader
|
||||
title="Auction Details"
|
||||
titleTypographyProps={{ variant: 'h6' }}
|
||||
action={
|
||||
<Button onClick={handleOpenDialog} variant="tertiary" size="sm">
|
||||
View details
|
||||
</Button>
|
||||
}
|
||||
sx={{ pb: 0.1 }}
|
||||
/>
|
||||
<CardContent>
|
||||
<div className="flex justify-between items-center mt-1">
|
||||
<Typography variant="subtitle1">Auction Status</Typography>
|
||||
<div className="ml-2">{renderAuctionStatus()}</div>
|
||||
</div>
|
||||
<div className="p-3 gap-2 rounded-xl border border-gray-200 transition-colors hover:bg-base-bg-alternate flex flex-col mt-8">
|
||||
<div className="flex justify-between items-center">
|
||||
<Heading className="text-lg leading-6 font-medium">Auction details</Heading>
|
||||
<Button onClick={handleOpenDialog} variant="tertiary" size="sm">
|
||||
View details
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-between items-center mt-2">
|
||||
<Typography variant="subtitle1">Auction Id</Typography>
|
||||
<Typography variant="body2" className="mt-1 text-right">
|
||||
{project.auctionId}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="flex justify-between items-center mt-1">
|
||||
<span className="text-elements-high-em text-sm font-medium tracking-tight">Auction Status</span>
|
||||
<div className="ml-2">{renderAuctionStatus()}</div>
|
||||
</div>
|
||||
|
||||
<Typography variant="subtitle1" className="mt-3">
|
||||
Deployer LRNs
|
||||
</Typography>
|
||||
<div>
|
||||
{deployerLrns.map((lrn, index) => (
|
||||
<Typography key={index} variant="body2" className="text-elements">
|
||||
{'\u2022'} {lrn}
|
||||
</Typography>
|
||||
))}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<div className="flex justify-between items-center mt-2">
|
||||
<span className="text-elements-high-em text-sm font-medium tracking-tight">Auction Id</span>
|
||||
<span className="text-elements-mid-em text-sm text-right">
|
||||
{project.auctionId}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<Dialog open={openDialog} onClose={handleCloseDialog} maxWidth="lg" fullWidth>
|
||||
<DialogTitle>Auction Details</DialogTitle>
|
||||
<DialogContent>
|
||||
{auctionDetails && (
|
||||
<Typography variant="body1">
|
||||
<pre>{JSON.stringify(auctionDetails, null, 2)}</pre>
|
||||
</Typography>
|
||||
)}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={handleCloseDialog}>Close</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</>
|
||||
{project.deployerLrn && (
|
||||
<div className="mt-3">
|
||||
<span className="text-elements-high-em text-sm font-medium tracking-tight">Deployer LRNs</span>
|
||||
{deployerLrns.map((lrn, index) => (
|
||||
<p key={index} className="text-elements-mid-em text-sm">
|
||||
{'\u2022'} {lrn}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Dialog open={openDialog} onClose={handleCloseDialog} fullWidth maxWidth="md">
|
||||
<DialogTitle>Auction Details</DialogTitle>
|
||||
<DialogContent>
|
||||
{auctionDetails && (
|
||||
<pre>{JSON.stringify(auctionDetails, null, 2)}</pre>
|
||||
)}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={handleCloseDialog}>Close</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -60,8 +60,8 @@ const DeleteProjectDialog = ({
|
||||
<Modal.Body>
|
||||
<Input
|
||||
label={
|
||||
"Deleting your project is irreversible. Enter your project's name " +
|
||||
project.name +
|
||||
"Deleting your project is irreversible. Enter your project's name " + '"' +
|
||||
project.name + '"' +
|
||||
' below to confirm you want to permanently delete it:'
|
||||
}
|
||||
id="input"
|
||||
|
||||
Vendored
+15
-3
@@ -28,6 +28,17 @@ type Fee = {
|
||||
type: string;
|
||||
quantity: string;
|
||||
};
|
||||
type Bid = {
|
||||
auctionId: string;
|
||||
bidderAddress: string;
|
||||
status: string;
|
||||
commitHash: string;
|
||||
commitTime?: Date;
|
||||
commitFee?: string;
|
||||
revealTime?: Date;
|
||||
revealFee?: string;
|
||||
bidAmount?: string;
|
||||
};
|
||||
type Auction = {
|
||||
id: string;
|
||||
kind: string;
|
||||
@@ -40,11 +51,12 @@ type Auction = {
|
||||
revealFee?: string;
|
||||
minimumBid?: string;
|
||||
winnerAddresses: string[];
|
||||
winningBids?: string[];
|
||||
winningPrice?: string;
|
||||
winnerBids?: string[];
|
||||
winnerPrice?: string;
|
||||
maxPrice?: string;
|
||||
numProviders: number;
|
||||
fundsReleased: boolean;
|
||||
bids: Bid[];
|
||||
};
|
||||
declare enum DomainStatus {
|
||||
Live = "Live",
|
||||
@@ -328,4 +340,4 @@ declare class GQLClient {
|
||||
getAuctionData(auctionId: string): Promise<Auction>;
|
||||
}
|
||||
|
||||
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type Auction, type AuctionData, AuctionStatus, type AuthenticateGitHubResponse, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type Fee, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User };
|
||||
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type Auction, type AuctionData, AuctionStatus, type AuthenticateGitHubResponse, type Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type Fee, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User };
|
||||
Vendored
+15
-3
@@ -28,6 +28,17 @@ type Fee = {
|
||||
type: string;
|
||||
quantity: string;
|
||||
};
|
||||
type Bid = {
|
||||
auctionId: string;
|
||||
bidderAddress: string;
|
||||
status: string;
|
||||
commitHash: string;
|
||||
commitTime?: Date;
|
||||
commitFee?: string;
|
||||
revealTime?: Date;
|
||||
revealFee?: string;
|
||||
bidAmount?: string;
|
||||
};
|
||||
type Auction = {
|
||||
id: string;
|
||||
kind: string;
|
||||
@@ -40,11 +51,12 @@ type Auction = {
|
||||
revealFee?: string;
|
||||
minimumBid?: string;
|
||||
winnerAddresses: string[];
|
||||
winningBids?: string[];
|
||||
winningPrice?: string;
|
||||
winnerBids?: string[];
|
||||
winnerPrice?: string;
|
||||
maxPrice?: string;
|
||||
numProviders: number;
|
||||
fundsReleased: boolean;
|
||||
bids: Bid[];
|
||||
};
|
||||
declare enum DomainStatus {
|
||||
Live = "Live",
|
||||
@@ -328,4 +340,4 @@ declare class GQLClient {
|
||||
getAuctionData(auctionId: string): Promise<Auction>;
|
||||
}
|
||||
|
||||
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type Auction, type AuctionData, AuctionStatus, type AuthenticateGitHubResponse, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type Fee, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User };
|
||||
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type Auction, type AuctionData, AuctionStatus, type AuthenticateGitHubResponse, type Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type Fee, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User };
|
||||
Vendored
+31
-3
@@ -294,11 +294,39 @@ query ($auctionId: String!) {
|
||||
quantity
|
||||
}
|
||||
winnerAddresses
|
||||
winningBids
|
||||
winningPrice
|
||||
maxPrice
|
||||
winnerBids {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
winnerPrice {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
maxPrice {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
numProviders
|
||||
fundsReleased
|
||||
bids {
|
||||
bidderAddress
|
||||
status
|
||||
commitHash
|
||||
commitTime
|
||||
revealTime
|
||||
commitFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
revealFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
bidAmount {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/queries.ts","../src/mutations.ts","../src/types.ts"],"sourcesContent":["export * from \"./client\";\nexport * from \"./types\";\n","import {\n ApolloClient,\n DefaultOptions,\n InMemoryCache,\n NormalizedCacheObject,\n} from \"@apollo/client\";\n\nimport * as queries from \"./queries\";\nimport * as types from \"./types\";\nimport * as mutations from \"./mutations\";\n\nexport interface GraphQLConfig {\n gqlEndpoint: string;\n}\n\n// TODO: check options\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"ignore\",\n },\n query: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"all\",\n },\n};\n\nexport class GQLClient {\n private client: ApolloClient<NormalizedCacheObject>;\n\n constructor(config: GraphQLConfig) {\n this.client = new ApolloClient({\n uri: config.gqlEndpoint,\n cache: new InMemoryCache(),\n defaultOptions,\n credentials: \"include\",\n });\n }\n\n async getUser(): Promise<types.GetUserResponse> {\n const { data } = await this.client.query({\n query: queries.getUser,\n });\n\n return data;\n }\n\n async getProject(projectId: string): Promise<types.GetProjectResponse> {\n const { data } = await this.client.query({\n query: queries.getProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectsInOrganization(\n organizationSlug: string\n ): Promise<types.GetProjectsInOrganizationResponse> {\n const { data } = await this.client.query({\n query: queries.getProjectsInOrganization,\n variables: {\n organizationSlug,\n },\n });\n\n return data;\n }\n\n async getOrganizations(): Promise<types.GetOrganizationsResponse> {\n const { data } = await this.client.query({\n query: queries.getOrganizations,\n });\n\n return data;\n }\n\n async getDeployments(\n projectId: string\n ): Promise<types.GetDeploymentsResponse> {\n const { data } = await this.client.query({\n query: queries.getDeployments,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getEnvironmentVariables(\n projectId: string\n ): Promise<types.GetEnvironmentVariablesResponse> {\n const { data } = await this.client.query({\n query: queries.getEnvironmentVariables,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectMembers(\n projectId: string\n ): Promise<types.GetProjectMembersResponse> {\n const result = await this.client.query({\n query: queries.getProjectMembers,\n variables: {\n projectId,\n },\n });\n\n return result.data;\n }\n\n async addProjectMember(\n projectId: string,\n data: types.AddProjectMemberInput\n ): Promise<types.AddProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.addProjectMember,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProjectMember(\n projectMemberId: string,\n data: types.UpdateProjectMemberInput\n ): Promise<types.UpdateProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMember,\n variables: {\n projectMemberId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeProjectMember(\n projectMemberId: string\n ): Promise<types.RemoveProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.removeProjectMember,\n variables: {\n projectMemberId,\n },\n });\n\n return result.data;\n }\n\n async searchProjects(\n searchText: string\n ): Promise<types.SearchProjectsResponse> {\n const { data } = await this.client.query({\n query: queries.searchProjects,\n variables: {\n searchText,\n },\n });\n\n return data;\n }\n\n async addEnvironmentVariables(\n projectId: string,\n data: types.AddEnvironmentVariableInput[]\n ): Promise<types.AddEnvironmentVariablesResponse> {\n const result = await this.client.mutate({\n mutation: mutations.addEnvironmentVariables,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateEnvironmentVariable(\n environmentVariableId: string,\n data: types.UpdateEnvironmentVariableInput\n ): Promise<types.UpdateEnvironmentVariableResponse> {\n const result = await this.client.mutate({\n mutation: mutations.updateEnvironmentVariable,\n variables: {\n environmentVariableId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeEnvironmentVariable(\n environmentVariableId: string\n ): Promise<types.RemoveEnvironmentVariableResponse> {\n const { data } = await thisLine truncated
|
||||
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/queries.ts","../src/mutations.ts","../src/types.ts"],"sourcesContent":["export * from \"./client\";\nexport * from \"./types\";\n","import {\n ApolloClient,\n DefaultOptions,\n InMemoryCache,\n NormalizedCacheObject,\n} from \"@apollo/client\";\n\nimport * as queries from \"./queries\";\nimport * as types from \"./types\";\nimport * as mutations from \"./mutations\";\n\nexport interface GraphQLConfig {\n gqlEndpoint: string;\n}\n\n// TODO: check options\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"ignore\",\n },\n query: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"all\",\n },\n};\n\nexport class GQLClient {\n private client: ApolloClient<NormalizedCacheObject>;\n\n constructor(config: GraphQLConfig) {\n this.client = new ApolloClient({\n uri: config.gqlEndpoint,\n cache: new InMemoryCache(),\n defaultOptions,\n credentials: \"include\",\n });\n }\n\n async getUser(): Promise<types.GetUserResponse> {\n const { data } = await this.client.query({\n query: queries.getUser,\n });\n\n return data;\n }\n\n async getProject(projectId: string): Promise<types.GetProjectResponse> {\n const { data } = await this.client.query({\n query: queries.getProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectsInOrganization(\n organizationSlug: string\n ): Promise<types.GetProjectsInOrganizationResponse> {\n const { data } = await this.client.query({\n query: queries.getProjectsInOrganization,\n variables: {\n organizationSlug,\n },\n });\n\n return data;\n }\n\n async getOrganizations(): Promise<types.GetOrganizationsResponse> {\n const { data } = await this.client.query({\n query: queries.getOrganizations,\n });\n\n return data;\n }\n\n async getDeployments(\n projectId: string\n ): Promise<types.GetDeploymentsResponse> {\n const { data } = await this.client.query({\n query: queries.getDeployments,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getEnvironmentVariables(\n projectId: string\n ): Promise<types.GetEnvironmentVariablesResponse> {\n const { data } = await this.client.query({\n query: queries.getEnvironmentVariables,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectMembers(\n projectId: string\n ): Promise<types.GetProjectMembersResponse> {\n const result = await this.client.query({\n query: queries.getProjectMembers,\n variables: {\n projectId,\n },\n });\n\n return result.data;\n }\n\n async addProjectMember(\n projectId: string,\n data: types.AddProjectMemberInput\n ): Promise<types.AddProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.addProjectMember,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProjectMember(\n projectMemberId: string,\n data: types.UpdateProjectMemberInput\n ): Promise<types.UpdateProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMember,\n variables: {\n projectMemberId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeProjectMember(\n projectMemberId: string\n ): Promise<types.RemoveProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.removeProjectMember,\n variables: {\n projectMemberId,\n },\n });\n\n return result.data;\n }\n\n async searchProjects(\n searchText: string\n ): Promise<types.SearchProjectsResponse> {\n const { data } = await this.client.query({\n query: queries.searchProjects,\n variables: {\n searchText,\n },\n });\n\n return data;\n }\n\n async addEnvironmentVariables(\n projectId: string,\n data: types.AddEnvironmentVariableInput[]\n ): Promise<types.AddEnvironmentVariablesResponse> {\n const result = await this.client.mutate({\n mutation: mutations.addEnvironmentVariables,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateEnvironmentVariable(\n environmentVariableId: string,\n data: types.UpdateEnvironmentVariableInput\n ): Promise<types.UpdateEnvironmentVariableResponse> {\n const result = await this.client.mutate({\n mutation: mutations.updateEnvironmentVariable,\n variables: {\n environmentVariableId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeEnvironmentVariable(\n environmentVariableId: string\n ): Promise<types.RemoveEnvironmentVariableResponse> {\n const { data } = await thisLine truncated
|
||||
Vendored
+31
-3
@@ -266,11 +266,39 @@ query ($auctionId: String!) {
|
||||
quantity
|
||||
}
|
||||
winnerAddresses
|
||||
winningBids
|
||||
winningPrice
|
||||
maxPrice
|
||||
winnerBids {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
winnerPrice {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
maxPrice {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
numProviders
|
||||
fundsReleased
|
||||
bids {
|
||||
bidderAddress
|
||||
status
|
||||
commitHash
|
||||
commitTime
|
||||
revealTime
|
||||
commitFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
revealFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
bidAmount {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/client.ts","../src/queries.ts","../src/mutations.ts","../src/types.ts"],"sourcesContent":["import {\n ApolloClient,\n DefaultOptions,\n InMemoryCache,\n NormalizedCacheObject,\n} from \"@apollo/client\";\n\nimport * as queries from \"./queries\";\nimport * as types from \"./types\";\nimport * as mutations from \"./mutations\";\n\nexport interface GraphQLConfig {\n gqlEndpoint: string;\n}\n\n// TODO: check options\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"ignore\",\n },\n query: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"all\",\n },\n};\n\nexport class GQLClient {\n private client: ApolloClient<NormalizedCacheObject>;\n\n constructor(config: GraphQLConfig) {\n this.client = new ApolloClient({\n uri: config.gqlEndpoint,\n cache: new InMemoryCache(),\n defaultOptions,\n credentials: \"include\",\n });\n }\n\n async getUser(): Promise<types.GetUserResponse> {\n const { data } = await this.client.query({\n query: queries.getUser,\n });\n\n return data;\n }\n\n async getProject(projectId: string): Promise<types.GetProjectResponse> {\n const { data } = await this.client.query({\n query: queries.getProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectsInOrganization(\n organizationSlug: string\n ): Promise<types.GetProjectsInOrganizationResponse> {\n const { data } = await this.client.query({\n query: queries.getProjectsInOrganization,\n variables: {\n organizationSlug,\n },\n });\n\n return data;\n }\n\n async getOrganizations(): Promise<types.GetOrganizationsResponse> {\n const { data } = await this.client.query({\n query: queries.getOrganizations,\n });\n\n return data;\n }\n\n async getDeployments(\n projectId: string\n ): Promise<types.GetDeploymentsResponse> {\n const { data } = await this.client.query({\n query: queries.getDeployments,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getEnvironmentVariables(\n projectId: string\n ): Promise<types.GetEnvironmentVariablesResponse> {\n const { data } = await this.client.query({\n query: queries.getEnvironmentVariables,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectMembers(\n projectId: string\n ): Promise<types.GetProjectMembersResponse> {\n const result = await this.client.query({\n query: queries.getProjectMembers,\n variables: {\n projectId,\n },\n });\n\n return result.data;\n }\n\n async addProjectMember(\n projectId: string,\n data: types.AddProjectMemberInput\n ): Promise<types.AddProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.addProjectMember,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProjectMember(\n projectMemberId: string,\n data: types.UpdateProjectMemberInput\n ): Promise<types.UpdateProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMember,\n variables: {\n projectMemberId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeProjectMember(\n projectMemberId: string\n ): Promise<types.RemoveProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.removeProjectMember,\n variables: {\n projectMemberId,\n },\n });\n\n return result.data;\n }\n\n async searchProjects(\n searchText: string\n ): Promise<types.SearchProjectsResponse> {\n const { data } = await this.client.query({\n query: queries.searchProjects,\n variables: {\n searchText,\n },\n });\n\n return data;\n }\n\n async addEnvironmentVariables(\n projectId: string,\n data: types.AddEnvironmentVariableInput[]\n ): Promise<types.AddEnvironmentVariablesResponse> {\n const result = await this.client.mutate({\n mutation: mutations.addEnvironmentVariables,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateEnvironmentVariable(\n environmentVariableId: string,\n data: types.UpdateEnvironmentVariableInput\n ): Promise<types.UpdateEnvironmentVariableResponse> {\n const result = await this.client.mutate({\n mutation: mutations.updateEnvironmentVariable,\n variables: {\n environmentVariableId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeEnvironmentVariable(\n environmentVariableId: string\n ): Promise<types.RemoveEnvironmentVariableResponse> {\n const { data } = await this.client.mutate({\n mutation: mutations.removeEnvironmentVariable,\n Line truncated
|
||||
{"version":3,"sources":["../src/client.ts","../src/queries.ts","../src/mutations.ts","../src/types.ts"],"sourcesContent":["import {\n ApolloClient,\n DefaultOptions,\n InMemoryCache,\n NormalizedCacheObject,\n} from \"@apollo/client\";\n\nimport * as queries from \"./queries\";\nimport * as types from \"./types\";\nimport * as mutations from \"./mutations\";\n\nexport interface GraphQLConfig {\n gqlEndpoint: string;\n}\n\n// TODO: check options\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"ignore\",\n },\n query: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"all\",\n },\n};\n\nexport class GQLClient {\n private client: ApolloClient<NormalizedCacheObject>;\n\n constructor(config: GraphQLConfig) {\n this.client = new ApolloClient({\n uri: config.gqlEndpoint,\n cache: new InMemoryCache(),\n defaultOptions,\n credentials: \"include\",\n });\n }\n\n async getUser(): Promise<types.GetUserResponse> {\n const { data } = await this.client.query({\n query: queries.getUser,\n });\n\n return data;\n }\n\n async getProject(projectId: string): Promise<types.GetProjectResponse> {\n const { data } = await this.client.query({\n query: queries.getProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectsInOrganization(\n organizationSlug: string\n ): Promise<types.GetProjectsInOrganizationResponse> {\n const { data } = await this.client.query({\n query: queries.getProjectsInOrganization,\n variables: {\n organizationSlug,\n },\n });\n\n return data;\n }\n\n async getOrganizations(): Promise<types.GetOrganizationsResponse> {\n const { data } = await this.client.query({\n query: queries.getOrganizations,\n });\n\n return data;\n }\n\n async getDeployments(\n projectId: string\n ): Promise<types.GetDeploymentsResponse> {\n const { data } = await this.client.query({\n query: queries.getDeployments,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getEnvironmentVariables(\n projectId: string\n ): Promise<types.GetEnvironmentVariablesResponse> {\n const { data } = await this.client.query({\n query: queries.getEnvironmentVariables,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectMembers(\n projectId: string\n ): Promise<types.GetProjectMembersResponse> {\n const result = await this.client.query({\n query: queries.getProjectMembers,\n variables: {\n projectId,\n },\n });\n\n return result.data;\n }\n\n async addProjectMember(\n projectId: string,\n data: types.AddProjectMemberInput\n ): Promise<types.AddProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.addProjectMember,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProjectMember(\n projectMemberId: string,\n data: types.UpdateProjectMemberInput\n ): Promise<types.UpdateProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMember,\n variables: {\n projectMemberId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeProjectMember(\n projectMemberId: string\n ): Promise<types.RemoveProjectMemberResponse> {\n const result = await this.client.mutate({\n mutation: mutations.removeProjectMember,\n variables: {\n projectMemberId,\n },\n });\n\n return result.data;\n }\n\n async searchProjects(\n searchText: string\n ): Promise<types.SearchProjectsResponse> {\n const { data } = await this.client.query({\n query: queries.searchProjects,\n variables: {\n searchText,\n },\n });\n\n return data;\n }\n\n async addEnvironmentVariables(\n projectId: string,\n data: types.AddEnvironmentVariableInput[]\n ): Promise<types.AddEnvironmentVariablesResponse> {\n const result = await this.client.mutate({\n mutation: mutations.addEnvironmentVariables,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateEnvironmentVariable(\n environmentVariableId: string,\n data: types.UpdateEnvironmentVariableInput\n ): Promise<types.UpdateEnvironmentVariableResponse> {\n const result = await this.client.mutate({\n mutation: mutations.updateEnvironmentVariable,\n variables: {\n environmentVariableId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeEnvironmentVariable(\n environmentVariableId: string\n ): Promise<types.RemoveEnvironmentVariableResponse> {\n const { data } = await this.client.mutate({\n mutation: mutations.removeEnvironmentVariable,\n Line truncated
|
||||
@@ -248,11 +248,39 @@ query ($auctionId: String!) {
|
||||
quantity
|
||||
}
|
||||
winnerAddresses
|
||||
winningBids
|
||||
winningPrice
|
||||
maxPrice
|
||||
winnerBids {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
winnerPrice {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
maxPrice {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
numProviders
|
||||
fundsReleased
|
||||
bids {
|
||||
bidderAddress
|
||||
status
|
||||
commitHash
|
||||
commitTime
|
||||
revealTime
|
||||
commitFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
revealFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
bidAmount {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -37,6 +37,18 @@ export type Fee = {
|
||||
quantity: string;
|
||||
}
|
||||
|
||||
export type Bid = {
|
||||
auctionId: string;
|
||||
bidderAddress: string;
|
||||
status: string;
|
||||
commitHash: string;
|
||||
commitTime?: Date;
|
||||
commitFee?: string;
|
||||
revealTime?: Date;
|
||||
revealFee?: string;
|
||||
bidAmount?: string;
|
||||
}
|
||||
|
||||
export type Auction = {
|
||||
id: string;
|
||||
kind: string;
|
||||
@@ -49,11 +61,12 @@ export type Auction = {
|
||||
revealFee?: string;
|
||||
minimumBid?: string;
|
||||
winnerAddresses: string[];
|
||||
winningBids?: string[];
|
||||
winningPrice?: string;
|
||||
winnerBids?: string[];
|
||||
winnerPrice?: string;
|
||||
maxPrice?: string;
|
||||
numProviders: number;
|
||||
fundsReleased: boolean;
|
||||
bids: Bid[];
|
||||
}
|
||||
|
||||
export enum DomainStatus {
|
||||
|
||||
Reference in new issue
Block a user