From a9d39168f670c8d83c726c6bfa12b95929b158e2 Mon Sep 17 00:00:00 2001 From: Leonn Leite Date: Tue, 23 Dec 2025 19:31:00 -0300 Subject: [PATCH] feat: add additional social media links to sale creation --- src/api/types/LaunchpadDtos.ts | 40 ++++++++++++++++++++++ src/chaincode/launchpad/createSale.spec.ts | 8 +++++ src/chaincode/launchpad/createSale.ts | 15 +++++++- 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/src/api/types/LaunchpadDtos.ts b/src/api/types/LaunchpadDtos.ts index c2bea99..1811770 100644 --- a/src/api/types/LaunchpadDtos.ts +++ b/src/api/types/LaunchpadDtos.ts @@ -116,6 +116,22 @@ export class CreateTokenSaleDTO extends SubmitCallDTO { @IsOptional() public twitterUrl?: string; + @IsString() + @IsOptional() + public instagramUrl?: string; + + @IsString() + @IsOptional() + public facebookUrl?: string; + + @IsString() + @IsOptional() + public redditUrl?: string; + + @IsString() + @IsOptional() + public tiktokUrl?: string; + @IsOptional() @IsInt() public saleStartTime?: number; @@ -185,6 +201,30 @@ export class CreateSaleResDto { @IsOptional() public twitterUrl?: string; + @IsOptional() + public instagramUrl?: string; + + @IsOptional() + public facebookUrl?: string; + + @IsOptional() + public redditUrl?: string; + + @IsOptional() + public tiktokUrl?: string; + + @IsOptional() + public instagramUrl?: string; + + @IsOptional() + public facebookUrl?: string; + + @IsOptional() + public redditUrl?: string; + + @IsOptional() + public tiktokUrl?: string; + @IsNotEmpty() public initialBuyQuantity: string; diff --git a/src/chaincode/launchpad/createSale.spec.ts b/src/chaincode/launchpad/createSale.spec.ts index 614f384..6dc845b 100644 --- a/src/chaincode/launchpad/createSale.spec.ts +++ b/src/chaincode/launchpad/createSale.spec.ts @@ -217,6 +217,10 @@ describe("createSale", () => { createSaleDto.websiteUrl = "https://socialtoken.com"; createSaleDto.telegramUrl = "https://t.me/socialtoken"; createSaleDto.twitterUrl = "https://twitter.com/socialtoken"; + createSaleDto.instagramUrl = "https://instagram.com/socialtoken"; + createSaleDto.facebookUrl = "https://facebook.com/socialtoken"; + createSaleDto.redditUrl = "https://reddit.com/r/socialtoken"; + createSaleDto.tiktokUrl = "https://tiktok.com/@socialtoken"; createSaleDto.uniqueKey = randomUniqueKey(); const signedDto = createSaleDto.signed(users.testUser1.privateKey); @@ -229,6 +233,10 @@ describe("createSale", () => { expect(response.Data?.websiteUrl).toBe("https://socialtoken.com"); expect(response.Data?.telegramUrl).toBe("https://t.me/socialtoken"); expect(response.Data?.twitterUrl).toBe("https://twitter.com/socialtoken"); + expect(response.Data?.instagramUrl).toBe("https://instagram.com/socialtoken"); + expect(response.Data?.facebookUrl).toBe("https://facebook.com/socialtoken"); + expect(response.Data?.redditUrl).toBe("https://reddit.com/r/socialtoken"); + expect(response.Data?.tiktokUrl).toBe("https://tiktok.com/@socialtoken"); }); it("should create sale with custom token image", async () => { diff --git a/src/chaincode/launchpad/createSale.ts b/src/chaincode/launchpad/createSale.ts index a4fd577..b4d60f8 100644 --- a/src/chaincode/launchpad/createSale.ts +++ b/src/chaincode/launchpad/createSale.ts @@ -62,7 +62,16 @@ export async function createSale( let isSaleFinalized = false; // Validate input parameters - if (!launchpadDetails.websiteUrl && !launchpadDetails.telegramUrl && !launchpadDetails.twitterUrl) { + const hasAnySocial = + launchpadDetails.websiteUrl || + launchpadDetails.telegramUrl || + launchpadDetails.twitterUrl || + launchpadDetails.instagramUrl || + launchpadDetails.facebookUrl || + launchpadDetails.redditUrl || + launchpadDetails.tiktokUrl; + + if (!hasAnySocial) { throw new PreConditionFailedError("Token sale creation requires atleast one social link."); } @@ -168,6 +177,10 @@ export async function createSale( websiteUrl: launchpadDetails.websiteUrl ? launchpadDetails.websiteUrl : "", telegramUrl: launchpadDetails.telegramUrl ? launchpadDetails.telegramUrl : "", twitterUrl: launchpadDetails.twitterUrl ? launchpadDetails.twitterUrl : "", + instagramUrl: launchpadDetails.instagramUrl ? launchpadDetails.instagramUrl : "", + facebookUrl: launchpadDetails.facebookUrl ? launchpadDetails.facebookUrl : "", + redditUrl: launchpadDetails.redditUrl ? launchpadDetails.redditUrl : "", + tiktokUrl: launchpadDetails.tiktokUrl ? launchpadDetails.tiktokUrl : "", initialBuyQuantity: launchpadDetails.preBuyQuantity.toFixed(), vaultAddress: vaultAddress, creatorAddress: ctx.callingUser,