clanker-sdk 4.2.0 → 4.2.2

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.
@@ -108,9 +108,12 @@ declare function claimAirdrop(data: {
108
108
  }>;
109
109
 
110
110
  declare enum PresaleStatus {
111
- Active = 0,
112
- Successful = 1,
113
- Failed = 2
111
+ NotCreated = 0,
112
+ Active = 1,
113
+ SuccessfulMinimumHit = 2,
114
+ SuccessfulMaximumHit = 3,
115
+ Failed = 4,
116
+ Claimable = 5
114
117
  }
115
118
  declare const PresaleConfigSchema: z.ZodObject<{
116
119
  minEthGoal: z.ZodNumber;
@@ -188,6 +191,11 @@ declare function buyIntoPresale(data: {
188
191
  /**
189
192
  * Get a transaction to end a presale
190
193
  *
194
+ * A presale can be ended in three scenarios:
195
+ * 1. Maximum ETH goal is reached (anyone can call)
196
+ * 2. Minimum ETH goal is reached AND duration has expired (anyone can call)
197
+ * 3. Minimum ETH goal is reached AND presale owner wants to end early (only presale owner can call)
198
+ *
191
199
  * @param presaleId The ID of the presale
192
200
  * @param salt The salt for token deployment
193
201
  * @param chainId The chain ID
@@ -201,6 +209,16 @@ declare function getEndPresaleTransaction({ presaleId, salt, chainId, }: {
201
209
  /**
202
210
  * End a presale and deploy the token
203
211
  *
212
+ * A presale can be ended in three scenarios:
213
+ * 1. Maximum ETH goal is reached (anyone can call)
214
+ * 2. Minimum ETH goal is reached AND duration has expired (anyone can call)
215
+ * 3. Minimum ETH goal is reached AND presale owner wants to end early (only presale owner can call)
216
+ *
217
+ * If the presale is successful (minimum goal reached), this will:
218
+ * - Deploy the token
219
+ * - Send raised ETH to the recipient (minus Clanker fee)
220
+ * - Allow users to claim tokens after lockup period
221
+ *
204
222
  * @param clanker Clanker object used for ending presale
205
223
  * @param presaleId The ID of the presale
206
224
  * @param salt The salt for token deployment
@@ -238,10 +256,15 @@ declare function claimTokens(data: {
238
256
  txHash: `0x${string}`;
239
257
  }>;
240
258
  /**
241
- * Get a transaction to claim ETH from a presale (for failed presales)
259
+ * Get a transaction to claim ETH from a successful presale (for presale owners)
260
+ *
261
+ * This function allows the presale owner to claim the raised ETH after the presale
262
+ * has been completed and the token has been deployed. Only callable by the presale
263
+ * owner or contract owner. A Clanker fee is deducted and the remaining ETH is sent
264
+ * to the recipient.
242
265
  *
243
266
  * @param presaleId The ID of the presale
244
- * @param recipient The recipient address for the ETH
267
+ * @param recipient The recipient address for the ETH (must be presale owner if called by contract owner)
245
268
  * @param chainId The chain ID
246
269
  * @returns Transaction configuration for claiming ETH
247
270
  */
@@ -251,11 +274,18 @@ declare function getClaimEthTransaction({ presaleId, recipient, chainId, }: {
251
274
  chainId: Chain;
252
275
  }): ClankerTransactionConfig<typeof Clanker_PresaleEthToCreator_v4_1_abi, 'claimEth'>;
253
276
  /**
254
- * Claim ETH from a failed presale
277
+ * Claim ETH from a successful presale
278
+ *
279
+ * This function allows the presale owner to claim the raised ETH after the presale
280
+ * has been completed and the token has been deployed. Only callable by the presale
281
+ * owner or contract owner. A Clanker fee is deducted and the remaining ETH is sent
282
+ * to the recipient. Can only be called once per presale.
283
+ *
284
+ * Note: For withdrawing from failed or active presales, use `withdrawFromPresale` instead.
255
285
  *
256
286
  * @param clanker Clanker object used for claiming ETH
257
287
  * @param presaleId The ID of the presale
258
- * @param recipient The recipient address for the ETH
288
+ * @param recipient The recipient address for the ETH (must be presale owner if called by contract owner)
259
289
  * @returns Outcome of the transaction
260
290
  */
261
291
  declare function claimEth(data: {
@@ -7469,9 +7469,12 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
7469
7469
 
7470
7470
  // src/v4/extensions/presale.ts
7471
7471
  var PresaleStatus = /* @__PURE__ */ ((PresaleStatus2) => {
7472
- PresaleStatus2[PresaleStatus2["Active"] = 0] = "Active";
7473
- PresaleStatus2[PresaleStatus2["Successful"] = 1] = "Successful";
7474
- PresaleStatus2[PresaleStatus2["Failed"] = 2] = "Failed";
7472
+ PresaleStatus2[PresaleStatus2["NotCreated"] = 0] = "NotCreated";
7473
+ PresaleStatus2[PresaleStatus2["Active"] = 1] = "Active";
7474
+ PresaleStatus2[PresaleStatus2["SuccessfulMinimumHit"] = 2] = "SuccessfulMinimumHit";
7475
+ PresaleStatus2[PresaleStatus2["SuccessfulMaximumHit"] = 3] = "SuccessfulMaximumHit";
7476
+ PresaleStatus2[PresaleStatus2["Failed"] = 4] = "Failed";
7477
+ PresaleStatus2[PresaleStatus2["Claimable"] = 5] = "Claimable";
7475
7478
  return PresaleStatus2;
7476
7479
  })(PresaleStatus || {});
7477
7480
  var PresaleConfigSchema = z4.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clanker-sdk",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "description": "SDK for deploying tokens using Clanker",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",