Update fees value in config

This commit is contained in:
IshaVenikar 2024-10-18 10:32:35 +05:30
parent 3ab081853e
commit 0415e3b1d4
16 changed files with 64 additions and 63 deletions

View File

@ -41,10 +41,11 @@
fees = ""
gasPrice = "1alnt"
# Durations are set to 2 mins as deployers may take time with ongoing deployments and auctions
[auction]
commitFee = "1000"
commitFee = "100000"
commitsDuration = "120s"
revealFee = "1000"
revealFee = "100000"
revealsDuration = "120s"
denom = "alnt"

View File

@ -14,7 +14,7 @@ import {
ApplicationDeploymentRequest,
ApplicationDeploymentRemovalRequest
} from './entity/Deployment';
import { AppDeploymentRecord, AppDeploymentRemovalRecord, AuctionData } from './types';
import { AppDeploymentRecord, AppDeploymentRemovalRecord, AuctionParams } from './types';
import { getConfig, getRepoDetails, sleep } from './utils';
const log = debug('snowball:registry');
@ -163,7 +163,7 @@ export class Registry {
async createApplicationDeploymentAuction(
appName: string,
octokit: Octokit,
auctionData: AuctionData,
auctionParams: AuctionParams,
data: DeepPartial<Deployment>,
): Promise<{
applicationDeploymentAuctionId: string;
@ -189,8 +189,8 @@ export class Registry {
revealFee: auctionConfig.revealFee,
revealsDuration: auctionConfig.revealsDuration,
denom: auctionConfig.denom,
maxPrice: auctionData.maxPrice,
numProviders: auctionData.numProviders,
maxPrice: auctionParams.maxPrice,
numProviders: auctionParams.numProviders,
},
this.registryConfig.privateKey,
fee

View File

@ -6,7 +6,7 @@ import { Permission } from './entity/ProjectMember';
import { Domain } from './entity/Domain';
import { Project } from './entity/Project';
import { EnvironmentVariable } from './entity/EnvironmentVariable';
import { AddProjectFromTemplateInput, AuctionData } from './types';
import { AddProjectFromTemplateInput, AuctionParams } from './types';
const log = debug('snowball:resolver');
@ -211,8 +211,8 @@ export const createResolvers = async (service: Service): Promise<any> => {
organizationSlug,
data,
lrn,
auctionData
}: { organizationSlug: string; data: AddProjectFromTemplateInput; lrn: string; auctionData: AuctionData },
auctionParams
}: { organizationSlug: string; data: AddProjectFromTemplateInput; lrn: string; auctionParams: AuctionParams },
context: any,
) => {
try {
@ -221,7 +221,7 @@ export const createResolvers = async (service: Service): Promise<any> => {
organizationSlug,
data,
lrn,
auctionData
auctionParams
);
} catch (err) {
log(err);
@ -235,12 +235,12 @@ export const createResolvers = async (service: Service): Promise<any> => {
organizationSlug,
data,
lrn,
auctionData
}: { organizationSlug: string; data: DeepPartial<Project>; lrn: string; auctionData: AuctionData },
auctionParams
}: { organizationSlug: string; data: DeepPartial<Project>; lrn: string; auctionParams: AuctionParams },
context: any,
) => {
try {
return await service.addProject(context.user, organizationSlug, data, lrn, auctionData);
return await service.addProject(context.user, organizationSlug, data, lrn, auctionParams);
} catch (err) {
log(err);
throw err;

View File

@ -230,7 +230,7 @@ type Auction {
bids: [Bid!]!
}
input AuctionData {
input AuctionParams {
maxPrice: String,
numProviders: Int,
}
@ -270,13 +270,13 @@ type Mutation {
organizationSlug: String!
data: AddProjectFromTemplateInput
lrn: String
auctionData: AuctionData
auctionParams: AuctionParams
): Project!
addProject(
organizationSlug: String!
data: AddProjectInput!
lrn: String
auctionData: AuctionData
auctionParams: AuctionParams
): Project!
updateProject(projectId: String!, data: UpdateProjectInput): Boolean!
redeployToProd(deploymentId: String!): Boolean!

View File

@ -19,7 +19,7 @@ import {
AddProjectFromTemplateInput,
AppDeploymentRecord,
AppDeploymentRemovalRecord,
AuctionData,
AuctionParams,
GitPushEventPayload,
} from './types';
import { Role } from './entity/UserOrganization';
@ -793,7 +793,7 @@ export class Service {
organizationSlug: string,
data: AddProjectFromTemplateInput,
lrn?: string,
auctionData?: AuctionData
auctionParams?: AuctionParams
): Promise<Project | undefined> {
try {
const octokit = await this.getOctokit(user.id);
@ -824,7 +824,7 @@ export class Service {
repository: gitRepo.data.full_name,
// TODO: Set selected template
template: 'webapp',
}, lrn, auctionData);
}, lrn, auctionParams);
if (!project || !project.id) {
throw new Error('Failed to create project from template');
@ -842,7 +842,7 @@ export class Service {
organizationSlug: string,
data: DeepPartial<Project>,
lrn?: string,
auctionData?: AuctionData
auctionParams?: AuctionParams
): Promise<Project | undefined> {
const organization = await this.db.getOrganization({
where: {
@ -878,8 +878,8 @@ export class Service {
commitMessage: latestCommit.commit.message,
};
if (auctionData) {
const { applicationDeploymentAuctionId } = await this.laconicRegistry.createApplicationDeploymentAuction(repo, octokit, auctionData!, deploymentData);
if (auctionParams) {
const { applicationDeploymentAuctionId } = await this.laconicRegistry.createApplicationDeploymentAuction(repo, octokit, auctionParams!, deploymentData);
await this.updateProject(project.id, { auctionId: applicationDeploymentAuctionId })
} else {
await this.createDeployment(user.id, octokit, deploymentData, lrn!);

View File

@ -72,7 +72,7 @@ export interface AddProjectFromTemplateInput {
isPrivate: boolean;
}
export interface AuctionData {
export interface AuctionParams {
maxPrice: string,
numProviders: number,
}

View File

@ -2,7 +2,7 @@ import { useCallback, useState } from 'react';
import { useForm, Controller, SubmitHandler } from 'react-hook-form';
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
import { useMediaQuery } from 'usehooks-ts';
import { AuctionData } from 'gql-client';
import { AuctionParams } from 'gql-client';
import {
ArrowRightCircleFilledIcon,
@ -48,12 +48,12 @@ const Configure = () => {
try {
let lrn: string | undefined;
let auctionData: AuctionData | undefined;
let auctionParams: AuctionParams | undefined;
if (data.option === 'LRN') {
lrn = data.lrn;
} else if (data.option === 'Auction') {
auctionData = {
auctionParams = {
numProviders: Number(data.numProviders!),
maxPrice: (data.maxPrice!).toString(),
};
@ -73,7 +73,7 @@ const Configure = () => {
orgSlug,
projectData,
lrn,
auctionData
auctionParams
);
data.option === 'Auction'
@ -94,7 +94,7 @@ const Configure = () => {
template: 'webapp',
},
lrn,
auctionData
auctionParams
);
data.option === 'Auction'

View File

@ -295,7 +295,7 @@ type AuthenticateGitHubResponse = {
type UnauthenticateGitHubResponse = {
unauthenticateGitHub: boolean;
};
type AuctionData = {
type AuctionParams = {
maxPrice: string;
numProviders: number;
};
@ -321,8 +321,8 @@ declare class GQLClient {
updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse>;
removeEnvironmentVariable(environmentVariableId: string): Promise<RemoveEnvironmentVariableResponse>;
updateDeploymentToProd(deploymentId: string): Promise<UpdateDeploymentToProdResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput, lrn?: string, auctionParams?: AuctionParams): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput, lrn?: string, auctionParams?: AuctionParams): Promise<AddProjectResponse>;
updateProject(projectId: string, data: UpdateProjectInput): Promise<UpdateProjectResponse>;
updateDomain(domainId: string, data: UpdateDomainInput): Promise<UpdateDomainResponse>;
redeployToProd(deploymentId: string): Promise<RedeployToProdResponse>;
@ -337,4 +337,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 Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, 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 AuctionParams, AuctionStatus, type AuthenticateGitHubResponse, type Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, 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 };

View File

@ -295,7 +295,7 @@ type AuthenticateGitHubResponse = {
type UnauthenticateGitHubResponse = {
unauthenticateGitHub: boolean;
};
type AuctionData = {
type AuctionParams = {
maxPrice: string;
numProviders: number;
};
@ -321,8 +321,8 @@ declare class GQLClient {
updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse>;
removeEnvironmentVariable(environmentVariableId: string): Promise<RemoveEnvironmentVariableResponse>;
updateDeploymentToProd(deploymentId: string): Promise<UpdateDeploymentToProdResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput, lrn?: string, auctionParams?: AuctionParams): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput, lrn?: string, auctionParams?: AuctionParams): Promise<AddProjectResponse>;
updateProject(projectId: string, data: UpdateProjectInput): Promise<UpdateProjectResponse>;
updateDomain(domainId: string, data: UpdateDomainInput): Promise<UpdateDomainResponse>;
redeployToProd(deploymentId: string): Promise<RedeployToProdResponse>;
@ -337,4 +337,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 Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, 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 AuctionParams, AuctionStatus, type AuthenticateGitHubResponse, type Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, 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 };

View File

@ -378,15 +378,15 @@ var updateDeploymentToProd = import_client2.gql`
}
`;
var addProjectFromTemplate = import_client2.gql`
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: String, $auctionData: AuctionData) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: String, $auctionParams: AuctionParams) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionParams: $auctionParams) {
id
}
}
`;
var addProject = import_client2.gql`
mutation ($organizationSlug: String!, $data: AddProjectInput!, $lrn: String, $auctionData: AuctionData) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
mutation ($organizationSlug: String!, $data: AddProjectInput!, $lrn: String, $auctionParams: Auctionparams) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionParams: $auctionParams) {
id
}
}
@ -627,7 +627,7 @@ var GQLClient = class {
return data;
});
}
addProjectFromTemplate(organizationSlug, data, lrn, auctionData) {
addProjectFromTemplate(organizationSlug, data, lrn, auctionParams) {
return __async(this, null, function* () {
const result = yield this.client.mutate({
mutation: addProjectFromTemplate,
@ -635,13 +635,13 @@ var GQLClient = class {
organizationSlug,
data,
lrn,
auctionData
auctionParams
}
});
return result.data;
});
}
addProject(organizationSlug, data, lrn, auctionData) {
addProject(organizationSlug, data, lrn, auctionParams) {
return __async(this, null, function* () {
const result = yield this.client.mutate({
mutation: addProject,
@ -649,7 +649,7 @@ var GQLClient = class {
organizationSlug,
data,
lrn,
auctionData
auctionParams
}
});
return result.data;

File diff suppressed because one or more lines are too long

View File

@ -350,15 +350,15 @@ var updateDeploymentToProd = gql2`
}
`;
var addProjectFromTemplate = gql2`
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: String, $auctionData: AuctionData) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: String, $auctionParams: AuctionParams) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionParams: $auctionParams) {
id
}
}
`;
var addProject = gql2`
mutation ($organizationSlug: String!, $data: AddProjectInput!, $lrn: String, $auctionData: AuctionData) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
mutation ($organizationSlug: String!, $data: AddProjectInput!, $lrn: String, $auctionParams: Auctionparams) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionParams: $auctionParams) {
id
}
}
@ -599,7 +599,7 @@ var GQLClient = class {
return data;
});
}
addProjectFromTemplate(organizationSlug, data, lrn, auctionData) {
addProjectFromTemplate(organizationSlug, data, lrn, auctionParams) {
return __async(this, null, function* () {
const result = yield this.client.mutate({
mutation: addProjectFromTemplate,
@ -607,13 +607,13 @@ var GQLClient = class {
organizationSlug,
data,
lrn,
auctionData
auctionParams
}
});
return result.data;
});
}
addProject(organizationSlug, data, lrn, auctionData) {
addProject(organizationSlug, data, lrn, auctionParams) {
return __async(this, null, function* () {
const result = yield this.client.mutate({
mutation: addProject,
@ -621,7 +621,7 @@ var GQLClient = class {
organizationSlug,
data,
lrn,
auctionData
auctionParams
}
});
return result.data;

File diff suppressed because one or more lines are too long

View File

@ -232,7 +232,7 @@ export class GQLClient {
organizationSlug: string,
data: types.AddProjectFromTemplateInput,
lrn?: string,
auctionData?: types.AuctionData,
auctionParams?: types.AuctionParams,
): Promise<types.AddProjectFromTemplateResponse> {
const result = await this.client.mutate({
mutation: mutations.addProjectFromTemplate,
@ -240,7 +240,7 @@ export class GQLClient {
organizationSlug,
data,
lrn,
auctionData
auctionParams
},
});
@ -251,7 +251,7 @@ export class GQLClient {
organizationSlug: string,
data: types.AddProjectInput,
lrn?: string,
auctionData?: types.AuctionData,
auctionParams?: types.AuctionParams,
): Promise<types.AddProjectResponse> {
const result = await this.client.mutate({
mutation: mutations.addProject,
@ -259,7 +259,7 @@ export class GQLClient {
organizationSlug,
data,
lrn,
auctionData
auctionParams
},
});

View File

@ -49,16 +49,16 @@ export const updateDeploymentToProd = gql`
`;
export const addProjectFromTemplate = gql`
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: String, $auctionData: AuctionData) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: String, $auctionParams: AuctionParams) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionParams: $auctionParams) {
id
}
}
`;
export const addProject = gql`
mutation ($organizationSlug: String!, $data: AddProjectInput!, $lrn: String, $auctionData: AuctionData) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
mutation ($organizationSlug: String!, $data: AddProjectInput!, $lrn: String, $auctionParams: Auctionparams) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionParams: $auctionParams) {
id
}
}

View File

@ -353,7 +353,7 @@ export type UnauthenticateGitHubResponse = {
unauthenticateGitHub: boolean;
};
export type AuctionData = {
export type AuctionParams = {
maxPrice: string;
numProviders: number;
};