Pass payment tx hash in deployment request #19

Merged
nabarun merged 10 commits from iv-update-request into main 2024-10-29 09:12:40 +00:00
3 changed files with 11 additions and 3 deletions
Showing only changes of commit 827213c9e7 - Show all commits

View File

@ -38,6 +38,7 @@ export interface ApplicationDeploymentRequest {
auction?: string; auction?: string;
config: string; config: string;
meta: string; meta: string;
payment: string;
} }
export interface ApplicationDeploymentRemovalRequest { export interface ApplicationDeploymentRemovalRequest {

View File

@ -248,6 +248,7 @@ export class Registry {
lrn: string, lrn: string,
environmentVariables: { [key: string]: string }, environmentVariables: { [key: string]: string },
dns: string, dns: string,
payment: string
}): Promise<{ }): Promise<{
applicationDeploymentRequestId: string; applicationDeploymentRequestId: string;
applicationDeploymentRequestData: ApplicationDeploymentRequest; applicationDeploymentRequestData: ApplicationDeploymentRequest;
@ -267,6 +268,7 @@ export class Registry {
name: `${applicationRecord.attributes.name}@${applicationRecord.attributes.app_version}`, name: `${applicationRecord.attributes.name}@${applicationRecord.attributes.app_version}`,
application: `${lrn}@${applicationRecord.attributes.app_version}`, application: `${lrn}@${applicationRecord.attributes.app_version}`,
dns: data.dns, dns: data.dns,
payment: data.payment,
// https://git.vdb.to/cerc-io/laconic-registry-cli/commit/129019105dfb93bebcea02fde0ed64d0f8e5983b // https://git.vdb.to/cerc-io/laconic-registry-cli/commit/129019105dfb93bebcea02fde0ed64d0f8e5983b
config: JSON.stringify({ config: JSON.stringify({

View File

@ -648,7 +648,8 @@ export class Service {
repository: repoUrl, repository: repoUrl,
environmentVariables: environmentVariablesObj, environmentVariables: environmentVariablesObj,
dns: `${newDeployment.project.name}`, dns: `${newDeployment.project.name}`,
lrn: deployer!.deployerLrn! lrn: deployer!.deployerLrn!,
payment: data.project.txHash!
}); });
} }
@ -660,6 +661,7 @@ export class Service {
lrn: deployer!.deployerLrn!, lrn: deployer!.deployerLrn!,
environmentVariables: environmentVariablesObj, environmentVariables: environmentVariablesObj,
dns: `${newDeployment.project.name}-${newDeployment.id}`, dns: `${newDeployment.project.name}-${newDeployment.id}`,
payment: data.project.txHash!
}); });
await this.db.updateDeploymentById(newDeployment.id, { await this.db.updateDeploymentById(newDeployment.id, {
@ -725,6 +727,7 @@ export class Service {
dns: `${newDeployment.project.name}`, dns: `${newDeployment.project.name}`,
auctionId: project.auctionId!, auctionId: project.auctionId!,
lrn: deployerLrn, lrn: deployerLrn,
payment: project.txHash!
}); });
} }
@ -738,6 +741,7 @@ export class Service {
lrn: deployerLrn, lrn: deployerLrn,
environmentVariables: environmentVariablesObj, environmentVariables: environmentVariablesObj,
dns: `${newDeployment.project.name}-${newDeployment.id}`, dns: `${newDeployment.project.name}-${newDeployment.id}`,
payment: project.txHash!
}); });
await this.db.updateDeploymentById(newDeployment.id, { await this.db.updateDeploymentById(newDeployment.id, {
@ -1342,12 +1346,13 @@ export class Service {
} }
const auction = await this.getAuctionData(project.auctionId); const auction = await this.getAuctionData(project.auctionId);
const maxPrice = Number(auction.maxPrice.quantity) * auction.numProviders;
let amountToBeReturned; let amountToBeReturned;
if (winningDeployersPresent) { if (winningDeployersPresent) {
amountToBeReturned = auction.winnerPrice * auction.numProviders; amountToBeReturned = maxPrice - auction.winnerAddresses.length * Number(auction.winnerPrice.quantity);
} else { } else {
amountToBeReturned = auction.maxPrice * auction.numProviders; amountToBeReturned = maxPrice;
} }
await this.laconicRegistry.sendTokensToAccount( await this.laconicRegistry.sendTokensToAccount(