Implement payments for app deployments #17

Merged
nabarun merged 27 commits from iv-integrate-payments into main 2024-10-28 09:46:19 +00:00
6 changed files with 35 additions and 0 deletions
Showing only changes of commit bae0d1323a - Show all commits

View File

@ -66,6 +66,12 @@ export class Project {
@Column('varchar', { nullable: true }) @Column('varchar', { nullable: true })
framework!: string | null; framework!: string | null;
@Column('varchar')
paymentAddress!: string;
@Column('varchar')
txHash!: string;
@Column({ @Column({
type: 'simple-array' type: 'simple-array'
}) })

View File

@ -77,6 +77,8 @@ type Project {
fundsReleased: Boolean fundsReleased: Boolean
template: String template: String
framework: String framework: String
paymentAddress: String!
txHash: String!
webhooks: [String!] webhooks: [String!]
members: [ProjectMember!] members: [ProjectMember!]
environmentVariables: [EnvironmentVariable!] environmentVariables: [EnvironmentVariable!]

View File

@ -66,6 +66,8 @@ const Configure = () => {
const createProject = async ( const createProject = async (
data: FieldValues, data: FieldValues,
envVariables: AddEnvironmentVariableInput[], envVariables: AddEnvironmentVariableInput[],
senderAddress: string,
txHash: string
): Promise<string> => { ): Promise<string> => {
setIsLoading(true); setIsLoading(true);
let projectId: string | null = null; let projectId: string | null = null;
@ -90,6 +92,8 @@ const Configure = () => {
owner, owner,
name, name,
isPrivate, isPrivate,
paymentAddress: senderAddress,
txHash
}; };
const { addProjectFromTemplate } = await client.addProjectFromTemplate( const { addProjectFromTemplate } = await client.addProjectFromTemplate(
@ -109,6 +113,8 @@ const Configure = () => {
prodBranch: defaultBranch!, prodBranch: defaultBranch!,
repository: fullName!, repository: fullName!,
template: 'webapp', template: 'webapp',
paymentAddress: senderAddress,
txHash
}, },
lrn, lrn,
auctionParams, auctionParams,
@ -138,6 +144,11 @@ const Configure = () => {
const handleFormSubmit = useCallback( const handleFormSubmit = useCallback(
async (createFormData: FieldValues) => { async (createFormData: FieldValues) => {
// Send tx request to wallet -> amount = createFormData.maxPrice * createFormData.numProviders
// Get address of sender account(from wallet connect session) and txHash(result.signature)
const senderAddress = 'address';
const txHash = 'txHash';
const environmentVariables = createFormData.variables.map( const environmentVariables = createFormData.variables.map(
(variable: any) => { (variable: any) => {
return { return {
@ -153,6 +164,8 @@ const Configure = () => {
const projectId = await createProject( const projectId = await createProject(
createFormData, createFormData,
environmentVariables, environmentVariables,
senderAddress,
txHash
); );
await client.getEnvironmentVariables(projectId); await client.getEnvironmentVariables(projectId);

View File

@ -134,6 +134,8 @@ export const project: Project = {
deployerLrn: 'lrn://deployer.apps.snowballtools.com ', deployerLrn: 'lrn://deployer.apps.snowballtools.com ',
}, },
], ],
paymentAddress: '0x657868687686rb4787987br8497298r79284797487',
txHash: '74btygeuydguygf838gcergurcbhuedbcjhu',
webhooks: ['beepboop'], webhooks: ['beepboop'],
icon: 'Icon', icon: 'Icon',
fundsReleased: true, fundsReleased: true,

View File

@ -29,6 +29,8 @@ query ($projectId: String!) {
deployerId deployerId
deployerApiUrl deployerApiUrl
} }
paymentAddress
txHash
fundsReleased fundsReleased
framework framework
repository repository
@ -85,6 +87,8 @@ query ($organizationSlug: String!) {
deployerId deployerId
deployerApiUrl deployerApiUrl
} }
paymentAddress
txHash
fundsReleased fundsReleased
prodBranch prodBranch
webhooks webhooks
@ -212,6 +216,8 @@ query ($searchText: String!) {
deployerId deployerId
deployerApiUrl deployerApiUrl
} }
paymentAddress
txHash
fundsReleased fundsReleased
prodBranch prodBranch
webhooks webhooks

View File

@ -177,6 +177,8 @@ export type Project = {
framework: string; framework: string;
deployers: [Deployer] deployers: [Deployer]
auctionId: string; auctionId: string;
paymentAddress: string;
txHash: string;
fundsReleased: boolean; fundsReleased: boolean;
webhooks: string[]; webhooks: string[];
members: ProjectMember[]; members: ProjectMember[];
@ -306,6 +308,8 @@ export type AddProjectFromTemplateInput = {
owner: string; owner: string;
name: string; name: string;
isPrivate: boolean; isPrivate: boolean;
paymentAddress: string;
txHash: string;
}; };
export type AddProjectInput = { export type AddProjectInput = {
@ -313,6 +317,8 @@ export type AddProjectInput = {
repository: string; repository: string;
prodBranch: string; prodBranch: string;
template?: string; template?: string;
paymentAddress: string;
txHash: string;
}; };
export type UpdateProjectInput = { export type UpdateProjectInput = {