proof-of-take-sdk 5.0.7 → 5.0.9
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.
|
@@ -22,10 +22,13 @@ export type LaunchpadPoolView = {
|
|
|
22
22
|
* Shared across all seasons for this token mint.
|
|
23
23
|
* @deprecated Use getMoonpool instead
|
|
24
24
|
*/
|
|
25
|
-
export declare function getSeasonLaunchpadPool(connection: Connection, seasonNumber: BN,
|
|
25
|
+
export declare function getSeasonLaunchpadPool(connection: Connection, seasonNumber: BN, launchpadTokenMint: PublicKey): Promise<LaunchpadPoolView>;
|
|
26
26
|
/**
|
|
27
27
|
* View the global Moonpool status (spot price, reserves, k).
|
|
28
28
|
* The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens).
|
|
29
|
-
*
|
|
29
|
+
* Unique per launchpadTokenMint - each Moonpool has its own Season and reserves.
|
|
30
|
+
* @param connection - Solana connection
|
|
31
|
+
* @param seasonNumber - The season number
|
|
32
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool)
|
|
30
33
|
*/
|
|
31
|
-
export declare function getMoonpool(connection: Connection, seasonNumber: BN,
|
|
34
|
+
export declare function getMoonpool(connection: Connection, seasonNumber: BN, launchpadTokenMint: PublicKey): Promise<LaunchpadPoolView>;
|
|
@@ -13,25 +13,29 @@ const pdas_1 = require("../utils/pdas");
|
|
|
13
13
|
* Shared across all seasons for this token mint.
|
|
14
14
|
* @deprecated Use getMoonpool instead
|
|
15
15
|
*/
|
|
16
|
-
async function getSeasonLaunchpadPool(connection, seasonNumber,
|
|
17
|
-
return getMoonpool(connection, seasonNumber,
|
|
16
|
+
async function getSeasonLaunchpadPool(connection, seasonNumber, launchpadTokenMint) {
|
|
17
|
+
return getMoonpool(connection, seasonNumber, launchpadTokenMint);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* View the global Moonpool status (spot price, reserves, k).
|
|
21
21
|
* The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens).
|
|
22
|
-
*
|
|
22
|
+
* Unique per launchpadTokenMint - each Moonpool has its own Season and reserves.
|
|
23
|
+
* @param connection - Solana connection
|
|
24
|
+
* @param seasonNumber - The season number
|
|
25
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool)
|
|
23
26
|
*/
|
|
24
|
-
async function getMoonpool(connection, seasonNumber,
|
|
27
|
+
async function getMoonpool(connection, seasonNumber, launchpadTokenMint) {
|
|
25
28
|
const program = (0, programHelpers_1.getProgram)(connection);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const [
|
|
29
|
+
// Season PDA uses launchpadTokenMint for Moonpool mode
|
|
30
|
+
const [season] = (0, pdas_1.getSeasonPda)(seasonNumber, constants_1.MIZD_TOKEN_MINT, launchpadTokenMint);
|
|
31
|
+
// Moonpool and treasury PDAs are scoped to launchpadTokenMint
|
|
32
|
+
const [moonpool] = (0, pdas_1.getMoonpoolPda)(launchpadTokenMint);
|
|
33
|
+
const [moonpoolTreasury] = (0, pdas_1.getMoonpoolTreasuryPda)(launchpadTokenMint);
|
|
30
34
|
const view = await program.methods
|
|
31
35
|
.viewLaunchpadPool(seasonNumber)
|
|
32
36
|
// Anchor's generated `.accounts` typing for `.view()` is sometimes overly strict;
|
|
33
37
|
// provide the correct accounts and cast to avoid leaking this complexity to callers.
|
|
34
|
-
.accounts({ season, moonpool, moonpoolTreasury, tokenMint })
|
|
38
|
+
.accounts({ season, moonpool, moonpoolTreasury, tokenMint: launchpadTokenMint })
|
|
35
39
|
.view();
|
|
36
40
|
// Anchor returns u128 as BN (and u64/i64 as BN).
|
|
37
41
|
return {
|
package/dist/utils/pdas.d.ts
CHANGED
|
@@ -23,14 +23,18 @@ export declare function getMiztakePda(shaHash: Sha256HexString | string): [Publi
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function getSeasonSettingsPda(): [PublicKey, number];
|
|
25
25
|
/**
|
|
26
|
-
* Derive the Season PDA for a given season number
|
|
26
|
+
* Derive the Season PDA for a given season number.
|
|
27
|
+
* For Moonpool mode, pass launchpadTokenMint to scope the Season to a specific Moonpool.
|
|
27
28
|
* @param seasonNumber - The season number
|
|
29
|
+
* @param tokenMint - The token mint (MIZD) - used only if launchpadTokenMint is not provided
|
|
30
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool) - use this for Moonpool mode
|
|
28
31
|
*/
|
|
29
|
-
export declare function getSeasonPda(seasonNumber: SeasonNumberLike, tokenMint?: PublicKey): [PublicKey, number];
|
|
32
|
+
export declare function getSeasonPda(seasonNumber: SeasonNumberLike, tokenMint?: PublicKey, launchpadTokenMint?: PublicKey): [PublicKey, number];
|
|
30
33
|
/**
|
|
31
|
-
* Derive the SeasonMembership PDA
|
|
34
|
+
* Derive the SeasonMembership PDA.
|
|
35
|
+
* For Moonpool mode, pass launchpadTokenMint to scope the membership to a specific Moonpool.
|
|
32
36
|
* PDA model:
|
|
33
|
-
* seeds = ["season_membership", season_number_le_u64, user_pubkey_bytes, tier_u8]
|
|
37
|
+
* seeds = ["season_membership", mint_pubkey, instance_id, season_number_le_u64, user_pubkey_bytes, tier_u8]
|
|
34
38
|
*
|
|
35
39
|
* Tier mapping (u8):
|
|
36
40
|
* 0 = copper, 1 = silver, 2 = gold, 3 = platinum, 4 = mithril
|
|
@@ -38,8 +42,10 @@ export declare function getSeasonPda(seasonNumber: SeasonNumberLike, tokenMint?:
|
|
|
38
42
|
* @param seasonNumber - The season number
|
|
39
43
|
* @param user - The user's public key
|
|
40
44
|
* @param tier - Tier number (0..=4)
|
|
45
|
+
* @param tokenMint - The token mint (MIZD) - used only if launchpadTokenMint is not provided
|
|
46
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool) - use this for Moonpool mode
|
|
41
47
|
*/
|
|
42
|
-
export declare function getSeasonMembershipPda(seasonNumber: SeasonNumberLike, user: PublicKey, tier: TierNumber, tokenMint?: PublicKey): [PublicKey, number];
|
|
48
|
+
export declare function getSeasonMembershipPda(seasonNumber: SeasonNumberLike, user: PublicKey, tier: TierNumber, tokenMint?: PublicKey, launchpadTokenMint?: PublicKey): [PublicKey, number];
|
|
43
49
|
/**
|
|
44
50
|
* Derive the RewardWindow PDA
|
|
45
51
|
* @param seasonNumber - The season number
|
package/dist/utils/pdas.js
CHANGED
|
@@ -57,22 +57,28 @@ function getSeasonSettingsPda() {
|
|
|
57
57
|
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("season_settings")], constants_1.PROGRAM_ID);
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Derive the Season PDA for a given season number
|
|
60
|
+
* Derive the Season PDA for a given season number.
|
|
61
|
+
* For Moonpool mode, pass launchpadTokenMint to scope the Season to a specific Moonpool.
|
|
61
62
|
* @param seasonNumber - The season number
|
|
63
|
+
* @param tokenMint - The token mint (MIZD) - used only if launchpadTokenMint is not provided
|
|
64
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool) - use this for Moonpool mode
|
|
62
65
|
*/
|
|
63
|
-
function getSeasonPda(seasonNumber, tokenMint = constants_1.MIZD_TOKEN_MINT) {
|
|
66
|
+
function getSeasonPda(seasonNumber, tokenMint = constants_1.MIZD_TOKEN_MINT, launchpadTokenMint) {
|
|
64
67
|
const seasonBn = (0, conversions_2.toSeasonNumberBn)(seasonNumber);
|
|
68
|
+
// For Moonpool mode, use launchpadTokenMint; for classic mode, use tokenMint
|
|
69
|
+
const mintToUse = launchpadTokenMint || tokenMint;
|
|
65
70
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
66
71
|
Buffer.from("season"),
|
|
67
|
-
|
|
72
|
+
mintToUse.toBuffer(),
|
|
68
73
|
constants_1.SEASON_INSTANCE_ID.toArrayLike(Buffer, "le", 8),
|
|
69
74
|
seasonBn.toArrayLike(Buffer, "le", 8),
|
|
70
75
|
], constants_1.PROGRAM_ID);
|
|
71
76
|
}
|
|
72
77
|
/**
|
|
73
|
-
* Derive the SeasonMembership PDA
|
|
78
|
+
* Derive the SeasonMembership PDA.
|
|
79
|
+
* For Moonpool mode, pass launchpadTokenMint to scope the membership to a specific Moonpool.
|
|
74
80
|
* PDA model:
|
|
75
|
-
* seeds = ["season_membership", season_number_le_u64, user_pubkey_bytes, tier_u8]
|
|
81
|
+
* seeds = ["season_membership", mint_pubkey, instance_id, season_number_le_u64, user_pubkey_bytes, tier_u8]
|
|
76
82
|
*
|
|
77
83
|
* Tier mapping (u8):
|
|
78
84
|
* 0 = copper, 1 = silver, 2 = gold, 3 = platinum, 4 = mithril
|
|
@@ -80,13 +86,17 @@ function getSeasonPda(seasonNumber, tokenMint = constants_1.MIZD_TOKEN_MINT) {
|
|
|
80
86
|
* @param seasonNumber - The season number
|
|
81
87
|
* @param user - The user's public key
|
|
82
88
|
* @param tier - Tier number (0..=4)
|
|
89
|
+
* @param tokenMint - The token mint (MIZD) - used only if launchpadTokenMint is not provided
|
|
90
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool) - use this for Moonpool mode
|
|
83
91
|
*/
|
|
84
|
-
function getSeasonMembershipPda(seasonNumber, user, tier, tokenMint = constants_1.MIZD_TOKEN_MINT) {
|
|
92
|
+
function getSeasonMembershipPda(seasonNumber, user, tier, tokenMint = constants_1.MIZD_TOKEN_MINT, launchpadTokenMint) {
|
|
85
93
|
const t = (0, tierPenalty_1.assertValidTierNumber)(tier);
|
|
86
94
|
const seasonBn = (0, conversions_2.toSeasonNumberBn)(seasonNumber);
|
|
95
|
+
// For Moonpool mode, use launchpadTokenMint; for classic mode, use tokenMint
|
|
96
|
+
const mintToUse = launchpadTokenMint || tokenMint;
|
|
87
97
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
88
98
|
Buffer.from("season_membership"),
|
|
89
|
-
|
|
99
|
+
mintToUse.toBuffer(),
|
|
90
100
|
constants_1.SEASON_INSTANCE_ID.toArrayLike(Buffer, "le", 8),
|
|
91
101
|
seasonBn.toArrayLike(Buffer, "le", 8),
|
|
92
102
|
user.toBuffer(),
|