proof-of-take-sdk 5.0.5 → 5.0.6

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.
@@ -42,6 +42,13 @@ export interface JoinSeasonOptions {
42
42
  * Only used when initializing a new pool (first join). Ignored when joining existing season.
43
43
  */
44
44
  symbol?: string;
45
+ /**
46
+ * Force generating a new launchpad token mint keypair, even if a moonpool already exists on-chain.
47
+ * Use this when creating a NEW Moonpool (i.e., the on-chain moonpool account may exist but was
48
+ * never fully initialized, or you want to start fresh with a new token mint).
49
+ * Only applies to launchpad mode.
50
+ */
51
+ forceNewLaunchpadMint?: boolean;
45
52
  /** Optional injected timestamp (seconds) for optimistic state calculation */
46
53
  now?: BN;
47
54
  feePayer?: PublicKey;
@@ -42,31 +42,39 @@ async function joinSeason(options) {
42
42
  let launchpadTokenMintKeypair;
43
43
  let launchpadTokenMintPubkey;
44
44
  if (launchpad) {
45
- // Check if moonpool is already initialized
46
- // First check currentAccounts (for LiteSVM or optimistic updates)
47
- let moonpoolData = options.currentAccounts?.moonpool ?? null;
48
- // If not provided, try to fetch it from the network
49
- if (!moonpoolData) {
50
- try {
51
- moonpoolData = await program.account.moonpool.fetch(pdasBase.moonpool);
52
- console.log("[joinSeason] Moonpool data fetched, launchpadTokenMint:", moonpoolData.launchpadTokenMint.toString());
53
- }
54
- catch (error) {
55
- // Moonpool doesn't exist (first join scenario) or network error - treat as first join
56
- moonpoolData = null;
57
- }
58
- }
59
- if (!moonpoolData || moonpoolData.launchpadTokenMint.equals(web3_js_1.PublicKey.default)) {
60
- // Moonpool doesn't exist yet (first join) - generate a keypair for the mint
61
- // The mint will be created and stored in the moonpool during initialization
45
+ // If forceNewLaunchpadMint is set, skip on-chain checks and always generate a new keypair
46
+ if (options.forceNewLaunchpadMint) {
62
47
  launchpadTokenMintKeypair = web3_js_1.Keypair.generate();
63
48
  launchpadTokenMintPubkey = launchpadTokenMintKeypair.publicKey;
64
- console.log("[joinSeason] First join - generated launchpad mint keypair:", launchpadTokenMintPubkey.toString());
49
+ console.log("[joinSeason] forceNewLaunchpadMint=true - generated new launchpad mint keypair:", launchpadTokenMintPubkey.toString());
65
50
  }
66
51
  else {
67
- // Moonpool is already initialized - use the mint address stored in moonpool
68
- launchpadTokenMintPubkey = moonpoolData.launchpadTokenMint;
69
- console.log("[joinSeason] Moonpool exists - using stored mint address:", launchpadTokenMintPubkey.toString());
52
+ // Check if moonpool is already initialized
53
+ // First check currentAccounts (for LiteSVM or optimistic updates)
54
+ let moonpoolData = options.currentAccounts?.moonpool ?? null;
55
+ // If not provided, try to fetch it from the network
56
+ if (!moonpoolData) {
57
+ try {
58
+ moonpoolData = await program.account.moonpool.fetch(pdasBase.moonpool);
59
+ console.log("[joinSeason] Moonpool data fetched, launchpadTokenMint:", moonpoolData.launchpadTokenMint.toString());
60
+ }
61
+ catch (error) {
62
+ // Moonpool doesn't exist (first join scenario) or network error - treat as first join
63
+ moonpoolData = null;
64
+ }
65
+ }
66
+ if (!moonpoolData || moonpoolData.launchpadTokenMint.equals(web3_js_1.PublicKey.default)) {
67
+ // Moonpool doesn't exist yet (first join) - generate a keypair for the mint
68
+ // The mint will be created and stored in the moonpool during initialization
69
+ launchpadTokenMintKeypair = web3_js_1.Keypair.generate();
70
+ launchpadTokenMintPubkey = launchpadTokenMintKeypair.publicKey;
71
+ console.log("[joinSeason] First join - generated launchpad mint keypair:", launchpadTokenMintPubkey.toString());
72
+ }
73
+ else {
74
+ // Moonpool is already initialized - use the mint address stored in moonpool
75
+ launchpadTokenMintPubkey = moonpoolData.launchpadTokenMint;
76
+ console.log("[joinSeason] Moonpool exists - using stored mint address:", launchpadTokenMintPubkey.toString());
77
+ }
70
78
  }
71
79
  }
72
80
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proof-of-take-sdk",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "description": "TypeScript SDK for Proof of Take Solana program",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",