@gala-chain/launchpad 1.0.16 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/package.json +8 -7
- package/lib/src/api/types/LaunchpadDtos.d.ts +0 -6
- package/lib/src/api/types/LaunchpadDtos.d.ts.map +1 -1
- package/lib/src/api/types/LaunchpadDtos.js +0 -27
- package/lib/src/api/types/LaunchpadDtos.js.map +1 -1
- package/lib/src/api/utils/error.d.ts +1 -0
- package/lib/src/api/utils/error.d.ts.map +1 -1
- package/lib/src/chaincode/launchpad/createSale.d.ts.map +1 -1
- package/lib/src/chaincode/launchpad/createSale.js +0 -7
- package/lib/src/chaincode/launchpad/createSale.js.map +1 -1
- package/lib/src/chaincode/test/launchpadgala.d.ts +0 -1
- package/lib/src/chaincode/test/launchpadgala.d.ts.map +1 -1
- package/lib/src/chaincode/test/launchpadgala.js +0 -1
- package/lib/src/chaincode/test/launchpadgala.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/src/api/types/LaunchpadDtos.ts +0 -21
- package/src/chaincode/launchpad/createSale.spec.ts +1 -87
- package/src/chaincode/launchpad/createSale.ts +1 -9
- package/src/chaincode/test/launchpadgala.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gala-chain/launchpad",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "GalaChain Launchpad Chaincode",
|
|
5
5
|
"main": "lib/src/index.js",
|
|
6
6
|
"types": "lib/src/index.d.ts",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"update-snapshot": "jest --updateSnapshot"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@gala-chain/api": "
|
|
27
|
-
"@gala-chain/chaincode": "
|
|
28
|
-
"@gala-chain/dex": "1.0
|
|
26
|
+
"@gala-chain/api": "3.0.0-beta",
|
|
27
|
+
"@gala-chain/chaincode": "3.0.0-beta",
|
|
28
|
+
"@gala-chain/dex": "1.1.0",
|
|
29
29
|
"@grpc/grpc-js": "1.10.10",
|
|
30
30
|
"decimal.js": "^10.5.0",
|
|
31
31
|
"dotenv": "^16.0.1",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"fabric-shim": "2.5.6"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@gala-chain/cli": "
|
|
37
|
-
"@gala-chain/client": "
|
|
38
|
-
"@gala-chain/test": "
|
|
36
|
+
"@gala-chain/cli": "3.0.0-beta",
|
|
37
|
+
"@gala-chain/client": "3.0.0-beta",
|
|
38
|
+
"@gala-chain/test": "3.0.0-beta",
|
|
39
39
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
40
40
|
"@types/jest": "^29.5.12",
|
|
41
41
|
"@types/node": "18.11.9",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"eslint-config-prettier": "^8.5.0",
|
|
46
46
|
"eslint-plugin-prettier": "^5.0.1",
|
|
47
47
|
"eslint-prettier-config": "^1.0.1",
|
|
48
|
+
"fabric-network": "^2.2.20",
|
|
48
49
|
"jest": "^29.7.0",
|
|
49
50
|
"prettier": "^3.1.1",
|
|
50
51
|
"ts-jest": "^29.1.2",
|
|
@@ -104,18 +104,6 @@ export class CreateTokenSaleDTO extends SubmitCallDTO {
|
|
|
104
104
|
@BigNumberProperty()
|
|
105
105
|
public preBuyQuantity: BigNumber;
|
|
106
106
|
|
|
107
|
-
@IsString()
|
|
108
|
-
@IsOptional()
|
|
109
|
-
public websiteUrl?: string;
|
|
110
|
-
|
|
111
|
-
@IsString()
|
|
112
|
-
@IsOptional()
|
|
113
|
-
public telegramUrl?: string;
|
|
114
|
-
|
|
115
|
-
@IsString()
|
|
116
|
-
@IsOptional()
|
|
117
|
-
public twitterUrl?: string;
|
|
118
|
-
|
|
119
107
|
@IsOptional()
|
|
120
108
|
@IsInt()
|
|
121
109
|
public saleStartTime?: number;
|
|
@@ -176,15 +164,6 @@ export class CreateSaleResDto {
|
|
|
176
164
|
@IsNotEmpty()
|
|
177
165
|
public description: string;
|
|
178
166
|
|
|
179
|
-
@IsOptional()
|
|
180
|
-
public websiteUrl?: string;
|
|
181
|
-
|
|
182
|
-
@IsOptional()
|
|
183
|
-
public telegramUrl?: string;
|
|
184
|
-
|
|
185
|
-
@IsOptional()
|
|
186
|
-
public twitterUrl?: string;
|
|
187
|
-
|
|
188
167
|
@IsNotEmpty()
|
|
189
168
|
public initialBuyQuantity: string;
|
|
190
169
|
|
|
@@ -34,7 +34,6 @@ describe("createSale", () => {
|
|
|
34
34
|
"TestCollection",
|
|
35
35
|
"TestCategory"
|
|
36
36
|
);
|
|
37
|
-
createSaleDto.websiteUrl = "https://example.com";
|
|
38
37
|
createSaleDto.uniqueKey = randomUniqueKey();
|
|
39
38
|
|
|
40
39
|
const signedDto = createSaleDto.signed(users.testUser1.privateKey);
|
|
@@ -54,60 +53,6 @@ describe("createSale", () => {
|
|
|
54
53
|
expect(response.Data?.isFinalized).toBe(false);
|
|
55
54
|
});
|
|
56
55
|
|
|
57
|
-
it("should create token sale with telegram URL", async () => {
|
|
58
|
-
// Given
|
|
59
|
-
const { ctx, contract } = fixture(LaunchpadContract).registeredUsers(users.testUser1);
|
|
60
|
-
|
|
61
|
-
const createSaleDto = new CreateTokenSaleDTO(
|
|
62
|
-
"Telegram Token",
|
|
63
|
-
"TG",
|
|
64
|
-
"A token with telegram link",
|
|
65
|
-
"https://example.com/tg.png",
|
|
66
|
-
new BigNumber(0),
|
|
67
|
-
"TelegramCollection",
|
|
68
|
-
"SocialCategory"
|
|
69
|
-
);
|
|
70
|
-
createSaleDto.telegramUrl = "https://t.me/testtoken";
|
|
71
|
-
createSaleDto.uniqueKey = randomUniqueKey();
|
|
72
|
-
|
|
73
|
-
const signedDto = createSaleDto.signed(users.testUser1.privateKey);
|
|
74
|
-
|
|
75
|
-
// When
|
|
76
|
-
const response = await contract.CreateSale(ctx, signedDto);
|
|
77
|
-
|
|
78
|
-
// Then
|
|
79
|
-
expect(response.Status).toBe(1);
|
|
80
|
-
expect(response.Data?.telegramUrl).toBe("https://t.me/testtoken");
|
|
81
|
-
expect(response.Data?.websiteUrl).toBe("");
|
|
82
|
-
expect(response.Data?.twitterUrl).toBe("");
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("should create token sale with twitter URL", async () => {
|
|
86
|
-
// Given
|
|
87
|
-
const { ctx, contract } = fixture(LaunchpadContract).registeredUsers(users.testUser1);
|
|
88
|
-
|
|
89
|
-
const createSaleDto = new CreateTokenSaleDTO(
|
|
90
|
-
"Twitter Token",
|
|
91
|
-
"TWT",
|
|
92
|
-
"A token with twitter link",
|
|
93
|
-
"https://example.com/twt.png",
|
|
94
|
-
new BigNumber(0),
|
|
95
|
-
"TwitterCollection",
|
|
96
|
-
"SocialCategory"
|
|
97
|
-
);
|
|
98
|
-
createSaleDto.twitterUrl = "https://twitter.com/testtoken";
|
|
99
|
-
createSaleDto.uniqueKey = randomUniqueKey();
|
|
100
|
-
|
|
101
|
-
const signedDto = createSaleDto.signed(users.testUser1.privateKey);
|
|
102
|
-
|
|
103
|
-
// When
|
|
104
|
-
const response = await contract.CreateSale(ctx, signedDto);
|
|
105
|
-
|
|
106
|
-
// Then
|
|
107
|
-
expect(response.Status).toBe(1);
|
|
108
|
-
expect(response.Data?.twitterUrl).toBe("https://twitter.com/testtoken");
|
|
109
|
-
});
|
|
110
|
-
|
|
111
56
|
it("should create token sale with pre-buy amount", async () => {
|
|
112
57
|
// Given - Setup GALA token for pre-buy (matching LaunchpadSale nativeToken)
|
|
113
58
|
const galaClass = plainToInstance(TokenClass, {
|
|
@@ -162,7 +107,6 @@ describe("createSale", () => {
|
|
|
162
107
|
"PreBuyCollection",
|
|
163
108
|
"PreBuyCategory"
|
|
164
109
|
);
|
|
165
|
-
createSaleDto.websiteUrl = "https://example.com";
|
|
166
110
|
createSaleDto.uniqueKey = randomUniqueKey();
|
|
167
111
|
|
|
168
112
|
const signedDto = createSaleDto.signed(users.testUser1.privateKey);
|
|
@@ -188,7 +132,6 @@ describe("createSale", () => {
|
|
|
188
132
|
"LowerCollection",
|
|
189
133
|
"LowerCategory"
|
|
190
134
|
);
|
|
191
|
-
createSaleDto.websiteUrl = "https://example.com";
|
|
192
135
|
createSaleDto.uniqueKey = randomUniqueKey();
|
|
193
136
|
|
|
194
137
|
const signedDto = createSaleDto.signed(users.testUser1.privateKey);
|
|
@@ -201,35 +144,7 @@ describe("createSale", () => {
|
|
|
201
144
|
expect(response.Data?.symbol).toBe("LOWER"); // Should be converted to uppercase
|
|
202
145
|
});
|
|
203
146
|
|
|
204
|
-
|
|
205
|
-
// Given
|
|
206
|
-
const { ctx, contract } = fixture(LaunchpadContract).registeredUsers(users.testUser1);
|
|
207
|
-
|
|
208
|
-
const createSaleDto = new CreateTokenSaleDTO(
|
|
209
|
-
"Social Token",
|
|
210
|
-
"SOC",
|
|
211
|
-
"A fully connected social token",
|
|
212
|
-
"https://example.com/soc.png",
|
|
213
|
-
new BigNumber(0),
|
|
214
|
-
"SocialCollection",
|
|
215
|
-
"FullSocialCategory"
|
|
216
|
-
);
|
|
217
|
-
createSaleDto.websiteUrl = "https://socialtoken.com";
|
|
218
|
-
createSaleDto.telegramUrl = "https://t.me/socialtoken";
|
|
219
|
-
createSaleDto.twitterUrl = "https://twitter.com/socialtoken";
|
|
220
|
-
createSaleDto.uniqueKey = randomUniqueKey();
|
|
221
|
-
|
|
222
|
-
const signedDto = createSaleDto.signed(users.testUser1.privateKey);
|
|
223
|
-
|
|
224
|
-
// When
|
|
225
|
-
const response = await contract.CreateSale(ctx, signedDto);
|
|
226
|
-
|
|
227
|
-
// Then
|
|
228
|
-
expect(response.Status).toBe(1);
|
|
229
|
-
expect(response.Data?.websiteUrl).toBe("https://socialtoken.com");
|
|
230
|
-
expect(response.Data?.telegramUrl).toBe("https://t.me/socialtoken");
|
|
231
|
-
expect(response.Data?.twitterUrl).toBe("https://twitter.com/socialtoken");
|
|
232
|
-
});
|
|
147
|
+
// Social links are now handled off-chain (DB source of truth); chain no longer returns them.
|
|
233
148
|
|
|
234
149
|
it("should create sale with custom token image", async () => {
|
|
235
150
|
// Given
|
|
@@ -244,7 +159,6 @@ describe("createSale", () => {
|
|
|
244
159
|
"ImageCollection",
|
|
245
160
|
"ImageCategory"
|
|
246
161
|
);
|
|
247
|
-
createSaleDto.websiteUrl = "https://example.com";
|
|
248
162
|
createSaleDto.uniqueKey = randomUniqueKey();
|
|
249
163
|
|
|
250
164
|
const signedDto = createSaleDto.signed(users.testUser1.privateKey);
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* See the License for the specific language governing permissions and
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
import { ConflictError,
|
|
15
|
+
import { ConflictError, TokenInstanceKey, asValidUserAlias } from "@gala-chain/api";
|
|
16
16
|
import {
|
|
17
17
|
GalaChainContext,
|
|
18
18
|
createTokenClass,
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
NativeTokenQuantityDto,
|
|
31
31
|
SaleStatus
|
|
32
32
|
} from "../../api/types";
|
|
33
|
-
import { PreConditionFailedError } from "../../api/utils/error";
|
|
34
33
|
import { buyWithNative } from "./buyWithNative";
|
|
35
34
|
|
|
36
35
|
/**
|
|
@@ -62,10 +61,6 @@ export async function createSale(
|
|
|
62
61
|
let isSaleFinalized = false;
|
|
63
62
|
// Validate input parameters
|
|
64
63
|
|
|
65
|
-
if (!launchpadDetails.websiteUrl && !launchpadDetails.telegramUrl && !launchpadDetails.twitterUrl) {
|
|
66
|
-
throw new PreConditionFailedError("Token sale creation requires atleast one social link.");
|
|
67
|
-
}
|
|
68
|
-
|
|
69
64
|
launchpadDetails.tokenSymbol = launchpadDetails.tokenSymbol.toUpperCase();
|
|
70
65
|
|
|
71
66
|
// Define the token class key
|
|
@@ -165,9 +160,6 @@ export async function createSale(
|
|
|
165
160
|
tokenName: launchpadDetails.tokenName,
|
|
166
161
|
symbol: launchpadDetails.tokenSymbol,
|
|
167
162
|
description: launchpadDetails.tokenDescription,
|
|
168
|
-
websiteUrl: launchpadDetails.websiteUrl ? launchpadDetails.websiteUrl : "",
|
|
169
|
-
telegramUrl: launchpadDetails.telegramUrl ? launchpadDetails.telegramUrl : "",
|
|
170
|
-
twitterUrl: launchpadDetails.twitterUrl ? launchpadDetails.twitterUrl : "",
|
|
171
163
|
initialBuyQuantity: launchpadDetails.preBuyQuantity.toFixed(),
|
|
172
164
|
vaultAddress: vaultAddress,
|
|
173
165
|
creatorAddress: ctx.callingUser,
|
|
@@ -126,7 +126,6 @@ const tokenInstancePlain = createPlainFn({
|
|
|
126
126
|
const tokenBalancePlain = createPlainFn({
|
|
127
127
|
...tokenClassKeyPlain(),
|
|
128
128
|
owner: users.testUser1.identityKey,
|
|
129
|
-
inUseHolds: [],
|
|
130
129
|
lockedHolds: [],
|
|
131
130
|
instanceIds: [],
|
|
132
131
|
quantity: new BigNumber("1000")
|